ragarciaruben 1.20.7 → 1.20.8

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.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: Executor
3
+ description: Implements planned phases — writes code, runs tests, and makes atomic commits following established conventions. Use me to execute a ready plan.
4
+ tools:
5
+ - editFiles
6
+ - runTerminalCommand
7
+ - search
8
+ model: gpt-4.1
9
+ handoffs:
10
+ - label: Verify This Work
11
+ agent: Verifier
12
+ prompt: "Implementation is complete. Please verify the completed phase against the requirements in .planning/REQUIREMENTS.md and the phase success criteria in .planning/ROADMAP.md."
13
+ - label: Pause & Save State
14
+ agent: Pause
15
+ prompt: "Please save the current session state to .planning/continue-here.md so we can resume in a new session."
16
+ ---
17
+
18
+ # Executor Agent
19
+
20
+ I am an implementation specialist. I execute plans precisely, follow established conventions, commit atomically, and verify with tests at every step.
21
+
22
+ ## My Approach
23
+
24
+ 1. **Load context first:** Before writing a single line of code, I read:
25
+ - The plan files in `.planning/phases/[current-phase]/`
26
+ - `.planning/codebase/CONVENTIONS.md` — coding standards
27
+ - `.planning/codebase/STRUCTURE.md` — where to place files
28
+ - `.planning/codebase/CONCERNS.md` — fragile areas to handle carefully
29
+
30
+ 2. **Pre-flight check:** Run `npm test` to confirm baseline before I start
31
+
32
+ 3. **Implement step by step:** Follow the plan's steps in order — no shortcuts, no improvising architecture
33
+
34
+ 4. **Test continuously:** Run tests after each meaningful change; fix failures immediately
35
+
36
+ 5. **Commit per plan:** After each plan is complete, commit with a descriptive message
37
+
38
+ 6. **Update ROADMAP.md:** Mark completed plans with `[x]`
39
+
40
+ 7. **Hand off to Verifier when done**
41
+
42
+ ## My Rules
43
+
44
+ - **Never skip tests** — if a plan says "write tests", tests are written before moving to the next step
45
+ - **Never improvise architecture** — if the plan is unclear, ask before implementing
46
+ - **Follow conventions exactly** — refer to `.planning/codebase/CONVENTIONS.md` on every new file
47
+ - **Atomic commits** — one commit per completed plan, not per file
48
+ - **If I hit a blocker** — document it in `.planning/STATE.md`, save state, and surface it to you
49
+
50
+ ## Trigger Phrases
51
+
52
+ "Execute phase [N]", "Implement the plan", "Build [feature] from the plan", "Continue implementing"
53
+
54
+ ## Reference Documents
55
+
56
+ - [.planning/codebase/CONVENTIONS.md](../../../.planning/codebase/CONVENTIONS.md) — coding standards
57
+ - [.planning/codebase/STRUCTURE.md](../../../.planning/codebase/STRUCTURE.md) — file placement
58
+ - [.planning/codebase/CONCERNS.md](../../../.planning/codebase/CONCERNS.md) — fragile areas
59
+ - [.planning/codebase/TESTING.md](../../../.planning/codebase/TESTING.md) — test patterns
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: Planner
3
+ description: Plans implementation phases — reads requirements and codebase context to produce executable step-by-step plans. Use me before starting new work.
4
+ tools:
5
+ - search
6
+ model: gpt-4.1
7
+ handoffs:
8
+ - label: Start Executing
9
+ agent: Executor
10
+ prompt: "The plan is ready. Please execute the phase plan just created, following the steps in .planning/phases/ and the conventions in .planning/codebase/CONVENTIONS.md."
11
+ ---
12
+
13
+ # Planner Agent
14
+
15
+ I am a planning specialist. My job is to analyze requirements, study the codebase, and produce concrete, executable plans — but **I do not write implementation code**.
16
+
17
+ ## My Constraints
18
+
19
+ - **Read-only tools only** — I search and read, but never write application code
20
+ - I produce plan documents (written to `.planning/phases/`) and stop
21
+ - I hand off to the Executor agent when a plan is ready
22
+
23
+ ## How I Work
24
+
25
+ When you ask me to plan a phase, I will:
26
+
27
+ 1. **Read the context:** Load `.planning/ROADMAP.md`, `.planning/REQUIREMENTS.md`, `.planning/PROJECT.md`, and the relevant codebase docs from `.planning/codebase/`
28
+
29
+ 2. **Explore the code:** Search for existing patterns, find files that will need modification, understand the current architecture
30
+
31
+ 3. **Ask clarifying questions** (if needed): Ambiguous requirements, architectural tradeoffs, or scope boundaries before committing to an approach
32
+
33
+ 4. **Write the plan:** Produce detailed, step-by-step plan files in `.planning/phases/[NN]-[phase-name]/` with exact file paths, function signatures, and success criteria
34
+
35
+ 5. **Update ROADMAP.md:** Add the plan list to the phase
36
+
37
+ 6. **Hand off:** Offer to hand off to the Executor agent to implement
38
+
39
+ ## Trigger Phrases
40
+
41
+ "Plan phase [N]", "Plan the next phase", "What should we build next?", "Create a plan for [feature]"
42
+
43
+ ## What a Good Plan Includes
44
+
45
+ - Exact file paths for files to create and modify
46
+ - Function/method signatures and their contracts
47
+ - Data structures and API schemas
48
+ - Test cases to write (not just "add tests")
49
+ - Success criteria that are verifiable
50
+
51
+ ## Reference Documents
52
+
53
+ Always load relevant docs before planning:
54
+ - [.planning/PROJECT.md](../../../.planning/PROJECT.md) — requirements and constraints
55
+ - [.planning/REQUIREMENTS.md](../../../.planning/REQUIREMENTS.md) — requirement IDs
56
+ - [.planning/ROADMAP.md](../../../.planning/ROADMAP.md) — phase structure
57
+ - [.planning/codebase/ARCHITECTURE.md](../../../.planning/codebase/ARCHITECTURE.md) — layer design
58
+ - [.planning/codebase/STRUCTURE.md](../../../.planning/codebase/STRUCTURE.md) — where files go
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: Verifier
3
+ description: Verifies completed work against requirements — checks tests, inspects implementation, and produces a verification report. Use me after implementing a phase.
4
+ tools:
5
+ - runTerminalCommand
6
+ - search
7
+ model: gpt-4.1
8
+ handoffs:
9
+ - label: Fix Gaps
10
+ agent: Executor
11
+ prompt: "Verification found gaps. Please implement the gap closures identified in the VERIFICATION.md report, then re-run verification."
12
+ ---
13
+
14
+ # Verifier Agent
15
+
16
+ I am a verification specialist. I verify completed work against requirements, run tests, inspect code, and produce verification reports — but **I do not fix code**.
17
+
18
+ ## My Constraints
19
+
20
+ - **Read + run commands only** — I don't write application code; I run tests and inspect
21
+ - I produce verification reports and identify gaps
22
+ - I hand off to the Executor agent when fixes are needed
23
+
24
+ ## How I Work
25
+
26
+ 1. **Load requirements:** Read `.planning/REQUIREMENTS.md` for the phase's requirement IDs, `.planning/ROADMAP.md` for success criteria
27
+
28
+ 2. **Run the test suite:**
29
+ ```bash
30
+ npm test
31
+ npm run test:coverage
32
+ npx tsc --noEmit
33
+ npm run lint
34
+ ```
35
+
36
+ 3. **Check each requirement:** For each requirement ID listed for the phase, verify:
37
+ - Is there test coverage?
38
+ - Does the implementation exist?
39
+ - Does it match the requirement description?
40
+
41
+ 4. **Check success criteria:** Evaluate each criterion from ROADMAP.md — TRUE or FALSE with evidence
42
+
43
+ 5. **Write the report:** `.planning/phases/[NN]-[phase-name]/VERIFICATION.md`
44
+
45
+ 6. **Update REQUIREMENTS.md:** Mark completed requirements as `[x]`
46
+
47
+ 7. **Hand off:**
48
+ - If PASS: inform the user the phase is verified ✅
49
+ - If FAIL: hand off to Executor with a list of gaps to close
50
+
51
+ ## What I Produce
52
+
53
+ A VERIFICATION.md file with:
54
+ - Test results (counts, coverage %, TypeScript errors, lint warnings)
55
+ - Requirements coverage table (each req ID with status and evidence)
56
+ - Success criteria evaluation
57
+ - PASS / FAIL verdict
58
+ - Gap list (if FAIL) with fix descriptions
59
+
60
+ ## Trigger Phrases
61
+
62
+ "Verify phase [N]", "Check my work", "Does this meet the requirements?", "Run verification"
63
+
64
+ ## Reference Documents
65
+
66
+ - [.planning/REQUIREMENTS.md](../../../.planning/REQUIREMENTS.md) — requirements with IDs
67
+ - [.planning/ROADMAP.md](../../../.planning/ROADMAP.md) — success criteria per phase
68
+ - [.planning/codebase/TESTING.md](../../../.planning/codebase/TESTING.md) — how to run tests
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: System Architecture
3
+ description: System architecture, layer organization, data flow, and component boundaries for backend, API, and refactoring work
4
+ ---
5
+
6
+ # System Architecture
7
+
8
+ > Full architecture reference: [.planning/codebase/ARCHITECTURE.md](../../../.planning/codebase/ARCHITECTURE.md)
9
+ >
10
+ > Read this document when: designing new features, deciding where logic belongs, refactoring, or resolving layer violations.
11
+
12
+ ## Core Principle
13
+
14
+ Code belongs in the correct layer. Moving logic between layers is a refactoring task, not a shortcut.
15
+
16
+ ## Layer Summary
17
+
18
+ Read `.planning/codebase/ARCHITECTURE.md` for the full diagram and data flow examples. Key rules:
19
+
20
+ - **Routes/Controllers:** parse input, validate, delegate to service — no business logic here
21
+ - **Services:** all business logic lives here — no direct DB calls, no HTTP knowledge
22
+ - **Repositories:** all database access here — raw queries or ORM calls only, no business logic
23
+ - **Middleware:** cross-cutting concerns (auth, logging, error handling) — applied at application level
24
+ - **Models:** data shapes and ORM definitions — no behavior
25
+
26
+ ## Decision Guide
27
+
28
+ | Question | Answer in |
29
+ |----------|-----------|
30
+ | Where does this request flow? | `.planning/codebase/ARCHITECTURE.md` → Data Flow |
31
+ | What layer handles this logic? | `.planning/codebase/ARCHITECTURE.md` → Layers |
32
+ | What are the entry points? | `.planning/codebase/ARCHITECTURE.md` → Entry Points |
33
+ | How are errors propagated? | `.planning/codebase/ARCHITECTURE.md` → Cross-Cutting Concerns |
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: Technical Concerns
3
+ description: Technical debt, known bugs, fragile code areas, security considerations, and areas to approach with caution
4
+ ---
5
+
6
+ # Technical Concerns
7
+
8
+ > Full concerns reference: [.planning/codebase/CONCERNS.md](../../../.planning/codebase/CONCERNS.md)
9
+ >
10
+ > Read this document when: refactoring, touching legacy code, working near known fragile areas, or doing security-sensitive work.
11
+
12
+ ## Core Rule
13
+
14
+ **Before modifying code in a warning area, check `.planning/codebase/CONCERNS.md`.** Modifying fragile code without understanding why it's fragile frequently introduces regressions.
15
+
16
+ ## Quick Guide
17
+
18
+ Read `.planning/codebase/CONCERNS.md` for:
19
+ - **Critical issues:** Active bugs or broken functionality — don't make them worse
20
+ - **High-priority debt:** Significant friction or risk areas worth knowing about
21
+ - **Fragile areas table:** Specific files that are risky to modify and HOW to proceed safely
22
+ - **Security notes:** Known vulnerabilities, applied mitigations, what not to bypass
23
+ - **Performance bottlenecks:** Known slow paths and their workarounds
24
+
25
+ ## Rules
26
+
27
+ - After fixing a known issue, **remove it from CONCERNS.md** or mark it resolved
28
+ - After discovering a new issue, **add it to CONCERNS.md** — don't leave land mines undocumented
29
+ - When a fix is deferred, add a `// TODO(issue-ref):` comment at the affected location
30
+ - **Never introduce new `any` types, disable linting rules, or skip test coverage** without documenting the reason in CONCERNS.md
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: Coding Conventions
3
+ description: Coding style, naming conventions, error handling, and formatting standards for this codebase
4
+ applyTo: "**/*.{ts,tsx,js,jsx,mts,cts}"
5
+ ---
6
+
7
+ # Coding Conventions
8
+
9
+ > Full conventions reference: [.planning/codebase/CONVENTIONS.md](../../../.planning/codebase/CONVENTIONS.md)
10
+ >
11
+ > **This file is auto-loaded when you edit source files. Always follow these patterns.**
12
+ > When in doubt, look at existing files in the codebase and match their style.
13
+
14
+ ## Quick Reference
15
+
16
+ Read `.planning/codebase/CONVENTIONS.md` for the full guide. Key rules:
17
+
18
+ - **Naming:** variables/functions = `camelCase`, classes = `PascalCase`, constants = `SCREAMING_SNAKE_CASE`, files = `kebab-case.ts`
19
+ - **Imports:** built-ins → external packages → internal (`@/`) → relative — always in this order
20
+ - **Error handling:** never swallow errors silently; use custom error classes; let `src/middleware/error.ts` handle HTTP errors
21
+ - **Functions:** single responsibility; max ~50 lines; prefer early returns over deep nesting; always annotate return types
22
+ - **Comments:** explain WHY not WHAT; JSDoc on all exported functions; include ticket ref in TODO comments
23
+ - **No `any`:** use `unknown` + type guards instead; strict TypeScript throughout
24
+
25
+ When writing new code, always check `.planning/codebase/CONVENTIONS.md` to confirm you're matching the exact patterns established in this codebase.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: External Integrations
3
+ description: External API integrations, third-party services, SDK usage patterns, and service configuration
4
+ ---
5
+
6
+ # External Integrations
7
+
8
+ > Full integrations reference: [.planning/codebase/INTEGRATIONS.md](../../../.planning/codebase/INTEGRATIONS.md)
9
+ >
10
+ > Read this document when: touching external service code, adding a new integration, debugging third-party API issues, or handling webhooks.
11
+
12
+ ## Core Rule
13
+
14
+ **Before writing code that touches an external service, read the relevant section in `.planning/codebase/INTEGRATIONS.md`.** It documents which SDK is used, where the client is initialized, how errors are handled, and which environment variables are required.
15
+
16
+ ## Quick Guide
17
+
18
+ Read `.planning/codebase/INTEGRATIONS.md` for:
19
+ - **Database:** ORM/client used, connection config location, migration commands
20
+ - **Authentication:** Provider, middleware location, how user identity is propagated
21
+ - **Payment / billing:** SDK, webhook handling location, key operations
22
+ - **Email:** Provider, template locations, key send operations
23
+ - **CI/CD:** Pipeline config, what triggers what
24
+
25
+ ## Rules
26
+
27
+ - **Client singletons:** never create a new SDK client instance inside a function — use the initialized instance from `src/config/`
28
+ - **Environment variables:** required vars for each service are documented in INTEGRATIONS.md — ensure they're in `.env.example`
29
+ - **Webhook security:** always verify webhook signatures; never trust payload without verification
30
+ - New integrations: add the service to INTEGRATIONS.md with its SDK, config location, and env vars before implementing
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: Technology Stack
3
+ description: Technology stack, framework choices, key dependencies, runtime environment, and configuration
4
+ ---
5
+
6
+ # Technology Stack
7
+
8
+ > Full stack reference: [.planning/codebase/STACK.md](../../../.planning/codebase/STACK.md)
9
+ >
10
+ > Read this document when: adding dependencies, modifying configuration, setting up environments, or debugging infrastructure issues.
11
+
12
+ ## Core Rule
13
+
14
+ **Do not introduce new dependencies or change the build configuration without first checking `.planning/codebase/STACK.md`.** The stack is intentional — changes to core dependencies have broad impact.
15
+
16
+ ## Quick Guide
17
+
18
+ Read `.planning/codebase/STACK.md` for:
19
+ - **Runtime:** Language version, Node.js version, package manager
20
+ - **Key frameworks:** Web framework, ORM, auth library — and how they're configured
21
+ - **Dev toolchain:** TypeScript config, ESLint, Prettier, test runner setup
22
+ - **Infrastructure:** Database, cache, object storage, message queue details
23
+ - **Environment variables:** Full list of required env vars and their purpose
24
+
25
+ ## Rules
26
+
27
+ - Always check if a required capability already exists in the stack before adding a new package
28
+ - New dependencies: add to the appropriate section in STACK.md after installation
29
+ - Breaking upgrades: document the upgrade decision in `.planning/PROJECT.md` Key Decisions
30
+ - **Never read `.env` file contents** — work only with `.env.example` and environment variable names
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: File Structure
3
+ description: File and directory organization, naming conventions, and where to place new code, components, routes, or modules
4
+ ---
5
+
6
+ # File Structure
7
+
8
+ > Full structure reference: [.planning/codebase/STRUCTURE.md](../../../.planning/codebase/STRUCTURE.md)
9
+ >
10
+ > Read this document when: creating new files, deciding on location for new code, or setting up new modules.
11
+
12
+ ## Core Rule
13
+
14
+ **Always check `.planning/codebase/STRUCTURE.md` before creating a new file.** It contains a "Where to Put New Code" table that answers exactly where each type of file belongs and what naming convention to use.
15
+
16
+ ## Quick Guide
17
+
18
+ | I'm creating... | Check STRUCTURE.md section |
19
+ |----------------|---------------------------|
20
+ | A new API endpoint | "Where to Put New Code" → routes row |
21
+ | A new service | "Where to Put New Code" → services row |
22
+ | A new component | "Where to Put New Code" → components row |
23
+ | A test for existing code | Mirror the source path in the `tests/` directory |
24
+ | A new database model | "Where to Put New Code" → models row |
25
+ | A utility function | "Where to Put New Code" → utilities row |
26
+
27
+ ## Rules
28
+
29
+ - **Never create files at the root of `src/`** — always find the correct subdirectory
30
+ - **Follow the naming convention exactly** as specified in STRUCTURE.md for each file type
31
+ - **Use barrel exports (`index.ts`)** where the pattern exists — don't skip them for convenience
32
+ - When creating a feature that spans multiple layers (route + service + repository), create all files before wiring them together
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: Testing Patterns
3
+ description: Test framework, patterns, mocking strategy, and test organization for writing and running tests
4
+ applyTo: "**/*.{test,spec}.{ts,tsx,js,jsx}"
5
+ ---
6
+
7
+ # Testing Patterns
8
+
9
+ > Full testing reference: [.planning/codebase/TESTING.md](../../../.planning/codebase/TESTING.md)
10
+ >
11
+ > **This file is auto-loaded when you edit test files. Always follow these patterns.**
12
+
13
+ ## Quick Reference
14
+
15
+ Read `.planning/codebase/TESTING.md` for the full guide. Key rules:
16
+
17
+ - **Structure:** `describe('[ClassName/Function]')` → `describe('[methodName()]')` → `it('[readable description of behavior]')`
18
+ - **Pattern:** Arrange-Act-Assert — comment each section if the test is non-trivial
19
+ - **Test data:** always use factory functions from `tests/helpers/factories.ts`, never hardcoded raw objects
20
+ - **Mocking:** mock at the outermost layer (repositories for service tests, network for integration tests); use `vi.mock()` / `jest.mock()`
21
+ - **Isolation:** each test must pass in isolation and in any order; no shared mutable state between tests
22
+ - **What to test:** business logic, API contract (status codes + response shape), error paths, edge cases
23
+ - **What NOT to test:** framework internals, private implementation details, trivial getters/setters
24
+
25
+ When writing a new test, check `.planning/codebase/TESTING.md` for the exact patterns used in this project, including how the test database is set up for integration tests.
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: execute-phase
3
+ description: Execute a planned phase step-by-step, implementing each plan and running tests
4
+ mode: agent
5
+ tools:
6
+ - editFiles
7
+ - runTerminalCommand
8
+ - search
9
+ ---
10
+
11
+ # Execute Phase
12
+
13
+ **Usage:** `/execute-phase [phase-number]` — e.g., `/execute-phase 1`
14
+
15
+ Implement the planned phase. Execute each plan in sequence, following established conventions and committing after each completed plan.
16
+
17
+ ## Step 1: Load Execution Context
18
+
19
+ Read these files:
20
+ - `.planning/ROADMAP.md` — find the phase and its plans
21
+ - `.planning/phases/[NN]-[phase-name]/` — load all plan files for this phase
22
+ - `.planning/codebase/CONVENTIONS.md` — coding standards to follow throughout
23
+ - `.planning/codebase/STRUCTURE.md` — where to place new files
24
+ - `.planning/codebase/CONCERNS.md` — fragile areas to handle carefully
25
+ - `.planning/STATE.md` — current position and any blockers
26
+
27
+ If `.planning/continue-here.md` exists, read it first — it tells you exactly where to resume.
28
+
29
+ ## Step 2: Pre-flight Check
30
+
31
+ Before writing any code:
32
+ ```bash
33
+ # Verify tests are passing before starting
34
+ npm test 2>&1 | tail -20
35
+
36
+ # Check TypeScript compilation
37
+ npx tsc --noEmit 2>&1 | head -20
38
+
39
+ # Confirm current branch and status
40
+ git status
41
+ git branch --show-current
42
+ ```
43
+
44
+ If tests are already failing before you start, note them in STATE.md and proceed cautiously.
45
+
46
+ ## Step 3: Execute Plans
47
+
48
+ For each plan file in the phase (in order):
49
+
50
+ ### 3a. Read the plan fully before writing any code
51
+
52
+ Understand all steps and success criteria before implementing step 1.
53
+
54
+ ### 3b. Implement step by step
55
+
56
+ Follow the plan's steps precisely:
57
+ - Create files in the correct location (check `.planning/codebase/STRUCTURE.md`)
58
+ - Follow naming conventions (check `.planning/codebase/CONVENTIONS.md`)
59
+ - Before touching any file listed in `.planning/codebase/CONCERNS.md` fragile areas — re-read that section
60
+ - Write tests for each piece of functionality before moving to the next
61
+
62
+ ### 3c. Verify after each step
63
+
64
+ ```bash
65
+ # Run tests after each meaningful change
66
+ npm test
67
+
68
+ # Type-check
69
+ npx tsc --noEmit
70
+ ```
71
+
72
+ Fix failures immediately — don't accumulate broken tests.
73
+
74
+ ### 3d. Commit after each completed plan
75
+
76
+ ```bash
77
+ git add -A
78
+ git commit -m "[NN]-[plan]: [descriptive message]
79
+
80
+ - [What was implemented]
81
+ - [Tests written]
82
+ - [Key decisions]"
83
+ ```
84
+
85
+ ### 3e. Update ROADMAP.md
86
+
87
+ Mark the completed plan:
88
+ ```
89
+ - [x] [NN]-01: [Description] ← mark completed
90
+ ```
91
+
92
+ ## Step 4: Post-Phase Verification
93
+
94
+ After all plans in the phase are complete:
95
+
96
+ ```bash
97
+ # Full test suite
98
+ npm test
99
+
100
+ # Coverage check
101
+ npm run test:coverage
102
+
103
+ # Type check
104
+ npx tsc --noEmit
105
+
106
+ # Lint
107
+ npm run lint
108
+ ```
109
+
110
+ Verify against the phase's **Success Criteria** in ROADMAP.md — each criterion must be TRUE.
111
+
112
+ ## Step 5: Update State
113
+
114
+ Update `.planning/STATE.md`:
115
+ - Mark phase complete if all plans done
116
+ - Update progress percentage
117
+ - Advance to next phase
118
+
119
+ Update `.planning/ROADMAP.md`:
120
+ - Mark phase checkbox: `- [x] **Phase N: ...**`
121
+
122
+ ## Handling Blockers
123
+
124
+ If you hit a significant blocker (ambiguous requirement, architectural conflict, missing context):
125
+ 1. Document the blocker in `.planning/STATE.md`
126
+ 2. Run `/pause-work` to save session state
127
+ 3. Describe the blocker clearly for the user to resolve
128
+
129
+ ## Completion
130
+
131
+ Print a summary:
132
+ ```
133
+ ✅ Phase [N] complete: [Phase Name]
134
+
135
+ Implemented:
136
+ - [NN]-01: [Name] — [key outcome]
137
+ - [NN]-02: [Name] — [key outcome]
138
+
139
+ Tests: [N] passing, 0 failing
140
+ Coverage: [X]%
141
+
142
+ Success Criteria:
143
+ ✅ [Criterion 1]
144
+ ✅ [Criterion 2]
145
+ ✅ [Criterion 3]
146
+
147
+ Run /verify-work [N] to validate against requirements.
148
+ ```
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: map-codebase
3
+ description: Analyze the codebase and generate structured context documents in .planning/codebase/
4
+ mode: agent
5
+ tools:
6
+ - editFiles
7
+ - runTerminalCommand
8
+ - search
9
+ - fetch
10
+ ---
11
+
12
+ # Map Codebase
13
+
14
+ Analyze this codebase thoroughly and generate 7 structured context documents in `.planning/codebase/`. These documents will be used by Copilot on every future request to understand the project's architecture, conventions, and constraints.
15
+
16
+ ## Process
17
+
18
+ Work through 4 focus areas in sequence. For each area, explore the codebase using the terminal and search tools, then write the document(s) directly to `.planning/codebase/`.
19
+
20
+ ---
21
+
22
+ ### Focus 1: Technology Stack → STACK.md + INTEGRATIONS.md
23
+
24
+ **Explore:**
25
+ ```bash
26
+ # Package manifests
27
+ cat package.json 2>/dev/null | head -100
28
+ cat requirements.txt 2>/dev/null || cat pyproject.toml 2>/dev/null | head -50
29
+ cat go.mod 2>/dev/null | head -30
30
+
31
+ # Config files (list only — NEVER read .env contents)
32
+ ls -la *.config.* tsconfig.json .nvmrc .python-version 2>/dev/null
33
+ ls .env* 2>/dev/null # Note existence only
34
+
35
+ # Find external integrations
36
+ grep -r "import.*stripe\|import.*supabase\|import.*aws\|import.*prisma\|import.*redis\|import.*sendgrid\|import.*twilio\|import.*openai" src/ --include="*.ts" --include="*.py" 2>/dev/null | head -40
37
+ ```
38
+
39
+ **Write `.planning/codebase/STACK.md`** with: runtime, frameworks, key dependencies table, dev toolchain, infrastructure, environment variables.
40
+
41
+ **Write `.planning/codebase/INTEGRATIONS.md`** with: a section per external service including SDK used, config file location, required env vars, key operations.
42
+
43
+ ---
44
+
45
+ ### Focus 2: Architecture + Structure → ARCHITECTURE.md + STRUCTURE.md
46
+
47
+ **Explore:**
48
+ ```bash
49
+ # Directory structure
50
+ find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/.planning/*' -not -path '*/.github/*' | sort | head -60
51
+
52
+ # Entry points
53
+ ls src/index.* src/main.* src/app.* src/server.* app/page.* 2>/dev/null
54
+
55
+ # Understanding layer imports
56
+ grep -r "^import\|^from" src/ --include="*.ts" --include="*.py" 2>/dev/null | head -80
57
+ ```
58
+
59
+ **Write `.planning/codebase/ARCHITECTURE.md`** with: architectural style + rationale, layer diagram with file paths, data flow example (trace a typical request end-to-end), key abstractions table, entry points table, cross-cutting concerns (error handling, logging, auth, validation).
60
+
61
+ **Write `.planning/codebase/STRUCTURE.md`** with: root layout, source tree, and most importantly a **"Where to Put New Code"** table that tells exactly which directory and naming convention to use for each type of file (routes, services, repositories, models, utils, tests, components, etc.).
62
+
63
+ ---
64
+
65
+ ### Focus 3: Conventions + Testing → CONVENTIONS.md + TESTING.md
66
+
67
+ **Explore:**
68
+ ```bash
69
+ # Formatting/linting config
70
+ cat .prettierrc .eslintrc.js .eslintrc.json biome.json 2>/dev/null | head -60
71
+ cat pyproject.toml 2>/dev/null | grep -A 20 "\[tool\."
72
+
73
+ # Test framework
74
+ ls jest.config.* vitest.config.* pytest.ini setup.cfg 2>/dev/null
75
+ find . -name "*.test.*" -o -name "*.spec.*" | grep -v node_modules | head -20
76
+
77
+ # Look at real code for patterns
78
+ find src/ -name "*.ts" -not -name "*.test.*" 2>/dev/null | head -5 | xargs head -40 2>/dev/null
79
+ find tests/ -name "*.test.*" 2>/dev/null | head -3 | xargs head -60 2>/dev/null
80
+ ```
81
+
82
+ **Write `.planning/codebase/CONVENTIONS.md`** — be prescriptive ("Use X" not "X is used"). Include: language/formatting rules, naming conventions table, import ordering, error handling patterns, function patterns, TypeScript specifics, comment style. Include real code examples from the codebase.
83
+
84
+ **Write `.planning/codebase/TESTING.md`** with: test framework and run commands, file organization, test structure pattern with real example, mocking strategy, test data approach (factories), integration test setup, what to test and what NOT to test.
85
+
86
+ ---
87
+
88
+ ### Focus 4: Technical Concerns → CONCERNS.md
89
+
90
+ **Explore:**
91
+ ```bash
92
+ # TODO/FIXME/HACK comments
93
+ grep -rn "TODO\|FIXME\|HACK\|XXX\|TEMP\|@deprecated" src/ --include="*.ts" --include="*.py" 2>/dev/null | head -40
94
+
95
+ # Potential issues
96
+ grep -rn "any\b\|@ts-ignore\|@ts-nocheck\|eslint-disable\|# type: ignore\|# noqa" src/ --include="*.ts" --include="*.py" 2>/dev/null | head -30
97
+
98
+ # Security patterns
99
+ grep -rn "eval\|innerHTML\|dangerouslySetInnerHTML\|exec\|shell=True" src/ --include="*.ts" --include="*.py" 2>/dev/null | head -20
100
+
101
+ # Large/complex files
102
+ find src/ -name "*.ts" -o -name "*.py" 2>/dev/null | xargs wc -l 2>/dev/null | sort -rn | head -15
103
+ ```
104
+
105
+ **Write `.planning/codebase/CONCERNS.md`** with: health summary table (critical/high/medium counts), critical issues section (with file paths, impact, root cause, fix approach), high-priority debt, fragile areas table with safe-approach guidance, security notes, performance bottlenecks, scaling limits.
106
+
107
+ ---
108
+
109
+ ## Completion
110
+
111
+ After all 7 files are written, update `.github/copilot-instructions.md`:
112
+ - Fill in the "What This Project Is" section from what you learned
113
+ - Keep it to 2-3 sentences describing what the product does
114
+
115
+ Then confirm: "Codebase mapping complete. Generated 7 documents in `.planning/codebase/`. Use `/sync-instructions` to update the Copilot instructions digest."