@wbern/claude-instructions 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +411 -0
  2. package/bin/cli.js +99 -0
  3. package/downloads/with-beads/add-command.md +130 -0
  4. package/downloads/with-beads/ask.md +134 -0
  5. package/downloads/with-beads/beepboop.md +54 -0
  6. package/downloads/with-beads/commit.md +47 -0
  7. package/downloads/with-beads/cycle.md +89 -0
  8. package/downloads/with-beads/green.md +89 -0
  9. package/downloads/with-beads/issue.md +141 -0
  10. package/downloads/with-beads/plan.md +167 -0
  11. package/downloads/with-beads/red.md +85 -0
  12. package/downloads/with-beads/refactor.md +87 -0
  13. package/downloads/with-beads/ship.md +93 -0
  14. package/downloads/with-beads/show.md +107 -0
  15. package/downloads/with-beads/spike.md +89 -0
  16. package/downloads/with-beads/summarize.md +38 -0
  17. package/downloads/with-beads/tdd.md +89 -0
  18. package/downloads/with-beads/worktree-add.md +262 -0
  19. package/downloads/with-beads/worktree-cleanup.md +226 -0
  20. package/downloads/without-beads/add-command.md +130 -0
  21. package/downloads/without-beads/ask.md +126 -0
  22. package/downloads/without-beads/beepboop.md +46 -0
  23. package/downloads/without-beads/commit.md +47 -0
  24. package/downloads/without-beads/cycle.md +89 -0
  25. package/downloads/without-beads/green.md +89 -0
  26. package/downloads/without-beads/issue.md +133 -0
  27. package/downloads/without-beads/plan.md +107 -0
  28. package/downloads/without-beads/red.md +85 -0
  29. package/downloads/without-beads/refactor.md +87 -0
  30. package/downloads/without-beads/ship.md +85 -0
  31. package/downloads/without-beads/show.md +99 -0
  32. package/downloads/without-beads/spike.md +89 -0
  33. package/downloads/without-beads/summarize.md +30 -0
  34. package/downloads/without-beads/tdd.md +89 -0
  35. package/downloads/without-beads/worktree-add.md +262 -0
  36. package/downloads/without-beads/worktree-cleanup.md +226 -0
  37. package/package.json +65 -0
@@ -0,0 +1,130 @@
1
+ ---
2
+ description: Guide for creating new slash commands
3
+ argument-hint: <command-name> <description>
4
+ ---
5
+
6
+ # Slash Command Creator Guide
7
+
8
+ ## How This Command Works
9
+ The `/add-command` command shows this guide for creating new slash commands. It includes:
10
+ - Command structure and syntax
11
+ - Common patterns and examples
12
+ - Security restrictions and limitations
13
+ - Frontmatter options
14
+
15
+ **Note for AI**: When creating commands, you CAN use bash tools like `Bash(mkdir:*)`, `Bash(ls:*)`, `Bash(git status:*)` in the `allowed-tools` frontmatter of NEW commands - but ONLY for operations within the current project directory. This command itself doesn't need bash tools since it's just documentation.
16
+
17
+ ## Command Locations
18
+ - **Personal**: `~/.claude/commands/` (available across all projects)
19
+ - **Project**: `.claude/commands/` (shared with team, shows "(project)")
20
+
21
+ ## Basic Structure
22
+
23
+ ```markdown
24
+ ---
25
+ allowed-tools: Read, Glob, Grep, Bash(git status:*), Task
26
+ description: Brief description of what this command does
27
+ argument-hint: [required-arg] [optional-arg]
28
+ ---
29
+
30
+ # Command Title
31
+
32
+ Your command instructions here.
33
+
34
+ Arguments: $ARGUMENTS
35
+
36
+ File reference: @path/to/file.js
37
+
38
+ Bash command output: (exclamation)git status(backticks)
39
+ ```
40
+
41
+ ## ⚠️ Security Restrictions
42
+
43
+ **Bash Commands (exclamation prefix)**: Limited to current working directory only.
44
+ - ✅ Works: `! + backtick + git status + backtick` (in project dir)
45
+ - ❌ Blocked: `! + backtick + ls /outside/project + backtick` (outside project)
46
+ - ❌ Blocked: `! + backtick + pwd + backtick` (if referencing dirs outside project)
47
+
48
+ **File References (`@` prefix)**: No directory restrictions.
49
+ - ✅ Works: `@/path/to/system/file.md`
50
+ - ✅ Works: `@../other-project/file.js`
51
+
52
+ ## Common Patterns
53
+
54
+ ### Simple Command
55
+ ```bash
56
+ echo "Review this code for bugs and suggest fixes" > ~/.claude/commands/review.md
57
+ ```
58
+
59
+ ### Command with Arguments
60
+ ```markdown
61
+ Fix issue #$ARGUMENTS following our coding standards
62
+ ```
63
+
64
+ ### Command with File References
65
+ ```markdown
66
+ Compare @src/old.js with @src/new.js and explain differences
67
+ ```
68
+
69
+ ### Command with Bash Output (Project Directory Only)
70
+ ```markdown
71
+ ---
72
+ allowed-tools: Bash(git status:*), Bash(git branch:*), Bash(git log:*)
73
+ ---
74
+ Current status: (!)git status(`)
75
+ Current branch: (!)git branch --show-current(`)
76
+ Recent commits: (!)git log --oneline -5(`)
77
+
78
+ Create commit for these changes.
79
+ ```
80
+
81
+ **Note**: Only works with commands in the current project directory.
82
+
83
+ ### Namespaced Command
84
+ ```bash
85
+ mkdir -p ~/.claude/commands/ai
86
+ echo "Ask GPT-5 about: $ARGUMENTS" > ~/.claude/commands/ai/gpt5.md
87
+ # Creates: /ai:gpt5
88
+ ```
89
+
90
+ ## Frontmatter Options
91
+ - `allowed-tools`: Tools this command can use
92
+ - **Important**: Intrusive tools like `Write`, `Edit`, `NotebookEdit` should NEVER be allowed in commands unless the user explicitly requests them. These tools modify files and should only be used when the command's purpose is to make changes.
93
+ - ✅ Safe for most commands: `Read`, `Glob`, `Grep`, `Bash(git status:*)`, `Task`, `AskUserQuestion`
94
+ - `description`: Brief description (shows in /help)
95
+ - `argument-hint`: Help text for arguments
96
+ - `model`: Specific model to use
97
+
98
+ ## Best Practices
99
+
100
+ ### Safe Commands (No Security Issues)
101
+ ```markdown
102
+ # System prompt editor (file reference only)
103
+ (@)path/to/system/prompt.md
104
+
105
+ Edit your system prompt above.
106
+ ```
107
+
108
+ ### Project-Specific Commands (Bash OK)
109
+ ```markdown
110
+ ---
111
+ allowed-tools: Bash(git status:*), Bash(npm list:*)
112
+ ---
113
+ Current git status: (!)git status(`)
114
+ Package info: (!)npm list --depth=0(`)
115
+
116
+ Review project state and suggest next steps.
117
+ ```
118
+
119
+ ### Cross-Directory File Access (Use @ not !)
120
+ ```markdown
121
+ # Compare config files
122
+ Compare (@)path/to/system.md with (@)project/config.md
123
+
124
+ Show differences and suggest improvements.
125
+ ```
126
+
127
+ ## Usage
128
+ After creating: `/<command-name> [arguments]`
129
+
130
+ Example: `/review` or `/ai:gpt5 "explain this code"`
@@ -0,0 +1,126 @@
1
+ ---
2
+ allowed-tools: mcp__github__*, Bash(git:*)
3
+ description: Request team review and approval - for complex changes needing discussion (OK fine, traditional PRs still have their place - Cursor)
4
+ argument-hint: [optional-pr-title-and-description]
5
+ ---
6
+
7
+ # Ask - Request Review and Approval
8
+
9
+ ## General Guidelines
10
+
11
+ ### Output Style
12
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
13
+ - Write natural, descriptive code without meta-commentary about the development process
14
+ - The code should speak for itself - TDD is the process, not the product
15
+
16
+ **Ship/Show/Ask Pattern - ASK**
17
+
18
+ > 💭 **Cursor says**: Fine, SOME things still need traditional PRs. But be intentional about it.
19
+
20
+ Ask is for complex changes that need team discussion and approval. Examples:
21
+ - Breaking API changes
22
+ - New architecture decisions
23
+ - Significant feature additions
24
+ - Performance trade-offs
25
+ - Security-sensitive changes
26
+
27
+ ## When to Ask
28
+
29
+ Use **Ask** when:
30
+ - Changes affect multiple systems
31
+ - Breaking changes are needed
32
+ - You need input on approach
33
+ - Security implications exist
34
+ - Performance trade-offs need discussion
35
+ - Uncertain about the best solution
36
+
37
+ ## Workflow
38
+
39
+ Current branch status:
40
+ !`git status`
41
+
42
+ Recent commits:
43
+ !`git log --oneline -5`
44
+
45
+ Arguments: $ARGUMENTS
46
+
47
+ **This is the traditional Pull Request workflow**, but with explicit intent that review and approval are required.
48
+
49
+ **Process:**
50
+
51
+ 1. **Ensure Branch is Ready**:
52
+ !`git status`
53
+ - Commit all changes
54
+ - Push to remote: `git push origin [branch-name]`
55
+
56
+ 2. **Create Ask PR**: Create a PR that clearly needs review
57
+
58
+ Title: conventional commits format, prefixed with `[ASK]`
59
+
60
+ Description template:
61
+ ```markdown
62
+ ## 🤔 Ask - Review and Approval Needed
63
+
64
+ **This is an ASK PR**: These changes need team review and discussion.
65
+
66
+ <!--
67
+ References: [link to relevant issues]
68
+ -->
69
+
70
+ ### What changed
71
+ [Detailed description of changes]
72
+
73
+ ### Why
74
+ [Rationale and context]
75
+
76
+ ### Questions for reviewers
77
+ - [ ] Question 1
78
+ - [ ] Question 2
79
+
80
+ ### Concerns
81
+ - Potential concern 1
82
+ - Potential concern 2
83
+
84
+ ### Test Plan
85
+ - [ ] Unit tests
86
+ - [ ] Integration tests
87
+ - [ ] Manual testing steps
88
+
89
+ ### Alternatives considered
90
+ - Alternative 1: [why not chosen]
91
+ - Alternative 2: [why not chosen]
92
+ ```
93
+
94
+ 3. **Request Reviewers**: Assign specific reviewers who should weigh in
95
+
96
+ 4. **Add Labels**:
97
+ - "needs-review"
98
+ - "breaking-change" (if applicable)
99
+ - "security" (if applicable)
100
+
101
+ 5. **Link Issues**: Reference related issues in the description
102
+
103
+ 6. **Monitor Discussion**: Be responsive to reviewer feedback and questions
104
+
105
+ ## Use GitHub MCP Tools
106
+
107
+ 1. Check current branch and ensure it's pushed
108
+ 2. Create a well-formatted pull request with [ASK] prefix
109
+ 3. Set reviewers
110
+ 4. Add appropriate labels
111
+ 5. Link related issues from commit messages
112
+
113
+ ## Decision Guide
114
+
115
+ Use **Ask** when:
116
+ - ✅ Change is complex or risky
117
+ - ✅ Breaking changes involved
118
+ - ✅ Need team input on approach
119
+ - ✅ Multiple solutions possible
120
+ - ✅ Security implications
121
+
122
+ Use **/show** instead if: confident in approach, just want visibility
123
+
124
+ Use **/ship** instead if: change is tiny, obvious, and safe
125
+
126
+
@@ -0,0 +1,46 @@
1
+ ---
2
+ allowed-tools: Read, Grep, Glob
3
+ description: Communicate AI-generated content with transparent attribution
4
+ argument-hint: <task-description>
5
+ ---
6
+
7
+ # AI-Attributed Communication Command
8
+
9
+ Execute the user's requested task (e.g., posting PR comments, GitHub issue comments, or other communications through various MCPs), but frame the output with clear AI attribution.
10
+
11
+ ## General Guidelines
12
+
13
+ ### Output Style
14
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
15
+ - Write natural, descriptive code without meta-commentary about the development process
16
+ - The code should speak for itself - TDD is the process, not the product
17
+
18
+
19
+ ## Instructions
20
+
21
+ Arguments: $ARGUMENTS
22
+
23
+ **IMPORTANT Communication Format:**
24
+
25
+ 1. **Opening**: Begin with "*Beep boop, I am Claude Code 🤖, my user has reviewed and approved the following written by me:*"
26
+ - Use italics for this line
27
+ - Clearly establishes AI authorship
28
+
29
+ 2. **Middle**: Perform the requested task (post comment, create review, etc.)
30
+ - Execute whatever communication task the user requested
31
+ - Write the actual content that accomplishes the user's goal
32
+
33
+ 3. **Closing**: End with "*Beep boop, Claude Code 🤖 out!*"
34
+ - Use italics for this line
35
+ - Provides clear closure
36
+
37
+ ## Purpose
38
+
39
+ This command ensures transparency about AI usage while maintaining that the user has reviewed and approved the content. It prevents offloading review responsibility to other users while being open about AI assistance.
40
+
41
+ ## Examples
42
+
43
+ - Posting a GitHub PR review comment
44
+ - Adding a comment to a GitHub issue
45
+ - Responding to feedback with AI-generated explanations
46
+ - Any communication where AI attribution is valuable
@@ -0,0 +1,47 @@
1
+ ---
2
+ allowed-tools: Bash(pnpm test:*), Bash(pnpm lint:*)
3
+ description: Create a git commit following project standards
4
+ argument-hint: [optional-commit-description]
5
+ ---
6
+
7
+ Create a git commit following project standards
8
+
9
+ Include any of the following info if specified: $ARGUMENTS
10
+
11
+ ## General Guidelines
12
+
13
+ ### Output Style
14
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
15
+ - Write natural, descriptive code without meta-commentary about the development process
16
+ - The code should speak for itself - TDD is the process, not the product
17
+
18
+ ## Commit Message Rules
19
+
20
+ Follows [Conventional Commits](https://www.conventionalcommits.org/) standard.
21
+
22
+ 1. **Format**: `type(#issue): description`
23
+ - Use `#123` for local repo issues
24
+ - Use `owner/repo#123` for cross-repo issues
25
+ - Common types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`
26
+
27
+ 2. **AI Credits**: **NEVER include AI credits in commit messages**
28
+ - No "Generated with Claude Code"
29
+ - No "Co-Authored-By: Claude" or "Co-Authored-By: Happy"
30
+ - Focus on the actual changes made, not conversation history
31
+
32
+ 3. **Content**: Write clear, concise commit messages describing what changed and why
33
+
34
+ ## Process
35
+
36
+ 1. Run `git status` and `git diff` to review changes
37
+ 2. Run `git log --oneline -5` to see recent commit style
38
+ 3. Stage relevant files with `git add`
39
+ 4. Create commit with descriptive message
40
+ 5. Verify with `git status`
41
+
42
+ ## Example
43
+
44
+ ```bash
45
+ git add <files>
46
+ git commit -m "feat(#123): add validation to user input form"
47
+ ```
@@ -0,0 +1,89 @@
1
+ ---
2
+ allowed-tools: Read, Glob, Grep, Bash(pnpm test:*), Bash(pnpm:*)
3
+ description: Execute complete TDD cycle - Red, Green, and Refactor phases in sequence
4
+ argument-hint: <feature or requirement description>
5
+ ---
6
+
7
+ RED+GREEN+REFACTOR (one cycle) PHASE! Apply the below to the info given by user input here:
8
+
9
+ $ARGUMENTS
10
+
11
+ ## General Guidelines
12
+
13
+ ### Output Style
14
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
15
+ - Write natural, descriptive code without meta-commentary about the development process
16
+ - The code should speak for itself - TDD is the process, not the product
17
+
18
+ (If there was no info above, fallback to:
19
+ 1. Context of the conversation, if there's an immediate thing
20
+ 2. `bd ready` to see what to work on next and start from there)
21
+
22
+ ## TDD Fundamentals
23
+
24
+ ### The TDD Cycle
25
+
26
+ The foundation of TDD is the Red-Green-Refactor cycle:
27
+
28
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
29
+
30
+ - The test must fail for the RIGHT reason (not syntax/import errors)
31
+ - Only one test at a time - this is critical for TDD discipline
32
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
33
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
34
+
35
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
36
+
37
+ - Implement only what's needed for the current failing test
38
+ - No anticipatory coding or extra features
39
+ - Address the specific failure message
40
+
41
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
42
+ - Only allowed when relevant tests are passing
43
+ - Requires proof that tests have been run and are green
44
+ - Applies to BOTH implementation and test code
45
+ - No refactoring with failing tests - fix them first
46
+
47
+ ### Core Violations
48
+
49
+ 1. **Multiple Test Addition**
50
+
51
+ - Adding more than one new test at once
52
+ - Exception: Initial test file setup or extracting shared test utilities
53
+
54
+ 2. **Over-Implementation**
55
+
56
+ - Code that exceeds what's needed to pass the current failing test
57
+ - Adding untested features, methods, or error handling
58
+ - Implementing multiple methods when test only requires one
59
+
60
+ 3. **Premature Implementation**
61
+ - Adding implementation before a test exists and fails properly
62
+ - Adding implementation without running the test first
63
+ - Refactoring when tests haven't been run or are failing
64
+
65
+ ### Critical Principle: Incremental Development
66
+
67
+ Each step in TDD should address ONE specific issue:
68
+
69
+ - Test fails "not defined" → Create empty stub/class only
70
+ - Test fails "not a function" → Add method stub only
71
+ - Test fails with assertion → Implement minimal logic only
72
+
73
+ ### Optional Pre-Phase: Spike Phase
74
+
75
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
76
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
77
+
78
+ - The goal of a Spike is **exploration and learning**, not implementation.
79
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
80
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
81
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
82
+
83
+ ### General Information
84
+
85
+ - Sometimes the test output shows as no tests have been run when a new test is failing due to a missing import or constructor. In such cases, allow the agent to create simple stubs. Ask them if they forgot to create a stub if they are stuck.
86
+ - It is never allowed to introduce new logic without evidence of relevant failing tests. However, stubs and simple implementation to make imports and test infrastructure work is fine.
87
+ - In the refactor phase, it is perfectly fine to refactor both test and implementation code. That said, completely new functionality is not allowed. Types, clean up, abstractions, and helpers are allowed as long as they do not introduce new behavior.
88
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
89
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
@@ -0,0 +1,89 @@
1
+ ---
2
+ allowed-tools: Read, Glob, Grep, Bash(pnpm test:*), Bash(pnpm:*)
3
+ description: Execute TDD Green Phase - write minimal implementation to pass the failing test
4
+ argument-hint: <implementation description>
5
+ ---
6
+
7
+ GREEN PHASE! Apply the below to the info given by user input here:
8
+
9
+ $ARGUMENTS
10
+
11
+ ## General Guidelines
12
+
13
+ ### Output Style
14
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
15
+ - Write natural, descriptive code without meta-commentary about the development process
16
+ - The code should speak for itself - TDD is the process, not the product
17
+
18
+ (If there was no info above, fallback to:
19
+ 1. Context of the conversation, if there's an immediate thing
20
+ 2. `bd ready` to see what to work on next and start from there)
21
+
22
+ ## TDD Fundamentals
23
+
24
+ ### The TDD Cycle
25
+
26
+ The foundation of TDD is the Red-Green-Refactor cycle:
27
+
28
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
29
+
30
+ - The test must fail for the RIGHT reason (not syntax/import errors)
31
+ - Only one test at a time - this is critical for TDD discipline
32
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
33
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
34
+
35
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
36
+
37
+ - Implement only what's needed for the current failing test
38
+ - No anticipatory coding or extra features
39
+ - Address the specific failure message
40
+
41
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
42
+ - Only allowed when relevant tests are passing
43
+ - Requires proof that tests have been run and are green
44
+ - Applies to BOTH implementation and test code
45
+ - No refactoring with failing tests - fix them first
46
+
47
+ ### Core Violations
48
+
49
+ 1. **Multiple Test Addition**
50
+
51
+ - Adding more than one new test at once
52
+ - Exception: Initial test file setup or extracting shared test utilities
53
+
54
+ 2. **Over-Implementation**
55
+
56
+ - Code that exceeds what's needed to pass the current failing test
57
+ - Adding untested features, methods, or error handling
58
+ - Implementing multiple methods when test only requires one
59
+
60
+ 3. **Premature Implementation**
61
+ - Adding implementation before a test exists and fails properly
62
+ - Adding implementation without running the test first
63
+ - Refactoring when tests haven't been run or are failing
64
+
65
+ ### Critical Principle: Incremental Development
66
+
67
+ Each step in TDD should address ONE specific issue:
68
+
69
+ - Test fails "not defined" → Create empty stub/class only
70
+ - Test fails "not a function" → Add method stub only
71
+ - Test fails with assertion → Implement minimal logic only
72
+
73
+ ### Optional Pre-Phase: Spike Phase
74
+
75
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
76
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
77
+
78
+ - The goal of a Spike is **exploration and learning**, not implementation.
79
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
80
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
81
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
82
+
83
+ ### General Information
84
+
85
+ - Sometimes the test output shows as no tests have been run when a new test is failing due to a missing import or constructor. In such cases, allow the agent to create simple stubs. Ask them if they forgot to create a stub if they are stuck.
86
+ - It is never allowed to introduce new logic without evidence of relevant failing tests. However, stubs and simple implementation to make imports and test infrastructure work is fine.
87
+ - In the refactor phase, it is perfectly fine to refactor both test and implementation code. That said, completely new functionality is not allowed. Types, clean up, abstractions, and helpers are allowed as long as they do not introduce new behavior.
88
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
89
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
@@ -0,0 +1,133 @@
1
+ ---
2
+ allowed-tools: mcp__github__issue_read, mcp__github__get_issue, Task
3
+ description: Analyze GitHub issue and create TDD implementation plan
4
+ argument-hint: [optional-issue-number]
5
+ ---
6
+
7
+ Analyze GitHub issue and create TDD implementation plan.
8
+
9
+ ## General Guidelines
10
+
11
+ ### Output Style
12
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
13
+ - Write natural, descriptive code without meta-commentary about the development process
14
+ - The code should speak for itself - TDD is the process, not the product
15
+
16
+ Process:
17
+
18
+ 1. Get Issue Number
19
+
20
+ - Either from branch name use that issue number
21
+ - Patterns: issue-123, 123-feature, feature/123, fix/123
22
+ - Or from this bullet point with custom info: $ARGUMENTS
23
+ - If not found: ask user
24
+
25
+ 2. Fetch Issue
26
+
27
+ Try to fetch the issue using GitHub MCP (mcp__github__issue_read tool).
28
+
29
+ If GitHub MCP is not configured, show:
30
+ ```
31
+ GitHub MCP not configured!
32
+ See: https://github.com/modelcontextprotocol/servers/tree/main/src/github
33
+ Trying GitHub CLI fallback...
34
+ ```
35
+
36
+ Then try using `gh issue view [ISSUE_NUMBER] --json` as fallback.
37
+
38
+ 3. Analyze and Plan
39
+
40
+ Summarize the issue and requirements, then:
41
+
42
+ ## Discovery Phase
43
+
44
+ Understand the requirement by asking (use AskUserQuestion if needed):
45
+
46
+ **Problem Statement**
47
+ - What problem does this solve?
48
+ - Who experiences this problem?
49
+ - What's the current pain point?
50
+
51
+ **Desired Outcome**
52
+ - What should happen after this is built?
53
+ - How will users interact with it?
54
+ - What does success look like?
55
+
56
+ **Scope & Constraints**
57
+ - What's in scope vs. out of scope?
58
+ - Any technical constraints?
59
+ - Dependencies on other systems/features?
60
+
61
+ **Context Check**
62
+ - Search codebase for related features/modules
63
+ - Check for existing test files that might be relevant
64
+
65
+
66
+ ## TDD Fundamentals
67
+
68
+ ### The TDD Cycle
69
+
70
+ The foundation of TDD is the Red-Green-Refactor cycle:
71
+
72
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
73
+
74
+ - The test must fail for the RIGHT reason (not syntax/import errors)
75
+ - Only one test at a time - this is critical for TDD discipline
76
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
77
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
78
+
79
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
80
+
81
+ - Implement only what's needed for the current failing test
82
+ - No anticipatory coding or extra features
83
+ - Address the specific failure message
84
+
85
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
86
+ - Only allowed when relevant tests are passing
87
+ - Requires proof that tests have been run and are green
88
+ - Applies to BOTH implementation and test code
89
+ - No refactoring with failing tests - fix them first
90
+
91
+ ### Core Violations
92
+
93
+ 1. **Multiple Test Addition**
94
+
95
+ - Adding more than one new test at once
96
+ - Exception: Initial test file setup or extracting shared test utilities
97
+
98
+ 2. **Over-Implementation**
99
+
100
+ - Code that exceeds what's needed to pass the current failing test
101
+ - Adding untested features, methods, or error handling
102
+ - Implementing multiple methods when test only requires one
103
+
104
+ 3. **Premature Implementation**
105
+ - Adding implementation before a test exists and fails properly
106
+ - Adding implementation without running the test first
107
+ - Refactoring when tests haven't been run or are failing
108
+
109
+ ### Critical Principle: Incremental Development
110
+
111
+ Each step in TDD should address ONE specific issue:
112
+
113
+ - Test fails "not defined" → Create empty stub/class only
114
+ - Test fails "not a function" → Add method stub only
115
+ - Test fails with assertion → Implement minimal logic only
116
+
117
+ ### Optional Pre-Phase: Spike Phase
118
+
119
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
120
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
121
+
122
+ - The goal of a Spike is **exploration and learning**, not implementation.
123
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
124
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
125
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
126
+
127
+ ### General Information
128
+
129
+ - Sometimes the test output shows as no tests have been run when a new test is failing due to a missing import or constructor. In such cases, allow the agent to create simple stubs. Ask them if they forgot to create a stub if they are stuck.
130
+ - It is never allowed to introduce new logic without evidence of relevant failing tests. However, stubs and simple implementation to make imports and test infrastructure work is fine.
131
+ - In the refactor phase, it is perfectly fine to refactor both test and implementation code. That said, completely new functionality is not allowed. Types, clean up, abstractions, and helpers are allowed as long as they do not introduce new behavior.
132
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
133
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.