cfsa-antigravity 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +14 -0
  2. package/package.json +1 -1
  3. package/template/.agent/instructions/commands.md +8 -32
  4. package/template/.agent/instructions/example.md +21 -0
  5. package/template/.agent/instructions/patterns.md +3 -3
  6. package/template/.agent/instructions/tech-stack.md +71 -23
  7. package/template/.agent/instructions/workflow.md +12 -1
  8. package/template/.agent/rules/completion-checklist.md +6 -0
  9. package/template/.agent/rules/security-first.md +3 -3
  10. package/template/.agent/rules/vertical-slices.md +1 -1
  11. package/template/.agent/skill-library/MANIFEST.md +6 -0
  12. package/template/.agent/skill-library/stack/devops/git-advanced/SKILL.md +972 -0
  13. package/template/.agent/skill-library/stack/devops/git-workflow/SKILL.md +420 -0
  14. package/template/.agent/skills/api-versioning/SKILL.md +44 -298
  15. package/template/.agent/skills/api-versioning/references/typescript.md +157 -0
  16. package/template/.agent/skills/architecture-mapping/SKILL.md +13 -13
  17. package/template/.agent/skills/bootstrap-agents/SKILL.md +151 -152
  18. package/template/.agent/skills/clean-code/SKILL.md +64 -118
  19. package/template/.agent/skills/clean-code/references/typescript.md +126 -0
  20. package/template/.agent/skills/database-schema-design/SKILL.md +93 -317
  21. package/template/.agent/skills/database-schema-design/references/relational.md +228 -0
  22. package/template/.agent/skills/error-handling-patterns/SKILL.md +62 -557
  23. package/template/.agent/skills/error-handling-patterns/references/go.md +162 -0
  24. package/template/.agent/skills/error-handling-patterns/references/python.md +262 -0
  25. package/template/.agent/skills/error-handling-patterns/references/rust.md +112 -0
  26. package/template/.agent/skills/error-handling-patterns/references/typescript.md +178 -0
  27. package/template/.agent/skills/idea-extraction/SKILL.md +322 -224
  28. package/template/.agent/skills/logging-best-practices/SKILL.md +108 -767
  29. package/template/.agent/skills/logging-best-practices/references/go.md +49 -0
  30. package/template/.agent/skills/logging-best-practices/references/python.md +52 -0
  31. package/template/.agent/skills/logging-best-practices/references/typescript.md +215 -0
  32. package/template/.agent/skills/migration-management/SKILL.md +127 -311
  33. package/template/.agent/skills/migration-management/references/relational.md +214 -0
  34. package/template/.agent/skills/parallel-feature-development/SKILL.md +34 -43
  35. package/template/.agent/skills/pipeline-rubrics/references/be-rubric.md +1 -1
  36. package/template/.agent/skills/pipeline-rubrics/references/ia-rubric.md +2 -2
  37. package/template/.agent/skills/pipeline-rubrics/references/scoring.md +1 -1
  38. package/template/.agent/skills/pipeline-rubrics/references/vision-rubric.md +2 -1
  39. package/template/.agent/skills/prd-templates/SKILL.md +23 -6
  40. package/template/.agent/skills/prd-templates/references/be-spec-template.md +2 -2
  41. package/template/.agent/skills/prd-templates/references/decomposition-templates.md +2 -2
  42. package/template/.agent/skills/prd-templates/references/engineering-standards-template.md +2 -0
  43. package/template/.agent/skills/prd-templates/references/fe-spec-template.md +1 -1
  44. package/template/.agent/skills/prd-templates/references/fractal-cx-template.md +58 -0
  45. package/template/.agent/skills/prd-templates/references/fractal-feature-template.md +93 -0
  46. package/template/.agent/skills/prd-templates/references/fractal-node-index-template.md +55 -0
  47. package/template/.agent/skills/prd-templates/references/ideation-crosscut-template.md +26 -47
  48. package/template/.agent/skills/prd-templates/references/ideation-index-template.md +47 -31
  49. package/template/.agent/skills/prd-templates/references/operational-templates.md +1 -1
  50. package/template/.agent/skills/prd-templates/references/placeholder-workflow-mapping.md +50 -21
  51. package/template/.agent/skills/prd-templates/references/skill-loading-protocol.md +32 -0
  52. package/template/.agent/skills/prd-templates/references/slice-completion-gates.md +29 -0
  53. package/template/.agent/skills/prd-templates/references/spec-coverage-sweep.md +3 -3
  54. package/template/.agent/skills/prd-templates/references/tdd-testing-policy.md +39 -0
  55. package/template/.agent/skills/prd-templates/references/vision-template.md +8 -8
  56. package/template/.agent/skills/regex-patterns/SKILL.md +122 -540
  57. package/template/.agent/skills/regex-patterns/references/go.md +44 -0
  58. package/template/.agent/skills/regex-patterns/references/javascript.md +63 -0
  59. package/template/.agent/skills/regex-patterns/references/python.md +77 -0
  60. package/template/.agent/skills/regex-patterns/references/rust.md +43 -0
  61. package/template/.agent/skills/resolve-ambiguity/SKILL.md +1 -1
  62. package/template/.agent/skills/session-continuity/SKILL.md +11 -9
  63. package/template/.agent/skills/session-continuity/protocols/02-progress-generation.md +2 -2
  64. package/template/.agent/skills/session-continuity/protocols/04-pattern-extraction.md +1 -1
  65. package/template/.agent/skills/session-continuity/protocols/05-session-close.md +1 -1
  66. package/template/.agent/skills/session-continuity/protocols/09-parallel-claim.md +1 -1
  67. package/template/.agent/skills/session-continuity/protocols/10-placeholder-verification-gate.md +57 -78
  68. package/template/.agent/skills/session-continuity/protocols/11-parallel-synthesis.md +1 -1
  69. package/template/.agent/skills/spec-writing/SKILL.md +1 -1
  70. package/template/.agent/skills/tdd-workflow/SKILL.md +94 -317
  71. package/template/.agent/skills/tdd-workflow/references/typescript.md +231 -0
  72. package/template/.agent/skills/testing-strategist/SKILL.md +74 -687
  73. package/template/.agent/skills/testing-strategist/references/typescript.md +328 -0
  74. package/template/.agent/skills/workflow-automation/SKILL.md +62 -154
  75. package/template/.agent/skills/workflow-automation/references/inngest.md +88 -0
  76. package/template/.agent/skills/workflow-automation/references/temporal.md +64 -0
  77. package/template/.agent/workflows/bootstrap-agents-fill.md +85 -143
  78. package/template/.agent/workflows/bootstrap-agents-provision.md +90 -107
  79. package/template/.agent/workflows/create-prd-architecture.md +23 -16
  80. package/template/.agent/workflows/create-prd-compile.md +11 -12
  81. package/template/.agent/workflows/create-prd-design-system.md +1 -1
  82. package/template/.agent/workflows/create-prd-security.md +9 -11
  83. package/template/.agent/workflows/create-prd-stack.md +10 -4
  84. package/template/.agent/workflows/create-prd.md +9 -9
  85. package/template/.agent/workflows/decompose-architecture-structure.md +4 -6
  86. package/template/.agent/workflows/decompose-architecture-validate.md +18 -1
  87. package/template/.agent/workflows/decompose-architecture.md +18 -3
  88. package/template/.agent/workflows/evolve-contract.md +11 -11
  89. package/template/.agent/workflows/evolve-feature-classify.md +14 -6
  90. package/template/.agent/workflows/ideate-discover.md +72 -107
  91. package/template/.agent/workflows/ideate-extract.md +84 -63
  92. package/template/.agent/workflows/ideate-validate.md +26 -22
  93. package/template/.agent/workflows/ideate.md +9 -9
  94. package/template/.agent/workflows/implement-slice-setup.md +25 -23
  95. package/template/.agent/workflows/implement-slice-tdd.md +73 -89
  96. package/template/.agent/workflows/implement-slice.md +4 -4
  97. package/template/.agent/workflows/plan-phase-preflight.md +6 -2
  98. package/template/.agent/workflows/plan-phase-write.md +6 -8
  99. package/template/.agent/workflows/remediate-pipeline-assess.md +2 -1
  100. package/template/.agent/workflows/resolve-ambiguity.md +2 -2
  101. package/template/.agent/workflows/update-architecture-map.md +22 -5
  102. package/template/.agent/workflows/validate-phase-quality.md +155 -0
  103. package/template/.agent/workflows/validate-phase-readiness.md +167 -0
  104. package/template/.agent/workflows/validate-phase.md +19 -157
  105. package/template/.agent/workflows/verify-infrastructure.md +10 -10
  106. package/template/.agent/workflows/write-architecture-spec-design.md +23 -14
  107. package/template/.agent/workflows/write-be-spec-classify.md +25 -21
  108. package/template/.agent/workflows/write-be-spec.md +1 -1
  109. package/template/.agent/workflows/write-fe-spec-classify.md +6 -12
  110. package/template/.agent/workflows/write-fe-spec-write.md +1 -1
  111. package/template/AGENTS.md +6 -2
  112. package/template/GEMINI.md +5 -3
  113. package/template/docs/README.md +10 -10
  114. package/template/docs/kit-architecture.md +126 -33
  115. package/template/docs/plans/ideation/README.md +8 -3
  116. package/template/.agent/skills/prd-templates/references/ideation-domain-template.md +0 -55
@@ -13,7 +13,7 @@ When invoked, you must:
13
13
 
14
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
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 Zod schemas and API routes present in the codebase. If an API worker exists, document its exposed routes, rate limiting, and exact CORS configurations.
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
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
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
19
 
@@ -24,11 +24,11 @@ Follow these strictly granular steps to perform an architecture mapping:
24
24
  ### Step 1: Deep Codebase Reconnaissance
25
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
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 (Zod or TypeScript interfaces) defining the data models.
27
+ - Locate exact schemas (contract library schemas, type interfaces, or data models) defining the data models.
28
28
 
29
29
  ### Step 2: Component & Contract Analysis
30
30
  - Group files logically, but identify the specific files governing these components.
31
- - For each component, trace its exact Zod schemas, API routes, or React props.
31
+ - For each component, trace its exact validation schemas, API routes, or component props.
32
32
  - Document exact environment variables and secrets expected by the code.
33
33
 
34
34
  ### Step 3: Granular Dependency Tracing
@@ -69,7 +69,7 @@ Create or update `docs/ARCHITECTURE.md` using the following structure:
69
69
  (Determine how information moves through the system down to the exact environment bindings, database connections, and request interceptors.)
70
70
 
71
71
  ## 3. Module Relationships & Contracts
72
- (Detail the actual Zod schemas and API routes present. Document exposed routes, rate limiting, and exact CORS configurations.)
72
+ (Detail the actual contract/validation schemas and API routes present. Document exposed routes, rate limiting, and exact CORS configurations.)
73
73
 
74
74
  ## 4. Key Patterns & Implementation Evidence
75
75
  (Identify architectural decisions, providing exact file references where these patterns are implemented.)
@@ -79,7 +79,7 @@ Create or update `docs/ARCHITECTURE.md` using the following structure:
79
79
 
80
80
  * **Granularity is Mandatory:** Do not describe the system abstractly. Use exact file paths, exact schema names, and exact environment binding names.
81
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 Zod validation schemas.
82
+ * **Be Explicit:** Avoid boilerplate. If an API has 3 endpoints, list the 3 endpoints and their exact validation schemas.
83
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
84
 
85
85
  ## Domain Boundary Protocol
@@ -102,13 +102,13 @@ Ideation sub-features:
102
102
  Split trigger: [none | review | mandatory-split]
103
103
  ```
104
104
 
105
- Read the relevant domain files from `docs/plans/ideation/domains/` and the architecture design to build each record.
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
106
 
107
107
  ### Split Trigger Rules
108
108
 
109
109
  Apply all three rules to every domain:
110
110
 
111
- 1. **80-line proxy** — If the ideation domain file for this domain exceeds ~80 lines of content (features, user stories, acceptance criteria combined), flag as `mandatory-split`.
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
112
 
113
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
114
 
@@ -141,17 +141,17 @@ User must approve or reject each split before the table is locked.
141
141
 
142
142
  ### Purpose
143
143
 
144
- Run this protocol when beginning any architecture spec shard. The ideation domain files are the primary source of truth for sub-features — the architecture design is secondary context.
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
145
 
146
146
  ### Sources to Read
147
147
 
148
- 1. The relevant domain file in `docs/plans/ideation/domains/` for this shard's domain
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
149
  2. The shard's `## Features` section
150
150
  3. `docs/plans/ideation/ideation-index.md` Must Have features for this domain
151
151
 
152
152
  ### Reconciliation Table
153
153
 
154
- | Sub-feature | Ideation domain file | Shard ## Features | Must Have? | Decision |
154
+ | Sub-feature | Ideation domain tree | Shard ## Features | Must Have? | Decision |
155
155
  |-------------|-------------|-------------------|------------|----------|
156
156
  | [name] | ✅ Listed | ✅ Listed | Yes/No | Keep |
157
157
  | [name] | ✅ Listed | ❌ Missing | Yes | **Add to shard immediately** |
@@ -160,9 +160,9 @@ Run this protocol when beginning any architecture spec shard. The ideation domai
160
160
 
161
161
  ### Mismatch Handling Rules
162
162
 
163
- 1. If a sub-feature appears in the ideation domain file 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.
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
164
 
165
- 2. If a sub-feature appears in the shard's `## Features` but not in the ideation domain file → **keep it** but mark it with `[Architecture-only — not in ideation]` as an audit trail. These items need explicit user confirmation.
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
166
 
167
167
  ### Scope Confirmation Presentation Format
168
168
 
@@ -173,7 +173,7 @@ Present the reconciled scope to the user in the following format:
173
173
  > [bullet list of all sub-features, with `[Architecture-only]` markers where applicable]
174
174
  >
175
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 file, added during decomposition.
176
+ > **[M] sub-features marked `[Architecture-only]`** — not found in ideation domain tree, added during decomposition.
177
177
  >
178
178
  > "Does this feature list match your intent for this domain? Any sub-features to add, remove, or re-scope?"
179
179
 
@@ -1,102 +1,90 @@
1
1
  ---
2
2
  name: bootstrap-agents
3
- description: "Utility — fill {{PLACEHOLDER}} values and provision skills from the library. Called by pipeline commands when tech stack info changes."
4
- version: 2.0.0
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
5
  ---
6
6
 
7
7
  # Bootstrap Agents
8
8
 
9
- **This is a utility command, not an entry point.** It gets called by other pipeline commands (like `/create-prd`, `/iterate-plan`, `/write-be-spec`, `/write-fe-spec`, `/add-feature`, `/implement-slice`) whenever they make tech stack decisions or introduce new dependencies.
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
10
 
11
11
  Bootstrap does two things:
12
- 1. **Fill `{{PLACEHOLDER}}` values** in kit instruction templates
13
- 2. **Provision skills** from `skill-library/` based on stack and surface triggers
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
14
 
15
- **Input**: Template values (package manager, framework, database, etc.) + optional stack/surface triggers
16
- **Output**: Filled templates + newly installed skills in `.claude/skills/`
15
+ **Input**: Surface-keyed stack values + optional global values
16
+ **Output**: Filled map cells + newly installed skills in `.agent/skills/`
17
17
 
18
18
  ---
19
19
 
20
- ## 1. Receive template values
20
+ ## 1. Receive values
21
21
 
22
- The calling command provides these values (all optional — fill only what's provided, leave others as `{{PLACEHOLDER}}`):
22
+ The calling command provides values in two categories:
23
23
 
24
- ### Command & Tool Values
24
+ ### Surface-Keyed Values (fill the Per-Surface Skills table)
25
25
 
26
- | Key | Example |
27
- |-----|---------|
28
- | `PACKAGE_MANAGER` | pnpm |
29
- | `DEV_COMMAND` | pnpm dev |
30
- | `TEST_COMMAND` | pnpm test |
31
- | `TEST_WATCH_COMMAND` | pnpm test:watch |
32
- | `TEST_COVERAGE_COMMAND` | pnpm test:coverage |
33
- | `LINT_COMMAND` | pnpm lint |
34
- | `LINT_FIX_COMMAND` | pnpm lint:fix |
35
- | `FORMAT_COMMAND` | pnpm format |
36
- | `TYPE_CHECK_COMMAND` | pnpm type-check |
37
- | `BUILD_COMMAND` | pnpm build |
38
- | `PREVIEW_COMMAND` | pnpm preview |
39
- | `VALIDATION_COMMAND` | pnpm test && pnpm lint && pnpm type-check && pnpm build |
40
-
41
- ### Project Identity
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)
42
70
 
43
71
  | Key | Example |
44
72
  |-----|---------|
45
- | `PROJECT_NAME` | My Project |
73
+ | `PROJECT_NAME` | RepairYour.Tech |
46
74
  | `DESCRIPTION` | One-line description |
47
- | `TECH_STACK_SUMMARY` | Astro + React + SurrealDB + Firebase Auth |
75
+ | `TECH_STACK_SUMMARY` | Supabase + SurrealDB + Astro + Tauri |
76
+ | `SURFACES` | web, desktop, mobile |
77
+ | `ARCHITECTURE_DOC` | docs/plans/2026-03-13-architecture-design.md |
48
78
 
49
- ### Architecture & Structure
79
+ ### Structural Values (fill instruction templates — unchanged from v2)
50
80
 
51
81
  | Key | Example |
52
82
  |-----|---------|
53
83
  | `FRAMEWORK_PATTERNS` | Framework-specific patterns block |
54
84
  | `PROJECT_STRUCTURE` | Directory layout block |
55
85
  | `ARCHITECTURE_TABLE` | Concern/Location/Runtime table rows |
56
- | `ARCHITECTURE_DOC` | docs/plans/2026-02-10-architecture-design.md |
57
- | `CONTRACTS_DIR` | src/contracts/ |
58
- | `BUILD_OUTPUT_DIR` | dist/ |
59
-
60
- ### Stack Values (trigger skill provisioning)
61
86
 
62
- | Key | Example |
63
- |-----|---------|
64
- | `DATABASE` | SurrealDB (self-hosted) |
65
- | `FRONTEND_FRAMEWORK` | Astro + React Islands |
66
- | `BACKEND_FRAMEWORK` | Hono |
67
- | `API_LAYER` | tRPC |
68
- | `BACKEND_RUNTIME` | Cloudflare Workers |
69
- | `ORM` | Drizzle |
70
- | `CSS_FRAMEWORK` | Tailwind CSS v4 |
71
- | `UI_LIBRARY` | shadcn/ui |
72
- | `AUTH_PROVIDER` | Firebase Auth |
73
- | `PAYMENTS` | Stripe |
74
- | `AI_SDK` | Vercel AI SDK |
75
- | `STATE_MANAGEMENT` | TanStack Query |
76
- | `E2E_TESTING` | Playwright |
77
- | `UNIT_TESTING` | Vitest |
78
- | `HOSTING` | Cloudflare Pages + Workers |
79
- | `CDN_ASSETS` | Cloudflare R2 |
80
- | `MONITORING` | Sentry |
81
- | `ANALYTICS` | Google Analytics |
82
- | `EMAIL` | Resend |
83
- | `QUEUE` | Inngest |
84
- | `REALTIME` | Socket.io |
85
- | `SEARCH` | Meilisearch |
86
- | `CMS` | Payload CMS |
87
- | `STORAGE` | AWS S3 |
88
- | `CI_CD` | GitHub Actions |
89
- | `MOBILE_FRAMEWORK` | Expo |
90
- | `LANGUAGE` | TypeScript |
91
- | `3D_FRAMEWORK` | Three.js / R3F |
92
- | `DESKTOP_FRAMEWORK` | Tauri |
93
- | `GAME_ENGINE` | Godot |
94
- | `SECURITY` | OWASP |
95
- | `TEST_RUNNER` | Vitest |
96
- | `LINTER` | ESLint |
97
- | `TYPE_CHECKER` | TypeScript (tsc) |
98
-
99
- ### Infrastructure Values
87
+ ### Infrastructure Values (fill instruction templates — unchanged from v2)
100
88
 
101
89
  | Key | Example |
102
90
  |-----|---------|
@@ -106,65 +94,69 @@ The calling command provides these values (all optional — fill only what's pro
106
94
  | `SECRET_MANAGEMENT` | wrangler secret |
107
95
  | `DEPLOY_COMMAND` | wrangler deploy |
108
96
 
109
- ### Surface Types
97
+ If any values are missing, leave those cells empty — they'll be filled on a future invocation.
110
98
 
111
- | Key | Example |
112
- |-----|---------|
113
- | `SURFACES` | web, api |
99
+ ---
114
100
 
115
- If any values are missing, leave those `{{PLACEHOLDER}}`s in place — they'll be filled on a future invocation.
101
+ ## 2. Fill the surface stack map
116
102
 
117
- ---
103
+ Open `.agent/instructions/tech-stack.md` and update:
118
104
 
119
- ## 2. Fill project skill templates
105
+ ### 2a. Per-Surface Skills table
120
106
 
121
- ### `.claude/skills/project-commands/SKILL.md`
122
- Replace: `{{PACKAGE_MANAGER}}`, `{{DEV_COMMAND}}`, `{{TEST_COMMAND}}`, `{{TEST_WATCH_COMMAND}}`, `{{TEST_COVERAGE_COMMAND}}`, `{{LINT_COMMAND}}`, `{{LINT_FIX_COMMAND}}`, `{{FORMAT_COMMAND}}`, `{{TYPE_CHECK_COMMAND}}`, `{{BUILD_COMMAND}}`, `{{PREVIEW_COMMAND}}`, `{{VALIDATION_COMMAND}}`
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
123
110
 
124
- ### `.claude/skills/project-workflow/SKILL.md`
125
- Replace: `{{VALIDATION_COMMAND}}`
111
+ ### 2b. Cross-Cutting Skills table
126
112
 
127
- ### `.claude/skills/project-patterns/SKILL.md`
128
- Replace: `{{FRAMEWORK_PATTERNS}}` if provided
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).
129
114
 
130
- ### `.claude/skills/project-structure/SKILL.md`
131
- Replace: `{{PROJECT_STRUCTURE}}`, `{{ARCHITECTURE_TABLE}}` if provided
115
+ ### 2c. Global Settings
132
116
 
133
- ### `.claude/skills/project-tech-stack/SKILL.md`
134
- Replace: `{{TECH_STACK_SUMMARY}}`, `{{FRONTEND_FRAMEWORK}}`, `{{BACKEND_RUNTIME}}`, `{{DATABASE}}`, `{{AUTH_PROVIDER}}`, `{{HOSTING}}`, `{{CDN_ASSETS}}`, `{{CICD}}`, `{{MONITORING}}`, `{{PACKAGE_MANAGER}}`, `{{TEST_RUNNER}}`, `{{LINTER}}`, `{{TYPE_CHECKER}}`, `{{INSTALLED_SKILLS}}`
117
+ Fill the Global Settings table with any provided global values.
135
118
 
136
119
  ---
137
120
 
138
- ## 3. Fill default operational skill templates
121
+ ## 3. Fill root agent config files
139
122
 
140
- Scan all `.claude/skills/*/SKILL.md` files for `{{PLACEHOLDER}}` values and fill any that match the provided template values:
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)
141
131
 
142
- - `{{VALIDATION_COMMAND}}` — in `fix-bug`, `main-workflow`, `deploy`, `refactor`
143
- - `{{PACKAGE_MANAGER}}` — in `refactor`, `security-audit`
144
- - `{{TEST_COVERAGE_COMMAND}}` — in `refactor`
145
- - `{{BUILD_COMMAND}}` — in `deploy`
146
- - `{{DEPLOY_COMMAND}}` — in `deploy`
147
- - `{{BUILD_OUTPUT_DIR}}` — in `deploy`
148
- - `{{SSH_HOST}}` — in `setup-session`
149
- - `{{DB_PORT}}` — in `setup-session`
150
- - `{{CREDENTIAL_TOOL}}` — in `setup-session`
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.
151
133
 
152
134
  ---
153
135
 
154
- ## 4. Fill rule templates
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.
155
146
 
156
- ### `.claude/rules/contract-first.md`
157
- Replace: `{{VALIDATION_COMMAND}}`, `{{TEST_RUNNER}}`
147
+ ### `.agent/instructions/structure.md`
148
+ Replace `{{PROJECT_STRUCTURE}}`, `{{ARCHITECTURE_TABLE}}` if provided.
158
149
 
159
150
  ---
160
151
 
161
- ## 5. Fill CLAUDE.md
152
+ ## 5. Fill operational skill and rule templates
162
153
 
163
- Replace in `CLAUDE.md` at project root:
164
- - `{{PROJECT_NAME}}`
165
- - `{{DESCRIPTION}}`
166
- - `{{TECH_STACK_SUMMARY}}`
167
- - `{{VALIDATION_COMMAND}}`
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
168
160
 
169
161
  ---
170
162
 
@@ -172,62 +164,67 @@ Replace in `CLAUDE.md` at project root:
172
164
 
173
165
  Read `skill-library/MANIFEST.md` to load the trigger tables.
174
166
 
175
- If `skill-library/MANIFEST.md` does not exist (e.g., user deleted it or is using a minimal kit), skip steps 7-8 and go to step 9.
167
+ If `skill-library/MANIFEST.md` does not exist, skip steps 7-8 and go to step 9.
176
168
 
177
169
  ---
178
170
 
179
- ## 7. Provision skills from library
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
180
 
181
- For each stack key provided in the template values, check the **Stack Triggers** table in the manifest:
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.
182
183
 
183
- 1. Match the provided value against the manifest's `Value Pattern` (case-insensitive)
184
- 2. If a match is found AND the skill is NOT already in `.claude/skills/[installed-as]/`:
185
- - Copy the entire directory from `skill-library/[library-path]/``.claude/skills/[installed-as]/`
186
- - Fill any `{{PLACEHOLDER}}`s in the newly-copied `SKILL.md` with current template values
187
- 3. If the skill already exists in `.claude/skills/`, skip it (idempotent)
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
188
 
189
- For each surface type provided in `SURFACES`, check the **Surface Triggers** table:
189
+ ### Tier 3: External Discovery
190
+ Read `.agent/skills/find-skills/SKILL.md` and invoke its discovery methodology to search for the skill externally.
190
191
 
191
- 1. Match the surface type against the manifest's `Surface Type` column
192
- 2. Copy matching skills that don't already exist, same as above
192
+ - **Found** install fill map cell with resolved name
193
+ - **Not found** proceed to Tier 4
193
194
 
194
- ### Matching rules
195
+ ### Tier 4: Human Escalation
196
+ Mark the map cell with `⚠️ {name} [not found]`. Include in the report:
195
197
 
196
- | Manifest Pattern | Matches |
197
- |-----------------|---------|
198
- | `*surrealdb*` | "SurrealDB", "surrealdb (self-hosted)", "SurrealDB Cloud" |
199
- | `*cloudflare*` | "Cloudflare Workers", "Cloudflare Pages + Workers" |
200
- | `*tailwind*` | "Tailwind CSS v4", "Tailwind CSS" |
201
- | `*vercel*` OR `*ai-sdk*` | "Vercel AI SDK", "AI SDK" |
202
- | `*three*` OR `*r3f*` | "Three.js", "React Three Fiber", "R3F" |
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 `—`)"
203
202
 
204
- Pattern matching is glob-style with `*` as wildcard, case-insensitive.
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
205
209
 
206
210
  ---
207
211
 
208
212
  ## 8. Update installed skills list
209
213
 
210
- After provisioning, build a markdown list of all installed skills (both defaults and library-provisioned) and update `{{INSTALLED_SKILLS}}` in `project-tech-stack`:
214
+ After provisioning, build a markdown list of all installed skills and update `{{INSTALLED_SKILLS}}` in `tech-stack.md`:
211
215
 
212
216
  ```markdown
213
217
  ### Default Skills
214
218
  - fix-bug — TDD bug fix workflow
215
219
  - refactor — Safe refactoring with test verification
216
- - add-feature — Add feature to existing architecture
217
- - deploy — Full deployment pipeline
218
- - pr-review Structured PR review
219
- - security-auditSecurity review across all layers
220
- - main-workflow — General development workflow
221
- - iterate-plan — Tech stack gap analysis
222
- - setup-session Session initialization
223
- - using-git-worktreesIsolated workspace management
224
- - github-workflow-automation — GitHub CI/CD patterns
225
- - audit-context-building — Deep code analysis
226
- - context7-auto-research — Auto documentation lookup
227
- - self-improving-agent — Learning from experiences
228
-
229
- ### Stack Skills
230
- - [skill-name] — [description] (installed for [STACK_KEY]=[value])
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])
231
228
  - ...
232
229
 
233
230
  ### Surface Skills
@@ -241,10 +238,11 @@ After provisioning, build a markdown list of all installed skills (both defaults
241
238
 
242
239
  Present the results to the calling command (not directly to the user — the calling command handles user communication):
243
240
 
244
- - Which `{{PLACEHOLDER}}`s were filled (and their values)
245
- - Which `{{PLACEHOLDER}}`s remain unfilled
246
- - Which skills were provisioned from the library (if any)
241
+ - Which map cells were filled (and their values)
242
+ - Which map cells remain empty
243
+ - Skill resolution report (from step 7)
247
244
  - Which skills were already installed and skipped
245
+ - Any `⚠️` cells requiring user attention
248
246
  - Any errors (missing files, missing library paths)
249
247
 
250
248
  ---
@@ -253,7 +251,8 @@ Present the results to the calling command (not directly to the user — the cal
253
251
 
254
252
  Bootstrap is safe to call multiple times:
255
253
 
256
- - **Already-filled placeholders**: If a `{{PLACEHOLDER}}` has already been replaced with a value, it is NOT re-filled unless the calling command explicitly provides a new value for that key
257
- - **Already-installed skills**: Skills that already exist in `.claude/skills/` are not re-copied from the library
258
- - **New values**: New stack/surface values trigger new skill installations without affecting existing ones
259
- - **Partial invocation**: Bootstrap can be called with just one or two new values — it only fills what's provided
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