Pular para o conteúdo
Skillpedia
Testes41 mil · #7027

tdd

O que ela faz

Esta skill guia um agente na construção de código escrevendo primeiro um teste e depois o menor código que o faz passar. É para desenvolvedores que querem que cada alteração seja comprovada por um teste escrito antes do código.

Quando usar

  • ✓Quando você quer um novo comportamento construído com testes primeiro, uma pequena etapa de cada vez.
  • ✓Quando você quer corrigir um bug escrevendo primeiro um teste que o reproduza.
  • ✓Quando você quer testes escritos a partir de uma fonte de verdade, e não a partir do próprio código.

Link da skill

https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/tdd/SKILL.md

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/tdd/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Construa a regra de desconto com testes primeiro, uma pequena etapa de cada vez, usando os exemplos da nossa especificação de preços.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

O agente escreve o próximo teste em um ponto combinado, confirma que ele falha pelo motivo esperado e então escreve a menor alteração que o faz passar. Ele repete esse ciclo e deixa a refatoração para uma etapa de revisão posterior.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

TDD

Red-green in small steps, at seams that were agreed in advance. In a launch run the seam list is C2's approved output; outside launch, agree the seams with the user before the first test exists — a seam nobody approved gets no tests.

The loop

One test → one implementation → repeat:

  1. Write the next test at a seam. Run it. Watch it fail for the reason you expect — a test that cannot fail is not a test.
  2. Implement the smallest change that turns it green.
  3. Repeat. Each test is a tracer bullet: a narrow but complete path through the behavior, not a layer finished in isolation.

Rules

  • Expected values come from an independent source of truth — a spec line, a worked example, a documented output. Never from the implementation under test: a test that asserts what the code happens to do is a mirror, not a check.
  • Substitute at the seam's declared boundary class only — in-process, locally substitutable, owned-remote port, or true-external, the class C2 records for each seam. No substitutes inside the boundary the test is exercising.
  • Refactoring is not part of the loop. It belongs to the review stage; the repair worker owns it. Do not refactor mid-red-green.
  • A bug fix starts with the failing test that reproduces it — reproduction before theory, the debugger's rule.
  • When proposing a seam, say in one line what it catches and what it lets through — a seam choice nobody can price is a guess, not a decision.

When no seam fits

If the behavior cannot be tested at any approved seam, stop and say so: report the missing seam as a finding (it feeds architecture-survey and refit) rather than inventing a seam or testing through internals.

Output

  • The seam list used, with boundary classes and each seam's catch/miss line
  • Red/green evidence — the failing run and the passing run
  • Any seam-absence findings
Perguntas frequentes

Os testes copiam o que o código faz?

Não. Os valores esperados vêm de uma fonte independente, como uma especificação ou um exemplo trabalhado, e não do código testado.

Onde os testes devem ficar?

Somente em pontos combinados antecipadamente, para que nenhum teste seja escrito em um ponto que ninguém aprovou.

Quando a refatoração é feita?

Não dentro do ciclo vermelho-verde. Ela pertence a uma etapa de revisão posterior.

Detalhes

Descrição original do autor

Test-first at pre-agreed seams — one test, one implementation, tracer-bullet red/green; independent expected values; substitutions only at the seam's boundary class; launch Phase 4 reference.

repo: Yeachan-Heo/oh-my-claudecode

Popularidade

Estrelas no GitHub
41 mil
Posição no ranking
#7027
Licença
MIT
Atualizada em
02/11/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas