@wbern/claude-instructions 1.21.0 → 2.1.0
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 +4 -2
- package/bin/cli.js +414 -229
- package/package.json +8 -6
- package/src/README.md +279 -0
- package/src/fragments/aaa-pattern.md +7 -0
- package/src/fragments/beads-awareness.md +1 -0
- package/src/fragments/beads-integration.md +8 -0
- package/{downloads/without-beads/commit.md → src/fragments/commit-process.md} +0 -17
- package/src/fragments/consistency-check.md +1 -0
- package/src/fragments/discovery-phase.md +22 -0
- package/src/fragments/fallback-arguments-beads.md +3 -0
- package/src/fragments/fallback-arguments.md +1 -0
- package/src/fragments/fullwidth-dollar-note.md +1 -0
- package/src/fragments/gap-beads.md +1 -0
- package/src/fragments/git-host-detection.md +19 -0
- package/src/fragments/github-issue-fetch.md +10 -0
- package/src/fragments/no-plan-files.md +3 -0
- package/src/fragments/peeping-tom-warning.md +9 -0
- package/src/fragments/plan-beads-context-hint.md +1 -0
- package/src/fragments/plan-beads-details.md +49 -0
- package/src/fragments/plan-beads-integration.md +2 -0
- package/src/fragments/summarize-beads.md +8 -0
- package/{downloads/without-beads/summarize.md → src/fragments/summarize-structure.md} +0 -20
- package/{downloads/without-beads/tdd.md → src/fragments/tdd-fundamentals.md} +0 -21
- package/src/fragments/test-quality-criteria.md +24 -0
- package/src/fragments/universal-guidelines.md +6 -0
- package/{downloads/without-beads → src/sources}/add-command.md +11 -25
- package/{downloads/without-beads → src/sources}/ask.md +11 -6
- package/{downloads/without-beads → src/sources}/beepboop.md +7 -6
- package/{downloads/without-beads → src/sources}/busycommit.md +9 -36
- package/{downloads/without-beads → src/sources}/code-review.md +16 -30
- package/src/sources/commit.md +23 -0
- package/src/sources/cycle.md +23 -0
- package/{downloads/without-beads → src/sources}/gap.md +11 -8
- package/src/sources/green.md +23 -0
- package/src/sources/issue.md +42 -0
- package/{downloads/without-beads → src/sources}/kata.md +10 -9
- package/{downloads/without-beads → src/sources}/plan.md +18 -39
- package/{downloads/without-beads → src/sources}/pr.md +10 -6
- package/src/sources/red.md +26 -0
- package/src/sources/refactor.md +27 -0
- package/{downloads/without-beads → src/sources}/ship.md +11 -6
- package/{downloads/without-beads → src/sources}/show.md +11 -6
- package/src/sources/spike.md +23 -0
- package/src/sources/summarize.md +23 -0
- package/{downloads/without-beads → src/sources}/tdd-review.md +11 -31
- package/src/sources/tdd.md +24 -0
- package/{downloads/without-beads → src/sources}/worktree-add.md +13 -31
- package/{downloads/without-beads → src/sources}/worktree-cleanup.md +9 -27
- package/downloads/with-beads/add-command.md +0 -159
- package/downloads/with-beads/ask.md +0 -144
- package/downloads/with-beads/beepboop.md +0 -47
- package/downloads/with-beads/busycommit.md +0 -78
- package/downloads/with-beads/code-review.md +0 -263
- package/downloads/with-beads/commands-metadata.json +0 -155
- package/downloads/with-beads/commit.md +0 -49
- package/downloads/with-beads/cycle.md +0 -95
- package/downloads/with-beads/gap.md +0 -38
- package/downloads/with-beads/green.md +0 -95
- package/downloads/with-beads/issue.md +0 -152
- package/downloads/with-beads/kata.md +0 -444
- package/downloads/with-beads/plan.md +0 -186
- package/downloads/with-beads/pr.md +0 -82
- package/downloads/with-beads/red.md +0 -103
- package/downloads/with-beads/refactor.md +0 -105
- package/downloads/with-beads/ship.md +0 -98
- package/downloads/with-beads/show.md +0 -114
- package/downloads/with-beads/spike.md +0 -95
- package/downloads/with-beads/summarize.md +0 -54
- package/downloads/with-beads/tdd-review.md +0 -102
- package/downloads/with-beads/tdd.md +0 -94
- package/downloads/with-beads/worktree-add.md +0 -357
- package/downloads/with-beads/worktree-cleanup.md +0 -250
- package/downloads/without-beads/commands-metadata.json +0 -155
- package/downloads/without-beads/cycle.md +0 -90
- package/downloads/without-beads/green.md +0 -90
- package/downloads/without-beads/issue.md +0 -140
- package/downloads/without-beads/red.md +0 -98
- package/downloads/without-beads/refactor.md +0 -100
- package/downloads/without-beads/spike.md +0 -90
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Analyze GitHub issue and create TDD implementation plan
|
|
3
|
-
argument-hint: [optional-issue-number]
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Analyze GitHub issue and create TDD implementation plan.
|
|
7
|
-
|
|
8
|
-
## General Guidelines
|
|
9
|
-
|
|
10
|
-
### Output Style
|
|
11
|
-
|
|
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
|
-
1. 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
|
-
```
|
|
32
|
-
GitHub MCP not configured!
|
|
33
|
-
See: https://github.com/modelcontextprotocol/servers/tree/main/src/github
|
|
34
|
-
Trying GitHub CLI fallback...
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Then try using `gh issue view [ISSUE_NUMBER] --json` as fallback.
|
|
38
|
-
|
|
39
|
-
1. Analyze and Plan
|
|
40
|
-
|
|
41
|
-
Summarize the issue and requirements, then:
|
|
42
|
-
|
|
43
|
-
## Discovery Phase
|
|
44
|
-
|
|
45
|
-
Understand the requirement by asking (use AskUserQuestion if needed):
|
|
46
|
-
|
|
47
|
-
**Problem Statement**
|
|
48
|
-
|
|
49
|
-
- What problem does this solve?
|
|
50
|
-
- Who experiences this problem?
|
|
51
|
-
- What's the current pain point?
|
|
52
|
-
|
|
53
|
-
**Desired Outcome**
|
|
54
|
-
|
|
55
|
-
- What should happen after this is built?
|
|
56
|
-
- How will users interact with it?
|
|
57
|
-
- What does success look like?
|
|
58
|
-
|
|
59
|
-
**Scope & Constraints**
|
|
60
|
-
|
|
61
|
-
- What's in scope vs. out of scope?
|
|
62
|
-
- Any technical constraints?
|
|
63
|
-
- Dependencies on other systems/features?
|
|
64
|
-
|
|
65
|
-
**Context Check**
|
|
66
|
-
|
|
67
|
-
- Search codebase for related features/modules
|
|
68
|
-
- Check for existing test files that might be relevant
|
|
69
|
-
|
|
70
|
-
## TDD Fundamentals
|
|
71
|
-
|
|
72
|
-
### The TDD Cycle
|
|
73
|
-
|
|
74
|
-
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
75
|
-
|
|
76
|
-
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
77
|
-
|
|
78
|
-
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
79
|
-
- Only one test at a time - this is critical for TDD discipline
|
|
80
|
-
- Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
|
|
81
|
-
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
82
|
-
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
83
|
-
- For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
|
|
84
|
-
- Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
|
|
85
|
-
|
|
86
|
-
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
87
|
-
|
|
88
|
-
- Implement only what's needed for the current failing test
|
|
89
|
-
- No anticipatory coding or extra features
|
|
90
|
-
- Address the specific failure message
|
|
91
|
-
|
|
92
|
-
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
93
|
-
- Only allowed when relevant tests are passing
|
|
94
|
-
- Requires proof that tests have been run and are green
|
|
95
|
-
- Applies to BOTH implementation and test code
|
|
96
|
-
- No refactoring with failing tests - fix them first
|
|
97
|
-
|
|
98
|
-
### Core Violations
|
|
99
|
-
|
|
100
|
-
1. **Multiple Test Addition**
|
|
101
|
-
|
|
102
|
-
- Adding more than one new test at once
|
|
103
|
-
- Exception: Initial test file setup or extracting shared test utilities
|
|
104
|
-
|
|
105
|
-
2. **Over-Implementation**
|
|
106
|
-
|
|
107
|
-
- Code that exceeds what's needed to pass the current failing test
|
|
108
|
-
- Adding untested features, methods, or error handling
|
|
109
|
-
- Implementing multiple methods when test only requires one
|
|
110
|
-
|
|
111
|
-
3. **Premature Implementation**
|
|
112
|
-
- Adding implementation before a test exists and fails properly
|
|
113
|
-
- Adding implementation without running the test first
|
|
114
|
-
- Refactoring when tests haven't been run or are failing
|
|
115
|
-
|
|
116
|
-
### Critical Principle: Incremental Development
|
|
117
|
-
|
|
118
|
-
Each step in TDD should address ONE specific issue:
|
|
119
|
-
|
|
120
|
-
- Test fails "not defined" → Create empty stub/class only
|
|
121
|
-
- Test fails "not a function" → Add method stub only
|
|
122
|
-
- Test fails with assertion → Implement minimal logic only
|
|
123
|
-
|
|
124
|
-
### Optional Pre-Phase: Spike Phase
|
|
125
|
-
|
|
126
|
-
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
127
|
-
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
128
|
-
|
|
129
|
-
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
130
|
-
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
131
|
-
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
132
|
-
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
133
|
-
|
|
134
|
-
### General Information
|
|
135
|
-
|
|
136
|
-
- 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.
|
|
137
|
-
- 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.
|
|
138
|
-
- 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.
|
|
139
|
-
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
140
|
-
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Execute TDD Red Phase - write ONE failing test
|
|
3
|
-
argument-hint: [optional additional info]
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
RED PHASE! Apply the below to the info given by user input here:
|
|
7
|
-
|
|
8
|
-
$ARGUMENTS
|
|
9
|
-
|
|
10
|
-
## General Guidelines
|
|
11
|
-
|
|
12
|
-
### Output Style
|
|
13
|
-
|
|
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 the context of the conversation)
|
|
19
|
-
|
|
20
|
-
## TDD Fundamentals
|
|
21
|
-
|
|
22
|
-
### The TDD Cycle
|
|
23
|
-
|
|
24
|
-
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
25
|
-
|
|
26
|
-
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
27
|
-
|
|
28
|
-
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
29
|
-
- Only one test at a time - this is critical for TDD discipline
|
|
30
|
-
- Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
|
|
31
|
-
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
32
|
-
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
33
|
-
- For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
|
|
34
|
-
- Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
|
|
35
|
-
|
|
36
|
-
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
37
|
-
|
|
38
|
-
- Implement only what's needed for the current failing test
|
|
39
|
-
- No anticipatory coding or extra features
|
|
40
|
-
- Address the specific failure message
|
|
41
|
-
|
|
42
|
-
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
43
|
-
- Only allowed when relevant tests are passing
|
|
44
|
-
- Requires proof that tests have been run and are green
|
|
45
|
-
- Applies to BOTH implementation and test code
|
|
46
|
-
- No refactoring with failing tests - fix them first
|
|
47
|
-
|
|
48
|
-
### Core Violations
|
|
49
|
-
|
|
50
|
-
1. **Multiple Test Addition**
|
|
51
|
-
|
|
52
|
-
- Adding more than one new test at once
|
|
53
|
-
- Exception: Initial test file setup or extracting shared test utilities
|
|
54
|
-
|
|
55
|
-
2. **Over-Implementation**
|
|
56
|
-
|
|
57
|
-
- Code that exceeds what's needed to pass the current failing test
|
|
58
|
-
- Adding untested features, methods, or error handling
|
|
59
|
-
- Implementing multiple methods when test only requires one
|
|
60
|
-
|
|
61
|
-
3. **Premature Implementation**
|
|
62
|
-
- Adding implementation before a test exists and fails properly
|
|
63
|
-
- Adding implementation without running the test first
|
|
64
|
-
- Refactoring when tests haven't been run or are failing
|
|
65
|
-
|
|
66
|
-
### Critical Principle: Incremental Development
|
|
67
|
-
|
|
68
|
-
Each step in TDD should address ONE specific issue:
|
|
69
|
-
|
|
70
|
-
- Test fails "not defined" → Create empty stub/class only
|
|
71
|
-
- Test fails "not a function" → Add method stub only
|
|
72
|
-
- Test fails with assertion → Implement minimal logic only
|
|
73
|
-
|
|
74
|
-
### Optional Pre-Phase: Spike Phase
|
|
75
|
-
|
|
76
|
-
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
77
|
-
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
78
|
-
|
|
79
|
-
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
80
|
-
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
81
|
-
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
82
|
-
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
83
|
-
|
|
84
|
-
### General Information
|
|
85
|
-
|
|
86
|
-
- 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.
|
|
87
|
-
- 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.
|
|
88
|
-
- 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.
|
|
89
|
-
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
90
|
-
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|
|
91
|
-
|
|
92
|
-
### Test Structure (AAA Pattern)
|
|
93
|
-
|
|
94
|
-
Structure each test with clear phases:
|
|
95
|
-
|
|
96
|
-
- **Arrange**: Set up test data and preconditions (keep minimal)
|
|
97
|
-
- **Act**: Execute the single action being tested
|
|
98
|
-
- **Assert**: Verify the expected outcome with specific assertions
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Execute TDD Refactor Phase - improve code structure while keeping tests green
|
|
3
|
-
argument-hint: <refactoring description>
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Apply this document (specifically the Refactor phase), to the info given by user input here: $ARGUMENTS
|
|
7
|
-
|
|
8
|
-
## General Guidelines
|
|
9
|
-
|
|
10
|
-
### Output Style
|
|
11
|
-
|
|
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
|
-
(If there was no info above, fallback to the context of the conversation)
|
|
17
|
-
|
|
18
|
-
## TDD Fundamentals
|
|
19
|
-
|
|
20
|
-
### The TDD Cycle
|
|
21
|
-
|
|
22
|
-
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
23
|
-
|
|
24
|
-
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
25
|
-
|
|
26
|
-
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
27
|
-
- Only one test at a time - this is critical for TDD discipline
|
|
28
|
-
- Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
|
|
29
|
-
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
30
|
-
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
31
|
-
- For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
|
|
32
|
-
- Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
|
|
33
|
-
|
|
34
|
-
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
35
|
-
|
|
36
|
-
- Implement only what's needed for the current failing test
|
|
37
|
-
- No anticipatory coding or extra features
|
|
38
|
-
- Address the specific failure message
|
|
39
|
-
|
|
40
|
-
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
41
|
-
- Only allowed when relevant tests are passing
|
|
42
|
-
- Requires proof that tests have been run and are green
|
|
43
|
-
- Applies to BOTH implementation and test code
|
|
44
|
-
- No refactoring with failing tests - fix them first
|
|
45
|
-
|
|
46
|
-
### Core Violations
|
|
47
|
-
|
|
48
|
-
1. **Multiple Test Addition**
|
|
49
|
-
|
|
50
|
-
- Adding more than one new test at once
|
|
51
|
-
- Exception: Initial test file setup or extracting shared test utilities
|
|
52
|
-
|
|
53
|
-
2. **Over-Implementation**
|
|
54
|
-
|
|
55
|
-
- Code that exceeds what's needed to pass the current failing test
|
|
56
|
-
- Adding untested features, methods, or error handling
|
|
57
|
-
- Implementing multiple methods when test only requires one
|
|
58
|
-
|
|
59
|
-
3. **Premature Implementation**
|
|
60
|
-
- Adding implementation before a test exists and fails properly
|
|
61
|
-
- Adding implementation without running the test first
|
|
62
|
-
- Refactoring when tests haven't been run or are failing
|
|
63
|
-
|
|
64
|
-
### Critical Principle: Incremental Development
|
|
65
|
-
|
|
66
|
-
Each step in TDD should address ONE specific issue:
|
|
67
|
-
|
|
68
|
-
- Test fails "not defined" → Create empty stub/class only
|
|
69
|
-
- Test fails "not a function" → Add method stub only
|
|
70
|
-
- Test fails with assertion → Implement minimal logic only
|
|
71
|
-
|
|
72
|
-
### Optional Pre-Phase: Spike Phase
|
|
73
|
-
|
|
74
|
-
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
75
|
-
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
76
|
-
|
|
77
|
-
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
78
|
-
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
79
|
-
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
80
|
-
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
81
|
-
|
|
82
|
-
### General Information
|
|
83
|
-
|
|
84
|
-
- 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.
|
|
85
|
-
- 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.
|
|
86
|
-
- 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.
|
|
87
|
-
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
88
|
-
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|
|
89
|
-
|
|
90
|
-
### Watch for Brittle Tests
|
|
91
|
-
|
|
92
|
-
When refactoring implementation, watch for **Peeping Tom** tests that:
|
|
93
|
-
|
|
94
|
-
- Test private methods or internal state directly
|
|
95
|
-
- Assert on implementation details rather than behavior
|
|
96
|
-
- Break on any refactoring even when behavior is preserved
|
|
97
|
-
|
|
98
|
-
If tests fail after a pure refactoring (no behavior change), consider whether the tests are testing implementation rather than behavior.
|
|
99
|
-
|
|
100
|
-
1. **Consistency check** - Look for inconsistent patterns, naming conventions, or structure across the codebase
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Execute TDD Spike Phase - exploratory coding to understand problem space before TDD
|
|
3
|
-
argument-hint: <exploration description>
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
SPIKE PHASE! Apply the below to the info given by user input here:
|
|
7
|
-
|
|
8
|
-
$ARGUMENTS
|
|
9
|
-
|
|
10
|
-
## General Guidelines
|
|
11
|
-
|
|
12
|
-
### Output Style
|
|
13
|
-
|
|
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 the context of the conversation)
|
|
19
|
-
|
|
20
|
-
## TDD Fundamentals
|
|
21
|
-
|
|
22
|
-
### The TDD Cycle
|
|
23
|
-
|
|
24
|
-
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
25
|
-
|
|
26
|
-
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
27
|
-
|
|
28
|
-
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
29
|
-
- Only one test at a time - this is critical for TDD discipline
|
|
30
|
-
- Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
|
|
31
|
-
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
32
|
-
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
33
|
-
- For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
|
|
34
|
-
- Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
|
|
35
|
-
|
|
36
|
-
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
37
|
-
|
|
38
|
-
- Implement only what's needed for the current failing test
|
|
39
|
-
- No anticipatory coding or extra features
|
|
40
|
-
- Address the specific failure message
|
|
41
|
-
|
|
42
|
-
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
43
|
-
- Only allowed when relevant tests are passing
|
|
44
|
-
- Requires proof that tests have been run and are green
|
|
45
|
-
- Applies to BOTH implementation and test code
|
|
46
|
-
- No refactoring with failing tests - fix them first
|
|
47
|
-
|
|
48
|
-
### Core Violations
|
|
49
|
-
|
|
50
|
-
1. **Multiple Test Addition**
|
|
51
|
-
|
|
52
|
-
- Adding more than one new test at once
|
|
53
|
-
- Exception: Initial test file setup or extracting shared test utilities
|
|
54
|
-
|
|
55
|
-
2. **Over-Implementation**
|
|
56
|
-
|
|
57
|
-
- Code that exceeds what's needed to pass the current failing test
|
|
58
|
-
- Adding untested features, methods, or error handling
|
|
59
|
-
- Implementing multiple methods when test only requires one
|
|
60
|
-
|
|
61
|
-
3. **Premature Implementation**
|
|
62
|
-
- Adding implementation before a test exists and fails properly
|
|
63
|
-
- Adding implementation without running the test first
|
|
64
|
-
- Refactoring when tests haven't been run or are failing
|
|
65
|
-
|
|
66
|
-
### Critical Principle: Incremental Development
|
|
67
|
-
|
|
68
|
-
Each step in TDD should address ONE specific issue:
|
|
69
|
-
|
|
70
|
-
- Test fails "not defined" → Create empty stub/class only
|
|
71
|
-
- Test fails "not a function" → Add method stub only
|
|
72
|
-
- Test fails with assertion → Implement minimal logic only
|
|
73
|
-
|
|
74
|
-
### Optional Pre-Phase: Spike Phase
|
|
75
|
-
|
|
76
|
-
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
77
|
-
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
78
|
-
|
|
79
|
-
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
80
|
-
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
81
|
-
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
82
|
-
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
83
|
-
|
|
84
|
-
### General Information
|
|
85
|
-
|
|
86
|
-
- 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.
|
|
87
|
-
- 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.
|
|
88
|
-
- 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.
|
|
89
|
-
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
90
|
-
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|