Habilidades test-driven-development
📦

test-driven-development

Seguro

Master test-driven development workflow

Também disponível em: Cycleaddict,davila7,ZhanlinCui,DMJGilbert,DYAI2025,Cygnusfear,CodingCossack,obra

Writing tests after code provides no proof they actually test anything. This skill enforces the Red-Green-Refactor cycle where every test must fail before implementation, ensuring tests verify real behavior.

Suporta: Claude Codex Code(CC)
🥉 74 Bronze
1

Baixar o ZIP da skill

2

Upload no Claude

Vá em Configurações → Capacidades → Skills → Upload skill

3

Ative e comece a usar

Testar

A utilizar "test-driven-development". Implement a function that retries failed operations 3 times

Resultado esperado:

  • Step 1 (RED): Write test 'retries failed operations 3 times'
  • Step 2: Run test - verify it fails because retry logic does not exist
  • Step 3 (GREEN): Implement minimal retry loop
  • Step 4: Run test - verify it passes
  • Step 5 (REFACTOR): Extract retry logic if needed

A utilizar "test-driven-development". Bug: Empty email accepted in form

Resultado esperado:

  • RED: test('rejects empty email') - expect error 'Email required'
  • Verify: Test fails - form currently accepts empty email
  • GREEN: Add validation check for empty email
  • Verify: Test passes, no regressions
  • Result: Bug fixed with test preventing regression

Auditoria de Segurança

Seguro
v1 • 2/25/2026

This skill contains only markdown documentation explaining test-driven development methodology. All 57 static analyzer findings for external_commands are false positives - the detected backticks are markdown code fences (```) used for syntax highlighting, not Ruby shell execution. The 6 cryptographic algorithm findings and reconnaissance detections are also false positives from pattern matching on documentation text. No executable code, network calls, or filesystem operations exist in this skill.

2
Arquivos analisados
674
Linhas analisadas
0
achados
1
Total de auditorias
Nenhum problema de segurança encontrado
Auditado por: claude

Pontuação de qualidade

38
Arquitetura
100
Manutenibilidade
87
Conteúdo
50
Comunidade
100
Segurança
91
Conformidade com especificações

O Que Você Pode Construir

New feature development

Use TDD when implementing new features to ensure each function has corresponding tests that prove correct behavior before commit

Bug fix with regression prevention

Write a failing test that reproduces the bug first, then implement the fix, ensuring the bug cannot regress

Refactoring with confidence

Use existing test suite to verify behavior remains unchanged during code restructuring or optimization

Tente Estes Prompts

Basic TDD cycle
I need to implement [feature]. Help me write a failing test first that describes the expected behavior, then guide me through Red-Green-Refactor.
Bug fix with TDD
Bug: [describe bug]. Help me write a test that reproduces this bug (should fail), then implement the minimal fix to make it pass.
Test quality review
Review my test for [function]. Does it test real behavior or mock behavior? Is the test name clear? Does it test one thing?
TDD anti-pattern check
I'm about to [action]. Check if this violates TDD principles. Am I testing mock behavior? Adding test-only code? Mocking without understanding?

Melhores Práticas

  • Always watch the test fail before implementing - this proves the test actually tests something
  • Write minimal code to pass the test - no extra features, no over-engineering
  • Delete implementation code if you skip the TDD cycle and start fresh with tests first

Evitar

  • Writing implementation code before the test exists
  • Testing mock behavior instead of real code behavior
  • Adding test-only methods to production classes

Perguntas Frequentes

What if I already wrote implementation code?
Delete it. The time is already spent. Rewrite using TDD starting with a failing test. Keeping unverified code is technical debt.
Can I write tests after implementation?
No. Tests written after pass immediately, proving nothing. You test what you built, not what is required. TDD requires test-first.
What if the code is too simple to test?
Simple code breaks too. A 30-second test prevents future bugs. If it is worth shipping, it is worth testing.
How do I handle existing code without tests?
Add tests for existing behavior before making changes. Test the current behavior first, then use TDD for new features.
What if my test setup is too complex?
Complex tests indicate complex design. Simplify the interface, extract helpers, or use dependency injection.
When can I skip TDD?
Only for throwaway prototypes, generated code, or configuration files. For production code, always use TDD unless your human partner approves an exception.

Detalhes do Desenvolvedor

Estrutura de arquivos