ccsetup 1.1.0 → 1.2.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.
Files changed (89) hide show
  1. package/README.md +100 -342
  2. package/bin/create-project.js +1616 -60
  3. package/bin/lib/claudeInterface.js +209 -0
  4. package/bin/lib/contextGenerator.js +287 -0
  5. package/bin/lib/scanner/index.js +28 -0
  6. package/bin/scan.js +367 -0
  7. package/lib/aiAgentSelector.js +155 -0
  8. package/lib/aiMergeHelper.js +112 -0
  9. package/lib/contextGenerator.js +574 -0
  10. package/lib/contextMerger.js +812 -0
  11. package/lib/progressReporter.js +88 -0
  12. package/lib/scanConfig.js +200 -0
  13. package/lib/scanner/fileAnalyzer.js +605 -0
  14. package/lib/scanner/index.js +164 -0
  15. package/lib/scanner/patterns.js +277 -0
  16. package/lib/scanner/projectDetector.js +147 -0
  17. package/lib/templates/README.md +176 -0
  18. package/lib/templates/catalog.js +230 -0
  19. package/lib/templates/filter.js +257 -0
  20. package/lib/templates/index.js +45 -0
  21. package/lib/templates/metadata/agents.json +413 -0
  22. package/lib/templates/metadata-extractor.js +329 -0
  23. package/lib/templates/search.js +356 -0
  24. package/package.json +11 -4
  25. package/template/{agents → .claude/agents}/checker.md +29 -0
  26. package/template/.claude/settings.json +15 -0
  27. package/template/.claude/skills/prd/SKILL.md +343 -0
  28. package/template/.claude/skills/ralph/SKILL.md +339 -0
  29. package/template/CLAUDE.md +39 -21
  30. package/template/CONTRIBUTING.md +37 -0
  31. package/template/GEMINI.md +126 -0
  32. package/template/agents/README.md +15 -171
  33. package/template/docs/ROADMAP.md +0 -36
  34. package/template/docs/agent-orchestration.md +24 -141
  35. package/template/hooks/workflow-selector/index.js +398 -0
  36. package/template/scripts/ralph/CLAUDE.md +174 -0
  37. package/template/scripts/ralph/ralph.sh +127 -0
  38. package/template/tickets/ticket-list.md +17 -68
  39. package/template/agents/ai-engineer.md +0 -31
  40. package/template/agents/api-documenter.md +0 -31
  41. package/template/agents/architect-review.md +0 -42
  42. package/template/agents/backend-architect.md +0 -29
  43. package/template/agents/business-analyst.md +0 -34
  44. package/template/agents/c-pro.md +0 -34
  45. package/template/agents/cloud-architect.md +0 -31
  46. package/template/agents/code-reviewer.md +0 -28
  47. package/template/agents/content-marketer.md +0 -34
  48. package/template/agents/context-manager.md +0 -63
  49. package/template/agents/cpp-pro.md +0 -37
  50. package/template/agents/customer-support.md +0 -34
  51. package/template/agents/data-engineer.md +0 -31
  52. package/template/agents/data-scientist.md +0 -28
  53. package/template/agents/database-admin.md +0 -31
  54. package/template/agents/database-optimizer.md +0 -31
  55. package/template/agents/debugger.md +0 -29
  56. package/template/agents/deployment-engineer.md +0 -31
  57. package/template/agents/devops-troubleshooter.md +0 -31
  58. package/template/agents/dx-optimizer.md +0 -62
  59. package/template/agents/error-detective.md +0 -31
  60. package/template/agents/frontend-developer.md +0 -30
  61. package/template/agents/golang-pro.md +0 -31
  62. package/template/agents/graphql-architect.md +0 -31
  63. package/template/agents/incident-responder.md +0 -73
  64. package/template/agents/javascript-pro.md +0 -34
  65. package/template/agents/legacy-modernizer.md +0 -31
  66. package/template/agents/ml-engineer.md +0 -31
  67. package/template/agents/mlops-engineer.md +0 -56
  68. package/template/agents/mobile-developer.md +0 -31
  69. package/template/agents/network-engineer.md +0 -31
  70. package/template/agents/payment-integration.md +0 -31
  71. package/template/agents/performance-engineer.md +0 -31
  72. package/template/agents/prompt-engineer.md +0 -58
  73. package/template/agents/python-pro.md +0 -31
  74. package/template/agents/quant-analyst.md +0 -31
  75. package/template/agents/risk-manager.md +0 -40
  76. package/template/agents/rust-pro.md +0 -34
  77. package/template/agents/sales-automator.md +0 -34
  78. package/template/agents/search-specialist.md +0 -58
  79. package/template/agents/security-auditor.md +0 -31
  80. package/template/agents/sql-pro.md +0 -34
  81. package/template/agents/terraform-specialist.md +0 -34
  82. package/template/agents/test-automator.md +0 -31
  83. /package/template/{agents → .claude/agents}/backend.md +0 -0
  84. /package/template/{agents → .claude/agents}/blockchain.md +0 -0
  85. /package/template/{agents → .claude/agents}/coder.md +0 -0
  86. /package/template/{agents → .claude/agents}/frontend.md +0 -0
  87. /package/template/{agents → .claude/agents}/planner.md +0 -0
  88. /package/template/{agents → .claude/agents}/researcher.md +0 -0
  89. /package/template/{agents → .claude/agents}/shadcn.md +0 -0
@@ -0,0 +1,339 @@
1
+ ---
2
+ name: ralph
3
+ description: "Convert PRDs to prd.json format for the Ralph autonomous agent system. Use when you have an existing PRD and need to convert it to Ralph's JSON format. Triggers on: convert this prd, turn this into ralph format, create prd.json from this, ralph json."
4
+ ---
5
+
6
+ # Ralph PRD Converter
7
+
8
+ Converts existing PRDs to the prd.json format that Ralph uses for autonomous execution. Scans the codebase to populate quality checks, file hints, and story notes automatically.
9
+
10
+ ---
11
+
12
+ ## The Job
13
+
14
+ 1. **Scan the codebase** to detect quality commands and relevant file paths
15
+ 2. Read the PRD (markdown file or text) — check for a Tech Context section first
16
+ 3. Convert to `scripts/ralph/prd.json` with codebase-informed stories
17
+ 4. Initialize `scripts/ralph/progress.txt` if it doesn't exist
18
+
19
+ **Important:** Do NOT start implementing. Just create the prd.json.
20
+
21
+ ---
22
+
23
+ ## Step 1: Codebase Reconnaissance
24
+
25
+ Before converting, silently scan the project using Claude Code tools.
26
+
27
+ ### If PRD has a Tech Context section
28
+ The improved `/prd` skill generates a Tech Context section with stack, quality gates, and relevant file paths. If present, use it directly — no need to re-scan.
29
+
30
+ ### If PRD has no Tech Context section
31
+ Scan manually:
32
+
33
+ **Detect quality commands** — Read `package.json` scripts, config files, Makefiles:
34
+ - Look for: `typecheck`, `tsc`, `check-types` → record the exact script (e.g., `npm run typecheck`)
35
+ - Look for: `lint`, `eslint`, `biome check` → record exact script (e.g., `npm run lint`)
36
+ - Look for: `test`, `vitest`, `jest`, `pytest` → record exact script (e.g., `npm test`)
37
+ - Look for: `build` → record exact script (e.g., `npm run build`)
38
+
39
+ **Scan relevant files** — Use Glob to find files related to each user story:
40
+ - Database: `**/schema.prisma`, `**/models/**`, `**/migrations/**`
41
+ - API: `**/api/**`, `**/routes/**`, `**/app/**/route.*`
42
+ - Components: `**/components/**`
43
+ - Utilities: `**/hooks/**`, `**/utils/**`, `**/lib/**`
44
+
45
+ These become `notes` on each story — giving Ralph file-level hints for where to work.
46
+
47
+ ---
48
+
49
+ ## Step 2: Output Format
50
+
51
+ ```json
52
+ {
53
+ "project": "[Project Name]",
54
+ "branchName": "ralph/[feature-name-kebab-case]",
55
+ "description": "[Feature description from PRD title/intro]",
56
+ "qualityChecks": {
57
+ "typecheck": "npm run typecheck",
58
+ "lint": "npm run lint",
59
+ "test": "npm test",
60
+ "build": "npm run build"
61
+ },
62
+ "userStories": [
63
+ {
64
+ "id": "US-001",
65
+ "title": "[Story title]",
66
+ "description": "As a [user], I want [feature] so that [benefit]",
67
+ "acceptanceCriteria": [
68
+ "Criterion 1",
69
+ "Criterion 2",
70
+ "Typecheck passes",
71
+ "Lint passes"
72
+ ],
73
+ "priority": 1,
74
+ "passes": false,
75
+ "notes": "Relevant files: prisma/schema.prisma, src/app/api/tasks/route.ts"
76
+ }
77
+ ]
78
+ }
79
+ ```
80
+
81
+ ### The `qualityChecks` field
82
+
83
+ This is **new and critical**. It tells Ralph the exact commands to run, so each iteration doesn't have to guess. Only include checks that actually exist in the project:
84
+
85
+ ```json
86
+ "qualityChecks": {
87
+ "typecheck": "npm run typecheck",
88
+ "lint": "npm run lint"
89
+ }
90
+ ```
91
+
92
+ If a project has no typecheck, don't include it. If it uses `make check`, use that. Be exact.
93
+
94
+ ### The `notes` field
95
+
96
+ Pre-populate with **file hints** from your codebase scan — relevant files the story will likely touch or extend:
97
+
98
+ ```
99
+ "notes": "Relevant files: prisma/schema.prisma (Task model), src/components/TaskCard.tsx (extend with badge)"
100
+ ```
101
+
102
+ This gives each Ralph iteration a head start instead of scanning the codebase from scratch.
103
+
104
+ ---
105
+
106
+ ## Story Size: The Number One Rule
107
+
108
+ **Each story must be completable in ONE Ralph iteration (one context window).**
109
+
110
+ Ralph spawns a fresh instance per iteration with no memory of previous work. If a story is too big, the LLM runs out of context before finishing and produces broken code.
111
+
112
+ ### Right-sized stories:
113
+ - Add a database column and migration
114
+ - Add a UI component to an existing page
115
+ - Update a server action with new logic
116
+ - Add a filter dropdown to a list
117
+
118
+ ### Too big (split these):
119
+ - "Build the entire dashboard" — Split into: schema, queries, UI components, filters
120
+ - "Add authentication" — Split into: schema, middleware, login UI, session handling
121
+ - "Refactor the API" — Split into one story per endpoint or pattern
122
+
123
+ **Rule of thumb:** If you cannot describe the change in 2-3 sentences, it is too big.
124
+
125
+ ---
126
+
127
+ ## Story Ordering: Dependencies First
128
+
129
+ Stories execute in priority order. Earlier stories must not depend on later ones.
130
+
131
+ **Correct order:**
132
+ 1. Schema/database changes (migrations)
133
+ 2. Server actions / backend logic
134
+ 3. UI components that use the backend
135
+ 4. Dashboard/summary views that aggregate data
136
+
137
+ **Wrong order:**
138
+ 1. UI component (depends on schema that does not exist yet)
139
+ 2. Schema change
140
+
141
+ ---
142
+
143
+ ## Acceptance Criteria: Must Be Verifiable
144
+
145
+ Each criterion must be something Ralph can CHECK, not something vague.
146
+
147
+ ### Good criteria (verifiable):
148
+ - "Add `status` column to tasks table with default 'pending'"
149
+ - "Filter dropdown has options: All, Active, Completed"
150
+ - "Clicking delete shows confirmation dialog"
151
+
152
+ ### Bad criteria (vague):
153
+ - "Works correctly"
154
+ - "User can do X easily"
155
+ - "Good UX"
156
+ - "Handles edge cases"
157
+
158
+ ### Quality criteria — use what the project actually has
159
+
160
+ Append the quality checks detected in Step 1. Examples:
161
+
162
+ - Project has typecheck + lint → append `"Typecheck passes"`, `"Lint passes"`
163
+ - Project has only tests → append `"Tests pass"`
164
+ - Project has a build step → append `"Build passes"`
165
+
166
+ Do **not** hardcode "Typecheck passes" if the project has no typecheck.
167
+
168
+ ### For stories that change UI, also include:
169
+ ```
170
+ "Verify in browser using dev-browser skill"
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Conversion Rules
176
+
177
+ 1. **Each user story becomes one JSON entry**
178
+ 2. **IDs**: Sequential (US-001, US-002, etc.)
179
+ 3. **Priority**: Based on dependency order, then document order
180
+ 4. **All stories**: `passes: false`
181
+ 5. **notes**: Pre-populate with relevant file paths from codebase scan
182
+ 6. **branchName**: Derive from feature name, kebab-case, prefixed with `ralph/`
183
+ 7. **qualityChecks**: Populated from detected project commands (Step 1)
184
+ 8. **Quality criteria on stories**: Match what `qualityChecks` contains
185
+
186
+ ---
187
+
188
+ ## Splitting Large PRDs
189
+
190
+ If a PRD has big features, split them:
191
+
192
+ **Original:**
193
+ > "Add user notification system"
194
+
195
+ **Split into:**
196
+ 1. US-001: Add notifications table to database
197
+ 2. US-002: Create notification service for sending notifications
198
+ 3. US-003: Add notification bell icon to header
199
+ 4. US-004: Create notification dropdown panel
200
+ 5. US-005: Add mark-as-read functionality
201
+ 6. US-006: Add notification preferences page
202
+
203
+ Each is one focused change that can be completed and verified independently.
204
+
205
+ ---
206
+
207
+ ## Example
208
+
209
+ **Input PRD with Tech Context:**
210
+ ```markdown
211
+ # PRD: Task Status Feature
212
+
213
+ ## Tech Context
214
+ - **Stack:** Next.js 14 (App Router) + TypeScript + Tailwind CSS
215
+ - **DB:** Prisma with PostgreSQL (`prisma/schema.prisma`)
216
+ - **UI:** shadcn/ui in `src/components/ui/`
217
+ - **Quality gates:** Typecheck (`tsc --noEmit`), Lint (`eslint`), Tests (`vitest`)
218
+ - **Relevant code:**
219
+ - Task model: `prisma/schema.prisma`
220
+ - Task list: `src/components/TaskList.tsx`
221
+ - Task card: `src/components/TaskCard.tsx`
222
+ - Badge: `src/components/ui/Badge.tsx`
223
+ - API: `src/app/api/tasks/`
224
+
225
+ ## User Stories
226
+ ### US-001: Add status field to database ...
227
+ ### US-002: Display status badge on task cards ...
228
+ ### US-003: Add status toggle ...
229
+ ### US-004: Filter tasks by status ...
230
+ ```
231
+
232
+ **Output prd.json:**
233
+ ```json
234
+ {
235
+ "project": "TaskApp",
236
+ "branchName": "ralph/task-status",
237
+ "description": "Task Status Feature - Track task progress with status indicators",
238
+ "qualityChecks": {
239
+ "typecheck": "npx tsc --noEmit",
240
+ "lint": "npm run lint",
241
+ "test": "npx vitest run"
242
+ },
243
+ "userStories": [
244
+ {
245
+ "id": "US-001",
246
+ "title": "Add status field to tasks table",
247
+ "description": "As a developer, I need to store task status in the database.",
248
+ "acceptanceCriteria": [
249
+ "Add status column: 'pending' | 'in_progress' | 'done' (default 'pending')",
250
+ "Generate and run migration successfully",
251
+ "Typecheck passes",
252
+ "Lint passes"
253
+ ],
254
+ "priority": 1,
255
+ "passes": false,
256
+ "notes": "Relevant files: prisma/schema.prisma (Task model)"
257
+ },
258
+ {
259
+ "id": "US-002",
260
+ "title": "Display status badge on task cards",
261
+ "description": "As a user, I want to see task status at a glance.",
262
+ "acceptanceCriteria": [
263
+ "Each task card shows colored status badge",
264
+ "Badge colors: gray=pending, blue=in_progress, green=done",
265
+ "Typecheck passes",
266
+ "Lint passes",
267
+ "Verify in browser using dev-browser skill"
268
+ ],
269
+ "priority": 2,
270
+ "passes": false,
271
+ "notes": "Relevant files: src/components/TaskCard.tsx (extend), src/components/ui/Badge.tsx (reuse with color variants)"
272
+ },
273
+ {
274
+ "id": "US-003",
275
+ "title": "Add status toggle to task list rows",
276
+ "description": "As a user, I want to change task status directly from the list.",
277
+ "acceptanceCriteria": [
278
+ "Each row has status dropdown or toggle",
279
+ "Changing status saves immediately via PATCH /api/tasks/[id]",
280
+ "UI updates without page refresh",
281
+ "Typecheck passes",
282
+ "Lint passes",
283
+ "Verify in browser using dev-browser skill"
284
+ ],
285
+ "priority": 3,
286
+ "passes": false,
287
+ "notes": "Relevant files: src/components/TaskList.tsx, src/app/api/tasks/[id]/route.ts"
288
+ },
289
+ {
290
+ "id": "US-004",
291
+ "title": "Filter tasks by status",
292
+ "description": "As a user, I want to filter the list to see only certain statuses.",
293
+ "acceptanceCriteria": [
294
+ "Filter dropdown: All | Pending | In Progress | Done",
295
+ "Filter persists in URL params",
296
+ "Typecheck passes",
297
+ "Lint passes",
298
+ "Tests pass",
299
+ "Verify in browser using dev-browser skill"
300
+ ],
301
+ "priority": 4,
302
+ "passes": false,
303
+ "notes": "Relevant files: src/components/TaskList.tsx (add filter dropdown)"
304
+ }
305
+ ]
306
+ }
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Archiving Previous Runs
312
+
313
+ **Before writing a new prd.json, check if there is an existing one from a different feature:**
314
+
315
+ 1. Read the current `prd.json` if it exists
316
+ 2. Check if `branchName` differs from the new feature's branch name
317
+ 3. If different AND `progress.txt` has content beyond the header:
318
+ - Create archive folder: `archive/YYYY-MM-DD-feature-name/`
319
+ - Copy current `prd.json` and `progress.txt` to archive
320
+ - Reset `progress.txt` with fresh header
321
+
322
+ **The ralph.sh script handles this automatically** when you run it, but if you are manually updating prd.json between runs, archive first.
323
+
324
+ ---
325
+
326
+ ## Checklist Before Saving
327
+
328
+ Before writing prd.json, verify:
329
+
330
+ - [ ] Ran codebase reconnaissance or read PRD's Tech Context (Step 1)
331
+ - [ ] `qualityChecks` populated with exact commands from the project
332
+ - [ ] **Previous run archived** (if prd.json exists with different branchName, archive it first)
333
+ - [ ] Each story is completable in one iteration (small enough)
334
+ - [ ] Stories are ordered by dependency (schema → backend → UI)
335
+ - [ ] Story quality criteria match what `qualityChecks` contains (not hardcoded)
336
+ - [ ] UI stories have "Verify in browser using dev-browser skill" as criterion
337
+ - [ ] Acceptance criteria are verifiable (not vague)
338
+ - [ ] Story `notes` pre-populated with relevant file paths
339
+ - [ ] No story depends on a later story
@@ -15,9 +15,12 @@
15
15
  ```
16
16
  .
17
17
  ├── CLAUDE.md # This file - project instructions for Claude
18
- ├── .claude/ # Claude Code configuration (auto-generated)
19
- └── agents/ # Project-specific agent overrides
20
- ├── agents/ # Custom agents for specialized tasks
18
+ ├── .claude/
19
+ ├── agents/ # 8 core agents (backend, blockchain, checker, coder, frontend, planner, researcher, shadcn)
20
+ │ └── skills/ # /prd and /ralph slash commands
21
+ ├── agents/ # Documentation only — see .claude/agents/ for active agents
22
+ ├── scripts/
23
+ │ └── ralph/ # Autonomous agent loop (ralph.sh + agent instructions)
21
24
  ├── docs/ # Project documentation
22
25
  ├── plans/ # Project plans and architectural documents
23
26
  └── tickets/ # Task tickets and issues
@@ -58,24 +61,44 @@
58
61
 
59
62
  ## Agents
60
63
 
61
- See @agents/README.md for available agents and their purposes
64
+ 8 core agents are pre-installed in `.claude/agents/`. See @agents/README.md for the full list and instructions for adding custom agents.
65
+
66
+ ## Skills (Slash Commands)
67
+
68
+ - **/prd** — Scans the codebase, then generates a structured PRD with real file paths and auto-detected quality criteria. Saves to `tasks/prd-[feature-name].md`.
69
+ - **/ralph** — Converts a PRD into `scripts/ralph/prd.json` for autonomous execution with quality checks and file hints per story.
70
+
71
+ ## Ralph — Autonomous Agent Loop
72
+
73
+ Ralph implements user stories from a PRD one at a time in a loop, with subagent verification after each story.
74
+
75
+ ```bash
76
+ ./scripts/ralph/ralph.sh # Default: 10 iterations with amp
77
+ ./scripts/ralph/ralph.sh --tool claude # Use Claude Code
78
+ ./scripts/ralph/ralph.sh --tool claude --model opus 20 # Specify model + iterations
79
+ ```
80
+
81
+ Typical workflow: `/prd` → `/ralph` → `./scripts/ralph/ralph.sh`
62
82
 
63
83
  ## Agent Orchestration
64
84
 
65
- After adding the agents you want to in `./claude/agents` folder, setup the workflow for Claude code to follow
85
+ See @docs/agent-orchestration.md for detailed workflow patterns on how to chain agents effectively.
86
+
87
+ ## Workflow Selector Hook (Optional)
88
+
89
+ An optional hook that suggests agent workflows based on your prompt. Claude will ask before applying.
90
+
91
+ To activate after installation:
92
+ ```bash
93
+ export CCSETUP_WORKFLOW=1
94
+ ```
95
+
96
+ When unset, the hook is inactive and Claude uses its default behavior. Install the hook with `npx ccsetup --install-hooks`.
66
97
 
67
98
  ## Tickets
68
99
 
69
100
  See @tickets/README.md for ticket format and management approach
70
101
 
71
- ### Ticket Management
72
- - **Ticket List**: Maintain @tickets/ticket-list.md as a centralized index of all tickets
73
- - **Update ticket-list.md** whenever you:
74
- - Create a new ticket (add to appropriate priority section)
75
- - Change ticket status (update emoji and move if completed)
76
- - Complete a ticket (move to completed section with date)
77
- - **Status Emojis**: 🔴 Todo | 🟡 In Progress | 🟢 Done | 🔵 Blocked | ⚫ Cancelled
78
-
79
102
  ## Plans
80
103
 
81
104
  See @plans/README.md for planning documents and architectural decisions
@@ -88,14 +111,9 @@ See @plans/README.md for planning documents and architectural decisions
88
111
 
89
112
  ## Important Instructions
90
113
 
91
- Before starting any task:
92
-
93
- 1. **Confirm understanding**: Always confirm you understand the request and outline your plan before proceeding
94
- 2. **Ask clarifying questions**: Never make assumptions - ask questions when requirements are unclear
95
- 3. **Create planning documents**: Before implementing any code or features, create a markdown file documenting the approach
96
- 4. **Use plans directory**: When discussing ideas or next steps, create timestamped files in the plans directory (e.g., `plans/next-steps-YYYY-MM-DD-HH-MM-SS.md`) to maintain a record of decisions
97
- 5. **No code comments**: Never add comments to any code you write - code should be self-documenting
98
- 6. **Maintain ticket list**: Always update @tickets/ticket-list.md when creating, updating, or completing tickets to maintain a clear project overview
114
+ - Ask clarifying questions when requirements are unclear
115
+ - Self-documenting code — no code comments
116
+ - For complex features, consider creating a plan document in `/plans` before implementing
99
117
 
100
118
  ## Additional Notes
101
119
 
@@ -0,0 +1,37 @@
1
+ # Contributing
2
+
3
+ ## Development Workflow
4
+
5
+ 1. **Task Planning**
6
+ - Study the existing codebase and understand the current state
7
+ - Use the **planner** agent to break down complex problems and create implementation roadmaps
8
+ - Create a plan document in the `/plans` directory for complex features
9
+ - Update `ROADMAP.md` to include the new task under Development
10
+ - Priority tasks should be inserted after the last completed task
11
+
12
+ 2. **Ticket Creation**
13
+ - Study the existing codebase and understand the current state
14
+ - Create a new ticket file in the `/tickets` directory
15
+ - Name format: `TICKET-XXX-description.md` (e.g., `TICKET-001-user-auth.md`)
16
+ - Include high-level specifications, relevant files, acceptance criteria, and implementation steps
17
+ - Refer to last completed ticket in the `/tickets` directory for examples
18
+ - Note that completed tickets show checked boxes and summary of changes
19
+ - For new tickets, use empty checkboxes and no summary section
20
+
21
+ 3. **Task Implementation**
22
+ - Use the **coder** agent for implementing features, fixing bugs, and optimizing code
23
+ - Follow the specifications in the ticket file
24
+ - Implement features and functionality following project conventions
25
+ - Update step progress within the ticket file after each step
26
+ - Stop after completing each step and wait for further instructions
27
+
28
+ 4. **Quality Assurance**
29
+ - Use the **checker** agent for testing, security analysis, and code review
30
+ - Verify all acceptance criteria are met
31
+ - Run tests and ensure code quality standards
32
+ - Document any issues found and their resolutions
33
+
34
+ 5. **Roadmap Updates**
35
+ - Mark completed tasks with ✅ in the roadmap
36
+ - Add reference to the ticket file (e.g., `See: /tickets/TICKET-001-user-auth.md`)
37
+ - Update related plan documents if applicable
@@ -0,0 +1,126 @@
1
+ # Persona: The Waterfall Architect
2
+
3
+ You are a **Senior Technical Product Manager** and **Solution Architect**, referred to as "The Architect." Your primary directive is to translate high-level feature requests into a master plan composed of atomic, sequential, and deeply detailed task specifications. You operate with a strict **waterfall methodology**. The master plan must be so comprehensive that it can be handed off to a third-party development house for implementation with zero ambiguity.
4
+
5
+ ## Core Directives
6
+
7
+ 1. **Total Context Awareness**: Before planning, you must achieve complete situational awareness of the project. Your first action for any new feature is to read and fully comprehend the entire technical landscape. This includes:
8
+ * **The Entire Codebase**: Recursively read all source files (`.go`, `.py`, `.ts`, etc.).
9
+ * **All Documentation**: Read all files in the `docs/` directory and any other `.md` files.
10
+ * **All Configurations**: Read all project configuration files (`.toml`, `.yaml`, `go.mod`, `package.json`, etc.).
11
+ * **Architectural Reality**: Synthesize this information to understand the project's true architecture, including:
12
+ * **Software Engineering Patterns**: CQRS (Command Query Responsibility Segregation), Event Sourcing, Domain-Driven Design, etc.
13
+ * **Technology Choices**:
14
+ * **Message Queue**: Watermill (Go), FastStream (Python), or other event streaming platforms
15
+ * **Database**: ScyllaDB, PostgreSQL, Redis, etc.
16
+ * **Frameworks**: FastAPI (Python), Gin/Echo (Go), Express/NestJS (TypeScript)
17
+ * **Critical Constraints**:
18
+ * **ScyllaDB Tablet Mode**: Does NOT support indexes, materialized views, or filters on non-primary key columns. This requires:
19
+ * Creating dedicated lookup tables for each query pattern
20
+ * Keeping lookup tables synchronized with main tables
21
+ * Using batch operations or event-driven updates for consistency
22
+ * **Event-Driven Architecture**: All state changes must be published as events
23
+ * **Async Processing**: Long-running operations must be handled asynchronously
24
+
25
+ 2. **Waterfall Deconstruction**: Break down the high-level feature into a strict sequence of tasks. Each task must be a prerequisite for the next, creating a clear, linear path from start to finish. There should be no parallel work.
26
+
27
+ 3. **Exhaustive Specification**: Author a ticket for each task. Each ticket must be self-contained and provide all necessary context, duplicated from other tickets if necessary. The developer should never need to refer to another ticket or ask for clarification.
28
+
29
+ ## Task Generation Workflow
30
+
31
+ 1. **Phase 1: Full Project Immersion**
32
+ * **Action**: Use `glob` to find all relevant files (`**/*.go`, `**/*.py`, `**/*.ts`, `docs/**/*.md`, etc.).
33
+ * **Action**: Use `read_many_files` to ingest the content of all identified files.
34
+ * **Output**: A deep internal understanding of the project's architecture, constraints, and conventions.
35
+
36
+ 2. **Phase 2: Master Plan Formulation**
37
+ * **Action**: Mentally map out the entire sequence of steps required to implement the feature.
38
+ * **Action**: For each step in the sequence, generate a task specification using the template below.
39
+
40
+ ## Task Specification Template
41
+
42
+ ---
43
+
44
+ ### **1. Task Metadata**
45
+ * **ID**: `[ProjectName-XXX]`
46
+ * **Title**: [A clear, descriptive title for this specific step]
47
+ * **Prerequisite Task**: `[ProjectName-YYY]`
48
+
49
+ ### **2. Executive Summary**
50
+ * **Objective**: [A one-sentence description of what this specific task accomplishes.]
51
+ * **Role in Feature**: [Explain how this task fits into the overall feature sequence.]
52
+
53
+ ### **3. Full Context Reiteration**
54
+ * **System Architecture**: [Reiterate the relevant architectural patterns, e.g., "This service uses CQRS. This task concerns the Command side."]
55
+ * **Technology Stack**: [Reiterate the specific libraries and versions for this task, e.g., "Use Watermill v1.2 for message publishing."]
56
+ * **Database Constraints**: [Reiterate all relevant database constraints, e.g., "Remember that ScyllaDB requires lookup tables for non-PK queries. This task must ensure the `user_email_lookup` table is updated atomically with the `users` table."]
57
+
58
+ ### **3. Implementation Blueprint**
59
+
60
+ #### **Files to Create/Modify**
61
+ * **File Path**: `[Absolute path from project root]`
62
+ * **Action**: `[CREATE | MODIFY]`
63
+ * **Description**: [Detailed, step-by-step instructions for the changes. Be explicit. "Add a new method `updateEmail` to the `UserService` class." is not enough. You must specify the exact code to be added or changed.]
64
+
65
+ #### **Function/Method Signatures**
66
+ * **File Path**: `[Absolute path from project root]`
67
+ * **Signature**: `function updateUserEmail(userID: string, newEmail: string): Promise<void>`
68
+ * **Description**: [Detail the function's purpose, each parameter, the return value, and all possible error conditions that must be handled.]
69
+
70
+ #### **Database Operations**
71
+ * **Table**: `[table_name]`
72
+ * **Action**: `[INSERT | UPDATE | DELETE | SELECT]`
73
+ * **Exact Query/ORM Call**: [Provide the exact SQL query or ORM function call, e.g., `db.users.update({ where: { id: userID }, data: { email: newEmail } })`.]
74
+
75
+ #### **API Endpoints**
76
+ * **`[METHOD] /api/v1/endpoint`**:
77
+ * **Authentication**: `[Required | Optional | None]`
78
+ * **Request Body**: Define the JSON structure with types.
79
+ * **Success Response (200)**: Define the JSON structure.
80
+ * **Error Responses (4xx, 5xx)**: List potential error codes and their response bodies.
81
+
82
+ ### **4. Quality Assurance**
83
+ * **Unit Tests**: List the critical scenarios to cover for new/modified functions.
84
+ * **Integration Tests**: Describe how this component interacts with others and what needs to be verified.
85
+ * **Security Checks**: List specific vulnerabilities to guard against (e.g., "Validate user input to prevent XSS").
86
+
87
+ ### **5. Dependencies & Integration**
88
+ * **Prerequisites**: List any task IDs that must be completed first.
89
+ * **Events**: Specify any events to be emitted or listened for.
90
+ * **Downstream Impact**: Note any other systems or features affected by this change (e.g., "Requires cache invalidation for user profiles").
91
+
92
+ ### **6. Definition of Done**
93
+ A checklist of all deliverables.
94
+ - [ ] All implemented functions have corresponding unit tests.
95
+ - [ ] Integration tests pass.
96
+ - [ ] Code adheres to the project's style guide.
97
+ - [ ] Documentation for new components is created.
98
+ - [ ] Task is reviewed and approved.
99
+
100
+ ---
101
+
102
+ ## Language-Specific Guidelines
103
+
104
+ ### Go Development
105
+ * **Error Handling**: Always check and handle errors explicitly. Use `if err != nil { return fmt.Errorf("context: %w", err) }`
106
+ * **Context Usage**: Pass `context.Context` as the first parameter to functions that perform I/O
107
+ * **Interfaces**: Define interfaces in the package that uses them, not the package that implements them
108
+ * **Concurrency**: Use channels for communication, mutexes for state protection
109
+ * **Testing**: Use table-driven tests with `t.Run()` for subtests
110
+ * **Dependencies**: Check `go.mod` for exact versions and available packages
111
+
112
+ ### TypeScript Development
113
+ * **Type Safety**: Never use `any`. Define explicit interfaces for all data structures
114
+ * **Async/Await**: Always use async/await instead of raw promises
115
+ * **Error Handling**: Use try-catch blocks or Result types for error handling
116
+ * **Null Safety**: Use optional chaining (`?.`) and nullish coalescing (`??`)
117
+ * **Testing**: Check if using Jest, Vitest, or another framework before writing tests
118
+ * **Module System**: Use ES modules (`import/export`) not CommonJS (`require/module.exports`)
119
+
120
+ ### Python Development
121
+ * **Type Hints**: Use type hints for all function signatures and class attributes
122
+ * **Async**: Use `async/await` with FastAPI or similar async frameworks
123
+ * **Pydantic**: Use Pydantic V2 models for data validation (check version in requirements)
124
+ * **Error Handling**: Use specific exception types, not bare `except:`
125
+ * **Testing**: Check if using pytest, unittest, or another framework
126
+ * **Code Style**: Follow PEP 8 and use tools like black, ruff for formatting