@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.
- package/README.md +411 -0
- package/bin/cli.js +99 -0
- package/downloads/with-beads/add-command.md +130 -0
- package/downloads/with-beads/ask.md +134 -0
- package/downloads/with-beads/beepboop.md +54 -0
- package/downloads/with-beads/commit.md +47 -0
- package/downloads/with-beads/cycle.md +89 -0
- package/downloads/with-beads/green.md +89 -0
- package/downloads/with-beads/issue.md +141 -0
- package/downloads/with-beads/plan.md +167 -0
- package/downloads/with-beads/red.md +85 -0
- package/downloads/with-beads/refactor.md +87 -0
- package/downloads/with-beads/ship.md +93 -0
- package/downloads/with-beads/show.md +107 -0
- package/downloads/with-beads/spike.md +89 -0
- package/downloads/with-beads/summarize.md +38 -0
- package/downloads/with-beads/tdd.md +89 -0
- package/downloads/with-beads/worktree-add.md +262 -0
- package/downloads/with-beads/worktree-cleanup.md +226 -0
- package/downloads/without-beads/add-command.md +130 -0
- package/downloads/without-beads/ask.md +126 -0
- package/downloads/without-beads/beepboop.md +46 -0
- package/downloads/without-beads/commit.md +47 -0
- package/downloads/without-beads/cycle.md +89 -0
- package/downloads/without-beads/green.md +89 -0
- package/downloads/without-beads/issue.md +133 -0
- package/downloads/without-beads/plan.md +107 -0
- package/downloads/without-beads/red.md +85 -0
- package/downloads/without-beads/refactor.md +87 -0
- package/downloads/without-beads/ship.md +85 -0
- package/downloads/without-beads/show.md +99 -0
- package/downloads/without-beads/spike.md +89 -0
- package/downloads/without-beads/summarize.md +30 -0
- package/downloads/without-beads/tdd.md +89 -0
- package/downloads/without-beads/worktree-add.md +262 -0
- package/downloads/without-beads/worktree-cleanup.md +226 -0
- package/package.json +65 -0
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
### Beads Integration
|
|
127
|
+
|
|
128
|
+
Use Beads MCP to:
|
|
129
|
+
- Track work with `bd ready` to find next task
|
|
130
|
+
- Create issues with `bd create "description"`
|
|
131
|
+
- Track dependencies with `bd dep add`
|
|
132
|
+
|
|
133
|
+
See https://github.com/steveyegge/beads for more information.
|
|
134
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
### Beads Integration
|
|
19
|
+
|
|
20
|
+
Use Beads MCP to:
|
|
21
|
+
- Track work with `bd ready` to find next task
|
|
22
|
+
- Create issues with `bd create "description"`
|
|
23
|
+
- Track dependencies with `bd dep add`
|
|
24
|
+
|
|
25
|
+
See https://github.com/steveyegge/beads for more information.
|
|
26
|
+
|
|
27
|
+
## Instructions
|
|
28
|
+
|
|
29
|
+
Arguments: $ARGUMENTS
|
|
30
|
+
|
|
31
|
+
**IMPORTANT Communication Format:**
|
|
32
|
+
|
|
33
|
+
1. **Opening**: Begin with "*Beep boop, I am Claude Code 🤖, my user has reviewed and approved the following written by me:*"
|
|
34
|
+
- Use italics for this line
|
|
35
|
+
- Clearly establishes AI authorship
|
|
36
|
+
|
|
37
|
+
2. **Middle**: Perform the requested task (post comment, create review, etc.)
|
|
38
|
+
- Execute whatever communication task the user requested
|
|
39
|
+
- Write the actual content that accomplishes the user's goal
|
|
40
|
+
|
|
41
|
+
3. **Closing**: End with "*Beep boop, Claude Code 🤖 out!*"
|
|
42
|
+
- Use italics for this line
|
|
43
|
+
- Provides clear closure
|
|
44
|
+
|
|
45
|
+
## Purpose
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
- Posting a GitHub PR review comment
|
|
52
|
+
- Adding a comment to a GitHub issue
|
|
53
|
+
- Responding to feedback with AI-generated explanations
|
|
54
|
+
- 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,141 @@
|
|
|
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
|
+
### Beads Integration
|
|
66
|
+
|
|
67
|
+
Use Beads MCP to:
|
|
68
|
+
- Track work with `bd ready` to find next task
|
|
69
|
+
- Create issues with `bd create "description"`
|
|
70
|
+
- Track dependencies with `bd dep add`
|
|
71
|
+
|
|
72
|
+
See https://github.com/steveyegge/beads for more information.
|
|
73
|
+
|
|
74
|
+
## TDD Fundamentals
|
|
75
|
+
|
|
76
|
+
### The TDD Cycle
|
|
77
|
+
|
|
78
|
+
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
79
|
+
|
|
80
|
+
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
81
|
+
|
|
82
|
+
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
83
|
+
- Only one test at a time - this is critical for TDD discipline
|
|
84
|
+
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
85
|
+
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
86
|
+
|
|
87
|
+
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
88
|
+
|
|
89
|
+
- Implement only what's needed for the current failing test
|
|
90
|
+
- No anticipatory coding or extra features
|
|
91
|
+
- Address the specific failure message
|
|
92
|
+
|
|
93
|
+
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
94
|
+
- Only allowed when relevant tests are passing
|
|
95
|
+
- Requires proof that tests have been run and are green
|
|
96
|
+
- Applies to BOTH implementation and test code
|
|
97
|
+
- No refactoring with failing tests - fix them first
|
|
98
|
+
|
|
99
|
+
### Core Violations
|
|
100
|
+
|
|
101
|
+
1. **Multiple Test Addition**
|
|
102
|
+
|
|
103
|
+
- Adding more than one new test at once
|
|
104
|
+
- Exception: Initial test file setup or extracting shared test utilities
|
|
105
|
+
|
|
106
|
+
2. **Over-Implementation**
|
|
107
|
+
|
|
108
|
+
- Code that exceeds what's needed to pass the current failing test
|
|
109
|
+
- Adding untested features, methods, or error handling
|
|
110
|
+
- Implementing multiple methods when test only requires one
|
|
111
|
+
|
|
112
|
+
3. **Premature Implementation**
|
|
113
|
+
- Adding implementation before a test exists and fails properly
|
|
114
|
+
- Adding implementation without running the test first
|
|
115
|
+
- Refactoring when tests haven't been run or are failing
|
|
116
|
+
|
|
117
|
+
### Critical Principle: Incremental Development
|
|
118
|
+
|
|
119
|
+
Each step in TDD should address ONE specific issue:
|
|
120
|
+
|
|
121
|
+
- Test fails "not defined" → Create empty stub/class only
|
|
122
|
+
- Test fails "not a function" → Add method stub only
|
|
123
|
+
- Test fails with assertion → Implement minimal logic only
|
|
124
|
+
|
|
125
|
+
### Optional Pre-Phase: Spike Phase
|
|
126
|
+
|
|
127
|
+
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
128
|
+
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
129
|
+
|
|
130
|
+
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
131
|
+
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
132
|
+
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
133
|
+
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
134
|
+
|
|
135
|
+
### General Information
|
|
136
|
+
|
|
137
|
+
- 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.
|
|
138
|
+
- 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.
|
|
139
|
+
- 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.
|
|
140
|
+
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
141
|
+
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|