k-harness 0.9.0 → 0.9.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/harness/agents/planner.md +12 -0
- package/harness/agents/reviewer.md +19 -0
- package/harness/agents/sprint-manager.md +31 -3
- package/harness/core-rules.md +2 -0
- package/harness/skills/feature-breakdown.md +19 -7
- package/harness/skills/impact-analysis.md +18 -8
- package/harness/skills/investigate.md +8 -3
- package/harness/skills/learn.md +20 -3
- package/harness/skills/security-checklist.md +12 -5
- package/harness/skills/test-integrity.md +15 -7
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ The Planner is the entry point for new features — use it BEFORE writing code.
|
|
|
18
18
|
- docs/dependency-map.md
|
|
19
19
|
- docs/project-state.md
|
|
20
20
|
- docs/failure-patterns.md
|
|
21
|
+
- docs/agent-memory/planner.md — Past estimation accuracy and architecture insights
|
|
21
22
|
|
|
22
23
|
## Input
|
|
23
24
|
|
|
@@ -38,6 +39,17 @@ Before proceeding, verify that required state files have content (not just TODO
|
|
|
38
39
|
If ALL files are empty/placeholder-only → **Stop and run the `bootstrap` skill first.** Report: "State files are empty. Running bootstrap to onboard this project."
|
|
39
40
|
If `docs/project-brief.md` alone is empty → Warn the user but proceed (the plan will lack direction guard).
|
|
40
41
|
|
|
42
|
+
### Step 0.5: Load Agent Memory
|
|
43
|
+
|
|
44
|
+
Read `docs/agent-memory/planner.md` for past learnings:
|
|
45
|
+
- Estimation accuracy from previous sprints (did Wave estimates match reality?)
|
|
46
|
+
- Architecture patterns that worked or failed in this project
|
|
47
|
+
- Repeated planning mistakes to avoid
|
|
48
|
+
|
|
49
|
+
Apply these insights when creating the implementation plan. If the memory file is empty or contains only placeholders, skip this step.
|
|
50
|
+
|
|
51
|
+
> **Team Mode**: In Team mode, agent memory is personal (`.harness/agent-memory/`). Each developer accumulates their own planning insights.
|
|
52
|
+
|
|
41
53
|
### For New Feature
|
|
42
54
|
|
|
43
55
|
1. Read `docs/project-brief.md` to understand project vision, goals, **non-goals**, and **Decision Log**
|
|
@@ -13,9 +13,12 @@ Finds issues and auto-fixes where safe, escalates where not.
|
|
|
13
13
|
|
|
14
14
|
## Referenced Files
|
|
15
15
|
|
|
16
|
+
- docs/project-brief.md — Project vision, goals, non-goals, and Decision Log
|
|
17
|
+
- docs/features.md — Feature registry (for Step 6 Feature Registry Check)
|
|
16
18
|
- docs/failure-patterns.md — Project failure patterns
|
|
17
19
|
- docs/project-state.md — Current Story scope
|
|
18
20
|
- docs/dependency-map.md — Module dependency graph
|
|
21
|
+
- docs/agent-memory/reviewer.md — Past review patterns and frequently missed items
|
|
19
22
|
|
|
20
23
|
## Procedure
|
|
21
24
|
|
|
@@ -27,6 +30,15 @@ Before reviewing, verify that required state files exist and are not empty:
|
|
|
27
30
|
|
|
28
31
|
If state files are empty/placeholder-only → Warn: "State files are not filled. Review will proceed but scope check and failure pattern cross-check will be limited. Consider running `bootstrap` skill."
|
|
29
32
|
|
|
33
|
+
### Step 0.5: Load Agent Memory
|
|
34
|
+
|
|
35
|
+
Read `docs/agent-memory/reviewer.md` for past learnings:
|
|
36
|
+
- Frequently missed review items in this project
|
|
37
|
+
- Common code patterns that caused issues
|
|
38
|
+
- Review statistics (pass rate, common failure categories)
|
|
39
|
+
|
|
40
|
+
Pay extra attention to items flagged in past reviews. If the memory file is empty or contains only placeholders, skip this step.
|
|
41
|
+
|
|
30
42
|
### Input
|
|
31
43
|
|
|
32
44
|
Changed file list (user-provided or from `git diff --name-only`)
|
|
@@ -138,3 +150,10 @@ Report using: **DONE** | **DONE_WITH_CONCERNS** | **BLOCKED** | **NEEDS_CONTEXT*
|
|
|
138
150
|
- Do not refactor beyond the review scope
|
|
139
151
|
- Auto-apply security fixes but always record them in output
|
|
140
152
|
- Escalate with NEEDS_CONTEXT after 3 uncertain judgments
|
|
153
|
+
|
|
154
|
+
## STATE-AUDIT Handoff
|
|
155
|
+
|
|
156
|
+
When Step 8 (State File Audit) produces `[STATE-AUDIT]` flags:
|
|
157
|
+
1. List all flagged items in the review output
|
|
158
|
+
2. The `learn` skill (run at session end) will verify and resolve these flags
|
|
159
|
+
3. If a flag is critical (missing module in dependency-map, unregistered feature), recommend fixing immediately rather than deferring to learn
|
|
@@ -5,10 +5,21 @@
|
|
|
5
5
|
Manage Sprint/Story state, guide development sequence, and prevent scope drift.
|
|
6
6
|
Keeps the LLM focused on the current work item.
|
|
7
7
|
|
|
8
|
+
## Referenced Skills
|
|
9
|
+
|
|
10
|
+
- bootstrap — Recommended when state files are empty
|
|
11
|
+
- learn — Recommended at session end or when all stories are done
|
|
12
|
+
- pivot — Recommended when direction change is detected
|
|
13
|
+
- investigate — Recommended when bug is blocking progress
|
|
14
|
+
|
|
8
15
|
## Referenced Files
|
|
9
16
|
|
|
10
17
|
- docs/project-state.md — Current state (this is the core file)
|
|
18
|
+
- docs/project-brief.md — Project vision and goals (for direction checks)
|
|
19
|
+
- docs/features.md — Feature registry (for progress overview)
|
|
20
|
+
- docs/dependency-map.md — Module graph (for scope validation)
|
|
11
21
|
- docs/failure-patterns.md — Recurring failure tracking
|
|
22
|
+
- docs/agent-memory/sprint-manager.md — Past velocity and scope drift data
|
|
12
23
|
|
|
13
24
|
## Procedure
|
|
14
25
|
|
|
@@ -18,7 +29,18 @@ Before handling any request, verify `docs/project-state.md` has content:
|
|
|
18
29
|
- Quick Summary must not be all TODO placeholders
|
|
19
30
|
- Story Status table must have at least one row
|
|
20
31
|
|
|
21
|
-
If `docs/project-state.md` is empty/placeholder-only → **Recommend running `bootstrap` skill first.** Report: docs/project-state.md is empty. Run bootstrap to initialize project state before tracking sprints."
|
|
32
|
+
If `docs/project-state.md` is empty/placeholder-only → **Recommend running `bootstrap` skill first.** Report: "docs/project-state.md is empty. Run bootstrap to initialize project state before tracking sprints."
|
|
33
|
+
|
|
34
|
+
### Step 0.5: Load Agent Memory
|
|
35
|
+
|
|
36
|
+
Read `docs/agent-memory/sprint-manager.md` for past learnings:
|
|
37
|
+
- Team velocity data (stories per sprint)
|
|
38
|
+
- Scope drift history (how often did scope expand?)
|
|
39
|
+
- Story sizing accuracy (were estimates correct?)
|
|
40
|
+
|
|
41
|
+
Use these insights when recommending story order and estimating sprint capacity. If the memory file is empty or contains only placeholders, skip this step.
|
|
42
|
+
|
|
43
|
+
> **Team Mode**: In Team mode, agent memory is personal (`.harness/agent-memory/`). Each developer tracks their own velocity and scope drift patterns.
|
|
22
44
|
|
|
23
45
|
### Input
|
|
24
46
|
|
|
@@ -63,8 +85,10 @@ After every status check, recommend the next action based on current context:
|
|
|
63
85
|
**Request: "new story" / "next task"**
|
|
64
86
|
1. Find next `todo` Story in docs/project-state.md
|
|
65
87
|
2. Change its status to `in-progress`
|
|
66
|
-
3.
|
|
67
|
-
4.
|
|
88
|
+
3. Read `docs/dependency-map.md` to identify modules involved in this Story
|
|
89
|
+
4. Specify Story scope (related files/directories from dependency-map)
|
|
90
|
+
5. Alert relevant docs/failure-patterns.md items
|
|
91
|
+
6. Recommend relevant skill: "Consider running `planner` if this story needs detailed breakdown"
|
|
68
92
|
|
|
69
93
|
**Request: "new sprint"**
|
|
70
94
|
1. Check all Stories in current Sprint
|
|
@@ -108,3 +132,7 @@ STATUS: DONE
|
|
|
108
132
|
- Do not modify code directly — manage state only
|
|
109
133
|
- Only write to docs/project-state.md; read-only for all other files
|
|
110
134
|
- Always confirm with user before modifying scope boundaries
|
|
135
|
+
|
|
136
|
+
## Related Failure Patterns
|
|
137
|
+
|
|
138
|
+
- FP-003: Scope drift → Scope Check handler detects out-of-scope modifications and warns the user before proceeding
|
package/harness/core-rules.md
CHANGED
|
@@ -9,6 +9,8 @@ Read `docs/project-state.md` first. If all state files are empty, run `bootstrap
|
|
|
9
9
|
|
|
10
10
|
## Workflow
|
|
11
11
|
|
|
12
|
+
- First time / empty state → run `bootstrap`
|
|
13
|
+
- Session start → run `sprint-manager` to check status
|
|
12
14
|
- New feature → run `planner` before coding
|
|
13
15
|
- Before commit → run `reviewer`
|
|
14
16
|
- Bug or issue → run `investigate`
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
Decompose a feature into implementation tasks ordered by dependency.
|
|
6
6
|
Ensures bottom-up implementation: foundations first, then layers that depend on them.
|
|
7
7
|
|
|
8
|
+
## Invoked By
|
|
9
|
+
|
|
10
|
+
- **planner** agent — Step 8: Create ordered task list for new features
|
|
11
|
+
|
|
8
12
|
## When to Apply
|
|
9
13
|
|
|
10
14
|
- Starting a new feature or Story
|
|
@@ -15,24 +19,26 @@ Ensures bottom-up implementation: foundations first, then layers that depend on
|
|
|
15
19
|
## Procedure
|
|
16
20
|
|
|
17
21
|
1. **Describe the feature** in one sentence
|
|
18
|
-
2. **Read docs/
|
|
19
|
-
3. **
|
|
20
|
-
4. **
|
|
22
|
+
2. **Read docs/project-brief.md** — verify the feature aligns with Goals and does not violate Non-Goals. If it conflicts with Non-Goals, **stop and warn the user** before proceeding. (Direction Guard — prevents breakdown of out-of-scope features even when invoked directly without planner)
|
|
23
|
+
3. **Read docs/dependency-map.md** to understand current module relationships
|
|
24
|
+
4. **Identify affected modules**: List every module that needs changes
|
|
25
|
+
5. **Classify changes per module**:
|
|
21
26
|
- NEW_MODULE: Entirely new module to create
|
|
22
27
|
- INTERFACE_CHANGE: Existing module's public interface changes
|
|
23
28
|
- INTERNAL_CHANGE: Only internal implementation changes
|
|
24
29
|
- TEST_ONLY: Only test updates needed
|
|
25
|
-
|
|
30
|
+
6. **Build dependency order**:
|
|
26
31
|
- Draw a mini dependency graph for just the affected modules
|
|
27
32
|
- Sort topologically: modules with no dependencies come first
|
|
28
33
|
- Group into implementation waves (parallel-safe batches)
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
7. **Create task sequence**: Convert waves into numbered tasks
|
|
35
|
+
8. **Annotate each task** with:
|
|
31
36
|
- Module name
|
|
32
|
-
- Change type (from step
|
|
37
|
+
- Change type (from step 5)
|
|
33
38
|
- Files to create/modify
|
|
34
39
|
- Tests to write
|
|
35
40
|
- Dependency (which prior task must finish first)
|
|
41
|
+
- ⚠️ Relevant failure patterns (check docs/failure-patterns.md)
|
|
36
42
|
|
|
37
43
|
## Output Format
|
|
38
44
|
|
|
@@ -87,3 +93,9 @@ After completing the breakdown, update these files in the same session:
|
|
|
87
93
|
| Skip dependency-map registration | Register immediately when creating module |
|
|
88
94
|
| Tests "later" | Tests in the same task |
|
|
89
95
|
| Produce breakdown but skip state file updates | State file updates are part of the breakdown, not a separate step |
|
|
96
|
+
|
|
97
|
+
## Related Failure Patterns
|
|
98
|
+
|
|
99
|
+
- FP-001: Interface changed, mock not updated → When creating tasks that modify interfaces, include "Update mock" as an explicit sub-task
|
|
100
|
+
- FP-002: Type confusion → When annotating tasks, specify expected types for new interfaces
|
|
101
|
+
- FP-003: Scope drift → If the breakdown exceeds the current Story scope, stop and report
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
Before modifying any module, trace all affected modules to prevent cascade failures.
|
|
6
6
|
The most common cause of regressions in growing projects is changing one module without updating its dependents.
|
|
7
7
|
|
|
8
|
+
## Invoked By
|
|
9
|
+
|
|
10
|
+
- **planner** agent — Step 9: for each existing module being modified
|
|
11
|
+
- **reviewer** agent — Step 7: when interface changes affect 2+ dependent modules
|
|
12
|
+
|
|
8
13
|
## When to Apply
|
|
9
14
|
|
|
10
15
|
- Adding, removing, or changing a module's public interface
|
|
@@ -16,21 +21,25 @@ The most common cause of regressions in growing projects is changing one module
|
|
|
16
21
|
|
|
17
22
|
1. **Identify the target module**: Which module are you about to change?
|
|
18
23
|
2. **Read docs/dependency-map.md**: Find the target module's row
|
|
19
|
-
3. **
|
|
20
|
-
4. **
|
|
24
|
+
3. **Read docs/failure-patterns.md**: Check if any active patterns (FP-001, FP-002, etc.) apply to the target module or change type. If FP-001 frequency > 0, flag mock updates as mandatory in step 6.
|
|
25
|
+
4. **List dependents**: Read the "Depended By" column — these are the blast radius
|
|
26
|
+
5. **Read docs/features.md**: Identify which features include the target module in their Key Files column. These features may need status or Key Files updates.
|
|
27
|
+
6. **Check interface impact**: Does your change affect the module's public interface?
|
|
21
28
|
- If NO (internal-only change) → proceed, but still run dependent tests
|
|
22
|
-
- If YES → continue to step
|
|
23
|
-
|
|
29
|
+
- If YES → continue to step 7
|
|
30
|
+
7. **Trace each dependent**:
|
|
24
31
|
- List files in each dependent module that import from the target
|
|
25
32
|
- Identify which functions/types they use
|
|
26
33
|
- Determine if the interface change breaks them
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
8. **Plan updates**: Create a task list of all files that need modification
|
|
35
|
+
9. **Verify scope**: Confirm all files are within the current Story scope (docs/project-state.md)
|
|
29
36
|
|
|
30
37
|
## Checklist
|
|
31
38
|
|
|
32
39
|
- [ ] Target module identified in docs/dependency-map.md
|
|
40
|
+
- [ ] docs/failure-patterns.md checked for active patterns
|
|
33
41
|
- [ ] All dependent modules listed
|
|
42
|
+
- [ ] Affected features identified from docs/features.md
|
|
34
43
|
- [ ] Interface vs internal change classified
|
|
35
44
|
- [ ] Files importing from target module enumerated
|
|
36
45
|
- [ ] Mock/test updates planned for each dependent (FP-001)
|
|
@@ -62,9 +71,10 @@ Plan: 4 files to update, all within S3-2 scope
|
|
|
62
71
|
After completing the analysis, update these files:
|
|
63
72
|
|
|
64
73
|
- [ ] **docs/dependency-map.md**: Update the Interface Change Log table with: Date, Module, Change description, Affected Modules, Status. **This is mandatory for ALL interface changes** — do not skip even if the change seems minor.
|
|
74
|
+
- [ ] **docs/features.md**: If the interface change affects a feature's Key Files, update the Key Files column. If test files change, update the Test Files column.
|
|
65
75
|
- [ ] **docs/project-state.md**: If scope exceeds current Story, add a note to Recent Changes.
|
|
66
76
|
|
|
67
77
|
## Related Failure Patterns
|
|
68
78
|
|
|
69
|
-
- FP-001: Interface changed, mock not updated → Checklist item
|
|
70
|
-
- FP-002: Type confusion across modules → Step
|
|
79
|
+
- FP-001: Interface changed, mock not updated → Checklist item 7 (mock/test updates planned)
|
|
80
|
+
- FP-002: Type confusion across modules → Step 7 (trace each dependent, verify types)
|
|
@@ -26,8 +26,10 @@ Debug bugs systematically. Prevent "symptom patching" — fixing without underst
|
|
|
26
26
|
### Phase 2: Scope Lock
|
|
27
27
|
|
|
28
28
|
1. Identify the module/directory containing the root cause
|
|
29
|
-
2.
|
|
30
|
-
3.
|
|
29
|
+
2. **Read docs/dependency-map.md**: Find the target module's row. Check "Depended By" column to understand which other modules might be affected by the same root cause or by your fix.
|
|
30
|
+
3. **Read docs/project-state.md**: Verify the fix scope is within the current Story scope. If the root cause is in a module outside the current Story, **warn the user** before proceeding (Iron Law #3: Scope Compliance).
|
|
31
|
+
4. Exclude files outside that scope from modification
|
|
32
|
+
5. Check docs/failure-patterns.md for matching patterns
|
|
31
33
|
|
|
32
34
|
### Phase 3: Hypothesis + Fix
|
|
33
35
|
|
|
@@ -45,6 +47,8 @@ Debug bugs systematically. Prevent "symptom patching" — fixing without underst
|
|
|
45
47
|
|
|
46
48
|
- [ ] Root cause hypothesis is stated explicitly
|
|
47
49
|
- [ ] Did NOT skip Phase 1 (evidence collection) and jump straight to fixing
|
|
50
|
+
- [ ] docs/dependency-map.md consulted for blast radius understanding
|
|
51
|
+
- [ ] Fix scope verified against current Story in docs/project-state.md
|
|
48
52
|
- [ ] Fix scope is limited to the problem's scope
|
|
49
53
|
- [ ] All related tests pass after the fix
|
|
50
54
|
- [ ] Regression test is added
|
|
@@ -82,5 +86,6 @@ After the fix is verified (Phase 4):
|
|
|
82
86
|
|
|
83
87
|
## Related Failure Patterns
|
|
84
88
|
|
|
85
|
-
- FP-002: Type confusion → Phase 1 requires verifying actual types
|
|
86
89
|
- FP-001: Mock not updated → Phase 4 requires checking mock sync
|
|
90
|
+
- FP-002: Type confusion → Phase 1 requires verifying actual types
|
|
91
|
+
- FP-003: Scope drift → Phase 2 Scope Lock must verify fix is within current Story scope
|
package/harness/skills/learn.md
CHANGED
|
@@ -60,6 +60,22 @@ For each issue/error that occurred in this session:
|
|
|
60
60
|
2. If existing features were modified → update Key Files and Test Files columns
|
|
61
61
|
3. If features were completed → update Status to `✅ done`
|
|
62
62
|
|
|
63
|
+
### Step 4.5: Verify docs/dependency-map.md (mandatory)
|
|
64
|
+
|
|
65
|
+
1. Check if any new modules were created in this session (scan `git diff --stat` for new directories)
|
|
66
|
+
2. Check if any module interfaces changed
|
|
67
|
+
3. For each finding:
|
|
68
|
+
- New module without dependency-map entry → **add it now**
|
|
69
|
+
- Interface change without Interface Change Log entry → **add it now**
|
|
70
|
+
4. Cross-reference `docs/features.md` Key Files against `docs/dependency-map.md` modules — flag orphaned modules
|
|
71
|
+
|
|
72
|
+
### Step 4.6: Resolve STATE-AUDIT Flags (if applicable)
|
|
73
|
+
|
|
74
|
+
If the `reviewer` agent was run in this session and produced `[STATE-AUDIT]` flags:
|
|
75
|
+
1. Review each flagged item
|
|
76
|
+
2. Apply the recommended state file update
|
|
77
|
+
3. If the flag was already resolved during the session, skip it
|
|
78
|
+
|
|
63
79
|
### Step 5: Update Agent Memory (if applicable)
|
|
64
80
|
|
|
65
81
|
If an agent (reviewer, planner, sprint-manager) was used in this session, update its memory file in `docs/agent-memory/`:
|
|
@@ -88,9 +104,10 @@ Present a summary of all updates made.
|
|
|
88
104
|
- [FP-NNN] (new/updated): [description]
|
|
89
105
|
|
|
90
106
|
### State Files Updated:
|
|
91
|
-
- [x]docs/project-state.md — Quick Summary refreshed
|
|
92
|
-
- [x]docs/failure-patterns.md — [N] patterns added/updated
|
|
93
|
-
- [x]docs/features.md — [N] features updated (if applicable)
|
|
107
|
+
- [x] docs/project-state.md — Quick Summary refreshed
|
|
108
|
+
- [x] docs/failure-patterns.md — [N] patterns added/updated
|
|
109
|
+
- [x] docs/features.md — [N] features updated (if applicable)
|
|
110
|
+
- [x] docs/dependency-map.md — [N] modules verified/added (if applicable)
|
|
94
111
|
- [x] docs/agent-memory/{name}.md — [N] agents updated (if applicable)
|
|
95
112
|
|
|
96
113
|
### Next Session Should:
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
Inspect for security risks before committing code.
|
|
6
6
|
Prevents credential leaks and accidental commits of sensitive files. (FP-004)
|
|
7
7
|
|
|
8
|
+
## Invoked By
|
|
9
|
+
|
|
10
|
+
- **reviewer** agent — Step 4: Security risk inspection
|
|
11
|
+
|
|
8
12
|
## When to Apply
|
|
9
13
|
|
|
10
14
|
- Before running `git add` or committing
|
|
@@ -15,13 +19,15 @@ Prevents credential leaks and accidental commits of sensitive files. (FP-004)
|
|
|
15
19
|
## Procedure
|
|
16
20
|
|
|
17
21
|
1. **Check staging area**: Run `git diff --cached --name-only` to list files staged for commit
|
|
18
|
-
2. **
|
|
19
|
-
3. **Scan for
|
|
20
|
-
4. **
|
|
21
|
-
5. **
|
|
22
|
+
2. **Read docs/failure-patterns.md**: Check FP-004 status. If frequency > 0, apply extra scrutiny to all staged files and verify .gitignore coverage is comprehensive.
|
|
23
|
+
3. **Scan for forbidden files**: Check if .env, credentials, *.pem, *.key files are staged
|
|
24
|
+
4. **Scan for hardcoded secrets**: Search staged files for passwords, API keys, tokens
|
|
25
|
+
5. **Verify .gitignore**: Ensure new environment files are covered by .gitignore
|
|
26
|
+
6. **Check for temp files**: Verify tmp_*, debug_*, coverage_* files are not staged
|
|
22
27
|
|
|
23
28
|
## Checklist
|
|
24
29
|
|
|
30
|
+
- [ ] docs/failure-patterns.md reviewed for FP-004 history
|
|
25
31
|
- [ ] (FP-004) No .env, credentials, *.key files in staging area
|
|
26
32
|
- [ ] (FP-004) No hardcoded passwords, API keys, or tokens in code
|
|
27
33
|
- [ ] Sensitive file patterns are registered in .gitignore
|
|
@@ -49,7 +55,8 @@ const dbPassword = "super_secret_123";
|
|
|
49
55
|
After completing the security check:
|
|
50
56
|
|
|
51
57
|
- [ ] **docs/failure-patterns.md**: If a security issue was found (credentials staged, hardcoded secret), add a new FP-NNN entry or increment FP-004 Frequency.
|
|
58
|
+
- [ ] **docs/project-state.md**: If a security issue was found, add to Recent Changes: "⚠️ Security: [description of issue found/fixed]". This ensures the next session's Quick Summary includes the security context.
|
|
52
59
|
|
|
53
60
|
## Related Failure Patterns
|
|
54
61
|
|
|
55
|
-
- FP-004: Dangerous file committed → Checklist items
|
|
62
|
+
- FP-004: Dangerous file committed → Checklist items 2, 5 (no forbidden files, no temp files)
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
Ensure test mocks stay synchronized when repository/service interfaces change.
|
|
6
6
|
Prevents the most common LLM coding failure: updating an interface but forgetting to update corresponding mocks. (FP-001)
|
|
7
7
|
|
|
8
|
+
## Invoked By
|
|
9
|
+
|
|
10
|
+
- **reviewer** agent — Step 3: Mock synchronization verification
|
|
11
|
+
|
|
8
12
|
## When to Apply
|
|
9
13
|
|
|
10
14
|
- Adding, removing, or modifying methods on a repository/service interface
|
|
@@ -13,16 +17,18 @@ Prevents the most common LLM coding failure: updating an interface but forgettin
|
|
|
13
17
|
|
|
14
18
|
## Procedure
|
|
15
19
|
|
|
16
|
-
1. **
|
|
17
|
-
2. **
|
|
18
|
-
3. **
|
|
19
|
-
4. **
|
|
20
|
-
5. **
|
|
20
|
+
1. **Read docs/failure-patterns.md**: Check FP-001 status. If frequency > 0, this project has a history of mock sync failures — apply extra scrutiny to every interface change.
|
|
21
|
+
2. **Identify changed interfaces**: Find modified files in your interface directory
|
|
22
|
+
3. **Map to mock files**: Locate the corresponding mock file for each changed interface
|
|
23
|
+
4. **Sync methods**: Verify every interface method exists in the mock
|
|
24
|
+
5. **Verify return types**: Confirm mock return values match the interface return types (FP-002: watch for type confusion)
|
|
25
|
+
6. **Check consumers**: Verify use case tests configure the mock correctly for new methods
|
|
21
26
|
|
|
22
27
|
## Checklist
|
|
23
28
|
|
|
29
|
+
- [ ] docs/failure-patterns.md reviewed for FP-001 history
|
|
24
30
|
- [ ] (FP-001) Every changed interface method is reflected in its mock
|
|
25
|
-
- [ ] Mock return types match interface signatures
|
|
31
|
+
- [ ] (FP-002) Mock return types match interface signatures (no type confusion)
|
|
26
32
|
- [ ] New methods have default mock return values set
|
|
27
33
|
- [ ] Use case tests correctly use the new mock methods
|
|
28
34
|
- [ ] Existing tests still pass
|
|
@@ -47,6 +53,7 @@ After synchronizing mocks:
|
|
|
47
53
|
|
|
48
54
|
- [ ] **docs/failure-patterns.md**: If mock sync was missed and caused a test failure, increment FP-001 Frequency.
|
|
49
55
|
- [ ] **docs/dependency-map.md**: If the interface change altered module relationships, update the relevant row.
|
|
56
|
+
- [ ] **docs/project-state.md**: If mock sync issues were found and fixed, add to Recent Changes: "🔧 Test: [interface] mock synchronized". This ensures the next session is aware of the fix.
|
|
50
57
|
|
|
51
58
|
## Testing Rules (enforced during this skill)
|
|
52
59
|
|
|
@@ -59,4 +66,5 @@ After synchronizing mocks:
|
|
|
59
66
|
|
|
60
67
|
## Related Failure Patterns
|
|
61
68
|
|
|
62
|
-
- FP-001: Interface changed, mock not updated → Checklist item
|
|
69
|
+
- FP-001: Interface changed, mock not updated → Checklist item 2
|
|
70
|
+
- FP-002: Type confusion → Step 5 return type verification
|