cfsa-antigravity 2.19.0 → 2.19.2

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 (200) hide show
  1. package/package.json +1 -1
  2. package/template/.agent/kit-sync.md +3 -3
  3. package/template/.claude/commands/audit-ambiguity-execute.md +6 -0
  4. package/template/.claude/commands/audit-ambiguity-rubrics.md +6 -0
  5. package/template/.claude/commands/audit-ambiguity.md +6 -0
  6. package/template/.claude/commands/bootstrap-agents-fill.md +6 -0
  7. package/template/.claude/commands/bootstrap-agents-provision.md +6 -0
  8. package/template/.claude/commands/bootstrap-agents.md +6 -0
  9. package/template/.claude/commands/create-prd-architecture.md +6 -0
  10. package/template/.claude/commands/create-prd-compile.md +6 -0
  11. package/template/.claude/commands/create-prd-design-system.md +6 -0
  12. package/template/.claude/commands/create-prd-security.md +6 -0
  13. package/template/.claude/commands/create-prd-stack.md +6 -0
  14. package/template/.claude/commands/decompose-architecture-structure.md +6 -0
  15. package/template/.claude/commands/decompose-architecture-validate.md +6 -0
  16. package/template/.claude/commands/evolve-contract.md +6 -0
  17. package/template/.claude/commands/evolve-feature-cascade.md +6 -0
  18. package/template/.claude/commands/evolve-feature-classify.md +6 -0
  19. package/template/.claude/commands/evolve-feature.md +6 -0
  20. package/template/.claude/commands/ideate-discover.md +6 -0
  21. package/template/.claude/commands/ideate-extract.md +6 -0
  22. package/template/.claude/commands/ideate-validate.md +6 -0
  23. package/template/.claude/commands/implement-slice-setup.md +6 -0
  24. package/template/.claude/commands/implement-slice-tdd.md +6 -0
  25. package/template/.claude/commands/plan-phase-preflight.md +6 -0
  26. package/template/.claude/commands/plan-phase-write.md +6 -0
  27. package/template/.claude/commands/propagate-decision-apply.md +6 -0
  28. package/template/.claude/commands/propagate-decision-scan.md +6 -0
  29. package/template/.claude/commands/propagate-decision.md +6 -0
  30. package/template/.claude/commands/remediate-pipeline-assess.md +6 -0
  31. package/template/.claude/commands/remediate-pipeline-execute.md +6 -0
  32. package/template/.claude/commands/remediate-pipeline.md +6 -0
  33. package/template/.claude/commands/remediate-shard-split.md +6 -0
  34. package/template/.claude/commands/resolve-ambiguity.md +6 -0
  35. package/template/.claude/commands/setup-workspace-cicd.md +6 -0
  36. package/template/.claude/commands/setup-workspace-data.md +6 -0
  37. package/template/.claude/commands/setup-workspace-hosting.md +6 -0
  38. package/template/.claude/commands/setup-workspace-scaffold.md +6 -0
  39. package/template/.claude/commands/sync-kit.md +6 -0
  40. package/template/.claude/commands/update-architecture-map.md +6 -0
  41. package/template/.claude/commands/validate-phase-quality.md +6 -0
  42. package/template/.claude/commands/validate-phase-readiness.md +6 -0
  43. package/template/.claude/commands/verify-infrastructure.md +6 -0
  44. package/template/.claude/commands/write-architecture-spec-deepen.md +6 -0
  45. package/template/.claude/commands/write-architecture-spec-design.md +6 -0
  46. package/template/.claude/commands/write-be-spec-classify.md +6 -0
  47. package/template/.claude/commands/write-be-spec-write.md +6 -0
  48. package/template/.claude/commands/write-fe-spec-classify.md +6 -0
  49. package/template/.claude/commands/write-fe-spec-write.md +6 -0
  50. package/template/.claude/skills/accessibility/SKILL.md +522 -0
  51. package/template/.claude/skills/accessibility/references/WCAG.md +162 -0
  52. package/template/.claude/skills/accessibility/references/ia-spec-checklist.md +35 -0
  53. package/template/.claude/skills/adversarial-review/SKILL.md +90 -0
  54. package/template/.claude/skills/antigravity-workflows/SKILL.md +81 -0
  55. package/template/.claude/skills/antigravity-workflows/resources/implementation-playbook.md +36 -0
  56. package/template/.claude/skills/api-design-principles/SKILL.md +169 -0
  57. package/template/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
  58. package/template/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
  59. package/template/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
  60. package/template/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
  61. package/template/.claude/skills/api-design-principles/resources/implementation-playbook.md +513 -0
  62. package/template/.claude/skills/api-versioning/SKILL.md +166 -0
  63. package/template/.claude/skills/api-versioning/references/typescript.md +157 -0
  64. package/template/.claude/skills/architecture-mapping/SKILL.md +219 -0
  65. package/template/.claude/skills/bootstrap-agents/SKILL.md +258 -0
  66. package/template/.claude/skills/brainstorming/SKILL.md +177 -0
  67. package/template/.claude/skills/brand-guidelines/SKILL.md +44 -0
  68. package/template/.claude/skills/clean-code/SKILL.md +196 -0
  69. package/template/.claude/skills/clean-code/references/typescript.md +126 -0
  70. package/template/.claude/skills/code-review-pro/SKILL.md +152 -0
  71. package/template/.claude/skills/concise-planning/SKILL.md +107 -0
  72. package/template/.claude/skills/cross-layer-consistency/SKILL.md +117 -0
  73. package/template/.claude/skills/database-schema-design/SKILL.md +205 -0
  74. package/template/.claude/skills/database-schema-design/references/relational.md +228 -0
  75. package/template/.claude/skills/deployment-procedures/SKILL.md +241 -0
  76. package/template/.claude/skills/design-anti-cliche/SKILL.md +159 -0
  77. package/template/.claude/skills/design-direction/SKILL.md +45 -0
  78. package/template/.claude/skills/error-handling-patterns/SKILL.md +226 -0
  79. package/template/.claude/skills/error-handling-patterns/references/go.md +162 -0
  80. package/template/.claude/skills/error-handling-patterns/references/python.md +262 -0
  81. package/template/.claude/skills/error-handling-patterns/references/rust.md +112 -0
  82. package/template/.claude/skills/error-handling-patterns/references/typescript.md +178 -0
  83. package/template/.claude/skills/find-skills/SKILL.md +145 -0
  84. package/template/.claude/skills/git-advanced/SKILL.md +972 -0
  85. package/template/.claude/skills/git-workflow/SKILL.md +420 -0
  86. package/template/.claude/skills/idea-extraction/SKILL.md +644 -0
  87. package/template/.claude/skills/logging-best-practices/SKILL.md +192 -0
  88. package/template/.claude/skills/logging-best-practices/references/go.md +49 -0
  89. package/template/.claude/skills/logging-best-practices/references/python.md +52 -0
  90. package/template/.claude/skills/logging-best-practices/references/typescript.md +215 -0
  91. package/template/.claude/skills/migration-management/SKILL.md +200 -0
  92. package/template/.claude/skills/migration-management/references/relational.md +214 -0
  93. package/template/.claude/skills/minimalist-surgical-development/SKILL.md +135 -0
  94. package/template/.claude/skills/parallel-agents/SKILL.md +165 -0
  95. package/template/.claude/skills/parallel-debugging/SKILL.md +135 -0
  96. package/template/.claude/skills/parallel-feature-development/SKILL.md +157 -0
  97. package/template/.claude/skills/performance-budgeting/SKILL.md +144 -0
  98. package/template/.claude/skills/pipeline-rubrics/SKILL.md +51 -0
  99. package/template/.claude/skills/pipeline-rubrics/references/architecture-rubric.md +19 -0
  100. package/template/.claude/skills/pipeline-rubrics/references/be-rubric.md +21 -0
  101. package/template/.claude/skills/pipeline-rubrics/references/fe-rubric.md +20 -0
  102. package/template/.claude/skills/pipeline-rubrics/references/ia-rubric.md +19 -0
  103. package/template/.claude/skills/pipeline-rubrics/references/scoring.md +32 -0
  104. package/template/.claude/skills/pipeline-rubrics/references/vision-rubric.md +12 -0
  105. package/template/.claude/skills/prd-templates/SKILL.md +107 -0
  106. package/template/.claude/skills/prd-templates/references/architecture-completeness-checklist.md +28 -0
  107. package/template/.claude/skills/prd-templates/references/architecture-design-template.md +88 -0
  108. package/template/.claude/skills/prd-templates/references/be-spec-classification.md +41 -0
  109. package/template/.claude/skills/prd-templates/references/be-spec-template.md +107 -0
  110. package/template/.claude/skills/prd-templates/references/bootstrap-verification-protocol.md +50 -0
  111. package/template/.claude/skills/prd-templates/references/constraint-exploration.md +41 -0
  112. package/template/.claude/skills/prd-templates/references/data-placement-template.md +74 -0
  113. package/template/.claude/skills/prd-templates/references/decision-confirmation-protocol.md +68 -0
  114. package/template/.claude/skills/prd-templates/references/decision-propagation.md +121 -0
  115. package/template/.claude/skills/prd-templates/references/decomposition-templates.md +226 -0
  116. package/template/.claude/skills/prd-templates/references/deep-ideation-loading-protocol.md +114 -0
  117. package/template/.claude/skills/prd-templates/references/design-system-decisions.md +198 -0
  118. package/template/.claude/skills/prd-templates/references/design-system-prerequisite-check.md +18 -0
  119. package/template/.claude/skills/prd-templates/references/domain-exhaustion-criteria.md +37 -0
  120. package/template/.claude/skills/prd-templates/references/engagement-tier-protocol.md +58 -0
  121. package/template/.claude/skills/prd-templates/references/engineering-standards-template.md +126 -0
  122. package/template/.claude/skills/prd-templates/references/evolution-layer-guidance.md +91 -0
  123. package/template/.claude/skills/prd-templates/references/expansion-modes.md +27 -0
  124. package/template/.claude/skills/prd-templates/references/fe-classification-procedures.md +47 -0
  125. package/template/.claude/skills/prd-templates/references/fe-spec-template.md +90 -0
  126. package/template/.claude/skills/prd-templates/references/feature-ledger-protocol.md +149 -0
  127. package/template/.claude/skills/prd-templates/references/folder-seeding-protocol.md +77 -0
  128. package/template/.claude/skills/prd-templates/references/fractal-cx-template.md +58 -0
  129. package/template/.claude/skills/prd-templates/references/fractal-feature-template.md +93 -0
  130. package/template/.claude/skills/prd-templates/references/fractal-node-index-template.md +55 -0
  131. package/template/.claude/skills/prd-templates/references/gate-applicability.md +92 -0
  132. package/template/.claude/skills/prd-templates/references/ideation-crosscut-template.md +36 -0
  133. package/template/.claude/skills/prd-templates/references/ideation-index-template.md +111 -0
  134. package/template/.claude/skills/prd-templates/references/ideation-meta-template.md +126 -0
  135. package/template/.claude/skills/prd-templates/references/infrastructure-report-template.md +71 -0
  136. package/template/.claude/skills/prd-templates/references/input-classification.md +23 -0
  137. package/template/.claude/skills/prd-templates/references/map-guard-protocol.md +65 -0
  138. package/template/.claude/skills/prd-templates/references/operational-templates.md +116 -0
  139. package/template/.claude/skills/prd-templates/references/persona-completeness-gate.md +20 -0
  140. package/template/.claude/skills/prd-templates/references/placeholder-guard-template.md +21 -0
  141. package/template/.claude/skills/prd-templates/references/placeholder-workflow-mapping.md +50 -0
  142. package/template/.claude/skills/prd-templates/references/shard-boundary-analysis.md +103 -0
  143. package/template/.claude/skills/prd-templates/references/shard-split-remediation.md +157 -0
  144. package/template/.claude/skills/prd-templates/references/skill-loading-protocol.md +36 -0
  145. package/template/.claude/skills/prd-templates/references/slice-completion-gates.md +29 -0
  146. package/template/.claude/skills/prd-templates/references/spec-coverage-sweep.md +44 -0
  147. package/template/.claude/skills/prd-templates/references/surface-model.md +61 -0
  148. package/template/.claude/skills/prd-templates/references/tdd-testing-policy.md +39 -0
  149. package/template/.claude/skills/prd-templates/references/vision-template.md +57 -0
  150. package/template/.claude/skills/prd-templates/references/workflow-checkpoint-protocol.md +112 -0
  151. package/template/.claude/skills/prd-templates/references/write-verification-protocol.md +57 -0
  152. package/template/.claude/skills/prompt-engineer/SKILL.md +203 -0
  153. package/template/.claude/skills/regex-patterns/SKILL.md +333 -0
  154. package/template/.claude/skills/regex-patterns/references/go.md +44 -0
  155. package/template/.claude/skills/regex-patterns/references/javascript.md +63 -0
  156. package/template/.claude/skills/regex-patterns/references/python.md +77 -0
  157. package/template/.claude/skills/regex-patterns/references/rust.md +43 -0
  158. package/template/.claude/skills/resolve-ambiguity/SKILL.md +278 -0
  159. package/template/.claude/skills/security-scanning-security-hardening/SKILL.md +231 -0
  160. package/template/.claude/skills/session-continuity/SKILL.md +732 -0
  161. package/template/.claude/skills/session-continuity/protocols/01-session-resumption.md +38 -0
  162. package/template/.claude/skills/session-continuity/protocols/02-progress-generation.md +85 -0
  163. package/template/.claude/skills/session-continuity/protocols/03-progress-update.md +70 -0
  164. package/template/.claude/skills/session-continuity/protocols/04-pattern-extraction.md +60 -0
  165. package/template/.claude/skills/session-continuity/protocols/05-session-close.md +37 -0
  166. package/template/.claude/skills/session-continuity/protocols/06-decision-analysis.md +84 -0
  167. package/template/.claude/skills/session-continuity/protocols/07-spec-pipeline-generation.md +48 -0
  168. package/template/.claude/skills/session-continuity/protocols/08-spec-pipeline-update.md +55 -0
  169. package/template/.claude/skills/session-continuity/protocols/09-parallel-claim.md +122 -0
  170. package/template/.claude/skills/session-continuity/protocols/10-placeholder-verification-gate.md +83 -0
  171. package/template/.claude/skills/session-continuity/protocols/11-parallel-synthesis.md +21 -0
  172. package/template/.claude/skills/session-continuity/protocols/ambiguity-gates.md +48 -0
  173. package/template/.claude/skills/skill-creator/SKILL.md +203 -0
  174. package/template/.claude/skills/skill-creator/references/.gitkeep +0 -0
  175. package/template/.claude/skills/skill-creator/scripts/.gitkeep +0 -0
  176. package/template/.claude/skills/spec-writing/SKILL.md +110 -0
  177. package/template/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
  178. package/template/.claude/skills/systematic-debugging/SKILL.md +297 -0
  179. package/template/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  180. package/template/.claude/skills/systematic-debugging/condition-based-waiting.md +115 -0
  181. package/template/.claude/skills/systematic-debugging/defense-in-depth.md +122 -0
  182. package/template/.claude/skills/systematic-debugging/find-polluter.sh +63 -0
  183. package/template/.claude/skills/systematic-debugging/root-cause-tracing.md +169 -0
  184. package/template/.claude/skills/systematic-debugging/test-academic.md +14 -0
  185. package/template/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
  186. package/template/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
  187. package/template/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
  188. package/template/.claude/skills/tdd-workflow/SKILL.md +186 -0
  189. package/template/.claude/skills/tdd-workflow/references/typescript.md +231 -0
  190. package/template/.claude/skills/tech-stack-catalog/SKILL.md +49 -0
  191. package/template/.claude/skills/tech-stack-catalog/references/constraint-questions.md +237 -0
  192. package/template/.claude/skills/tech-stack-catalog/references/dev-tooling-decisions.md +37 -0
  193. package/template/.claude/skills/tech-stack-catalog/references/surface-decision-tables.md +69 -0
  194. package/template/.claude/skills/technical-writer/SKILL.md +242 -0
  195. package/template/.claude/skills/testing-strategist/SKILL.md +319 -0
  196. package/template/.claude/skills/testing-strategist/references/typescript.md +328 -0
  197. package/template/.claude/skills/verification-before-completion/SKILL.md +97 -0
  198. package/template/.claude/skills/workflow-automation/SKILL.md +166 -0
  199. package/template/.claude/skills/workflow-automation/references/inngest.md +88 -0
  200. package/template/.claude/skills/workflow-automation/references/temporal.md +64 -0
@@ -0,0 +1,157 @@
1
+ # TypeScript API Versioning Patterns
2
+
3
+ Language-specific patterns for the `api-versioning` skill. Read `SKILL.md` first for universal methodology.
4
+
5
+ ---
6
+
7
+ ## URL Path Versioning
8
+
9
+ ```typescript
10
+ // src/pages/api/v1/models/[id].ts
11
+ export async function GET({ params }: APIContext) {
12
+ return new Response(JSON.stringify({
13
+ id: params.id,
14
+ name: model.name,
15
+ provider: model.provider,
16
+ price_per_token: model.pricePerToken, // V1 flat field
17
+ }));
18
+ }
19
+
20
+ // src/pages/api/v2/models/[id].ts
21
+ export async function GET({ params }: APIContext) {
22
+ return new Response(JSON.stringify({
23
+ id: params.id,
24
+ name: model.name,
25
+ provider: model.provider,
26
+ pricing: { // V2 structured pricing
27
+ input: model.inputPrice,
28
+ output: model.outputPrice,
29
+ currency: 'USD',
30
+ unit: 'per_million_tokens',
31
+ },
32
+ }));
33
+ }
34
+ ```
35
+
36
+ ## Header Versioning Middleware
37
+
38
+ ```typescript
39
+ function versionRouter(handlers: Record<string, Handler>): Handler {
40
+ return async (context) => {
41
+ const version = context.request.headers.get('API-Version')
42
+ ?? context.url.searchParams.get('version')
43
+ ?? DEFAULT_VERSION;
44
+
45
+ const handler = handlers[version];
46
+ if (!handler) {
47
+ return new Response(JSON.stringify({
48
+ type: 'https://api.example.com/problems/unsupported-version',
49
+ title: 'Unsupported API Version',
50
+ status: 400,
51
+ detail: `API version '${version}' is not supported.`,
52
+ }), { status: 400, headers: { 'Content-Type': 'application/problem+json' } });
53
+ }
54
+
55
+ const response = await handler(context);
56
+ response.headers.set('API-Version', version);
57
+ return response;
58
+ };
59
+ }
60
+ ```
61
+
62
+ ## Sunset Headers
63
+
64
+ ```typescript
65
+ function addDeprecationHeaders(response: Response, sunsetDate: string, docUrl: string): Response {
66
+ response.headers.set('Deprecation', 'true');
67
+ response.headers.set('Sunset', sunsetDate);
68
+ response.headers.set('Link', `<${docUrl}>; rel="sunset"`);
69
+ return response;
70
+ }
71
+
72
+ function sunsetResponse(migrationUrl: string): Response {
73
+ return new Response(JSON.stringify({
74
+ type: 'https://api.example.com/problems/gone',
75
+ title: 'API Version Removed',
76
+ status: 410,
77
+ detail: 'This API version has been sunset. Please migrate.',
78
+ migrationGuide: migrationUrl,
79
+ }), {
80
+ status: 410,
81
+ headers: {
82
+ 'Content-Type': 'application/problem+json',
83
+ 'Link': `<${migrationUrl}>; rel="successor-version"`,
84
+ },
85
+ });
86
+ }
87
+ ```
88
+
89
+ ## Consumer-Driven Contract Tests (Vitest)
90
+
91
+ ```typescript
92
+ import { describe, it, expect } from 'vitest';
93
+
94
+ describe('Model API Contract (Consumer: Dashboard)', () => {
95
+ it('GET /api/v1/models/:id returns expected shape', async () => {
96
+ const response = await fetch(`${API_URL}/api/v1/models/gpt-4`);
97
+ const data = await response.json();
98
+
99
+ expect(data).toMatchObject({
100
+ id: expect.any(String),
101
+ name: expect.any(String),
102
+ provider: expect.any(String),
103
+ });
104
+ });
105
+
106
+ it('returns 404 for unknown model', async () => {
107
+ const response = await fetch(`${API_URL}/api/v1/models/nonexistent`);
108
+ expect(response.status).toBe(404);
109
+ });
110
+ });
111
+ ```
112
+
113
+ ## Full Version Routing Middleware
114
+
115
+ ```typescript
116
+ export function createVersionedRoute(
117
+ handlers: Record<string, Handler>,
118
+ options: {
119
+ defaultVersion?: string;
120
+ deprecated?: Record<string, { sunset: string; migrationUrl: string }>;
121
+ } = {}
122
+ ): Handler {
123
+ const { defaultVersion, deprecated = {} } = options;
124
+
125
+ return async (context) => {
126
+ const version = resolveVersion(context.request) ?? defaultVersion;
127
+
128
+ if (!version) {
129
+ return problemResponse({
130
+ type: 'https://api.example.com/problems/version-required',
131
+ title: 'API Version Required', status: 400,
132
+ detail: 'Please specify an API version via the API-Version header.',
133
+ });
134
+ }
135
+
136
+ if (!(version in handlers)) {
137
+ return problemResponse({
138
+ type: 'https://api.example.com/problems/unsupported-version',
139
+ title: 'Unsupported API Version', status: 400,
140
+ detail: `Version '${version}' is not supported.`,
141
+ });
142
+ }
143
+
144
+ const response = await handlers[version](context);
145
+ response.headers.set('API-Version', version);
146
+
147
+ if (version in deprecated) {
148
+ const { sunset, migrationUrl } = deprecated[version];
149
+ response.headers.set('Deprecation', 'true');
150
+ response.headers.set('Sunset', sunset);
151
+ response.headers.set('Link', `<${migrationUrl}>; rel="sunset"`);
152
+ }
153
+
154
+ return response;
155
+ };
156
+ }
157
+ ```
@@ -0,0 +1,219 @@
1
+ ---
2
+ name: architecture-mapping
3
+ description: Analyzes codebase structure, data flow, module relationships, and key patterns to generate and maintain a living architecture document (ARCHITECTURE.md).
4
+ ---
5
+
6
+ # Architecture Mapping Skill
7
+
8
+ You are an expert software architect acting as a cartographer for the codebase. Your job is to analyze the current state of a repository and produce a "living map" of its architecture.
9
+
10
+ ## Core Responsibilities
11
+
12
+ When invoked, you must:
13
+
14
+ 1. **Analyze structural layout at a granular level:** Identify exactly where specific functionality lives, listing out key files (e.g., `src/api/worker.ts`, specific domain schemas, core components). **Do not just list directories; list the critical files within them**.
15
+ 2. **Trace data flow explicitly:** Determine how information moves through the system down to the exact environment bindings, database connections (e.g., SurrealDB KV bindings, Worker `Env` interfaces), and request interceptors.
16
+ 3. **Map relationships & contracts:** Detail the actual contract/validation schemas and API routes present in the codebase. If an API worker exists, document its exposed routes, rate limiting, and exact CORS configurations.
17
+ 4. **Extract key patterns:** Identify the architectural decisions and conventions in use, providing exact file references where these patterns are implemented (e.g., CFPA, React Islands).
18
+ 5. **Generate/Update Document:** Write these highly granular findings into a structured `docs/ARCHITECTURE.md` file. Avoid generic boilerplate; if the project only has 3 files, document precisely what those 3 files do.
19
+
20
+ ## Execution Strategy
21
+
22
+ Follow these strictly granular steps to perform an architecture mapping:
23
+
24
+ ### Step 1: Deep Codebase Reconnaissance
25
+ - **Do not just list directories.** Use your file exploration tools (`list_dir`, `view_file_outline`, `grep_search`) to survey the repository, but immediately follow up by reading the *contents* of key files (`view_file`).
26
+ - Identify exact entry points (`src/api/worker.ts`, `src/pages/index.astro`), configuration files (`astro.config.mjs`, `wrangler.toml`), and trace their imports.
27
+ - Locate exact schemas (contract library schemas, type interfaces, or data models) defining the data models.
28
+
29
+ ### Step 2: Component & Contract Analysis
30
+ - Group files logically, but identify the specific files governing these components.
31
+ - For each component, trace its exact validation schemas, API routes, or component props.
32
+ - Document exact environment variables and secrets expected by the code.
33
+
34
+ ### Step 3: Granular Dependency Tracing
35
+ - Trace exactly how components interact (e.g., "The `login` Astro page fetches data directly from SurrealDB using the `surrealdb.js` client in `src/lib/db.ts`").
36
+ - Explicitly catalog external integrations down to the binding name (e.g., "KVNamespace RATE_LIMITS").
37
+
38
+ ### Step 4: Pattern Extraction
39
+ - Read the implementation details of representative files to prove use of architectural patterns.
40
+ - If the project uses CFPA, locate the schema, the test, and the implementation file as proof.
41
+
42
+ ## 5. Document Generation
43
+ Create or update `docs/ARCHITECTURE.md` using the following structure:
44
+
45
+ ```markdown
46
+ # [Project Name] - Living Architecture Map
47
+
48
+ **Last Updated:** [Current Date]
49
+ **Purpose:** Deep, granular code context, environmental bindings, and exact architectural tracing.
50
+
51
+ ---
52
+
53
+ ## 1. Codebase Topography & Critical Files
54
+
55
+ ### Directory Tree
56
+ (You MUST include a full, comprehensive file/folder tree of the `src/` directory and any other relevant project directories. Do not summarize this; show the actual files.)
57
+ ```text
58
+ /
59
+ ├── src/
60
+ │ ├── api/
61
+ │ │ └── worker.ts
62
+ │ └── ...
63
+ ```
64
+
65
+ ### Critical Files
66
+ (Identify exactly where specific functionality lives, listing out key files defined in the tree above. Do not just list directories; explain what the critical files within them do.)
67
+
68
+ ## 2. Infrastructure & Explicit Data Flow
69
+ (Determine how information moves through the system down to the exact environment bindings, database connections, and request interceptors.)
70
+
71
+ ## 3. Module Relationships & Contracts
72
+ (Detail the actual contract/validation schemas and API routes present. Document exposed routes, rate limiting, and exact CORS configurations.)
73
+
74
+ ## 4. Key Patterns & Implementation Evidence
75
+ (Identify architectural decisions, providing exact file references where these patterns are implemented.)
76
+ ```
77
+
78
+ ## Best Practices
79
+
80
+ * **Granularity is Mandatory:** Do not describe the system abstractly. Use exact file paths, exact schema names, and exact environment binding names.
81
+ * **Trace the Code:** Never guess architectural boundaries. Use `grep_search` and `view_file` to trace imports and confirm how modules interact before documenting them.
82
+ * **Be Explicit:** Avoid boilerplate. If an API has 3 endpoints, list the 3 endpoints and their exact validation schemas.
83
+ * **Living Document:** If updating an *existing* `ARCHITECTURE.md`, do not simply append. Integrate new, granular findings holistically into the existing structure. Update the "Last Updated" date.
84
+
85
+ ## Domain Boundary Protocol
86
+
87
+ ### Purpose
88
+
89
+ Run this protocol before proposing domain boundaries. Uses a domain inventory record to evaluate every candidate domain.
90
+
91
+ ### Domain Inventory Record Format
92
+
93
+ For each candidate domain, build a record in the following format:
94
+
95
+ ```
96
+ Domain: [name]
97
+ Architecture description: [one-line summary from architecture design]
98
+ Ideation sub-features:
99
+ 1. [Actor] can [goal] → primary data: [entity/table]
100
+ 2. [Actor] can [goal] → primary data: [entity/table]
101
+ ...
102
+ Split trigger: [none | review | mandatory-split]
103
+ ```
104
+
105
+ Read the relevant ideation domain folders (use `ideation-index.md` Structure Map for correct paths — folders may be under `domains/` or `surfaces/{name}/`). For each domain, read the `*-index.md` for the children table, then each child feature file for sub-feature details. Use the architecture design as secondary context to build each record.
106
+
107
+ ### Split Trigger Rules
108
+
109
+ Apply all three rules to every domain:
110
+
111
+ 1. **Child-count proxy** — If the ideation domain folder contains ≥6 direct child feature files (or the fractal tree has depth ≥3 levels below this domain), flag as `mandatory-split`.
112
+
113
+ 2. **3-table rule** — If the domain's sub-features touch ≥3 independent database tables with no shared queries, flag as `mandatory-split`.
114
+
115
+ 3. **No-shared-query test** — If two sub-feature groups within a domain could each be assigned to a different developer without coordination (no shared API endpoints, no shared data mutations), flag as `review`.
116
+
117
+ ### Domain Boundary Table Template
118
+
119
+ | # | Domain | Features Included | Sub-feature Count | Complexity | Split Candidate? | Needs Deep Dive? |
120
+ |---|--------|-------------------|-------------------|------------|-----------------|------------------|
121
+ | 00 | Cross-cutting | Auth, API conventions, error handling | — | Medium | — | No |
122
+ | 01 | [Domain] | [Features] | [N] | [Low/Med/High] | [Yes/No — reason] | [Yes/No] |
123
+
124
+ ### User Approval Protocol
125
+
126
+ Present split candidates to the user before finalising the domain boundary table. For each candidate show:
127
+
128
+ - Domain name
129
+ - Sub-feature list
130
+ - Proposed split boundary
131
+ - Rationale
132
+
133
+ User must approve or reject each split before the table is locked.
134
+
135
+ ### Shard Numbering Convention
136
+
137
+ - `00-*` for cross-cutting concerns (may be multiple)
138
+ - `01-*` through `NN-*` for feature domains ordered by dependency (dependencies first)
139
+
140
+ ## Sub-Feature Reconciliation Protocol
141
+
142
+ ### Purpose
143
+
144
+ Run this protocol when beginning any architecture spec shard. The ideation domain's feature files (within the fractal tree) are the primary source of truth for sub-features — the architecture design is secondary context.
145
+
146
+ ### Sources to Read
147
+
148
+ 1. The relevant ideation domain folder for this shard (path from `ideation-index.md` Structure Map) — read the `*-index.md` then each child feature file
149
+ 2. The shard's `## Features` section
150
+ 3. `docs/plans/ideation/ideation-index.md` Must Have features for this domain
151
+
152
+ ### Reconciliation Table
153
+
154
+ | Sub-feature | Ideation domain tree | Shard ## Features | Must Have? | Decision |
155
+ |-------------|-------------|-------------------|------------|----------|
156
+ | [name] | ✅ Listed | ✅ Listed | Yes/No | Keep |
157
+ | [name] | ✅ Listed | ❌ Missing | Yes | **Add to shard immediately** |
158
+ | [name] | ✅ Listed | ❌ Missing | No | Add to shard — ideation is authoritative |
159
+ | [name] | ❌ Not listed | ✅ Listed | — | `[Architecture-only — not in ideation]` — keep but audit |
160
+
161
+ ### Mismatch Handling Rules
162
+
163
+ 1. If a sub-feature appears in the ideation domain tree but not in the shard's `## Features` → **add it to the shard's `## Features` section immediately** before proceeding. Do not wait for user confirmation to add ideation-sourced sub-features.
164
+
165
+ 2. If a sub-feature appears in the shard's `## Features` but not in the ideation domain tree → **keep it** but mark it with `[Architecture-only — not in ideation]` as an audit trail. These items need explicit user confirmation.
166
+
167
+ ### Scope Confirmation Presentation Format
168
+
169
+ Present the reconciled scope to the user in the following format:
170
+
171
+ > **Reconciled features for [Shard NN — Domain Name]:**
172
+ >
173
+ > [bullet list of all sub-features, with `[Architecture-only]` markers where applicable]
174
+ >
175
+ > **[N] sub-features added from ideation** that were missing from the shard skeleton.
176
+ > **[M] sub-features marked `[Architecture-only]`** — not found in ideation domain tree, added during decomposition.
177
+ >
178
+ > "Does this feature list match your intent for this domain? Any sub-features to add, remove, or re-scope?"
179
+
180
+ Wait for explicit user confirmation before proceeding. If the user modifies the list, update the shard file immediately.
181
+
182
+ ## Sub-Feature Complexity Split Protocol
183
+
184
+ ### Purpose
185
+
186
+ Run this protocol after reconciliation when the confirmed sub-feature count is **≥ 10**. This threshold indicates the shard is too complex for a single spec pass and must be split before writing proceeds.
187
+
188
+ ### Counting Rule
189
+
190
+ Count every bullet or named item under the confirmed feature list, excluding group headers. Use the same counting rule as `/decompose-architecture-validate` Step 12.
191
+
192
+ ### Split Proposal Format
193
+
194
+ Present to the user:
195
+
196
+ ```
197
+ Shard [NN] — [domain name] has [N] sub-features (threshold: ≥10 → mandatory split)
198
+
199
+ Current sub-features:
200
+ 1. [sub-feature]
201
+ 2. [sub-feature]
202
+ ...
203
+
204
+ Proposed split:
205
+ [NN]a — [new domain name] → file: docs/plans/ia/[NN]a-[domain].md
206
+ Sub-features: 1, 3, 5
207
+ [NN]b — [new domain name] → file: docs/plans/ia/[NN]b-[domain].md
208
+ Sub-features: 2, 4, 6
209
+
210
+ Split rationale: [why these groups are independent]
211
+
212
+ Does this split make sense, or would you prefer a different boundary?
213
+ ```
214
+
215
+ ### Approval Gate
216
+
217
+ **Wait for explicit user approval of the split before proceeding.** Do NOT continue spec writing with an oversized shard.
218
+
219
+ If the user approves: stop the current workflow and run `/decompose-architecture-validate` to formally register the new shards (it will re-run the Must Have coverage gate and update the decomposition plan). Then run `/remediate-shard-split` to update all downstream cross-references — do NOT restart spec work until zero stale parent references remain. Then restart the spec workflow for each new shard individually.
@@ -0,0 +1,258 @@
1
+ ---
2
+ name: bootstrap-agents
3
+ description: "Utility — fill the surface stack map in tech-stack.md and provision skills using intelligent resolution. Called by pipeline commands when tech stack info changes."
4
+ version: 3.0.0
5
+ ---
6
+
7
+ # Bootstrap Agents
8
+
9
+ **This is a utility command, not an entry point.** It gets called by other pipeline commands (like `/create-prd`, `/write-be-spec`, `/write-fe-spec`, `/implement-slice`) whenever they make tech stack decisions or introduce new dependencies.
10
+
11
+ Bootstrap does two things:
12
+ 1. **Fill the surface stack map** in `.agent/instructions/tech-stack.md` with stack decisions
13
+ 2. **Provision skills** from `skill-library/` using the 4-tier resolution chain
14
+
15
+ **Input**: Surface-keyed stack values + optional global values
16
+ **Output**: Filled map cells + newly installed skills in `.agent/skills/`
17
+
18
+ ---
19
+
20
+ ## 1. Receive values
21
+
22
+ The calling command provides values in two categories:
23
+
24
+ ### Surface-Keyed Values (fill the Per-Surface Skills table)
25
+
26
+ Each value is tagged with a surface. Format: `SURFACE=<surface> KEY=<value>`
27
+
28
+ Example invocation from `/create-prd-stack`:
29
+ ```
30
+ SURFACE=shared LANGUAGES=typescript BE_FRAMEWORKS=hono DATABASES=supabase,surrealdb ORMS=drizzle
31
+ SURFACE=web LANGUAGES=typescript FE_FRAMEWORKS=astro FE_DESIGN=tailwind,vanilla-css STATE_MGMT=nanostores DATABASES=supabase,surrealdb UNIT_TESTS=vitest E2E_TESTS=playwright
32
+ SURFACE=desktop LANGUAGES=typescript,rust FE_FRAMEWORKS=— BE_FRAMEWORKS=tauri DATABASES=supabase,surrealdb,pglite,surrealdb-embedded UNIT_TESTS=vitest,cargo-test
33
+ ```
34
+
35
+ Per-surface column keys:
36
+
37
+ | Column Key | Map Column | Example |
38
+ |-----------|------------|---------|
39
+ | `LANGUAGES` | Languages | typescript, rust |
40
+ | `BE_FRAMEWORKS` | BE Frameworks | hono, tauri |
41
+ | `FE_FRAMEWORKS` | FE Frameworks | astro, react-native |
42
+ | `FE_DESIGN` | FE Design | tailwind, vanilla-css |
43
+ | `ORMS` | ORMs | drizzle |
44
+ | `STATE_MGMT` | State Mgmt | nanostores, zustand |
45
+ | `DATABASES` | Databases | supabase, surrealdb, pglite |
46
+ | `UNIT_TESTS` | Unit Tests | vitest, cargo-test |
47
+ | `E2E_TESTS` | E2E Tests | playwright, detox |
48
+ | `TEST_CMD` | Test Cmd | npm test |
49
+ | `VALIDATION_CMD` | Validation Cmd | npm run validate |
50
+ | `LINT_CMD` | Lint Cmd | npm run lint |
51
+ | `BUILD_CMD` | Build Cmd | npm run build |
52
+ | `DEV_CMD` | Dev Cmd | npm run dev |
53
+ | `PACKAGE_MGR` | Package Mgr | npm |
54
+
55
+ ### Cross-Cutting Values (fill the Cross-Cutting Skills table)
56
+
57
+ These are project-wide, not per-surface:
58
+
59
+ | Key | Map Category | Example |
60
+ |-----|-------------|---------|
61
+ | `AUTH` | Auth | clerk, supabase-auth |
62
+ | `CI_CD` | CI/CD | github-actions |
63
+ | `HOSTING` | Hosting | vercel, tauri-updater |
64
+ | `SECURITY` | Security | owasp-web, desktop-sandboxing |
65
+ | `API_DESIGN` | API Design | api-design-principles |
66
+ | `ACCESSIBILITY` | Accessibility | accessibility |
67
+ | `CONTRACT_LIBRARY` | Contract Library | zod |
68
+
69
+ ### Global Values (fill Global Settings in tech-stack.md + root configs)
70
+
71
+ | Key | Example |
72
+ |-----|---------|
73
+ | `PROJECT_NAME` | RepairYour.Tech |
74
+ | `DESCRIPTION` | One-line description |
75
+ | `TECH_STACK_SUMMARY` | Supabase + SurrealDB + Astro + Tauri |
76
+ | `SURFACES` | web, desktop, mobile |
77
+ | `ARCHITECTURE_DOC` | docs/plans/2026-03-13-architecture-design.md |
78
+
79
+ ### Structural Values (fill instruction templates — unchanged from v2)
80
+
81
+ | Key | Example |
82
+ |-----|---------|
83
+ | `FRAMEWORK_PATTERNS` | Framework-specific patterns block |
84
+ | `PROJECT_STRUCTURE` | Directory layout block |
85
+ | `ARCHITECTURE_TABLE` | Concern/Location/Runtime table rows |
86
+
87
+ ### Infrastructure Values (fill instruction templates — unchanged from v2)
88
+
89
+ | Key | Example |
90
+ |-----|---------|
91
+ | `SSH_HOST` | my-vps |
92
+ | `DB_PORT` | 19000 |
93
+ | `CREDENTIAL_TOOL` | agent-auth ssh-add |
94
+ | `SECRET_MANAGEMENT` | wrangler secret |
95
+ | `DEPLOY_COMMAND` | wrangler deploy |
96
+
97
+ If any values are missing, leave those cells empty — they'll be filled on a future invocation.
98
+
99
+ ---
100
+
101
+ ## 2. Fill the surface stack map
102
+
103
+ Open `.agent/instructions/tech-stack.md` and update:
104
+
105
+ ### 2a. Per-Surface Skills table
106
+
107
+ For each `SURFACE=<name>` received:
108
+ 1. If a row for `<name>` exists → update the cells for the provided column keys only (don't overwrite cells that already have values unless explicitly re-provided)
109
+ 2. If no row exists → add a new row with the provided values, `—` for unprovided columns
110
+
111
+ ### 2b. Cross-Cutting Skills table
112
+
113
+ For each cross-cutting key received, update the corresponding category row. If the value is additive (e.g., adding a second database), **append** to the comma-separated list rather than overwriting. If the value is already present, skip (idempotent).
114
+
115
+ ### 2c. Global Settings
116
+
117
+ Fill the Global Settings table with any provided global values.
118
+
119
+ ---
120
+
121
+ ## 3. Fill root agent config files
122
+
123
+ Replace in **both** `AGENTS.md` and `GEMINI.md`:
124
+ - `{{PROJECT_NAME}}`
125
+ - `{{DESCRIPTION}}`
126
+ - `{{TECH_STACK_SUMMARY}}`
127
+ - `{{VALIDATION_COMMAND}}` — use the **primary surface's** validation command from the map (first non-shared row, or shared if only shared exists)
128
+ - `{{ARCHITECTURE_DOC}}`
129
+ - `{{CONTRACT_LIBRARY}}`
130
+ - `{{INSTALLED_SKILLS}}` (if provided; otherwise leave for step 8)
131
+
132
+ > **Note**: Both files serve as root agent config. Both must be kept in sync — any value filled in one must be filled in the other.
133
+
134
+ ---
135
+
136
+ ## 4. Fill instruction templates
137
+
138
+ ### `.agent/instructions/commands.md`
139
+ Write per-surface command sections. For each surface in the map, create a section with its commands (Test Cmd, Validation Cmd, Lint Cmd, Build Cmd, Dev Cmd, Package Mgr).
140
+
141
+ ### `.agent/instructions/workflow.md`
142
+ Fill `{{VALIDATION_COMMAND}}` with the primary surface's validation command.
143
+
144
+ ### `.agent/instructions/patterns.md`
145
+ Replace `{{FRAMEWORK_PATTERNS}}` if provided.
146
+
147
+ ### `.agent/instructions/structure.md`
148
+ Replace `{{PROJECT_STRUCTURE}}`, `{{ARCHITECTURE_TABLE}}` if provided.
149
+
150
+ ---
151
+
152
+ ## 5. Fill operational skill and rule templates
153
+
154
+ Scan `.agent/skills/*/SKILL.md` and `.agent/rules/*.md` for `{{PLACEHOLDER}}` values and fill any that match the provided values. Currently applicable:
155
+
156
+ - `{{VALIDATION_COMMAND}}` — in `fix-bug`, `main-workflow`, `deploy`, `refactor`
157
+ - `{{PACKAGE_MANAGER}}` — in `refactor`, `security-audit`
158
+ - `{{CONTRACT_LIBRARY}}` — in `tdd-contract-first.md`
159
+ - Other command/infra placeholders as documented in v2
160
+
161
+ ---
162
+
163
+ ## 6. Read skill library manifest
164
+
165
+ Read `skill-library/MANIFEST.md` to load the trigger tables.
166
+
167
+ If `skill-library/MANIFEST.md` does not exist, skip steps 7-8 and go to step 9.
168
+
169
+ ---
170
+
171
+ ## 7. Provision skills — 4-Tier Resolution Chain
172
+
173
+ For each skill name referenced in ANY cell of the surface stack map, resolve it using this chain:
174
+
175
+ ### Tier 1: Exact Match
176
+ Check `.agent/skill-library/{name}/` (or `.agent/skills/{name}/` if already installed).
177
+ - **Found in library** AND not yet installed → copy to `.agent/skills/{name}/`, fill any `{{PLACEHOLDER}}`s in the copied SKILL.md
178
+ - **Already installed** → skip (idempotent)
179
+ - **Not found** → proceed to Tier 2
180
+
181
+ ### Tier 2: Partial Match + Adequacy Check
182
+ Search `.agent/skill-library/` and `.agent/skills/` for skills whose name contains the base term. E.g., for `surrealdb-embedded`, check if `surrealdb` exists.
183
+
184
+ - **Partial match found** → Read its `SKILL.md`. Assess: does it cover the needed variant? Check for keywords related to the specific need (e.g., "embedded", "WASM", "Rust-native" for `surrealdb-embedded`).
185
+ - **Adequate** — the existing skill covers the variant → use it. Note in the report: `"{name}" resolved by existing "{partial}" skill (covers {variant})`.
186
+ - **Falls short** — the skill doesn't address the specific variant → proceed to Tier 3
187
+ - **No partial match** → proceed to Tier 3
188
+
189
+ ### Tier 3: External Discovery
190
+ Read `.agent/skills/find-skills/SKILL.md` and invoke its discovery methodology to search for the skill externally.
191
+
192
+ - **Found** → install → fill map cell with resolved name
193
+ - **Not found** → proceed to Tier 4
194
+
195
+ ### Tier 4: Human Escalation
196
+ Mark the map cell with `⚠️ {name} [not found]`. Include in the report:
197
+
198
+ > "Skill `{name}` was not found in the skill library, via partial match, or externally. Options:
199
+ > 1. Create it with `/skill-creator`
200
+ > 2. Provide an alternative skill name
201
+ > 3. Mark as not needed (change cell to `—`)"
202
+
203
+ ### Resolution reporting
204
+ After resolving all skills, report:
205
+ - Which skills were installed (Tier 1)
206
+ - Which skills were resolved by adequacy check (Tier 2) — include justification
207
+ - Which skills were discovered externally (Tier 3)
208
+ - Which skills need human attention (Tier 4) — include the `⚠️` cells
209
+
210
+ ---
211
+
212
+ ## 8. Update installed skills list
213
+
214
+ After provisioning, build a markdown list of all installed skills and update `{{INSTALLED_SKILLS}}` in `tech-stack.md`:
215
+
216
+ ```markdown
217
+ ### Default Skills
218
+ - fix-bug — TDD bug fix workflow
219
+ - refactor — Safe refactoring with test verification
220
+ - ...
221
+
222
+ ### Stack Skills (Per-Surface)
223
+ - [skill-name] — [description] (surface: [surface], column: [column])
224
+ - ...
225
+
226
+ ### Stack Skills (Cross-Cutting)
227
+ - [skill-name] — [description] (category: [category])
228
+ - ...
229
+
230
+ ### Surface Skills
231
+ - [skill-name] — [description] (installed for [surface] surface)
232
+ - ...
233
+ ```
234
+
235
+ ---
236
+
237
+ ## 9. Report results
238
+
239
+ Present the results to the calling command (not directly to the user — the calling command handles user communication):
240
+
241
+ - Which map cells were filled (and their values)
242
+ - Which map cells remain empty
243
+ - Skill resolution report (from step 7)
244
+ - Which skills were already installed and skipped
245
+ - Any `⚠️` cells requiring user attention
246
+ - Any errors (missing files, missing library paths)
247
+
248
+ ---
249
+
250
+ ## Idempotency
251
+
252
+ Bootstrap is safe to call multiple times:
253
+
254
+ - **Already-filled map cells**: Cells with values are NOT overwritten unless the calling command explicitly re-provides a value for that surface + column
255
+ - **Already-installed skills**: Skills that already exist in `.agent/skills/` are not re-copied from the library
256
+ - **New surface rows**: New surfaces trigger new row creation without affecting existing rows
257
+ - **Appending values**: Cross-cutting skills and accumulated columns append to existing comma-separated lists without duplicating
258
+ - **Partial invocation**: Bootstrap can be called with just one surface or one key — it only fills what's provided