@juicesharp/rpiv-pi 0.4.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/LICENSE +21 -0
- package/README.md +178 -0
- package/agents/codebase-analyzer.md +121 -0
- package/agents/codebase-locator.md +107 -0
- package/agents/codebase-pattern-finder.md +207 -0
- package/agents/integration-scanner.md +97 -0
- package/agents/precedent-locator.md +130 -0
- package/agents/test-case-locator.md +121 -0
- package/agents/thoughts-analyzer.md +147 -0
- package/agents/thoughts-locator.md +138 -0
- package/agents/web-search-researcher.md +107 -0
- package/extensions/rpiv-core/agents.ts +312 -0
- package/extensions/rpiv-core/git-context.ts +81 -0
- package/extensions/rpiv-core/guidance.ts +213 -0
- package/extensions/rpiv-core/index.ts +275 -0
- package/extensions/rpiv-core/package-checks.ts +51 -0
- package/package.json +36 -0
- package/scripts/migrate.js +242 -0
- package/scripts/types.js +1 -0
- package/skills/annotate-guidance/SKILL.md +303 -0
- package/skills/annotate-guidance/examples/root-dotnet-clean-arch.md +38 -0
- package/skills/annotate-guidance/examples/root-nodejs-monorepo.md +42 -0
- package/skills/annotate-guidance/examples/subfolder-database-layer.md +81 -0
- package/skills/annotate-guidance/examples/subfolder-dotnet-application.md +64 -0
- package/skills/annotate-guidance/examples/subfolder-schemas-layer.md +50 -0
- package/skills/annotate-guidance/templates/root-architecture.md +46 -0
- package/skills/annotate-guidance/templates/subfolder-architecture.md +57 -0
- package/skills/annotate-inline/SKILL.md +299 -0
- package/skills/annotate-inline/examples/root-dotnet-clean-arch.md +38 -0
- package/skills/annotate-inline/examples/root-nodejs-monorepo.md +42 -0
- package/skills/annotate-inline/examples/subfolder-database-layer.md +81 -0
- package/skills/annotate-inline/examples/subfolder-dotnet-application.md +64 -0
- package/skills/annotate-inline/examples/subfolder-schemas-layer.md +50 -0
- package/skills/annotate-inline/templates/root-claude-md.md +46 -0
- package/skills/annotate-inline/templates/subfolder-claude-md.md +57 -0
- package/skills/code-review/SKILL.md +184 -0
- package/skills/commit/SKILL.md +65 -0
- package/skills/create-handoff/SKILL.md +91 -0
- package/skills/design/SKILL.md +416 -0
- package/skills/discover/SKILL.md +242 -0
- package/skills/explore/SKILL.md +261 -0
- package/skills/implement/SKILL.md +74 -0
- package/skills/migrate-to-guidance/SKILL.md +88 -0
- package/skills/outline-test-cases/SKILL.md +348 -0
- package/skills/outline-test-cases/templates/feature-meta.md +43 -0
- package/skills/outline-test-cases/templates/outline-readme.md +36 -0
- package/skills/plan/SKILL.md +281 -0
- package/skills/research/SKILL.md +304 -0
- package/skills/resume-handoff/SKILL.md +207 -0
- package/skills/revise/SKILL.md +242 -0
- package/skills/validate/SKILL.md +175 -0
- package/skills/write-test-cases/SKILL.md +322 -0
- package/skills/write-test-cases/examples/customer-auth-flow.md +50 -0
- package/skills/write-test-cases/examples/order-management-suite.md +57 -0
- package/skills/write-test-cases/examples/order-placement-flow.md +54 -0
- package/skills/write-test-cases/examples/team-management-flow.md +56 -0
- package/skills/write-test-cases/examples/team-management-suite.md +54 -0
- package/skills/write-test-cases/templates/coverage-map.md +64 -0
- package/skills/write-test-cases/templates/regression-suite.md +63 -0
- package/skills/write-test-cases/templates/test-case.md +65 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan
|
|
3
|
+
description: Create phased implementation plans from design artifacts. Decomposes designs into parallelized atomic phases with success criteria in thoughts/shared/plans/. Use after design.
|
|
4
|
+
argument-hint: [design artifact path]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Write Plan
|
|
8
|
+
|
|
9
|
+
You are tasked with creating phased implementation plans from design artifacts. The design artifact contains all architectural decisions, full implementation code, and ordering constraints. Your job is to decompose that design into parallelized atomic phases with success criteria that implement can execute.
|
|
10
|
+
|
|
11
|
+
## Step 1: Read Design Artifact
|
|
12
|
+
|
|
13
|
+
When this command is invoked:
|
|
14
|
+
|
|
15
|
+
1. **Determine input mode**:
|
|
16
|
+
|
|
17
|
+
**Design artifact provided** (path to a `.md` file in `thoughts/shared/designs/`):
|
|
18
|
+
- Read the design artifact FULLY using the Read tool WITHOUT limit/offset
|
|
19
|
+
- Extract: Architecture (the code changes), File Map, Ordering Constraints, Verification Notes, Performance Considerations, Scope
|
|
20
|
+
- These are the inputs for phasing
|
|
21
|
+
- Design decisions are settled — do not re-evaluate them
|
|
22
|
+
- If the design has unresolved questions, STOP — tell the developer to return to design
|
|
23
|
+
|
|
24
|
+
**No arguments provided**:
|
|
25
|
+
```
|
|
26
|
+
I'll create an implementation plan from a design artifact. Please provide the path:
|
|
27
|
+
|
|
28
|
+
`/skill:plan thoughts/shared/designs/2025-01-20_09-30-00_feature.md`
|
|
29
|
+
|
|
30
|
+
Run `/skill:design` first to produce the design artifact. There is no standalone path.
|
|
31
|
+
```
|
|
32
|
+
Then wait for input.
|
|
33
|
+
|
|
34
|
+
2. **Read any additional files mentioned** in the design's References — research documents, tickets. Read them FULLY for context.
|
|
35
|
+
|
|
36
|
+
## Step 2: Decompose into Phases
|
|
37
|
+
|
|
38
|
+
Read the Ordering Constraints and File Map from the design artifact. Apply phasing rules:
|
|
39
|
+
|
|
40
|
+
1. **Independently implementable**: Each phase must compile and pass tests on its own — no cross-phase runtime state
|
|
41
|
+
2. **Parallelizable**: Phases that don't depend on each other are explicitly marked (e.g., "Phases 2 and 3 can run in parallel")
|
|
42
|
+
3. **Worktree-sized**: Each phase should be appropriate for a single implement session in a worktree (~3-8 files changed, 1-3 components touched)
|
|
43
|
+
4. **Dependency-ordered**: Phase ordering follows the design artifact's Ordering Constraints
|
|
44
|
+
5. **Grouped coherently**: Related file changes go in the same phase (e.g., import change + hook setup + JSX modification for one component)
|
|
45
|
+
|
|
46
|
+
**If the design's Ordering Constraints say "all files independent"**, consider whether a single phase is appropriate. Don't split into phases just for the sake of it — if all changes can be done in one worktree session, one phase is correct.
|
|
47
|
+
|
|
48
|
+
Present phase outline and get developer feedback BEFORE writing details:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Here's my proposed plan structure based on the design at [path]:
|
|
52
|
+
|
|
53
|
+
## Implementation Phases:
|
|
54
|
+
1. [Phase name] - [what it accomplishes] ([N] files)
|
|
55
|
+
2. [Phase name] - [what it accomplishes] ([N] files)
|
|
56
|
+
3. [Phase name] - [what it accomplishes] ([N] files)
|
|
57
|
+
|
|
58
|
+
Phases [2] and [3] can run in parallel after Phase 1.
|
|
59
|
+
Total: [N] files across [M] phases.
|
|
60
|
+
|
|
61
|
+
Does this phasing make sense? Should I adjust the order or granularity?
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Use the `ask_user_question` tool to confirm the phase structure. Question: "[N] phases, [M] total files. Does this structure work?". Header: "Phases". Options: "Proceed (Recommended)" (Write the detailed plan with code blocks and success criteria); "Adjust phases" (Split, merge, or reorder phases before writing); "Change scope" (Add or remove files from the plan).
|
|
65
|
+
|
|
66
|
+
Get feedback on structure before writing details.
|
|
67
|
+
|
|
68
|
+
## Step 3: Write Plan
|
|
69
|
+
|
|
70
|
+
After structure approval, write the plan **incrementally** — skeleton first, then fill each phase:
|
|
71
|
+
|
|
72
|
+
1. **Write the plan skeleton** to `thoughts/shared/plans/YYYY-MM-DD_HH-MM-SS_description.md`
|
|
73
|
+
- Format: `YYYY-MM-DD_HH-MM-SS_description.md` where:
|
|
74
|
+
- YYYY-MM-DD is today's date
|
|
75
|
+
- HH-MM-SS is the current time in 24-hour format
|
|
76
|
+
- description is a brief kebab-case description (may include ticket number)
|
|
77
|
+
- Examples:
|
|
78
|
+
- With ticket: `2025-01-08_14-30-00_ENG-1478-parent-child-tracking.md`
|
|
79
|
+
- Without ticket: `2025-01-08_14-30-00_improve-error-handling.md`
|
|
80
|
+
- The skeleton includes everything EXCEPT large code blocks: frontmatter, Overview, Desired End State, What We're NOT Doing, full phase structure (Overview, Changes Required with file paths and change summaries, Success Criteria, parallelism annotations), Testing Strategy, Performance Considerations, References. All phasing and structural decisions happen in this pass.
|
|
81
|
+
|
|
82
|
+
2. **Fill code blocks using Edit** — one phase at a time:
|
|
83
|
+
- For each phase, Edit to insert the before/after code blocks from the design's Architecture section into the Changes Required subsections
|
|
84
|
+
|
|
85
|
+
3. **Use this template structure**:
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
---
|
|
89
|
+
date: [Current date and time with timezone in ISO format]
|
|
90
|
+
planner: [User from injected git context]
|
|
91
|
+
git_commit: [Current commit hash]
|
|
92
|
+
branch: [Current branch name]
|
|
93
|
+
repository: [Repository name]
|
|
94
|
+
topic: "[Feature/Task Name]"
|
|
95
|
+
tags: [plan, relevant-component-names]
|
|
96
|
+
status: ready
|
|
97
|
+
design_source: "[path to design artifact]"
|
|
98
|
+
last_updated: [Current date in YYYY-MM-DD format]
|
|
99
|
+
last_updated_by: [User from injected git context]
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
# [Feature/Task Name] Implementation Plan
|
|
103
|
+
|
|
104
|
+
## Overview
|
|
105
|
+
|
|
106
|
+
[Brief description of what we're implementing and why. Reference design artifact.]
|
|
107
|
+
|
|
108
|
+
## Desired End State
|
|
109
|
+
|
|
110
|
+
[From design artifact's Desired End State / Summary — what "done" looks like and how to verify it]
|
|
111
|
+
|
|
112
|
+
## What We're NOT Doing
|
|
113
|
+
|
|
114
|
+
[From design artifact's Scope → Not Building]
|
|
115
|
+
|
|
116
|
+
## Phase 1: [Descriptive Name]
|
|
117
|
+
|
|
118
|
+
### Overview
|
|
119
|
+
[What this phase accomplishes]
|
|
120
|
+
|
|
121
|
+
### Changes Required:
|
|
122
|
+
|
|
123
|
+
#### 1. [Component/File Group]
|
|
124
|
+
**File**: `path/to/file.ext`
|
|
125
|
+
**Changes**: [Summary of changes]
|
|
126
|
+
|
|
127
|
+
```[language]
|
|
128
|
+
// Code from design artifact's Architecture section
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Success Criteria:
|
|
132
|
+
|
|
133
|
+
#### Automated Verification:
|
|
134
|
+
- [ ] Type checking passes: `pnpm typecheck`
|
|
135
|
+
- [ ] Linting passes: `pnpm lint`
|
|
136
|
+
- [ ] Tests pass: `pnpm test`
|
|
137
|
+
|
|
138
|
+
#### Manual Verification:
|
|
139
|
+
- [ ] [From design's Verification Notes — specific visual/behavioral check]
|
|
140
|
+
- [ ] [Component-specific verification]
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Phase 2: [Descriptive Name]
|
|
145
|
+
|
|
146
|
+
[Similar structure with both automated and manual success criteria...]
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Testing Strategy
|
|
151
|
+
|
|
152
|
+
### Automated:
|
|
153
|
+
- [Standard project checks from success criteria]
|
|
154
|
+
|
|
155
|
+
### Manual Testing Steps:
|
|
156
|
+
1. [From design's Verification Notes — converted to step-by-step]
|
|
157
|
+
2. [Another verification step]
|
|
158
|
+
|
|
159
|
+
## Performance Considerations
|
|
160
|
+
|
|
161
|
+
[From design artifact — copied directly]
|
|
162
|
+
|
|
163
|
+
## Migration Notes
|
|
164
|
+
|
|
165
|
+
[From design artifact — copied directly. If applicable: schema changes, data migration, rollback strategy, backwards compatibility. Empty if not applicable.]
|
|
166
|
+
|
|
167
|
+
## References
|
|
168
|
+
|
|
169
|
+
- Design: `thoughts/shared/designs/[file].md`
|
|
170
|
+
- Research: `thoughts/shared/research/[file].md`
|
|
171
|
+
- Original ticket: `thoughts/me/tickets/[file].md`
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Step 4: Review
|
|
175
|
+
|
|
176
|
+
1. **Present the plan location**:
|
|
177
|
+
```
|
|
178
|
+
Implementation plan written to:
|
|
179
|
+
`thoughts/shared/plans/[filename].md`
|
|
180
|
+
|
|
181
|
+
[N] phases, [M] total file changes.
|
|
182
|
+
|
|
183
|
+
Please review:
|
|
184
|
+
- Are the phases properly scoped for worktree execution?
|
|
185
|
+
- Are the success criteria specific enough?
|
|
186
|
+
- Any phase that should be split or merged?
|
|
187
|
+
|
|
188
|
+
When ready, run `/skill:implement thoughts/shared/plans/[filename].md Phase 1`
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
2. **Iterate based on feedback** — be ready to:
|
|
192
|
+
- Split large phases
|
|
193
|
+
- Merge small phases
|
|
194
|
+
- Adjust success criteria
|
|
195
|
+
- Reorder phases
|
|
196
|
+
|
|
197
|
+
3. **Continue refining** until the developer is satisfied
|
|
198
|
+
|
|
199
|
+
## Guidelines
|
|
200
|
+
|
|
201
|
+
1. **Trust the Design**:
|
|
202
|
+
- Design decisions are fixed — do not re-evaluate architectural choices
|
|
203
|
+
- If something in the design seems wrong, flag it to the developer
|
|
204
|
+
- Don't silently change the approach or add scope
|
|
205
|
+
- The design is the source of truth for what to build
|
|
206
|
+
|
|
207
|
+
2. **Be Interactive**:
|
|
208
|
+
- Don't write the full plan in one shot
|
|
209
|
+
- Get buy-in on phase structure first
|
|
210
|
+
- Allow course corrections on granularity
|
|
211
|
+
- Work collaboratively
|
|
212
|
+
|
|
213
|
+
3. **Be Practical**:
|
|
214
|
+
- Focus on incremental, testable changes
|
|
215
|
+
- Each phase should leave the codebase in a working state
|
|
216
|
+
- Think about what can be verified independently
|
|
217
|
+
- Include "what we're NOT doing" from the design's scope
|
|
218
|
+
|
|
219
|
+
4. **Phase for Worktrees**:
|
|
220
|
+
- Each phase should be implementable in an isolated worktree
|
|
221
|
+
- No phase should depend on another phase's uncommitted changes
|
|
222
|
+
- If the design says "all independent," one phase may be correct
|
|
223
|
+
- Don't split for the sake of splitting
|
|
224
|
+
|
|
225
|
+
5. **Track Progress**:
|
|
226
|
+
- Use a todo list to track planning tasks
|
|
227
|
+
- Mark planning tasks complete when done
|
|
228
|
+
|
|
229
|
+
6. **No Open Questions in Final Plan**:
|
|
230
|
+
- If you encounter open questions during planning, STOP
|
|
231
|
+
- If the design artifact has unresolved questions, send the developer back to design
|
|
232
|
+
- Do NOT write the plan with unresolved questions
|
|
233
|
+
- The implementation plan must be complete and actionable
|
|
234
|
+
|
|
235
|
+
## Success Criteria Guidelines
|
|
236
|
+
|
|
237
|
+
**Always separate success criteria into two categories:**
|
|
238
|
+
|
|
239
|
+
1. **Automated Verification** (can be run by execution agents):
|
|
240
|
+
- Commands that can be run: `make test`, `npm run lint`, etc.
|
|
241
|
+
- Specific files that should exist
|
|
242
|
+
- Code compilation/type checking
|
|
243
|
+
- Automated test suites
|
|
244
|
+
|
|
245
|
+
2. **Manual Verification** (requires human testing):
|
|
246
|
+
- UI/UX functionality
|
|
247
|
+
- Performance under real conditions
|
|
248
|
+
- Edge cases that are hard to automate
|
|
249
|
+
- User acceptance criteria
|
|
250
|
+
|
|
251
|
+
**Format example:**
|
|
252
|
+
```markdown
|
|
253
|
+
### Success Criteria:
|
|
254
|
+
|
|
255
|
+
#### Automated Verification:
|
|
256
|
+
- [ ] Database migration runs successfully: `make migrate`
|
|
257
|
+
- [ ] All unit tests pass: `go test ./...`
|
|
258
|
+
- [ ] No linting errors: `golangci-lint run`
|
|
259
|
+
- [ ] API endpoint returns 200: `curl localhost:8080/api/new-endpoint`
|
|
260
|
+
|
|
261
|
+
#### Manual Verification:
|
|
262
|
+
- [ ] New feature appears correctly in the UI
|
|
263
|
+
- [ ] Performance is acceptable with 1000+ items
|
|
264
|
+
- [ ] Error messages are user-friendly
|
|
265
|
+
- [ ] Feature works correctly on mobile devices
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Convert design's Verification Notes to success criteria:**
|
|
269
|
+
- Prose warnings → specific automated commands or manual steps
|
|
270
|
+
- "Test production builds" → `pnpm build && verify in built app`
|
|
271
|
+
- "Verify scrollbar appearance" → `[ ] Open [component], scroll, observe slim scrollbar`
|
|
272
|
+
- "Do NOT use X" → `grep -r "X" src/ should return 0 matches`
|
|
273
|
+
|
|
274
|
+
## Important Notes
|
|
275
|
+
|
|
276
|
+
- NEVER edit source files — this skill produces a plan document, not implementation
|
|
277
|
+
- Always read the design artifact FULLY before decomposing into phases
|
|
278
|
+
- The plan template must be compatible with implement — preserve the phase/success criteria structure
|
|
279
|
+
- If the design artifact has unresolved questions, STOP — send the developer back to design
|
|
280
|
+
- Code in the plan comes from the design artifact's Architecture section — do not invent new code
|
|
281
|
+
- **Frontmatter consistency**: Use snake_case for multi-word field names in plan frontmatter
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research
|
|
3
|
+
description: Answer structured research questions via targeted parallel analysis agents. Consumes question artifacts from discover. Produces research documents in thoughts/shared/research/. Second stage of the research pipeline — always requires a questions artifact.
|
|
4
|
+
argument-hint: [path to discover artifact]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Questions Source
|
|
8
|
+
|
|
9
|
+
If the user has not already provided a specific discover artifact path, ask them for it before proceeding. Their input will appear as a follow-up paragraph after this skill body.
|
|
10
|
+
|
|
11
|
+
# Research
|
|
12
|
+
|
|
13
|
+
You are tasked with answering structured research questions by spawning targeted analysis agents and synthesizing their findings into a comprehensive research document. This skill consumes questions artifacts produced by the `discover` skill.
|
|
14
|
+
|
|
15
|
+
## Step 1: Read Questions Artifact
|
|
16
|
+
|
|
17
|
+
1. **Determine input:**
|
|
18
|
+
|
|
19
|
+
**Questions artifact provided** (path to a `.md` file in `thoughts/`):
|
|
20
|
+
- Read the questions artifact FULLY using the Read tool WITHOUT limit/offset
|
|
21
|
+
- Extract: Discovery Summary, Questions (dense paragraphs), frontmatter metadata (topic, tags)
|
|
22
|
+
- The Discovery Summary provides the file landscape overview — no need to re-discover
|
|
23
|
+
|
|
24
|
+
**No arguments provided:**
|
|
25
|
+
```
|
|
26
|
+
I'll answer research questions from a questions artifact. Please provide the path:
|
|
27
|
+
`/skill:research thoughts/shared/questions/YYYY-MM-DD_HH-MM-SS_topic.md`
|
|
28
|
+
|
|
29
|
+
This skill requires a questions artifact from discover.
|
|
30
|
+
There is no standalone path — run /skill:discover first to produce a questions artifact.
|
|
31
|
+
```
|
|
32
|
+
Then wait for input.
|
|
33
|
+
|
|
34
|
+
2. **Read key shared files** referenced across multiple questions into main context — especially shared utilities, type definitions, and integration points that multiple questions mention.
|
|
35
|
+
|
|
36
|
+
3. **Analyze question overlap for grouping:**
|
|
37
|
+
- Parse all question paragraphs and extract file references from each
|
|
38
|
+
- Identify questions that share 2+ file references — these are candidates for grouping
|
|
39
|
+
- Group related questions together (2-3 questions per group max)
|
|
40
|
+
- Questions with no significant file overlap remain standalone
|
|
41
|
+
- Target: 3-6 agent dispatches total (grouped + standalone)
|
|
42
|
+
|
|
43
|
+
4. **Report chained status:**
|
|
44
|
+
```
|
|
45
|
+
[Chained]: Found research questions for "[topic]". [N] questions in [G] groups, [M] shared files.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Step 2: Dispatch Analysis Agents
|
|
49
|
+
|
|
50
|
+
Spawn analysis agents using the Agent tool. All agents run in parallel.
|
|
51
|
+
|
|
52
|
+
**Default agent**: `codebase-analyzer` for all codebase questions. This agent has Read, Grep, Glob, LS — it can trace code paths, find patterns, and analyze integration points.
|
|
53
|
+
|
|
54
|
+
**Exception**: Questions that explicitly reference external documentation, web APIs, or third-party libraries → `web-search-researcher`.
|
|
55
|
+
|
|
56
|
+
**Agent prompt — question-as-prompt:**
|
|
57
|
+
|
|
58
|
+
Each agent receives the dense question paragraph(s) directly as its prompt. The question IS the instruction.
|
|
59
|
+
|
|
60
|
+
For standalone questions (no grouping):
|
|
61
|
+
```
|
|
62
|
+
Research topic: [topic from frontmatter]
|
|
63
|
+
|
|
64
|
+
Answer the following research question thoroughly with file:line references. Read the files mentioned, trace the code paths described, and provide a complete analysis.
|
|
65
|
+
|
|
66
|
+
[Full dense question paragraph]
|
|
67
|
+
|
|
68
|
+
Provide your analysis with exact file:line references. Focus on DEPTH — trace the actual code, don't just locate it.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For grouped questions:
|
|
72
|
+
```
|
|
73
|
+
Research topic: [topic from frontmatter]
|
|
74
|
+
|
|
75
|
+
Answer the following related research questions thoroughly with file:line references. These questions share overlapping code paths — use your cross-question context to provide deeper, more connected analysis.
|
|
76
|
+
|
|
77
|
+
Question 1: [Full dense question paragraph]
|
|
78
|
+
|
|
79
|
+
Question 2: [Full dense question paragraph]
|
|
80
|
+
|
|
81
|
+
For each question, provide your analysis with exact file:line references. Note connections between the questions where the same code serves multiple roles. Focus on DEPTH — trace the actual code, don't just locate it.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Precedent sweep (always spawn):**
|
|
85
|
+
Spawn one `precedent-locator` agent alongside the question agents:
|
|
86
|
+
"Find similar past changes involving [list key files from Discovery Summary]. Search git log for commits that touched these files, similar commit messages, and follow-up fixes. Research topic: [original query]."
|
|
87
|
+
|
|
88
|
+
This agent runs with full knowledge of discovered files — its findings go into Precedents & Lessons, not tied to a specific question.
|
|
89
|
+
|
|
90
|
+
**Wait for ALL agents to complete** before proceeding.
|
|
91
|
+
|
|
92
|
+
## Step 3: Synthesize and Checkpoint
|
|
93
|
+
|
|
94
|
+
1. **Compile findings:**
|
|
95
|
+
- Match each agent's response to the question(s) it answered
|
|
96
|
+
- Cross-reference findings across questions — look for patterns, conflicts, and connections
|
|
97
|
+
- Prioritize live codebase findings as primary source of truth
|
|
98
|
+
- Use thoughts/ findings as supplementary historical context
|
|
99
|
+
- Include specific file paths and line numbers
|
|
100
|
+
- Build Code References as jump-table entries for the planner, not narrative (file:startLine-endLine format)
|
|
101
|
+
- No multi-line code blocks (>3 lines) — use file:line refs + prose. No implementation recipes — facts only.
|
|
102
|
+
- No artifact summaries — link plans/designs in Historical Context, don't summarize their contents. Research describes current codebase state.
|
|
103
|
+
|
|
104
|
+
2. **Developer checkpoint — grounded questions one at a time:**
|
|
105
|
+
|
|
106
|
+
Start with grounded questions referencing real findings with file:line evidence. Ask ONE question at a time, waiting for the answer before the next. Use a **❓ Question:** prefix. Each question must pull NEW information from the developer — not confirm what you already found:
|
|
107
|
+
|
|
108
|
+
Every question MUST embed at least one `file:line` reference in the question text — not just in surrounding context. Examples:
|
|
109
|
+
|
|
110
|
+
- "❓ Question: `src/events/orders.ts:45-67` has 3 event hooks but no error recovery path. Is there a retry mechanism elsewhere I'm not seeing?"
|
|
111
|
+
- "❓ Question: Pattern-finder found manual mapping at `src/services/OrderService.ts:45` (8 uses) vs AutoMapper at `src/services/UserService.ts:12` (2 uses). Which should new code follow?"
|
|
112
|
+
- "❓ Question: Precedent commit `abc123` required a follow-up fix at `src/handlers/key.ts:158` for connection leak. Should we account for that pattern in this design?"
|
|
113
|
+
|
|
114
|
+
Anti-patterns — NEVER ask these:
|
|
115
|
+
- "Is this research to understand X or prepare for Y?" — confirmatory, pulls zero new information
|
|
116
|
+
- "Does this look correct?" / "Should I continue?" — asks developer to validate YOUR work instead of providing NEW context
|
|
117
|
+
- Questions without `file:line` — if you can't ground it in code, it's not a research question
|
|
118
|
+
|
|
119
|
+
**Question patterns by finding type:**
|
|
120
|
+
|
|
121
|
+
- **Pattern conflict**: "Found 2 implementations of [X] — which is canonical?" with options citing `file:line` + occurrence count
|
|
122
|
+
- **Scope boundary**: "Question [N] references files [A,B,C] but analysis shows [D] is the real integration point. Extend scope?" with yes/no + "describe what I missed"
|
|
123
|
+
- **Priority override**: "Questions Q1 and Q2 have competing implications for [area]. Which is load-bearing?" with options
|
|
124
|
+
- **Integration ambiguity**: "Found no connection between [X] and [Y]. Is there an indirect path?" (free-text — can't predict the answer)
|
|
125
|
+
|
|
126
|
+
**Choosing question format:**
|
|
127
|
+
|
|
128
|
+
- **`ask_user_question` tool** — when your question has 2-4 concrete options from code analysis (pattern conflicts, integration choices, scope boundaries, priority overrides). The user can always pick "Other" for free-text. Example:
|
|
129
|
+
|
|
130
|
+
> Use the `ask_user_question` tool with the following question: "Found 2 patterns for retry logic — which is canonical?". Header: "Pattern". Options: "Event-sourced retry (Recommended)" (`src/events/orders.ts:45-67` — 3 hooks, matches precedent commit `abc123`); "Direct retry loop" (`src/services/OrderService.ts:112` — single use, no event traceability).
|
|
131
|
+
|
|
132
|
+
- **Free-text with ❓ Question: prefix** — when the question is open-ended and options can't be predicted (discovery, "what am I missing?", corrections). Example:
|
|
133
|
+
"❓ Question: `src/events/orders.ts:45-67` has 3 event hooks but no error recovery path. Is there a retry mechanism elsewhere I'm not seeing?"
|
|
134
|
+
|
|
135
|
+
**Anti-pattern** — do NOT dump a verbose paragraph mixing analysis with a trailing question:
|
|
136
|
+
|
|
137
|
+
❌ "The premise inversion is load-bearing for prioritization — it means Site A is a no-op, and the real bloat only hits general-purpose dispatches. Given this, where is the bloat actually landing? Do your skills dispatch named bundled agents — in which case append-mode is irrelevant — or general-purpose — in which case it IS the dominant source?"
|
|
138
|
+
|
|
139
|
+
✅ Extract the 2 concrete options and call `ask_user_question`: "Where is the prompt bloat landing?". Header: "Bloat source". Options: "Named bundled agents (Recommended)" (Skills dispatch `codebase-analyzer` etc. — `prompt_mode: "replace"`, no parent inheritance); "General-purpose agent" (`default-agents.ts:11-28` — `promptMode: "append"`, inherits full parent prompt).
|
|
140
|
+
|
|
141
|
+
**Batching**: When you have 2-4 independent questions (answers don't depend on each other), you MAY batch them in a single `ask_user_question` call. Keep dependent questions sequential.
|
|
142
|
+
|
|
143
|
+
**CRITICAL**: Ask ONE question at a time. Wait for the answer before asking the next. Lead with your most significant finding.
|
|
144
|
+
|
|
145
|
+
3. **Present compiled scan** (under 30 lines):
|
|
146
|
+
```
|
|
147
|
+
Task: [one-line summary]
|
|
148
|
+
Scope: [N files across M layers, K integration points]
|
|
149
|
+
|
|
150
|
+
[Layer name] — [key files and what they do]
|
|
151
|
+
[Layer name] — [key files and what they do]
|
|
152
|
+
Integration — [N inbound, M outbound, K wiring. Top concern if any]
|
|
153
|
+
History — [N relevant docs. Key insight if any]
|
|
154
|
+
|
|
155
|
+
Best template: [implementation to model after]
|
|
156
|
+
Precedents — [N similar changes found. Top lesson if any]
|
|
157
|
+
Inconsistencies: [count] found ([short names])
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Wait for the developer's response before proceeding.
|
|
161
|
+
|
|
162
|
+
4. **Incorporate developer input:**
|
|
163
|
+
|
|
164
|
+
Classify each response:
|
|
165
|
+
|
|
166
|
+
**Corrections** (e.g., "skip the job scheduler", "use CreateProduct not GetUser"):
|
|
167
|
+
- Incorporate directly into synthesis. Record in Developer Context.
|
|
168
|
+
|
|
169
|
+
**New areas** (e.g., "you missed the events module"):
|
|
170
|
+
- Spawn targeted rescan: **codebase-locator** + **codebase-analyzer** on the new area (max 2 agents).
|
|
171
|
+
- Merge results into synthesis. Record in Developer Context.
|
|
172
|
+
|
|
173
|
+
**Decisions** (e.g., "yes, hook into that event chain"):
|
|
174
|
+
- Record in Developer Context. Remove corresponding item from Open Questions.
|
|
175
|
+
|
|
176
|
+
**Scope/focus** (e.g., "focus on API layer, UI is out of scope"):
|
|
177
|
+
- Record in Developer Context.
|
|
178
|
+
|
|
179
|
+
After incorporating all input, proceed to Step 4.
|
|
180
|
+
|
|
181
|
+
## Step 4: Write Research Document
|
|
182
|
+
|
|
183
|
+
1. **Determine metadata:**
|
|
184
|
+
- Filename: `thoughts/shared/research/YYYY-MM-DD_HH-MM-SS_[topic].md`
|
|
185
|
+
- YYYY-MM-DD_HH-MM-SS: Current date and time
|
|
186
|
+
- topic: Brief kebab-case description
|
|
187
|
+
- Repository name: from git root basename, or current directory basename if not a git repo
|
|
188
|
+
- Use the git branch and commit from the git context injected at the start of the session (or run `git branch --show-current` / `git rev-parse --short HEAD` directly)
|
|
189
|
+
- Researcher: use the User from the git context injected at the start of the session (fallback: "unknown")
|
|
190
|
+
- If metadata unavailable: use "unknown" for commit/branch
|
|
191
|
+
|
|
192
|
+
2. **Write the research document** — this document is compressed context for a new session. Include everything the planner needs to make architectural decisions without re-researching:
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
---
|
|
196
|
+
date: [Current date and time with timezone in ISO format]
|
|
197
|
+
researcher: [User from injected git context]
|
|
198
|
+
git_commit: [Current commit hash]
|
|
199
|
+
branch: [Current branch name]
|
|
200
|
+
repository: [Repository name]
|
|
201
|
+
topic: "[User's Research Topic]"
|
|
202
|
+
tags: [research, codebase, relevant-component-names]
|
|
203
|
+
status: complete
|
|
204
|
+
questions_source: "[path to questions artifact]"
|
|
205
|
+
last_updated: [Current date in YYYY-MM-DD format]
|
|
206
|
+
last_updated_by: [User from injected git context]
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
# Research: [User's Research Topic]
|
|
210
|
+
|
|
211
|
+
## Research Question
|
|
212
|
+
[Original user query from questions artifact]
|
|
213
|
+
|
|
214
|
+
## Summary
|
|
215
|
+
[High-level findings answering the user's question]
|
|
216
|
+
|
|
217
|
+
## Detailed Findings
|
|
218
|
+
|
|
219
|
+
### [Component/Area 1]
|
|
220
|
+
- Finding with reference (`file.ext:line`)
|
|
221
|
+
- Connection to other components
|
|
222
|
+
- Implementation details
|
|
223
|
+
|
|
224
|
+
### [Component/Area 2]
|
|
225
|
+
...
|
|
226
|
+
|
|
227
|
+
## Code References
|
|
228
|
+
- `path/to/file.py:123` — Description of what's there
|
|
229
|
+
- `another/file.ts:45-67` — Description of the code block
|
|
230
|
+
|
|
231
|
+
## Integration Points
|
|
232
|
+
[All connections to the researched area. Enumerate each consumer, dependency, and wiring point with file:line. Source from the questions artifact's Discovery Summary + new connections found by analysis agents.]
|
|
233
|
+
|
|
234
|
+
### Inbound References
|
|
235
|
+
- `path/to/consumer.ext:line` — [What references the component and how]
|
|
236
|
+
|
|
237
|
+
### Outbound Dependencies
|
|
238
|
+
- `path/to/dependency.ext:line` — [What the component depends on]
|
|
239
|
+
|
|
240
|
+
### Infrastructure Wiring
|
|
241
|
+
- `path/to/config.ext:line` — [DI, routes, events, jobs, middleware]
|
|
242
|
+
|
|
243
|
+
## Architecture Insights
|
|
244
|
+
[Patterns, conventions, and design decisions discovered]
|
|
245
|
+
|
|
246
|
+
## Precedents & Lessons
|
|
247
|
+
[N] similar past changes analyzed. Key commits: `hash` (description).
|
|
248
|
+
|
|
249
|
+
- [Composite lesson 1 — with relevant `commit hash` inline]
|
|
250
|
+
- [Composite lesson 2]
|
|
251
|
+
|
|
252
|
+
## Historical Context (from thoughts/)
|
|
253
|
+
[Links only — one line per doc, no summaries of their contents]
|
|
254
|
+
- `thoughts/shared/something.md` — [one-line description of what this doc covers]
|
|
255
|
+
## Developer Context
|
|
256
|
+
**Q (`file.ext:line`): [Question grounded in specific code reference]**
|
|
257
|
+
A: [Developer's answer]
|
|
258
|
+
|
|
259
|
+
## Related Research
|
|
260
|
+
- Questions source: `[path to questions artifact]`
|
|
261
|
+
- [Links to other research documents]
|
|
262
|
+
|
|
263
|
+
## Open Questions
|
|
264
|
+
[Only questions NOT resolved during checkpoint]
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Step 5: Present and Chain
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
Research document written to:
|
|
271
|
+
`thoughts/shared/research/[filename].md`
|
|
272
|
+
|
|
273
|
+
[N] questions answered, [M] findings across [K] files.
|
|
274
|
+
|
|
275
|
+
Please review and let me know if you have follow-up questions.
|
|
276
|
+
|
|
277
|
+
When ready:
|
|
278
|
+
`/skill:design thoughts/shared/research/[filename].md`
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Step 6: Handle Follow-ups
|
|
282
|
+
|
|
283
|
+
- If the user has follow-up questions, append to the same research document
|
|
284
|
+
- Update frontmatter: `last_updated` and `last_updated_by`
|
|
285
|
+
- Add `last_updated_note: "Added follow-up research for [brief description]"` to frontmatter
|
|
286
|
+
- Add section: `## Follow-up Research [timestamp]`
|
|
287
|
+
- Spawn new analysis agents as needed
|
|
288
|
+
|
|
289
|
+
## Important Notes
|
|
290
|
+
|
|
291
|
+
- **Analysis only**: This skill answers questions. It does NOT discover what to ask — that's discover's job.
|
|
292
|
+
- **Always chained**: This skill requires a questions artifact from discover. There is no standalone path.
|
|
293
|
+
- **Grouped dispatch**: Related questions are batched per agent based on file overlap. Default agent: codebase-analyzer. This reduces token waste from redundant file reads and lets agents build cross-question context.
|
|
294
|
+
- **Downstream compatible**: Research documents feed directly into design and plan — the same Code References / Integration Points / Architecture Insights sections they expect.
|
|
295
|
+
- **File reading**: Always read the questions artifact FULLY (no limit/offset) before dispatching agents
|
|
296
|
+
- **Critical ordering**: Follow the numbered steps exactly
|
|
297
|
+
- ALWAYS read the questions artifact first (Step 1)
|
|
298
|
+
- ALWAYS analyze question overlap for grouping (Step 1)
|
|
299
|
+
- ALWAYS wait for all agents to complete (Step 2)
|
|
300
|
+
- ALWAYS run developer checkpoint before writing (Step 3)
|
|
301
|
+
- ALWAYS gather metadata before writing (Step 4)
|
|
302
|
+
- NEVER write the document with placeholder values
|
|
303
|
+
- **Frontmatter consistency**: Always include frontmatter, use snake_case fields, include `questions_source`
|
|
304
|
+
- CC auto-loads CLAUDE.md files when agents read files in a directory — no need to scan for them explicitly
|