Agent skill
tdd-cycle
Enforces strict red-green-refactor TDD with suite mode and refactor-clean integration. Use when writing all tests upfront before implementation (suite mode), when you need metrics-driven refactoring thresholds during TDD, or when explicitly invoking /tdd-cycle. For standard incremental TDD, superpowers:test-driven-development is used automatically.
Install this agent skill to your Project
npx add-skill https://github.com/philoserf/claude-code-setup/tree/main/skills/tdd-cycle
SKILL.md
TDD Cycle
Strict red-green-refactor cycle enforcement. Every line of production code is justified by a failing test. Phase gates prevent skipping ahead — no implementation without a red test, no refactoring without green tests.
When to Use
- Building new features test-first
- Adding tests to untested code before changing it
- User asks to "TDD", "write tests first", "red green refactor", or "test-driven"
- Bug fix where the first step is a reproducing test
When NOT to Use
- Refactoring code that already has passing tests (use
refactor-clean) - Writing tests after implementation (that's just "add tests", not TDD)
- Pure test infrastructure work (fixtures, helpers, CI config)
Relationship to refactor-clean
- tdd-cycle owns phase discipline: when to write tests, when to implement, when to refactor, and transition gates between phases
- refactor-clean owns refactoring methodology: what smells to detect, how to prioritize, how to verify quality
- The REFACTOR phase delegates smell detection and prioritization to
refactor-clean's analysis rubric
Development Modes
Incremental (default)
One test at a time — write a failing test, make it pass, refactor, repeat. Best for exploring unfamiliar domains, complex logic, or when requirements are unclear.
Suite
Write all tests for a feature upfront, then implement to pass the full suite, then refactor. Best for well-understood requirements with clear acceptance criteria.
Choose the mode based on how well the requirements are understood. When in doubt, use incremental.
Workflow
1. Understand
Analyze requirements and identify test scenarios before writing any code.
- Break the feature into independently testable behaviors
- Identify edge cases, error conditions, and boundary values
- Decide on development mode (incremental vs suite)
- Identify the test framework and assertion style already in use in the project
2. RED — Write Failing Tests
Write tests that define the expected behavior. No implementation code yet.
Follow the RED phase rules strictly:
- Tests must fail due to missing implementation, not syntax or import errors
- Each test targets one specific behavior
- Use the AAA pattern (Arrange-Act-Assert)
- Run tests and confirm meaningful failures before proceeding
Gate: Do not proceed to GREEN until all RED phase validation checks pass.
3. GREEN — Minimal Implementation
Write the minimum code to make tests pass. Nothing more.
Follow the GREEN phase rules strictly:
- Choose the right technique: Fake It, Obvious Implementation, or Triangulation
- One test at a time in incremental mode; run after each change
- Track shortcuts taken for the REFACTOR phase
- Do not add error handling, optimization, or features beyond what tests require
Gate: Do not proceed to REFACTOR until all GREEN phase validation checks pass.
4. REFACTOR — Improve Structure
Improve code quality while keeping all tests green.
Follow the REFACTOR phase rules strictly:
- Refactor both production code and test code
- Use
refactor-clean's analysis rubric to identify smells - One atomic change at a time, run tests after each
- Revert immediately if any test breaks
- No behavior changes — if new behavior is needed, go back to RED
Gate: Do not start the next cycle until all REFACTOR phase validation checks pass.
5. Repeat
Pick the next test scenario and return to step 2. Continue until all identified behaviors are covered and coverage thresholds are met.
Output Format
After completing one or more cycles, report:
## TDD Cycle Report
### Cycles Completed: N
### Tests
- Written: X (unit: A, integration: B, other: C)
- Passing: X / X
- Coverage: line NN%, branch NN%
### Refactoring Applied
- [list of structural improvements made]
### Remaining
- [deferred items or next feature slices]
Reference Files
Detailed phase rules and metrics:
- phase-discipline.md — RED/GREEN/REFACTOR rules, techniques, and validation gates
- thresholds.md — Coverage targets, refactoring triggers, cycle metrics, failure recovery
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
pre-release
Validates a project is ready to tag and ship. Use when tagging a release, cutting a version, shipping a package, or asking "are we ready to release?" Checks repo hygiene, CI status, docs, version sync, and build verification. Optimized for Obsidian plugins with fallback detection for other project types.
local-issues
Reviews a codebase for bugs, design issues, and code cleanliness problems with specific file paths and line numbers. Use when auditing code quality, finding bugs, doing a code review, finding problems, or reviewing a project for issues. Creates issue files in `.issues/` directory.
skill-improve
Generates prioritized improvement recommendations for Claude Code skills. Use when improving skills, enhancing customizations, or wanting actionable feedback on how to make a skill better. Provides impact/effort prioritization with specific fix suggestions.
release
Executes the final release workflow for Obsidian plugins after pre-release checks pass. Use when tagging a release, publishing a version, or shipping an Obsidian plugin. Bumps version via bun run script, creates git tag, pushes to trigger GitHub Actions, and updates GitHub release notes from CHANGELOG.md.
skill-quality
Scores Claude Code skills (1-5) across 6 weighted quality dimensions aligned with official Anthropic docs. Use when evaluating skill quality, rating skills, scoring customizations, comparing skill effectiveness, or checking if a skill follows best practices. Produces per-dimension scores with evidence, weighted totals, quality tier classification, and actionable improvement recommendations.
obsidian-cli
Interacts with Obsidian vaults using the Obsidian CLI to read, create, and manage notes, tasks, properties, tags, and more. Also supports plugin and theme development with commands to reload plugins, run JavaScript, capture errors, take screenshots, and inspect the DOM. Use when the user asks to interact with their Obsidian vault, manage notes, add to daily note, find notes about a topic, check tasks, append to a note, query the vault, list tags, list files, manage bookmarks, check sync status, view file history, use templates, query bases, run QuickAdd, perform vault operations from the command line, or develop and debug Obsidian plugins and themes.
Didn't find tool you were looking for?