Logotipo de Test Driven Development

Test Driven Development

Comunidad
AlexAI-MCP
test-driven-development

Apply a disciplined red-green-refactor workflow in Claude Code. Use when adding behavior safely, reproducing a bug before fixing it, designing APIs from the outside in, or strengthening change confidence with targeted tests.

Descripción general

EditorAlexAI-MCP
Repositoriohermes-CCC
Nombre de la habilidadtest-driven-development
Estrellas
134
Forks
22
Archivos incluidos
Solo instrucciones
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Todo en las instrucciones

    Todo lo que necesita el modelo está en las instrucciones: no hay archivos adicionales que sincronizar.

  • Código abierto

    Publicada por AlexAI-MCP en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Test Driven Development en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/test-driven-development
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AlexAI-MCP/hermes-CCC.git /tmp/hermes-CCC
mkdir -p .claude/skills
cp -r /tmp/hermes-CCC/skills/test-driven-development .claude/skills/test-driven-development
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Test Driven Development en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Test Driven Development automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Test Driven Development no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Test-Driven Development

Purpose

  • Drive implementation from observable behavior.
  • Reproduce bugs before fixing them.
  • Keep code changes tightly coupled to expected outcomes.
  • Use tests as design tools, not just safety nets.
  • Reduce regressions by proving each behavior change.

Activation Signals

  • Use this skill when adding a new feature with clear acceptance behavior.
  • Use this skill when fixing a bug that should never recur.
  • Use this skill when API shape is easier to design from usage than internals.
  • Use this skill when reviewers will ask for evidence.
  • Use this skill when the codebase already has a strong test culture.

Core Cycle

  1. Write a failing test.
  2. Run the smallest test scope and watch it fail for the right reason.
  3. Implement the smallest change that makes it pass.
  4. Re-run the test.
  5. Refactor while keeping tests green.
  6. Expand coverage only when a new behavior boundary appears.

Red Phase

  • Express one behavior at a time.
  • Name the test after the behavior, not the implementation.
  • Ensure the failure is caused by missing behavior, not a broken fixture.
  • Keep setup minimal.
  • Prefer explicit assertions over snapshot sprawl unless snapshots are already standard.
  • For bug fixes, make the failing test mirror the actual defect.

Green Phase

  • Implement the smallest viable change.
  • Do not optimize before the test passes.
  • Avoid speculative abstractions.
  • If several code paths fail, make one behavior pass first.
  • Keep the first passing diff small enough to reason about.

Refactor Phase

  • Remove duplication exposed by the passing test.
  • Improve names and structure.
  • Preserve behavior while simplifying code.
  • Re-run relevant tests after each meaningful refactor.
  • Stop refactoring once readability improves and the tests still describe the behavior clearly.

Bug-Fix TDD

  • Reproduce the bug in a failing test before touching the fix.
  • If reproduction is expensive, build a narrow harness.
  • If the bug is timing-sensitive, isolate the timing dependency rather than sleeping more.
  • If the bug cannot be reproduced, treat the fix as higher risk and document why.

Test Selection Rules

  • Use unit tests for pure behavior and deterministic branching.
  • Use integration tests for component boundaries and data flow.
  • Use end-to-end tests only when lower layers cannot express the guarantee.
  • Put the regression test at the lowest layer that still captures the defect.

Assertion Rules

  • Assert the most important observable outcome first.
  • Prefer stable assertions over implementation detail checks.
  • Avoid asserting on incidental formatting unless formatting is the feature.
  • For collections, assert the contract that matters: count, key values, order, or identity.

Good Test Names

  • test_search_returns_ranked_results_for_partial_match
  • test_login_redirect_does_not_loop_when_session_is_hydrated
  • test_serializer_rejects_missing_required_field

Bad Test Names

  • test_fix
  • test_works
  • test_api
  • test_stuff

Useful Commands

bash
pytest tests/test_module.py::test_specific_behavior -vv
pytest tests/ -k "auth and redirect" -vv
ruff check path/to/file.py

Design Benefits To Exploit

  • Tests clarify API ergonomics.
  • Tests reveal hidden dependencies.
  • Tests pressure functions toward clean inputs and outputs.
  • Tests expose when code is too coupled to mock cleanly.

Decision Rules

  • If a feature request has no acceptance behavior, clarify before writing code.
  • If the first test is too hard to write, the design seam may be missing.
  • If the code needed to pass the test is huge, the test scope is probably too broad.
  • If refactoring requires changing many tests, the tests may be overfit to internals.

Anti-Patterns

  • writing tests after the implementation and calling it TDD
  • changing the test to match a broken implementation
  • asserting on private internals instead of behavior
  • creating giant fixture setups for simple behavior
  • using TDD language while skipping the red phase

Output Contract

When reporting TDD progress, include:

  • failing test added
  • implementation change
  • verification command
  • refactor notes
  • remaining coverage gaps

Example Status Block

markdown
TDD status:
- Red: added failing regression test for partially hydrated session redirect
- Green: updated middleware guard to wait for token presence
- Refactor: simplified session-check helper naming
- Verify: pytest tests/test_auth.py::test_login_redirect_does_not_loop_when_session_is_hydrated -vv

Coverage Guidance

  • Start with one high-signal test.
  • Add neighboring tests only when the bug or feature has multiple edges.
  • Do not explode the matrix on the first pass.
  • Prefer targeted new tests over broad rewrites of existing suites.

Failure Modes

  • wrong failure reason in red phase
  • massive green-phase implementation
  • no refactor after a crude passing patch
  • tests too brittle to survive harmless refactors
  • overuse of mocks where real data flow would be clearer

Recovery Moves

  • Rewrite the test if it fails for the wrong reason.
  • Split one large behavior into multiple smaller tests.
  • Move down a layer if end-to-end setup is hiding the real contract.
  • Replace mocks with real collaborators when possible.

Checklist

  1. Name the behavior.
  2. Write the failing test.
  3. Confirm the right failure.
  4. Implement the smallest fix.
  5. Re-run the narrow test.
  6. Refactor with tests green.
  7. Run adjacent coverage.
  8. Report evidence, not confidence alone.

Preguntas frecuentes

¿Qué hace la habilidad de IA Test Driven Development?

Apply a disciplined red-green-refactor workflow in Claude Code. Use when adding behavior safely, reproducing a bug before fixing it, designing APIs from the outside in, or strengthening change confidence with targeted tests.

¿Por qué usar Test Driven Development en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Test Driven Development está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Test Driven Development en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/test-driven-development. TypingMind lee el archivo SKILL.md de esa carpeta e instala su contenido como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Test Driven Development?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Test Driven Development?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Test Driven Development con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Test Driven Development?

Sí. AlexAI-MCP la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇