tdd
Skill30 starsChanged 3 months agoMITView on GitHub
Implement a ticket using Test-Driven Development (RED-GREEN-REFACTOR)
194 other projects use a version of this.
Adopted by
Most recently taken up by
- ishandutta2007/Awesome-Claude-Skillstheir own version, first seen Nov 8, 2026
- trpc/trpctheir own version, first seen Nov 8, 2026
- wowyuarm/dsh-agent-teamtheir own version, first seen Nov 8, 2026
- Contexera/dsh-agent-teamtheir own version, first seen Nov 8, 2026
- Dimon94/dveritytheir own version, first seen Nov 8, 2026
- Dimon94/skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use capture-learning-tools, design-frontend-dev and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
The-Vibe-CompanySkillcapture-learning-tools
Turn technical conversations, bugs, CI failures, review comments,
Also in 5 projects that use this
The-Vibe-CompanySkilldesign-frontend-dev
Clean Impeccable frontend design skill. Use when the user wants to
Also in 5 projects that use this
tristanphvnSkillketchup-video
Catch the user up like /keel:ketchup, with a short silent video of slides for what happened and the waiting calls as text under it. Use for /keel:ketchup-video.
Also in 14 projects that use this
jaydubya818Skillfigure-it-out
Use when novel or multi-phase work needs an auditable workflow and no narrower playbook fits.
Also in 54 projects that use this
jaydubya818Skillprinciple-laziness-protocol
Apply when a refactor is adding wrappers or abstractions instead of simplifying.
Also in 45 projects that use this
- +2 more from The-Vibe-Company
- +5 more from jaydubya818
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- mattpocock/skills★ 309ksame name
- trpc/trpc★ 41ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 41ksame name
- Yeachan-Heo/oh-my-claudecode★ 41ksame name
- QuivrHQ/quivr★ 40ksame name
- The-Vibe-Company/quivr★ 40ksame name
- ccusage/ccusage★ 19ksame name
- ryoppippi/ccusage★ 19ksame name
- MODSetter/SurfSense★ 17ksame name
- GreyDGL/PentestGPT★ 16ksame name
184 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- change-briefSkill
- clean-goneSkill
- close-customer-loopSkill
- commitSkill
- finishSkill
- notificationsSkill
- plan-qaSkill
- plan-tddSkill
- release-notesSkill
- releaseSkill
- review-requestSkill
- reviewSkill
- review-watchSkill
- rfcSkill
- setupSkill
- standupSkill
- start-qaSkill
- startSkill
- statusSkill
- syncSkill
- updateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 21 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 186 edited versions we read keep these.
21
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Check for configuration and context:
- Distinctive: line 93
If not provided, prompt the user for it
- Distinctive: line 107
If Linear ticket format is detected, use the Linear MCP server:
- Distinctive: line 121
If Jira is configured, use the Jira MCP server:
- Distinctive: line 135
If GitHub format detected:
- Distinctive: line 157
Search for files related to the ticket:
- Very specific: line 184
Test file naming convention (*.test.ts, *.spec.ts, *_test.py, etc.)
- Distinctive: line 185
Test framework (Jest, Vitest, pytest, go test, etc.)
- Distinctive: line 186
Test structure (describe/it, test(), etc.)
- Distinctive: line 214
Ask the user to confirm the bug reproduction:
- Distinctive: line 241
If test file doesn't exist, create it following project conventions:
- Distinctive: line 307
Add more tests before implementing
- Distinctive: line 311
Write the minimum code necessary to make tests pass:
- Distinctive: line 315
Don't add extra functionality
- Distinctive: line 316
Don't optimize yet
- Distinctive: line 317
Don't refactor yet
- Distinctive: line 332
If tests still fail:
- Distinctive: line 357
Ensure no regressions were introduced.
- Distinctive: line 370
Add more tests first
- Distinctive: line 391
After each refactoring change:
- Distinctive: line 399
Ensure tests remain GREEN throughout refactoring.
- Very specific: line 451
Update .git-workflow/pr-context.json with TDD information:
- Distinctive: line 457
Always write the canonical path.
“Common” is measured: kept by at least 6 in 10 of the 186 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cross-runtime: follow runtime compatibility for invocation, delegation, configuration precedence, state paths, and permissions.
You are helping implement a ticket using Test-Driven Development (TDD). Your task is to guide the user through the RED-GREEN-REFACTOR cycle: write failing tests first, implement code to pass tests, then refactor while keeping tests green.
Step 1: Load Configuration
Check for configuration and context:
# Check for config and context files
if [ -f ".git-workflow/config.yaml" ]; then
CONFIG_PATH=".git-workflow/config.yaml"
elif [ -f ".claude/config.yaml" ]; then
CONFIG_PATH=".claude/config.yaml" # legacy read-only fallback
else
CONFIG_PATH=""
fi
if [ -f ".git-workflow/pr-context.json" ]; then
CONTEXT_PATH=".git-workflow/pr-context.json"
elif [ -f ".claude/.pr-context.json" ]; then
CONTEXT_PATH=".claude/.pr-context.json" # legacy read-only fallback
else
CONTEXT_PATH=""
fiLoad from the resolved CONFIG_PATH (if one exists):
qa:
tdd:
confirmBeforeGreen: true
confirmBeforeRefactor: true
maxRedAttempts: 3
runFullSuiteEachPhase: false
autoStartServer: false
testing:
unit: auto
lint: auto
typeCheck: auto
issueTracker:
type: autoDefault Values (when no config):
qa:
tdd:
confirmBeforeGreen: true
confirmBeforeRefactor: true
maxRedAttempts: 3
runFullSuiteEachPhase: false
autoStartServer: falseStep 2: Parse Arguments
Extract from $ARGUMENTS:
$ARGUMENTSPatterns to Extract:
| Pattern | Example | Meaning |
| Ticket ID | PROJ-123, ENG-456 | Issue tracker ticket |
| GitHub Issue | #789 | GitHub issue number |
| Linear URL | https://linear.app/.../ENG-456/... | Extract ticket ID |
| Jira URL | https://....atlassian.net/browse/PROJ-123 | Extract ticket ID |
Parsing Logic:
- Extract ticket ID from URL if provided
- Linear: Pattern
/issue/([A-Z]+-\d+)/ - Jira: Pattern
/browse/([A-Z]+-\d+) - GitHub: Pattern
issues/(\d+)or#(\d+)
Validation:
- Ticket ID is required for TDD workflow
- If not provided, prompt the user for it
Step 3: Fetch Ticket Details
Auto-Detect Issue Tracker Type
Based on ticket format and available MCP servers:
^[A-Z]+-\d+$with Linear MCP available -> Linear^[A-Z]+-\d+$with Jira config/MCP available -> Jira^#?\d+$or GitHub URL -> GitHub Issues (viaghCLI)
Linear Integration
If Linear ticket format is detected, use the Linear MCP server:
mcp__linear__get_issue(id: ticketId)Extract:
- Title
- Description
- Acceptance criteria
- Labels (to determine bug vs feature)
Jira Integration
If Jira is configured, use the Jira MCP server:
mcp__jira__get_issue(issueKey: ticketId)Extract:
- Summary (title)
- Description
- Acceptance criteria
- Issue type (Bug/Story/Task)
GitHub Issues
If GitHub format detected:
gh issue view {issue_number} --repo {owner}/{repo} --json title,body,labelsDetermine Ticket Type
From ticket labels/type, determine:
| Label/Type | Classification | TDD Behavior |
bug, Bug, defect | Bug | Include reproduction step |
feature, Story, enhancement | Feature | Skip reproduction |
refactor, tech-debt | Refactor | Focus on existing tests first |
Step 4: Explore Codebase
Gather context about the codebase:
Find Related Files
Search for files related to the ticket:
# Search for keywords from ticket title/description
# Look for existing implementations
# Find related test filesLook for:
- Files matching keywords from ticket
- Existing test files in same area
- Related service/controller files
- Configuration files
Analyze Test Patterns
Identify existing test patterns:
# Find test files
find . -name "*.test.ts" -o -name "*.spec.ts" -o -name "*_test.py" -o -name "*_test.go" | head -20
# Check test framework imports
grep -r "describe\|it\|test\|expect" --include="*.test.*" -l | head -5Extract:
- Test file naming convention (
*.test.ts,*.spec.ts,*_test.py, etc.) - Test framework (Jest, Vitest, pytest, go test, etc.)
- Test structure (describe/it, test(), etc.)
- Mock patterns used
Detect Test Framework
Full per-language detection commands, tables, and the detection-results JSON shape: see
references/test-frameworks.md.
Step 5: Reproduce Issue (Bugs Only)
Skip this step for features and refactors.
For bugs, attempt to reproduce the issue:
Optional: Start Development Server
If qa.tdd.autoStartServer: true:
# Detect and start dev server (background)
npm run dev &
# or
pnpm dev &
# Wait for server to be ready
sleep 5Manual Reproduction
Ask the user to confirm the bug reproduction:
Question: "Can you reproduce the bug? Describe the steps and current behavior."
Options:
- Yes, I can reproduce it
- No, let me try first
- Skip reproduction (proceed to tests)
Document Expected vs Actual
If user reproduces:
{
"reproduction": {
"steps": ["Step 1", "Step 2"],
"currentBehavior": "What happens now",
"expectedBehavior": "What should happen"
}
}Step 6: TDD RED Phase - Write Failing Tests
Create Test File
If test file doesn't exist, create it following project conventions:
# Determine test file location
# Based on source file: src/services/auth.ts -> tests/services/auth.test.ts
# Or co-located: src/services/auth.ts -> src/services/auth.test.tsGenerate Test Cases
Based on ticket acceptance criteria, generate failing tests:
Sample generated test code for bugs and features: see
references/examples.md.
Run Tests - Verify RED
# Run the specific test target (varies by framework)
{TEST_COMMAND} {TEST_FILE}Per-language run commands (Go, Rust, etc.) and examples: see
references/test-frameworks.md.
Expected: Tests should FAIL (RED phase)
Handle Unexpected Results
| Result | Action |
| Tests fail (expected) | Proceed to GREEN phase |
| Tests pass | Warning: "Tests pass but shouldn't. Is the issue already fixed?" |
| Syntax errors | Fix test syntax, retry |
| Import errors | Fix imports, retry |
If tests pass unexpectedly:
Question: "The tests pass, but we expected them to fail. What should we do?"
Options:
- Issue is already fixed - verify and close
- Tests are incorrect - adjust test assertions
- Different test needed - rewrite tests
- Proceed anyway
Max Attempts:
Track attempts (default: maxRedAttempts: 3). If max reached:
Question: "Failed to achieve RED phase after {N} attempts. How should we proceed?"
Options:
- Continue trying with guidance
- Skip to implementation
- Abort TDD workflow
Step 7: TDD GREEN Phase - Implement Code
Confirmation (If Configured)
If qa.tdd.confirmBeforeGreen: true:
Question: "RED phase complete. Tests are failing as expected. Proceed to GREEN phase?"
Options:
- Yes, implement the fix/feature
- Review tests first
- Add more tests before implementing
Implement Minimum Code
Write the minimum code necessary to make tests pass:
Guidelines:
- Focus only on passing the tests
- Don't add extra functionality
- Don't optimize yet
- Don't refactor yet
Run Tests - Verify GREEN
# Run tests again (use the same target as RED phase)
{TEST_COMMAND} {TEST_FILE}Per-language run commands: see
references/test-frameworks.md.
Expected: Tests should PASS (GREEN phase)
Handle Failures
If tests still fail:
- Analyze error messages
- Fix implementation
- Re-run tests
- Repeat until green
Track attempts. If struggling:
Question: "Tests are still failing. Need help troubleshooting?"
Options:
- Show me the errors - I'll help debug
- I'll fix it manually
- Skip to refactor phase anyway
Optional: Run Full Suite
If qa.tdd.runFullSuiteEachPhase: true:
# Run full test suite
{TEST_COMMAND}Ensure no regressions were introduced.
Step 8: TDD REFACTOR Phase - Clean Up
Confirmation (If Configured)
If qa.tdd.confirmBeforeRefactor: true:
Question: "GREEN phase complete. All tests pass. Proceed to REFACTOR phase?"
Options:
- Yes, clean up the code
- Skip refactoring - code is good enough
- Add more tests first
Refactoring Guidelines
Review and improve the implementation:
Check for:
- Code duplication
- Long methods/functions
- Poor naming
- Missing error handling
- Performance issues
- Type safety
Do NOT:
- Add new functionality
- Change behavior
- Break existing tests
Run Tests After Each Change
After each refactoring change:
{TEST_COMMAND} {TEST_FILE}Per-language run commands: see
references/test-frameworks.md.
Ensure tests remain GREEN throughout refactoring.
Step 9: Final Verification
Run Full Test Suite
# Run all tests
{FULL_TEST_COMMAND}
# Examples:
# npm test
# pnpm test
# pytest
# cargo test
# go test ./...Run Linting
# Auto-detected or from config
{LINT_COMMAND}
# Examples:
# npm run lint
# pnpm lint
# ruff check .
# cargo clippyRun Type Check (If Applicable)
# TypeScript
npx tsc --noEmit
# Python (mypy)
mypy .Summary of Checks
| Check | Status | Notes |
| New tests | PASS | {N} tests added |
| Full suite | PASS | {M} total tests |
| Linting | PASS | No issues |
| Type check | PASS | No errors |
Step 10: Update Context
Update .git-workflow/pr-context.json with TDD information:
mkdir -p .git-workflowAlways write the canonical path. Never modify the legacy context fallback.
{
"ticket_id": "PROJ-1234",
"ticket_url": "https://...",
"ticket_title": "Title from ticket",
"branch": "fix/proj-1234-description",
"type": "fix",
"description": "Description",
"started_at": "2025-01-17T12:00:00Z",
"tdd": {
"test_files": ["tests/auth/login.test.ts"],
"implementation_files": ["src/services/auth.ts"],
"tests_added": 2,
"tests_modified": 0,
"phases_completed": ["red", "green", "refactor"],
"completed_at": "2025-01-17T14:30:00Z"
}
}This enables /commit to generate better commit messages and /finish to include TDD summary in PR description.
Step 11: Summary
Output a completion summary:
Sample completion summary format: see
references/examples.md.
Configuration Reference
Full settings table: see
references/configuration.md.
Error Handling
Full error-scenario table: see
references/error-handling.md.
Examples
Full worked examples (Bug Fix Flow, Feature Flow, No Ticket Flow): see
references/examples.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

