tdd-workflows-tdd-refactor
Refactor Code Safely with TDD
Maintain code quality while refactoring without breaking existing functionality. This skill provides comprehensive TDD workflows to guide safe code transformations.
Baixar o ZIP da skill
Upload no Claude
Vá em Configurações → Capacidades → Skills → Upload skill
Ative e comece a usar
Testar
A utilizar "tdd-workflows-tdd-refactor". Refactor this OrderProcessor class while keeping tests green
Resultado esperado:
Applied Extract Method, Value Objects, and Dependency Injection patterns. All tests passing. Created separate validation service, introduced OrderTotal value object, and injected dependencies. Code coverage maintained at 95%.
A utilizar "tdd-workflows-tdd-refactor". Eliminate code smells in this 200-line function
Resultado esperado:
Decomposed into 8 focused methods using Extract Method pattern. Applied Single Responsibility Principle. Introduced Parameter Objects for complex method signatures. All 42 tests still passing. Cyclomatic complexity reduced from 45 to 8.
Auditoria de Segurança
SeguroStatic analysis detected 9 potential issues (external commands, weak crypto, reconnaissance patterns). All findings are FALSE POSITIVES - they occur in code documentation examples and markdown backticks, not executable code. No prompt injection attempts or malicious intent detected. This is a legitimate TDD refactoring skill.
Problemas de Baixo Risco (1)
Fatores de risco
⚙️ Comandos externos (4)
Pontuação de qualidade
O Que Você Pode Construir
Legacy Code Modernization
Refactor legacy codebases incrementally while maintaining functionality
Code Quality Improvement
Eliminate code smells and apply design patterns systematically
Test-Supported Architecture Evolution
Evolve architecture patterns safely using comprehensive test coverage
Tente Estes Prompts
Refactor this code while keeping all tests green. Focus on eliminating code smells and improving readability.
Apply the Extract Method pattern to this code. Break down the long method into smaller, focused functions while maintaining all tests green.
Refactor this code using TDD refactor phase: establish green baseline, detect code smells, apply appropriate design patterns, verify with full test suite, and provide before/after metrics.
Refactor this code to improve architecture using the Strangler Fig pattern. Gradually replace legacy components while maintaining test safety and provide incremental migration plan.
Melhores Práticas
- Always run tests before refactoring to establish a green baseline
- Make small, incremental changes and run tests after each modification
- Commit after each successful refactoring to enable easy rollback
- Separate refactoring changes from behavior changes completely
Evitar
- Refactoring without test coverage - leads to undetected regressions
- Making large-scale changes without intermediate test runs - high risk of breaking functionality
- Mixing refactoring with feature additions - violates Single Responsibility Principle
- Skipping rollback planning - makes recovery difficult when tests fail
Perguntas Frequentes
Do I need existing tests to use this skill?
How large should refactoring changes be?
Can this skill write tests for my code?
What if my tests fail during refactoring?
Does this work with all programming languages?
How do I know which design pattern to apply?
Detalhes do Desenvolvedor
Autor
sickn33Licença
MIT
Repositório
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/tdd-workflows-tdd-refactorReferência
main
Estrutura de arquivos
📄 SKILL.md