Logo de Test Driven Development

Test Driven Development

Comunidade
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.

Visão geral

Publicado porAlexAI-MCP
Repositóriohermes-CCC
Nome da habilidadetest-driven-development
Estrelas
134
Forks
22
Arquivos incluídos
Somente instruções
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por AlexAI-MCP no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Test Driven Development no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/test-driven-development
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse 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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Test Driven Development em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Test Driven Development automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Test Driven Development não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu 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.

Perguntas frequentes

O que a habilidade de IA Test Driven Development faz?

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 que usar Test Driven Development no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Test Driven Development é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Test Driven Development no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/test-driven-development. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Test Driven Development?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Test Driven Development?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Test Driven Development com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Test Driven Development é gratuita?

Sim. A habilidade é publicada no GitHub por AlexAI-MCP sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇