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.
スキルZIPをダウンロード
Claudeでアップロード
設定 → 機能 → スキル → スキルをアップロードへ移動
オンにして利用開始
テストする
「tdd-workflows-tdd-refactor」を使用しています。 Refactor this OrderProcessor class while keeping tests green
期待される結果:
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%.
「tdd-workflows-tdd-refactor」を使用しています。 Eliminate code smells in this 200-line function
期待される結果:
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.
セキュリティ監査
安全Static 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.
低リスクの問題 (1)
リスク要因
⚙️ 外部コマンド (4)
品質スコア
作れるもの
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
これらのプロンプトを試す
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.
ベストプラクティス
- 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
回避
- 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
よくある質問
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?
開発者の詳細
作成者
sickn33ライセンス
MIT
リポジトリ
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/tdd-workflows-tdd-refactor参照
main
ファイル構成
📄 SKILL.md