opencastle 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +215 -0
- package/bin/cli.mjs +69 -0
- package/dist/cli/adapters/claude-code.d.ts +22 -0
- package/dist/cli/adapters/claude-code.d.ts.map +1 -0
- package/dist/cli/adapters/claude-code.js +237 -0
- package/dist/cli/adapters/claude-code.js.map +1 -0
- package/dist/cli/adapters/cursor.d.ts +20 -0
- package/dist/cli/adapters/cursor.d.ts.map +1 -0
- package/dist/cli/adapters/cursor.js +231 -0
- package/dist/cli/adapters/cursor.js.map +1 -0
- package/dist/cli/adapters/vscode.d.ts +20 -0
- package/dist/cli/adapters/vscode.d.ts.map +1 -0
- package/dist/cli/adapters/vscode.js +132 -0
- package/dist/cli/adapters/vscode.js.map +1 -0
- package/dist/cli/copy.d.ts +14 -0
- package/dist/cli/copy.d.ts.map +1 -0
- package/dist/cli/copy.js +62 -0
- package/dist/cli/copy.js.map +1 -0
- package/dist/cli/dashboard.d.ts +3 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +183 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/cli/diff.d.ts +3 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +27 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/eject.d.ts +3 -0
- package/dist/cli/eject.d.ts.map +1 -0
- package/dist/cli/eject.js +27 -0
- package/dist/cli/eject.js.map +1 -0
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +92 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/manifest.d.ts +14 -0
- package/dist/cli/manifest.d.ts.map +1 -0
- package/dist/cli/manifest.js +34 -0
- package/dist/cli/manifest.js.map +1 -0
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +35 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/prompt.d.ts +12 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +104 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/run/adapters/claude-code.d.ts +16 -0
- package/dist/cli/run/adapters/claude-code.d.ts.map +1 -0
- package/dist/cli/run/adapters/claude-code.js +82 -0
- package/dist/cli/run/adapters/claude-code.js.map +1 -0
- package/dist/cli/run/adapters/copilot.d.ts +16 -0
- package/dist/cli/run/adapters/copilot.d.ts.map +1 -0
- package/dist/cli/run/adapters/copilot.js +84 -0
- package/dist/cli/run/adapters/copilot.js.map +1 -0
- package/dist/cli/run/adapters/cursor.d.ts +16 -0
- package/dist/cli/run/adapters/cursor.d.ts.map +1 -0
- package/dist/cli/run/adapters/cursor.js +81 -0
- package/dist/cli/run/adapters/cursor.js.map +1 -0
- package/dist/cli/run/adapters/index.d.ts +14 -0
- package/dist/cli/run/adapters/index.d.ts.map +1 -0
- package/dist/cli/run/adapters/index.js +35 -0
- package/dist/cli/run/adapters/index.js.map +1 -0
- package/dist/cli/run/executor.d.ts +15 -0
- package/dist/cli/run/executor.d.ts.map +1 -0
- package/dist/cli/run/executor.js +249 -0
- package/dist/cli/run/executor.js.map +1 -0
- package/dist/cli/run/reporter.d.ts +10 -0
- package/dist/cli/run/reporter.d.ts.map +1 -0
- package/dist/cli/run/reporter.js +112 -0
- package/dist/cli/run/reporter.js.map +1 -0
- package/dist/cli/run/schema.d.ts +28 -0
- package/dist/cli/run/schema.d.ts.map +1 -0
- package/dist/cli/run/schema.js +511 -0
- package/dist/cli/run/schema.js.map +1 -0
- package/dist/cli/run.d.ts +6 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +123 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/stack-config.d.ts +12 -0
- package/dist/cli/stack-config.d.ts.map +1 -0
- package/dist/cli/stack-config.js +146 -0
- package/dist/cli/stack-config.js.map +1 -0
- package/dist/cli/types.d.ts +169 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/update.d.ts +3 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/update.js +50 -0
- package/dist/cli/update.js.map +1 -0
- package/package.json +48 -0
- package/src/cli/adapters/claude-code.ts +287 -0
- package/src/cli/adapters/cursor.ts +377 -0
- package/src/cli/adapters/vscode.ts +168 -0
- package/src/cli/copy.ts +79 -0
- package/src/cli/dashboard.ts +225 -0
- package/src/cli/diff.ts +44 -0
- package/src/cli/eject.ts +39 -0
- package/src/cli/init.ts +120 -0
- package/src/cli/manifest.ts +45 -0
- package/src/cli/mcp.ts +49 -0
- package/src/cli/prompt.ts +115 -0
- package/src/cli/run/adapters/claude-code.ts +95 -0
- package/src/cli/run/adapters/copilot.ts +97 -0
- package/src/cli/run/adapters/cursor.ts +94 -0
- package/src/cli/run/adapters/index.ts +40 -0
- package/src/cli/run/executor.ts +292 -0
- package/src/cli/run/reporter.ts +129 -0
- package/src/cli/run/schema.ts +595 -0
- package/src/cli/run.ts +137 -0
- package/src/cli/stack-config.ts +180 -0
- package/src/cli/types.ts +207 -0
- package/src/cli/update.ts +75 -0
- package/src/dashboard/astro.config.mjs +6 -0
- package/src/dashboard/package-lock.json +5455 -0
- package/src/dashboard/package.json +14 -0
- package/src/dashboard/public/data/delegations.ndjson +35 -0
- package/src/dashboard/public/data/panels.ndjson +13 -0
- package/src/dashboard/public/data/sessions.ndjson +50 -0
- package/src/dashboard/public/icon-192.png +0 -0
- package/src/dashboard/scripts/generate-seed-data.ts +355 -0
- package/src/dashboard/src/layouts/Layout.astro +25 -0
- package/src/dashboard/src/pages/index.astro +1070 -0
- package/src/dashboard/src/styles/dashboard.css +1078 -0
- package/src/dashboard/tsconfig.json +6 -0
- package/src/orchestrator/agent-workflows/README.md +22 -0
- package/src/orchestrator/agent-workflows/bug-fix.md +128 -0
- package/src/orchestrator/agent-workflows/data-pipeline.md +145 -0
- package/src/orchestrator/agent-workflows/database-migration.md +159 -0
- package/src/orchestrator/agent-workflows/feature-implementation.md +223 -0
- package/src/orchestrator/agent-workflows/performance-optimization.md +125 -0
- package/src/orchestrator/agent-workflows/refactoring.md +142 -0
- package/src/orchestrator/agent-workflows/schema-changes.md +164 -0
- package/src/orchestrator/agent-workflows/security-audit.md +148 -0
- package/src/orchestrator/agent-workflows/shared-delivery-phase.md +33 -0
- package/src/orchestrator/agents/api-designer.agent.md +68 -0
- package/src/orchestrator/agents/architect.agent.md +129 -0
- package/src/orchestrator/agents/content-engineer.agent.md +57 -0
- package/src/orchestrator/agents/copywriter.agent.md +95 -0
- package/src/orchestrator/agents/data-expert.agent.md +63 -0
- package/src/orchestrator/agents/database-engineer.agent.md +62 -0
- package/src/orchestrator/agents/developer.agent.md +66 -0
- package/src/orchestrator/agents/devops-expert.agent.md +57 -0
- package/src/orchestrator/agents/documentation-writer.agent.md +60 -0
- package/src/orchestrator/agents/performance-expert.agent.md +58 -0
- package/src/orchestrator/agents/release-manager.agent.md +72 -0
- package/src/orchestrator/agents/researcher.agent.md +145 -0
- package/src/orchestrator/agents/reviewer.agent.md +62 -0
- package/src/orchestrator/agents/security-expert.agent.md +64 -0
- package/src/orchestrator/agents/seo-specialist.agent.md +67 -0
- package/src/orchestrator/agents/team-lead.agent.md +644 -0
- package/src/orchestrator/agents/testing-expert.agent.md +85 -0
- package/src/orchestrator/agents/ui-ux-expert.agent.md +63 -0
- package/src/orchestrator/copilot-instructions.md +3 -0
- package/src/orchestrator/customizations/AGENT-EXPERTISE.md +325 -0
- package/src/orchestrator/customizations/AGENT-FAILURES.md +69 -0
- package/src/orchestrator/customizations/AGENT-PERFORMANCE.md +58 -0
- package/src/orchestrator/customizations/DISPUTES.md +162 -0
- package/src/orchestrator/customizations/KNOWLEDGE-GRAPH.md +10 -0
- package/src/orchestrator/customizations/LESSONS-LEARNED.md +70 -0
- package/src/orchestrator/customizations/README.md +59 -0
- package/src/orchestrator/customizations/agents/agent-registry.md +46 -0
- package/src/orchestrator/customizations/agents/skill-matrix.md +142 -0
- package/src/orchestrator/customizations/logs/README.md +181 -0
- package/src/orchestrator/customizations/logs/delegations.ndjson +1 -0
- package/src/orchestrator/customizations/logs/panels.ndjson +1 -0
- package/src/orchestrator/customizations/logs/sessions.ndjson +1 -0
- package/src/orchestrator/customizations/project/docs-structure.md +23 -0
- package/src/orchestrator/customizations/project/tracker-config.md +45 -0
- package/src/orchestrator/customizations/project.instructions.md +64 -0
- package/src/orchestrator/customizations/stack/api-config.md +37 -0
- package/src/orchestrator/customizations/stack/cms-config.md +26 -0
- package/src/orchestrator/customizations/stack/data-pipeline-config.md +41 -0
- package/src/orchestrator/customizations/stack/database-config.md +44 -0
- package/src/orchestrator/customizations/stack/deployment-config.md +45 -0
- package/src/orchestrator/customizations/stack/testing-config.md +56 -0
- package/src/orchestrator/instructions/ai-optimization.instructions.md +143 -0
- package/src/orchestrator/instructions/general.instructions.md +194 -0
- package/src/orchestrator/mcp.json +55 -0
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +235 -0
- package/src/orchestrator/prompts/brainstorm.prompt.md +115 -0
- package/src/orchestrator/prompts/bug-fix.prompt.md +141 -0
- package/src/orchestrator/prompts/create-skill.prompt.md +103 -0
- package/src/orchestrator/prompts/generate-task-spec.prompt.md +154 -0
- package/src/orchestrator/prompts/implement-feature.prompt.md +124 -0
- package/src/orchestrator/prompts/metrics-report.prompt.md +142 -0
- package/src/orchestrator/prompts/quick-refinement.prompt.md +137 -0
- package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +100 -0
- package/src/orchestrator/skills/accessibility-standards/SKILL.md +164 -0
- package/src/orchestrator/skills/agent-hooks/SKILL.md +147 -0
- package/src/orchestrator/skills/agent-memory/SKILL.md +144 -0
- package/src/orchestrator/skills/api-patterns/SKILL.md +106 -0
- package/src/orchestrator/skills/browser-testing/SKILL.md +203 -0
- package/src/orchestrator/skills/code-commenting/SKILL.md +133 -0
- package/src/orchestrator/skills/contentful-cms/SKILL.md +43 -0
- package/src/orchestrator/skills/context-map/SKILL.md +135 -0
- package/src/orchestrator/skills/convex-database/SKILL.md +80 -0
- package/src/orchestrator/skills/data-engineering/SKILL.md +99 -0
- package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +49 -0
- package/src/orchestrator/skills/documentation-standards/SKILL.md +85 -0
- package/src/orchestrator/skills/fast-review/SKILL.md +327 -0
- package/src/orchestrator/skills/frontend-design/SKILL.md +42 -0
- package/src/orchestrator/skills/jira-management/SKILL.md +168 -0
- package/src/orchestrator/skills/memory-merger/SKILL.md +123 -0
- package/src/orchestrator/skills/nextjs-patterns/SKILL.md +75 -0
- package/src/orchestrator/skills/nx-workspace/SKILL.md +192 -0
- package/src/orchestrator/skills/panel-majority-vote/SKILL.md +184 -0
- package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +38 -0
- package/src/orchestrator/skills/performance-optimization/SKILL.md +101 -0
- package/src/orchestrator/skills/react-development/SKILL.md +117 -0
- package/src/orchestrator/skills/sanity-cms/SKILL.md +18 -0
- package/src/orchestrator/skills/security-hardening/SKILL.md +118 -0
- package/src/orchestrator/skills/self-improvement/SKILL.md +137 -0
- package/src/orchestrator/skills/seo-patterns/SKILL.md +40 -0
- package/src/orchestrator/skills/session-checkpoints/SKILL.md +205 -0
- package/src/orchestrator/skills/slack-notifications/SKILL.md +211 -0
- package/src/orchestrator/skills/strapi-cms/SKILL.md +43 -0
- package/src/orchestrator/skills/supabase-database/SKILL.md +24 -0
- package/src/orchestrator/skills/task-management/SKILL.md +143 -0
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +317 -0
- package/src/orchestrator/skills/teams-notifications/SKILL.md +249 -0
- package/src/orchestrator/skills/testing-workflow/SKILL.md +134 -0
- package/src/orchestrator/skills/validation-gates/SKILL.md +100 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Workflow: Performance Optimization
|
|
2
|
+
|
|
3
|
+
Measure-first optimization workflow. Never optimize without profiling data.
|
|
4
|
+
|
|
5
|
+
## Phases
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Phase 1: Baseline Measurement (sub-agent, inline)
|
|
9
|
+
Phase 2: Analysis (sub-agent, inline)
|
|
10
|
+
Phase 3: Optimization (background agents, parallel)
|
|
11
|
+
Phase 4: Verification (sub-agent, inline)
|
|
12
|
+
Phase 5: Compound (direct, Team Lead)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Branch & Delivery Strategy
|
|
18
|
+
|
|
19
|
+
Follow the **Delivery Outcome** in `general.instructions.md` and the **Branch Ownership** rules in `team-lead.agent.md`. Branch naming: `perf/<ticket-id>-<short-description>` or `feat/<ticket-id>-<short-description>`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Phase 1: Baseline Measurement
|
|
24
|
+
|
|
25
|
+
**Agent:** Performance Expert (via sub-agent)
|
|
26
|
+
**Type:** Sub-agent (inline)
|
|
27
|
+
|
|
28
|
+
### Steps
|
|
29
|
+
|
|
30
|
+
1. Build the affected app(s) with production config
|
|
31
|
+
2. Run Lighthouse audit on key pages
|
|
32
|
+
3. Measure bundle size (`yarn nx run <app>:build` output)
|
|
33
|
+
4. Record Core Web Vitals: LCP, FID/INP, CLS, TTFB
|
|
34
|
+
5. Profile server-side rendering time
|
|
35
|
+
6. Document baseline metrics
|
|
36
|
+
|
|
37
|
+
### Key Pages to Measure
|
|
38
|
+
|
|
39
|
+
> See `project.instructions.md` for the app inventory and key routes. Prioritize pages with the most traffic and the most complex rendering.
|
|
40
|
+
|
|
41
|
+
### Exit Criteria
|
|
42
|
+
|
|
43
|
+
- [ ] Baseline metrics recorded for all key pages
|
|
44
|
+
- [ ] Bundle size documented
|
|
45
|
+
- [ ] Lighthouse scores saved
|
|
46
|
+
- [ ] Linear issue created with targets
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Phase 2: Analysis
|
|
51
|
+
|
|
52
|
+
**Agent:** Performance Expert (via sub-agent)
|
|
53
|
+
**Type:** Sub-agent (inline)
|
|
54
|
+
|
|
55
|
+
### Steps
|
|
56
|
+
|
|
57
|
+
1. Identify the top 3 performance bottlenecks
|
|
58
|
+
2. Analyze bundle composition (largest chunks)
|
|
59
|
+
3. Check for unnecessary client-side JavaScript
|
|
60
|
+
4. Review image optimization (WebP/AVIF, lazy loading, sizing)
|
|
61
|
+
5. Check caching headers and ISR configuration
|
|
62
|
+
6. Review database query performance (if applicable)
|
|
63
|
+
7. Prioritize optimizations by impact/effort
|
|
64
|
+
|
|
65
|
+
### Exit Criteria
|
|
66
|
+
|
|
67
|
+
- [ ] Top 3 bottlenecks identified with evidence
|
|
68
|
+
- [ ] Optimization plan created (ordered by impact)
|
|
69
|
+
- [ ] Each optimization has expected improvement estimate
|
|
70
|
+
- [ ] File partitions mapped for parallel work
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Phase 3: Optimization (Parallel)
|
|
75
|
+
|
|
76
|
+
**Agents:** Varies by optimization type
|
|
77
|
+
**Type:** Background agents (parallel where file partitions allow)
|
|
78
|
+
|
|
79
|
+
### Typical Tracks
|
|
80
|
+
|
|
81
|
+
| Track | Agent | Focus | Files |
|
|
82
|
+
|-------|-------|-------|-------|
|
|
83
|
+
| A: Bundle | Performance Expert | Code splitting, tree shaking, dynamic imports | `app/`, `libs/` |
|
|
84
|
+
| B: Images | UI/UX Expert | Image optimization, lazy loading, srcset | `components/`, `public/` |
|
|
85
|
+
| C: Queries | Developer | Query optimization, caching | Query library, framework config |
|
|
86
|
+
| D: Database | Database Engineer | Index optimization, query planning | Database migrations |
|
|
87
|
+
|
|
88
|
+
### Exit Criteria (per track)
|
|
89
|
+
|
|
90
|
+
- [ ] Optimization implemented
|
|
91
|
+
- [ ] Lint + test + build pass
|
|
92
|
+
- [ ] Output contract with before/after metrics
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Phase 4: Verification
|
|
97
|
+
|
|
98
|
+
**Agent:** Performance Expert (via sub-agent)
|
|
99
|
+
**Type:** Sub-agent (inline)
|
|
100
|
+
|
|
101
|
+
### Steps
|
|
102
|
+
|
|
103
|
+
1. Rebuild with production config
|
|
104
|
+
2. Re-run Lighthouse on same pages as Phase 1
|
|
105
|
+
3. Compare metrics: before vs. after
|
|
106
|
+
4. Verify no visual regressions (browser test)
|
|
107
|
+
5. Confirm no functional regressions (test suite)
|
|
108
|
+
6. Document results
|
|
109
|
+
|
|
110
|
+
### Exit Criteria
|
|
111
|
+
|
|
112
|
+
- [ ] Metrics improved (or justified why not)
|
|
113
|
+
- [ ] No visual regressions
|
|
114
|
+
- [ ] No functional regressions
|
|
115
|
+
- [ ] Results documented in Linear issue
|
|
116
|
+
- [ ] Roadmap updated
|
|
117
|
+
- [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Phase 5: Delivery (Compound)
|
|
122
|
+
|
|
123
|
+
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
124
|
+
>
|
|
125
|
+
> Commit → Push → PR → Linear linkage. Team Lead owns delivery.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Workflow: Code Refactoring
|
|
2
|
+
|
|
3
|
+
Structured workflow for safe code refactoring — improving code quality without changing behavior.
|
|
4
|
+
|
|
5
|
+
## Phases
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Phase 1: Scope & Baseline (sub-agent, inline)
|
|
9
|
+
Phase 2: Test Coverage Gap (sub-agent or background)
|
|
10
|
+
Phase 3: Refactor Implementation (sub-agent or background)
|
|
11
|
+
Phase 4: Verification (sub-agent, inline)
|
|
12
|
+
Phase 5: Panel Review (sub-agent, for large refactors)
|
|
13
|
+
Phase 6: Compound (direct, Team Lead)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Branch & Delivery Strategy
|
|
19
|
+
|
|
20
|
+
Follow the **Delivery Outcome** in `general.instructions.md` and the **Branch Ownership** rules in `team-lead.agent.md`. Branch naming: `refactor/<ticket-id>-<short-description>`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Phase 1: Scope & Baseline
|
|
25
|
+
|
|
26
|
+
**Agent:** Team Lead (self)
|
|
27
|
+
**Type:** Direct research
|
|
28
|
+
|
|
29
|
+
### Steps
|
|
30
|
+
|
|
31
|
+
1. Identify all files and modules in scope for refactoring
|
|
32
|
+
2. Document current behavior (screenshots, test outputs, API responses)
|
|
33
|
+
3. Run baseline tests: `yarn nx run <project>:test --coverage`
|
|
34
|
+
4. Run baseline lint: `yarn nx run <project>:lint`
|
|
35
|
+
5. Record baseline metrics (test count, coverage %, lint errors, bundle size)
|
|
36
|
+
6. Create Linear issues for the refactoring scope
|
|
37
|
+
|
|
38
|
+
### Exit Criteria
|
|
39
|
+
|
|
40
|
+
- [ ] Scope documented with file list
|
|
41
|
+
- [ ] Baseline metrics recorded
|
|
42
|
+
- [ ] Linear issues created
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Phase 2: Test Coverage Gap
|
|
47
|
+
|
|
48
|
+
**Agent:** Testing Expert
|
|
49
|
+
**Type:** Sub-agent (inline) or background
|
|
50
|
+
|
|
51
|
+
### Steps
|
|
52
|
+
|
|
53
|
+
1. Analyze test coverage for all files in scope
|
|
54
|
+
2. Write missing tests to cover existing behavior BEFORE refactoring
|
|
55
|
+
3. Ensure every function/component being refactored has test coverage
|
|
56
|
+
4. Run full test suite to confirm all new tests pass
|
|
57
|
+
|
|
58
|
+
### Exit Criteria
|
|
59
|
+
|
|
60
|
+
- [ ] All in-scope code has test coverage for existing behavior
|
|
61
|
+
- [ ] No test failures
|
|
62
|
+
- [ ] Coverage report saved
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Phase 3: Refactor Implementation
|
|
67
|
+
|
|
68
|
+
**Agent:** Appropriate specialist (Developer, UI/UX Expert, etc.)
|
|
69
|
+
**Type:** Sub-agent or background (depending on scope)
|
|
70
|
+
|
|
71
|
+
### Steps
|
|
72
|
+
|
|
73
|
+
1. Apply refactoring changes following project conventions
|
|
74
|
+
2. Maintain all existing public APIs and behavior
|
|
75
|
+
3. Run lint and type-check after each significant change
|
|
76
|
+
4. Commit atomic changes (one concern per commit when possible)
|
|
77
|
+
|
|
78
|
+
### File Partition
|
|
79
|
+
|
|
80
|
+
The refactoring agent owns only the scoped files. No changes outside the partition.
|
|
81
|
+
|
|
82
|
+
### Exit Criteria
|
|
83
|
+
|
|
84
|
+
- [ ] Refactoring complete per scope
|
|
85
|
+
- [ ] No lint or type errors
|
|
86
|
+
- [ ] All tests still pass (same count, same behavior)
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Phase 4: Verification
|
|
91
|
+
|
|
92
|
+
**Agent:** Team Lead (self) + Testing Expert
|
|
93
|
+
**Type:** Sub-agent (inline)
|
|
94
|
+
|
|
95
|
+
### Steps
|
|
96
|
+
|
|
97
|
+
1. Run full test suite: `yarn nx run <project>:test`
|
|
98
|
+
2. Run lint: `yarn nx run <project>:lint`
|
|
99
|
+
3. Run build: `yarn nx run <project>:build`
|
|
100
|
+
4. Compare metrics against Phase 1 baseline (test count, coverage, bundle size)
|
|
101
|
+
5. For UI refactors: start dev server and visually verify at all breakpoints
|
|
102
|
+
6. Verify no regressions in dependent code
|
|
103
|
+
|
|
104
|
+
### Exit Criteria
|
|
105
|
+
|
|
106
|
+
- [ ] All tests pass (count >= baseline)
|
|
107
|
+
- [ ] Coverage >= baseline
|
|
108
|
+
- [ ] No new lint errors
|
|
109
|
+
- [ ] Build succeeds
|
|
110
|
+
- [ ] visual verification passed (for UI changes)
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Phase 5: Panel Review (Large Refactors)
|
|
115
|
+
|
|
116
|
+
**Agent:** Panel (3 reviewers)
|
|
117
|
+
**Type:** Sub-agent (inline)
|
|
118
|
+
|
|
119
|
+
### When to use
|
|
120
|
+
|
|
121
|
+
- Refactoring touches >10 files
|
|
122
|
+
- Refactoring changes shared library interfaces
|
|
123
|
+
- Refactoring affects authentication or security code
|
|
124
|
+
|
|
125
|
+
### Steps
|
|
126
|
+
|
|
127
|
+
1. Load **panel-majority-vote** skill
|
|
128
|
+
2. Run panel with question: "Does this refactoring preserve all existing behavior while improving code quality?"
|
|
129
|
+
3. On BLOCK: extract MUST-FIX items and re-delegate
|
|
130
|
+
|
|
131
|
+
### Exit Criteria
|
|
132
|
+
|
|
133
|
+
- [ ] Panel PASS (2/3 majority)
|
|
134
|
+
- [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Phase 6: Delivery (Compound)
|
|
139
|
+
|
|
140
|
+
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
141
|
+
>
|
|
142
|
+
> Commit → Push → PR → Linear linkage. Team Lead owns delivery.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Workflow: Schema / CMS Changes
|
|
2
|
+
|
|
3
|
+
Structured workflow for CMS schema modifications, query updates, and content model changes.
|
|
4
|
+
|
|
5
|
+
> **Project config:** For CMS-specific paths, schema locations, and query library details, see the relevant CMS customization file (e.g., `sanity-config.md`).
|
|
6
|
+
|
|
7
|
+
## Phases
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Phase 1: Schema Analysis (sub-agent, inline)
|
|
11
|
+
Phase 2: Schema Implementation (sub-agent or background)
|
|
12
|
+
Phase 3: Query Updates (sub-agent, sequential)
|
|
13
|
+
Phase 4: Page Integration (sub-agent, sequential)
|
|
14
|
+
Phase 5: Verification (sub-agent, inline)
|
|
15
|
+
Phase 6: Compound (direct, Team Lead)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Branch & Delivery Strategy
|
|
21
|
+
|
|
22
|
+
Follow the **Delivery Outcome** in `general.instructions.md` and the **Branch Ownership** rules in `team-lead.agent.md`. Branch naming: `feat/<ticket-id>-<short-description>` or `chore/<ticket-id>-<short-description>`.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Phase 1: Schema Analysis
|
|
27
|
+
|
|
28
|
+
**Agent:** Content Engineer (via sub-agent)
|
|
29
|
+
**Type:** Sub-agent (inline)
|
|
30
|
+
|
|
31
|
+
### Steps
|
|
32
|
+
|
|
33
|
+
1. Read current CMS schema to understand existing types
|
|
34
|
+
2. Check the data model documentation (see `docs-structure.md`) for field documentation
|
|
35
|
+
3. Check the query library (see CMS customization) for queries that will be affected
|
|
36
|
+
4. Verify schema changes don't conflict with existing content in the CMS
|
|
37
|
+
5. Document field mapping (new vs existing fields)
|
|
38
|
+
6. Create Linear issue with schema change details
|
|
39
|
+
|
|
40
|
+
### Exit Criteria
|
|
41
|
+
|
|
42
|
+
- [ ] Existing schema understood
|
|
43
|
+
- [ ] Impact on data queries assessed
|
|
44
|
+
- [ ] Impact on existing content assessed
|
|
45
|
+
- [ ] Linear issue created
|
|
46
|
+
- [ ] Approach decided (new type vs modify existing)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Phase 2: Schema Implementation
|
|
51
|
+
|
|
52
|
+
**Agent:** Content Engineer
|
|
53
|
+
**Type:** Sub-agent (simple changes) or Background (complex schema additions)
|
|
54
|
+
|
|
55
|
+
### File Partition
|
|
56
|
+
|
|
57
|
+
> See the CMS customization file for project-specific paths.
|
|
58
|
+
|
|
59
|
+
- CMS schema directory — schema type files
|
|
60
|
+
- CMS config file — schema registry
|
|
61
|
+
|
|
62
|
+
### Steps
|
|
63
|
+
|
|
64
|
+
1. Create or modify schema type files using `defineType` / `defineField`
|
|
65
|
+
2. Add validation rules where appropriate
|
|
66
|
+
3. Update the schema index to register new types
|
|
67
|
+
4. Deploy schema (see CMS customization for deploy command)
|
|
68
|
+
5. Verify in CMS studio that the schema renders correctly
|
|
69
|
+
6. Create any necessary content for new types
|
|
70
|
+
|
|
71
|
+
### Exit Criteria
|
|
72
|
+
|
|
73
|
+
- [ ] Schema files created/modified
|
|
74
|
+
- [ ] Schema deployed successfully
|
|
75
|
+
- [ ] Schema renders correctly in CMS Studio
|
|
76
|
+
- [ ] Existing content not broken by changes
|
|
77
|
+
- [ ] Output contract returned
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Phase 3: Query Updates
|
|
82
|
+
|
|
83
|
+
**Agent:** Content Engineer or Developer (via sub-agent)
|
|
84
|
+
**Type:** Sub-agent (sequential — depends on Phase 2)
|
|
85
|
+
|
|
86
|
+
### File Partition
|
|
87
|
+
|
|
88
|
+
> See the CMS customization file for project-specific query library paths.
|
|
89
|
+
|
|
90
|
+
- Query library — data query files
|
|
91
|
+
|
|
92
|
+
### Steps
|
|
93
|
+
|
|
94
|
+
1. Update data queries to include new/modified fields
|
|
95
|
+
2. Update TypeScript types for query results
|
|
96
|
+
3. Test queries in the CMS query tool
|
|
97
|
+
4. Run query library tests
|
|
98
|
+
|
|
99
|
+
### Exit Criteria
|
|
100
|
+
|
|
101
|
+
- [ ] Data queries updated
|
|
102
|
+
- [ ] TypeScript types match schema
|
|
103
|
+
- [ ] Queries tested in CMS query tool
|
|
104
|
+
- [ ] Query tests pass
|
|
105
|
+
- [ ] Output contract returned
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Phase 4: Page Integration
|
|
110
|
+
|
|
111
|
+
**Agent:** Developer (via sub-agent)
|
|
112
|
+
**Type:** Sub-agent (sequential — depends on Phase 3)
|
|
113
|
+
|
|
114
|
+
### File Partition
|
|
115
|
+
|
|
116
|
+
- Varies by feature — typically app page routes and shared UI components
|
|
117
|
+
|
|
118
|
+
### Steps
|
|
119
|
+
|
|
120
|
+
1. Update components to use new/modified fields
|
|
121
|
+
2. Handle missing data gracefully (backwards compatibility)
|
|
122
|
+
3. Run lint + test + build for affected projects
|
|
123
|
+
4. Start dev server and verify in browser
|
|
124
|
+
|
|
125
|
+
### Exit Criteria
|
|
126
|
+
|
|
127
|
+
- [ ] Components updated
|
|
128
|
+
- [ ] Missing data handled gracefully
|
|
129
|
+
- [ ] Lint + test + build pass
|
|
130
|
+
- [ ] Visual verification in browser
|
|
131
|
+
- [ ] Output contract returned
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Phase 5: Verification
|
|
136
|
+
|
|
137
|
+
**Agent:** Team Lead (self)
|
|
138
|
+
**Type:** Direct verification
|
|
139
|
+
|
|
140
|
+
### Steps
|
|
141
|
+
|
|
142
|
+
1. Review all output contracts
|
|
143
|
+
2. Verify in CMS that content can be created/edited
|
|
144
|
+
3. Start dev server and verify pages render correctly
|
|
145
|
+
4. Check both apps if shared schema/queries changed
|
|
146
|
+
5. Verify data model documentation is updated
|
|
147
|
+
6. Move Linear issue to Done
|
|
148
|
+
|
|
149
|
+
### Exit Criteria
|
|
150
|
+
|
|
151
|
+
- [ ] Schema works in CMS
|
|
152
|
+
- [ ] Pages render correctly in browser
|
|
153
|
+
- [ ] Both apps verified (if shared code changed)
|
|
154
|
+
- [ ] Data model documentation updated (if applicable)
|
|
155
|
+
- [ ] Linear issue moved to Done
|
|
156
|
+
- [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### Phase 6: Delivery (Compound)
|
|
161
|
+
|
|
162
|
+
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
163
|
+
>
|
|
164
|
+
> Commit → Push → PR → Linear linkage. Team Lead owns delivery.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Workflow: Security Audit
|
|
2
|
+
|
|
3
|
+
Comprehensive security review workflow for auth, RLS, headers, and API security.
|
|
4
|
+
|
|
5
|
+
## Phases
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Phase 1: Scope & Context (sub-agent, inline)
|
|
9
|
+
Phase 2: Automated Checks (sub-agent, inline)
|
|
10
|
+
Phase 3: Manual Review (background agent)
|
|
11
|
+
Phase 4: Panel Review (sub-agent, inline)
|
|
12
|
+
Phase 5: Remediation (sub-agent or background)
|
|
13
|
+
Phase 6: Compound (direct, Team Lead)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Branch & Delivery Strategy
|
|
19
|
+
|
|
20
|
+
Follow the **Delivery Outcome** in `general.instructions.md` and the **Branch Ownership** rules in `team-lead.agent.md`. Branch naming: `fix/<ticket-id>-<short-description>` for remediations.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Phase 1: Scope & Context
|
|
25
|
+
|
|
26
|
+
**Agent:** Team Lead (self)
|
|
27
|
+
**Type:** Direct research
|
|
28
|
+
|
|
29
|
+
### Steps
|
|
30
|
+
|
|
31
|
+
1. Define audit scope (full audit vs. targeted area)
|
|
32
|
+
2. Read `docs/PROJECT.md` security sections
|
|
33
|
+
3. Read `docs/KNOWN-ISSUES.md` for existing security items
|
|
34
|
+
4. Check current CSP configuration in `next.config.js`
|
|
35
|
+
5. Review auth flow (see database/auth customization for library paths)
|
|
36
|
+
6. Map all API routes and Server Actions
|
|
37
|
+
7. Create Linear issue for the audit
|
|
38
|
+
|
|
39
|
+
### Exit Criteria
|
|
40
|
+
|
|
41
|
+
- [ ] Scope defined (which apps, libs, routes)
|
|
42
|
+
- [ ] Existing security docs reviewed
|
|
43
|
+
- [ ] Attack surface mapped
|
|
44
|
+
- [ ] Linear issue created
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Phase 2: Automated Checks
|
|
49
|
+
|
|
50
|
+
**Agent:** Security Expert (via sub-agent)
|
|
51
|
+
**Type:** Sub-agent (inline)
|
|
52
|
+
|
|
53
|
+
### Steps
|
|
54
|
+
|
|
55
|
+
1. Run lint with security rules
|
|
56
|
+
2. Check for hardcoded secrets (`grep -r "password\|secret\|api_key"`)
|
|
57
|
+
3. Validate CSP headers
|
|
58
|
+
4. Check dependency vulnerabilities (`yarn audit`)
|
|
59
|
+
5. Verify RLS is enabled on all database tables
|
|
60
|
+
6. Check for `dangerouslySetInnerHTML` usage
|
|
61
|
+
|
|
62
|
+
### Exit Criteria
|
|
63
|
+
|
|
64
|
+
- [ ] No hardcoded secrets found
|
|
65
|
+
- [ ] CSP headers valid
|
|
66
|
+
- [ ] Dependency audit clean (or known issues documented)
|
|
67
|
+
- [ ] RLS enabled on all tables
|
|
68
|
+
- [ ] No unsafe HTML injection points
|
|
69
|
+
- [ ] Findings documented
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Phase 3: Manual Review
|
|
74
|
+
|
|
75
|
+
**Agent:** Security Expert
|
|
76
|
+
**Type:** Background agent
|
|
77
|
+
|
|
78
|
+
### Checklist
|
|
79
|
+
|
|
80
|
+
- [ ] **Authentication:** Session handling, token refresh, logout flow
|
|
81
|
+
- [ ] **Authorization:** Role checks, route protection, middleware
|
|
82
|
+
- [ ] **RLS Policies:** Default-deny, explicit-allow, policy correctness
|
|
83
|
+
- [ ] **Input Validation:** Zod schemas on all API routes and Server Actions
|
|
84
|
+
- [ ] **CSRF Protection:** Server Actions use form tokens
|
|
85
|
+
- [ ] **Rate Limiting:** Proxy layer, per-IP limits, fingerprinting
|
|
86
|
+
- [ ] **Error Handling:** No sensitive data in error responses
|
|
87
|
+
- [ ] **OAuth:** Callback URLs, state parameter, PKCE
|
|
88
|
+
- [ ] **Headers:** HSTS, X-Content-Type-Options, X-Frame-Options
|
|
89
|
+
- [ ] **Cookies:** HttpOnly, Secure, SameSite flags
|
|
90
|
+
|
|
91
|
+
### Exit Criteria
|
|
92
|
+
|
|
93
|
+
- [ ] All checklist items reviewed
|
|
94
|
+
- [ ] Findings categorized by severity
|
|
95
|
+
- [ ] Output contract returned with findings list
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Phase 4: Panel Review
|
|
100
|
+
|
|
101
|
+
**Agent:** Team Lead (orchestrates panel)
|
|
102
|
+
**Type:** Sub-agent (inline)
|
|
103
|
+
|
|
104
|
+
### Steps
|
|
105
|
+
|
|
106
|
+
1. Load **panel-majority-vote** skill
|
|
107
|
+
2. Provide Phase 3 findings and affected files as in-scope artifacts
|
|
108
|
+
3. Panel question: "Are there any unmitigated security vulnerabilities in the reviewed code?"
|
|
109
|
+
4. Run 3 reviewer sub-agents
|
|
110
|
+
5. Consolidate results
|
|
111
|
+
|
|
112
|
+
### Exit Criteria
|
|
113
|
+
|
|
114
|
+
- [ ] Panel completed (PASS or BLOCK)
|
|
115
|
+
- [ ] Panel report linked to Linear issue
|
|
116
|
+
- [ ] If BLOCK: MUST-FIX items extracted
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Phase 5: Remediation
|
|
121
|
+
|
|
122
|
+
**Agent:** Security Expert or Developer (depends on finding)
|
|
123
|
+
**Type:** Sub-agent (critical fixes) or Background (non-critical)
|
|
124
|
+
|
|
125
|
+
### Steps
|
|
126
|
+
|
|
127
|
+
1. Fix Critical and High severity findings first
|
|
128
|
+
2. Create separate Linear issues for Medium/Low findings if not fixing now
|
|
129
|
+
3. Run verification after each fix
|
|
130
|
+
4. Re-run panel review if initial panel BLOCKed
|
|
131
|
+
5. Update `docs/KNOWN-ISSUES.md` for any accepted risks
|
|
132
|
+
|
|
133
|
+
### Exit Criteria
|
|
134
|
+
|
|
135
|
+
- [ ] Critical/High findings remediated
|
|
136
|
+
- [ ] Medium/Low findings tracked in Linear
|
|
137
|
+
- [ ] Panel review passed (if applicable)
|
|
138
|
+
- [ ] Known issues updated for accepted risks
|
|
139
|
+
- [ ] All Linear issues updated
|
|
140
|
+
- [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), Linear linked
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### Phase 6: Delivery (Compound)
|
|
145
|
+
|
|
146
|
+
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
147
|
+
>
|
|
148
|
+
> Commit → Push → PR → Linear linkage. Team Lead owns delivery.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Shared Delivery Phase
|
|
2
|
+
|
|
3
|
+
This phase is referenced by all workflow templates. It covers the final delivery steps after all implementation and verification is complete.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. **Commit all changes** to the feature branch with Linear issue IDs in commit messages
|
|
8
|
+
2. **Push the branch** to origin: `git push -u origin <branch-name>`
|
|
9
|
+
3. **Open a PR** using `gh` CLI (always use `GH_PAGER=cat` to prevent pager issues):
|
|
10
|
+
```bash
|
|
11
|
+
GH_PAGER=cat gh pr create --base main --title "TAS-XX: Short description" --body "Resolves TAS-XX"
|
|
12
|
+
```
|
|
13
|
+
4. **Do NOT merge** — PRs are opened for human review only
|
|
14
|
+
5. **Update Linear issues** with the PR URL for traceability
|
|
15
|
+
6. **Clean up session checkpoint** if one exists
|
|
16
|
+
|
|
17
|
+
## Branch & Delivery Strategy
|
|
18
|
+
|
|
19
|
+
The **Team Lead owns delivery**, not individual specialist agents:
|
|
20
|
+
|
|
21
|
+
- **Team Lead creates the branch** in Phase 1 before any delegation
|
|
22
|
+
- **Sub-agents** work directly on the Team Lead's branch (shared working tree)
|
|
23
|
+
- **Background agents** work in isolated worktrees branched from the feature branch
|
|
24
|
+
- **Team Lead merges worktrees back** during verification
|
|
25
|
+
- **Only the Team Lead pushes** to the branch and opens the PR
|
|
26
|
+
|
|
27
|
+
## Exit Criteria
|
|
28
|
+
|
|
29
|
+
- [ ] All changes committed with Linear issue IDs in messages
|
|
30
|
+
- [ ] Branch pushed to origin
|
|
31
|
+
- [ ] PR opened on GitHub (NOT merged)
|
|
32
|
+
- [ ] Linear issues updated with PR URL
|
|
33
|
+
- [ ] All project issues marked Done or Cancelled
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'API designer for route architecture, endpoint conventions, request/response schemas, versioning strategy, and API documentation.'
|
|
3
|
+
name: 'API Designer'
|
|
4
|
+
model: Gemini 3.1 Pro
|
|
5
|
+
tools: ['search/changes', 'search/codebase', 'edit/editFiles', 'web/fetch', 'read/problems', 'execute/getTerminalOutput', 'execute/runInTerminal', 'read/terminalLastCommand', 'read/terminalSelection', 'search', 'execute/testFailure', 'search/usages']
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# API Designer
|
|
9
|
+
|
|
10
|
+
You are an API designer specializing in route architecture, endpoint conventions, request/response schemas, versioning, error handling patterns, and API documentation.
|
|
11
|
+
|
|
12
|
+
## Critical Rules
|
|
13
|
+
|
|
14
|
+
1. **Design before implementing** — define the contract (request/response shapes, status codes, errors) before writing handler code
|
|
15
|
+
2. **Consistent conventions** — all endpoints follow the same naming, error format, and pagination pattern
|
|
16
|
+
3. **Validate everything** — every endpoint has input validation schemas; never trust client input
|
|
17
|
+
4. **Version from the start** — design for backward compatibility; breaking changes require a new version
|
|
18
|
+
|
|
19
|
+
## Skills
|
|
20
|
+
|
|
21
|
+
### Capability Slots
|
|
22
|
+
|
|
23
|
+
Resolve via [skill-matrix.md](.github/customizations/agents/skill-matrix.md).
|
|
24
|
+
|
|
25
|
+
- **api-layer** — Route handler patterns, server-side actions, validation libraries, search API architecture
|
|
26
|
+
- **framework** — Framework routing conventions, middleware, request lifecycle
|
|
27
|
+
- **security** — Input validation, authentication, authorization, rate limiting
|
|
28
|
+
|
|
29
|
+
## API Design Principles
|
|
30
|
+
|
|
31
|
+
Load the **api-patterns** skill for comprehensive API design guidelines covering route architecture, request/response schemas, error handling, pagination, versioning, and rate limiting.
|
|
32
|
+
|
|
33
|
+
## Guidelines
|
|
34
|
+
|
|
35
|
+
- Audit existing API routes before designing new ones — maintain consistency
|
|
36
|
+
- Document every endpoint with method, path, request schema, response schema, and error cases
|
|
37
|
+
- Consider the consumer's perspective — what makes this API easy to use?
|
|
38
|
+
- Design for both internal (app) and potential external (public API) consumers
|
|
39
|
+
- Coordinate with Database Engineer for query efficiency behind endpoints
|
|
40
|
+
- Coordinate with Security Expert for authentication and authorization patterns
|
|
41
|
+
|
|
42
|
+
## Done When
|
|
43
|
+
|
|
44
|
+
- API contract is fully defined (routes, methods, request/response schemas, error cases)
|
|
45
|
+
- Zod schemas are created for all inputs and outputs
|
|
46
|
+
- Route handlers are implemented following the framework's conventions
|
|
47
|
+
- Error handling is consistent across all endpoints
|
|
48
|
+
- API documentation is generated or written
|
|
49
|
+
- Existing endpoint conventions are maintained
|
|
50
|
+
|
|
51
|
+
## Out of Scope
|
|
52
|
+
|
|
53
|
+
- Database schema design or migrations (define data needs, not table structure)
|
|
54
|
+
- Frontend integration (design the contract, not the consumer)
|
|
55
|
+
- Load testing or performance benchmarking
|
|
56
|
+
- Authentication provider setup (use existing auth patterns)
|
|
57
|
+
|
|
58
|
+
## Output Contract
|
|
59
|
+
|
|
60
|
+
When completing a task, return a structured summary:
|
|
61
|
+
|
|
62
|
+
1. **Endpoints** — List each endpoint with method, path, and purpose
|
|
63
|
+
2. **Schemas** — Request/response Zod schemas created or modified
|
|
64
|
+
3. **Error Cases** — Error codes and status codes for each endpoint
|
|
65
|
+
4. **Verification** — Lint, type-check, and test results
|
|
66
|
+
5. **Documentation** — API docs produced or updated
|
|
67
|
+
|
|
68
|
+
See **Base Output Contract** in `general.instructions.md` for the standard closing items (Discovered Issues + Lessons Applied).
|