bugfix
Skill15 starsChanged 3 months agoMITView on GitHub
Fix bugs using Test-Driven Development. Use for bug fixes from Linear tickets or user reports. Emphasizes writing tests FIRST before any implementation.
18 other projects use a version of this.
Adopted by
Most recently taken up by
- grimoire-rs/grimoiretheir own version, first seen Oct 4, 2026
- wtsi-hgi/agentskillstheir own version, first seen Oct 4, 2026
- yacb2/aidextheir own version, first seen Sep 30, 2026
- akshaypimprikar/pragmatheir own version, first seen Sep 29, 2026
- dan-the-dev/xp-developer-skillstheir own version, first seen Sep 23, 2026
- flightctl/ai-workflowstheir own version, first seen Sep 21, 2026
Used with
Projects with it also use refactor, commit and 2 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.
GitHubSkillrefactor
Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.
Also in 3 projects that use this
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 4 projects that use this
SentrySkillreview
Fixture review skill.
Also in 4 projects that use this
BlockSkillplan
Draft a TDD, PRD, or lightweight plan in the conversation without committing it.
Also in 3 projects that use this
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- oasm-platform/open-asm★ 204same name
- atelier-fashion/adlc-toolkit★ 171same name
- Snowflake-Labs/coco-skills★ 38same name
- dan-the-dev/xp-developer-skills★ 30same name
- ecodelearn/template-claude-code-open★ 24same name
- grimoire-rs/grimoire★ 14same name
- duthaho/skillhub★ 9same name
- flightctl/ai-workflows★ 9same name
- akshaypimprikar/pragma★ 4same name
- bhoon716/skill-forge★ 4same name
8 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 repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- backend/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- frontend/CLAUDE.mdCLAUDE.md
- add-session-cardSkill
- backend-maintenanceSkill
- cut-releaseSkill
- frontend-maintenanceSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. 0 are common, 21 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
21
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
RED: - Write a failing test that reproduces the bug
- Distinctive: line 15
GREEN: - Write the minimal code to make the test pass
- Distinctive: line 25
Use TodoWrite to track TDD phases explicitly
- Distinctive: line 27
Write the test FIRST - it must fail initially
- Distinctive: line 29
Run all tests to ensure no regressions
- Distinctive: line 31
Only after code review passes: update Linear ticket and commit (if requested)
- Distinctive: line 107
The test MUST fail before proceeding: If it passes, either:
- Distinctive: line 122
Do NOT refactor unrelated code
- Distinctive: line 123
Do NOT add features beyond the bug fix
- Distinctive: line 124
Do NOT change function signatures unless necessary
- Distinctive: line 148
Only if the fix introduced code that could be cleaner:
- Distinctive: line 207
Read the diff carefully: - Use git diff to see exactly what changed
- Distinctive: line 210
Question everything: - If something seems odd, investigate
- Distinctive: line 226
Magic numbers: - Should they be constants?
- Distinctive: line 227
Copy-pasted code: - Should it be abstracted?
- Distinctive: line 228
Long functions: - Should they be broken up?
- Distinctive: line 236
Only proceed here after Phase 5 (Code Review) is complete and you are confident in the fix.
- Distinctive: line 256
Add a comment to the ticket with:
- Distinctive: line 265
Writing a test that passes immediately: - Test must fail first
- Distinctive: line 266
Over-engineering the fix: - Keep changes minimal
- Distinctive: line 269
Rushing to commit: - Always do a thorough code review first
“Common” is measured: kept by at least 6 in 10 of the 17 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
Bug Fix (TDD Workflow)
Fix bugs using strict Test-Driven Development. Always write tests first.
Critical: TDD is Mandatory
This skill enforces TDD. The workflow is:
- RED - Write a failing test that reproduces the bug
- GREEN - Write the minimal code to make the test pass
- REFACTOR - Clean up while keeping tests green
- REVIEW - Perform extremely thorough code review before commit
Do NOT write implementation code before the test exists and fails.
Do NOT commit or push until code review is complete.
Instructions for Claude
- Use TodoWrite to track TDD phases explicitly
- Understand the bug thoroughly before writing any code
- Write the test FIRST - it must fail initially
- Implement the fix - minimal changes only
- Run all tests to ensure no regressions
- Perform an extremely thorough code review before committing
- Only after code review passes: update Linear ticket and commit (if requested)
Phase 1: Understand the Bug
Track with TodoWrite:
- Read the bug report/ticket thoroughly
- Identify the affected code path
- Understand the expected vs actual behavior
- Identify the test file location
Locate Existing Tests
Backend (Go):
# Find test file for a source file
# e.g., db.go -> db_test.go
ls backend/internal/*/**_test.goFrontend (TypeScript):
# Tests are usually co-located
# e.g., Component.tsx -> Component.test.tsx
ls frontend/src/**/*.test.tsx
ls frontend/src/**/*.test.tsPhase 2: RED - Write Failing Test
This is the most important phase. Do not skip it.
Track with TodoWrite:
- Write test that reproduces the bug
- Run test to confirm it FAILS
- Verify failure message matches expected bug behavior
Test Writing Guidelines
Backend (Go):
func TestFunctionName_BugDescription(t *testing.T) {
// Arrange: Set up the conditions that trigger the bug
// Act: Execute the code path
// Assert: Verify correct behavior (this will FAIL initially)
}Frontend (TypeScript/Vitest):
describe('ComponentOrFunction', () => {
it('should handle the specific bug case', () => {
// Arrange
// Act
// Assert (this will FAIL initially)
});
});Run the Test to Confirm Failure
Backend:
cd backend && go test -v -run TestFunctionName ./path/to/package/...Frontend:
cd frontend && npm test -- --run -t "test description"The test MUST fail before proceeding. If it passes, either:
- The bug doesn't exist (investigate further)
- The test doesn't correctly reproduce the bug (fix the test)
Phase 3: GREEN - Implement the Fix
Track with TodoWrite:
- Write minimal code to fix the bug
- Run the specific test to see it PASS
- Run all related tests to check for regressions
Implementation Guidelines
- Make the smallest possible change to fix the bug
- Do NOT refactor unrelated code
- Do NOT add features beyond the bug fix
- Do NOT change function signatures unless necessary
Run Tests
Backend:
# Run specific test
cd backend && go test -v -run TestFunctionName ./path/to/package/...
# Run all tests in package
cd backend && go test -v ./path/to/package/...
# Run full test suite (with Docker for integration tests)
cd backend && DOCKER_HOST=unix:///Users/santaclaude/.orbstack/run/docker.sock go test ./...Frontend:
# Run all tests
cd frontend && npm run build && npm run lint && npm testPhase 4: REFACTOR (Optional)
Only if the fix introduced code that could be cleaner:
Track with TodoWrite:
- Identify refactoring opportunities
- Refactor while keeping tests green
- Run full test suite after refactoring
Skip this phase if the fix is already clean.
Phase 5: Code Review (MANDATORY)
Do NOT commit or push until this phase is complete.
Perform an extremely thorough code review of ALL changes before even considering commit and push. This is a critical gate - bugs that slip through here go to production.
Track with TodoWrite:
- Review every line of changed code
- Verify the fix is correct and complete
- Check for edge cases not covered by tests
- Look for unintended side effects
- Ensure code style matches the codebase
- Verify no debugging code was left behind
Code Review Checklist
Correctness:
- Does the fix actually solve the reported bug?
- Are all edge cases handled?
- Could this fix break other functionality?
- Is the logic sound under all conditions?
Completeness:
- Are there other places with the same bug pattern?
- Should similar fixes be applied elsewhere?
- Is the test comprehensive enough?
- Are error cases tested?
Quality:
- Is the code readable and self-documenting?
- Are variable/function names clear?
- Is the solution the simplest possible?
- Does it follow existing patterns in the codebase?
Safety:
- No SQL injection vulnerabilities?
- No XSS vulnerabilities?
- No sensitive data exposed?
- No race conditions introduced?
Cleanliness:
- No console.log/fmt.Println debugging left behind?
- No commented-out code?
- No TODO comments for things that should be done now?
- No unrelated formatting changes?
How to Review
- Read the diff carefully - Use
git diffto see exactly what changed - Read surrounding context - Understand the code around your changes
- Trace the code path - Mentally execute the fix with different inputs
- Question everything - If something seems odd, investigate
- Sleep on it - For complex fixes, consider reviewing again later
# View all changes
git diff
# View changes with more context
git diff -U10
# View staged changes
git diff --cachedRed Flags to Watch For
- Magic numbers - Should they be constants?
- Copy-pasted code - Should it be abstracted?
- Long functions - Should they be broken up?
- Deep nesting - Can it be flattened?
- Implicit assumptions - Are they documented or validated?
If you find ANY issues during review, go back and fix them before proceeding.
Phase 6: Finalize
Only proceed here after Phase 5 (Code Review) is complete and you are confident in the fix.
Track with TodoWrite:
- Run full test suite one final time
- Update Linear ticket with fix summary
- Commit changes (if user requests)
Full Test Suite
# Backend
cd backend && DOCKER_HOST=unix:///Users/santaclaude/.orbstack/run/docker.sock go test ./...
# Frontend
cd frontend && npm run build && npm run lint && npm testLinear Ticket Update
Add a comment to the ticket with:
- What was the root cause
- What test was added
- What code was changed
- How to verify the fix
Common Pitfalls to Avoid
- Writing the fix before the test - This defeats TDD
- Writing a test that passes immediately - Test must fail first
- Over-engineering the fix - Keep changes minimal
- Skipping the refactor phase entirely - At least consider it
- Not running the full test suite - Regressions happen
- Rushing to commit - Always do a thorough code review first
- Skipping code review because tests pass - Tests don't catch everything
- Reviewing your own code too quickly - Take time, be critical
When to Use This Skill
- Bug reports from Linear tickets
- Bugs discovered during development
- Regressions found in testing
- User-reported issues
When NOT to Use This Skill
- New features (use a feature skill instead)
- Major refactoring (use frontend-maintenance or backend-maintenance)
- Security vulnerabilities (may need faster response)
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.

