cfsa-antigravity 2.0.0 → 2.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/README.md +14 -0
- package/package.json +1 -1
- package/template/.agent/instructions/commands.md +8 -32
- package/template/.agent/instructions/patterns.md +3 -3
- package/template/.agent/instructions/tech-stack.md +71 -23
- package/template/.agent/instructions/workflow.md +12 -1
- package/template/.agent/rules/completion-checklist.md +6 -0
- package/template/.agent/rules/security-first.md +3 -3
- package/template/.agent/rules/vertical-slices.md +1 -1
- package/template/.agent/skill-library/MANIFEST.md +6 -0
- package/template/.agent/skill-library/stack/devops/git-advanced/SKILL.md +972 -0
- package/template/.agent/skill-library/stack/devops/git-workflow/SKILL.md +420 -0
- package/template/.agent/skills/api-versioning/SKILL.md +44 -298
- package/template/.agent/skills/api-versioning/references/typescript.md +157 -0
- package/template/.agent/skills/architecture-mapping/SKILL.md +7 -7
- package/template/.agent/skills/bootstrap-agents/SKILL.md +151 -152
- package/template/.agent/skills/clean-code/SKILL.md +64 -118
- package/template/.agent/skills/clean-code/references/typescript.md +126 -0
- package/template/.agent/skills/database-schema-design/SKILL.md +93 -317
- package/template/.agent/skills/database-schema-design/references/relational.md +228 -0
- package/template/.agent/skills/error-handling-patterns/SKILL.md +62 -557
- package/template/.agent/skills/error-handling-patterns/references/go.md +162 -0
- package/template/.agent/skills/error-handling-patterns/references/python.md +262 -0
- package/template/.agent/skills/error-handling-patterns/references/rust.md +112 -0
- package/template/.agent/skills/error-handling-patterns/references/typescript.md +178 -0
- package/template/.agent/skills/idea-extraction/SKILL.md +119 -12
- package/template/.agent/skills/logging-best-practices/SKILL.md +108 -767
- package/template/.agent/skills/logging-best-practices/references/go.md +49 -0
- package/template/.agent/skills/logging-best-practices/references/python.md +52 -0
- package/template/.agent/skills/logging-best-practices/references/typescript.md +215 -0
- package/template/.agent/skills/migration-management/SKILL.md +127 -311
- package/template/.agent/skills/migration-management/references/relational.md +214 -0
- package/template/.agent/skills/parallel-feature-development/SKILL.md +34 -43
- package/template/.agent/skills/pipeline-rubrics/references/be-rubric.md +1 -1
- package/template/.agent/skills/pipeline-rubrics/references/ia-rubric.md +1 -1
- package/template/.agent/skills/prd-templates/SKILL.md +20 -3
- package/template/.agent/skills/prd-templates/references/be-spec-template.md +2 -2
- package/template/.agent/skills/prd-templates/references/decomposition-templates.md +2 -2
- package/template/.agent/skills/prd-templates/references/fe-spec-template.md +1 -1
- package/template/.agent/skills/prd-templates/references/ideation-domain-template.md +8 -2
- package/template/.agent/skills/prd-templates/references/ideation-index-template.md +25 -1
- package/template/.agent/skills/prd-templates/references/operational-templates.md +1 -1
- package/template/.agent/skills/prd-templates/references/placeholder-workflow-mapping.md +50 -21
- package/template/.agent/skills/prd-templates/references/skill-loading-protocol.md +32 -0
- package/template/.agent/skills/prd-templates/references/slice-completion-gates.md +21 -0
- package/template/.agent/skills/prd-templates/references/spec-coverage-sweep.md +3 -3
- package/template/.agent/skills/prd-templates/references/tdd-testing-policy.md +39 -0
- package/template/.agent/skills/prd-templates/references/vision-template.md +1 -1
- package/template/.agent/skills/regex-patterns/SKILL.md +122 -540
- package/template/.agent/skills/regex-patterns/references/go.md +44 -0
- package/template/.agent/skills/regex-patterns/references/javascript.md +63 -0
- package/template/.agent/skills/regex-patterns/references/python.md +77 -0
- package/template/.agent/skills/regex-patterns/references/rust.md +43 -0
- package/template/.agent/skills/session-continuity/SKILL.md +11 -9
- package/template/.agent/skills/session-continuity/protocols/02-progress-generation.md +2 -2
- package/template/.agent/skills/session-continuity/protocols/04-pattern-extraction.md +1 -1
- package/template/.agent/skills/session-continuity/protocols/05-session-close.md +1 -1
- package/template/.agent/skills/session-continuity/protocols/09-parallel-claim.md +1 -1
- package/template/.agent/skills/session-continuity/protocols/10-placeholder-verification-gate.md +57 -78
- package/template/.agent/skills/session-continuity/protocols/11-parallel-synthesis.md +1 -1
- package/template/.agent/skills/tdd-workflow/SKILL.md +94 -317
- package/template/.agent/skills/tdd-workflow/references/typescript.md +231 -0
- package/template/.agent/skills/testing-strategist/SKILL.md +74 -687
- package/template/.agent/skills/testing-strategist/references/typescript.md +328 -0
- package/template/.agent/skills/workflow-automation/SKILL.md +62 -154
- package/template/.agent/skills/workflow-automation/references/inngest.md +88 -0
- package/template/.agent/skills/workflow-automation/references/temporal.md +64 -0
- package/template/.agent/workflows/bootstrap-agents-fill.md +85 -143
- package/template/.agent/workflows/bootstrap-agents-provision.md +90 -107
- package/template/.agent/workflows/create-prd-architecture.md +16 -14
- package/template/.agent/workflows/create-prd-compile.md +11 -12
- package/template/.agent/workflows/create-prd-design-system.md +1 -1
- package/template/.agent/workflows/create-prd-security.md +9 -11
- package/template/.agent/workflows/create-prd-stack.md +10 -4
- package/template/.agent/workflows/create-prd.md +5 -6
- package/template/.agent/workflows/decompose-architecture-structure.md +3 -5
- package/template/.agent/workflows/decompose-architecture-validate.md +18 -1
- package/template/.agent/workflows/evolve-contract.md +11 -11
- package/template/.agent/workflows/ideate-discover.md +10 -6
- package/template/.agent/workflows/ideate-extract.md +61 -4
- package/template/.agent/workflows/ideate-validate.md +3 -3
- package/template/.agent/workflows/ideate.md +2 -2
- package/template/.agent/workflows/implement-slice-setup.md +25 -23
- package/template/.agent/workflows/implement-slice-tdd.md +51 -92
- package/template/.agent/workflows/implement-slice.md +4 -4
- package/template/.agent/workflows/plan-phase-preflight.md +6 -2
- package/template/.agent/workflows/plan-phase-write.md +6 -8
- package/template/.agent/workflows/resolve-ambiguity.md +1 -1
- package/template/.agent/workflows/update-architecture-map.md +22 -5
- package/template/.agent/workflows/validate-phase.md +26 -29
- package/template/.agent/workflows/verify-infrastructure.md +10 -10
- package/template/.agent/workflows/write-architecture-spec-design.md +17 -12
- package/template/.agent/workflows/write-be-spec-classify.md +25 -21
- package/template/.agent/workflows/write-be-spec.md +1 -1
- package/template/.agent/workflows/write-fe-spec-classify.md +6 -12
- package/template/.agent/workflows/write-fe-spec-write.md +1 -1
- package/template/AGENTS.md +1 -1
- package/template/GEMINI.md +3 -3
- package/template/docs/kit-architecture.md +34 -8
|
@@ -1,102 +1,90 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bootstrap-agents
|
|
3
|
-
description: "Utility — fill
|
|
4
|
-
version:
|
|
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`, `/
|
|
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
|
|
13
|
-
2. **Provision skills** from `skill-library/`
|
|
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**:
|
|
16
|
-
**Output**: Filled
|
|
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
|
|
20
|
+
## 1. Receive values
|
|
21
21
|
|
|
22
|
-
The calling command provides
|
|
22
|
+
The calling command provides values in two categories:
|
|
23
23
|
|
|
24
|
-
###
|
|
24
|
+
### Surface-Keyed Values (fill the Per-Surface Skills table)
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
| `
|
|
40
|
-
|
|
41
|
-
|
|
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` |
|
|
73
|
+
| `PROJECT_NAME` | RepairYour.Tech |
|
|
46
74
|
| `DESCRIPTION` | One-line description |
|
|
47
|
-
| `TECH_STACK_SUMMARY` |
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
|
|
97
|
+
If any values are missing, leave those cells empty — they'll be filled on a future invocation.
|
|
110
98
|
|
|
111
|
-
|
|
112
|
-
|-----|---------|
|
|
113
|
-
| `SURFACES` | web, api |
|
|
99
|
+
---
|
|
114
100
|
|
|
115
|
-
|
|
101
|
+
## 2. Fill the surface stack map
|
|
116
102
|
|
|
117
|
-
|
|
103
|
+
Open `.agent/instructions/tech-stack.md` and update:
|
|
118
104
|
|
|
119
|
-
|
|
105
|
+
### 2a. Per-Surface Skills table
|
|
120
106
|
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
###
|
|
125
|
-
Replace: `{{VALIDATION_COMMAND}}`
|
|
111
|
+
### 2b. Cross-Cutting Skills table
|
|
126
112
|
|
|
127
|
-
|
|
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
|
-
###
|
|
131
|
-
Replace: `{{PROJECT_STRUCTURE}}`, `{{ARCHITECTURE_TABLE}}` if provided
|
|
115
|
+
### 2c. Global Settings
|
|
132
116
|
|
|
133
|
-
|
|
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
|
|
121
|
+
## 3. Fill root agent config files
|
|
139
122
|
|
|
140
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
### `.
|
|
157
|
-
Replace
|
|
147
|
+
### `.agent/instructions/structure.md`
|
|
148
|
+
Replace `{{PROJECT_STRUCTURE}}`, `{{ARCHITECTURE_TABLE}}` if provided.
|
|
158
149
|
|
|
159
150
|
---
|
|
160
151
|
|
|
161
|
-
## 5. Fill
|
|
152
|
+
## 5. Fill operational skill and rule templates
|
|
162
153
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- `{{
|
|
166
|
-
- `{{
|
|
167
|
-
- `{{
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
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
|
-
|
|
192
|
-
|
|
192
|
+
- **Found** → install → fill map cell with resolved name
|
|
193
|
+
- **Not found** → proceed to Tier 4
|
|
193
194
|
|
|
194
|
-
###
|
|
195
|
+
### Tier 4: Human Escalation
|
|
196
|
+
Mark the map cell with `⚠️ {name} [not found]`. Include in the report:
|
|
195
197
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
-
|
|
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
|
|
245
|
-
- Which
|
|
246
|
-
-
|
|
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
|
|
257
|
-
- **Already-installed skills**: Skills that already exist in `.
|
|
258
|
-
- **New
|
|
259
|
-
- **
|
|
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
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
name: clean-code
|
|
3
3
|
description: "Applies battle-tested clean code principles to writing, reviewing, and refactoring code. Covers naming, functions, comments, error handling, class design, and the critical difference between clever code and clear code."
|
|
4
4
|
version: 2.0.0
|
|
5
|
-
source: self
|
|
6
|
-
date_added: "2026-02-27"
|
|
7
|
-
date_rewritten: "2026-03-14"
|
|
8
5
|
---
|
|
9
6
|
|
|
10
7
|
# Clean Code
|
|
@@ -18,6 +15,17 @@ Code is read 10x more than it's written. Every naming choice, every function bou
|
|
|
18
15
|
- Refactoring existing code
|
|
19
16
|
- When code "works but feels wrong"
|
|
20
17
|
|
|
18
|
+
## Stack-Specific References
|
|
19
|
+
|
|
20
|
+
The principles below are language-agnostic. For idiomatic patterns and syntax, read the reference matching your surface's Languages column:
|
|
21
|
+
|
|
22
|
+
| Language | Reference |
|
|
23
|
+
|----------|-----------|
|
|
24
|
+
| TypeScript / JavaScript | `references/typescript.md` |
|
|
25
|
+
| Python | `references/python.md` |
|
|
26
|
+
| Go | `references/go.md` |
|
|
27
|
+
| Rust | `references/rust.md` |
|
|
28
|
+
|
|
21
29
|
## Core Principles
|
|
22
30
|
|
|
23
31
|
### 1. Names Are Documentation
|
|
@@ -36,7 +44,7 @@ Names should reveal intent. If a name requires a comment to explain it, the name
|
|
|
36
44
|
| `Utils` | `StringFormatter` | Util for what? |
|
|
37
45
|
|
|
38
46
|
**Rules:**
|
|
39
|
-
- Classes → nouns (`UserRepository`, `PaymentGateway`)
|
|
47
|
+
- Classes/types → nouns (`UserRepository`, `PaymentGateway`)
|
|
40
48
|
- Functions → verbs (`calculateTotal`, `sendNotification`)
|
|
41
49
|
- Booleans → questions (`isActive`, `hasPermission`, `canEdit`)
|
|
42
50
|
- Constants → screaming snake with context (`MAX_RETRY_ATTEMPTS`, not `MAX`)
|
|
@@ -48,46 +56,16 @@ A function that does one thing well is easy to name, test, and reuse. A function
|
|
|
48
56
|
|
|
49
57
|
**The test:** Can you describe the function without using "and"? If not, split it.
|
|
50
58
|
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
total += item.price * item.quantity;
|
|
62
|
-
if (item.taxable) total += item.price * 0.08;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Save
|
|
66
|
-
db.orders.insert({ ...order, total, status: "pending" });
|
|
67
|
-
emailService.send(order.customer.email, "Order confirmed");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// ✅ Each function does one thing
|
|
71
|
-
function validateOrder(order: Order): void {
|
|
72
|
-
if (!order.items.length) throw new InvalidOrderError("Empty order");
|
|
73
|
-
if (!order.customer) throw new InvalidOrderError("No customer");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function calculateOrderTotal(items: OrderItem[]): number {
|
|
77
|
-
return items.reduce((total, item) => {
|
|
78
|
-
const subtotal = item.price * item.quantity;
|
|
79
|
-
const tax = item.taxable ? item.price * TAX_RATE : 0;
|
|
80
|
-
return total + subtotal + tax;
|
|
81
|
-
}, 0);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function submitOrder(order: Order): OrderConfirmation {
|
|
85
|
-
validateOrder(order);
|
|
86
|
-
const total = calculateOrderTotal(order.items);
|
|
87
|
-
const saved = db.orders.insert({ ...order, total, status: "pending" });
|
|
88
|
-
emailService.send(order.customer.email, "Order confirmed");
|
|
89
|
-
return { orderId: saved.id, total };
|
|
90
|
-
}
|
|
59
|
+
```
|
|
60
|
+
❌ processOrder(order)
|
|
61
|
+
— validates order
|
|
62
|
+
— calculates total with tax
|
|
63
|
+
— saves to database
|
|
64
|
+
— sends confirmation email
|
|
65
|
+
|
|
66
|
+
✅ validateOrder(order) → throws if invalid
|
|
67
|
+
calculateOrderTotal(items) → returns numeric total
|
|
68
|
+
submitOrder(order) → orchestrates the above
|
|
91
69
|
```
|
|
92
70
|
|
|
93
71
|
**Function size limits:**
|
|
@@ -100,111 +78,79 @@ function submitOrder(order: Order): OrderConfirmation {
|
|
|
100
78
|
|
|
101
79
|
- **0-2 parameters**: ideal
|
|
102
80
|
- **3 parameters**: acceptable with named/destructured args
|
|
103
|
-
- **4+ parameters**: use an options object
|
|
81
|
+
- **4+ parameters**: use an options object/struct/dataclass
|
|
104
82
|
- **Boolean parameters**: almost always a code smell — split into two functions
|
|
105
83
|
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
function createAdmin(name: string): User { ... }
|
|
113
|
-
|
|
114
|
-
// ❌ Too many positional args
|
|
115
|
-
function sendEmail(to: string, from: string, subject: string, body: string, cc?: string): void { ... }
|
|
116
|
-
|
|
117
|
-
// ✅ Options object
|
|
118
|
-
interface SendEmailOptions {
|
|
119
|
-
to: string;
|
|
120
|
-
from: string;
|
|
121
|
-
subject: string;
|
|
122
|
-
body: string;
|
|
123
|
-
cc?: string;
|
|
124
|
-
}
|
|
125
|
-
function sendEmail(options: SendEmailOptions): void { ... }
|
|
84
|
+
```
|
|
85
|
+
❌ createUser(name, isAdmin)
|
|
86
|
+
✅ createUser(name) / createAdmin(name)
|
|
87
|
+
|
|
88
|
+
❌ sendEmail(to, from, subject, body, cc)
|
|
89
|
+
✅ sendEmail(options) ← options is a structured type
|
|
126
90
|
```
|
|
127
91
|
|
|
128
92
|
### 4. Comments: Why, Not What
|
|
129
93
|
|
|
130
94
|
Good code doesn't need comments to explain WHAT it does. Comments should explain WHY — the non-obvious reasoning, business rules, or constraints.
|
|
131
95
|
|
|
132
|
-
```
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
counter += 1;
|
|
96
|
+
```
|
|
97
|
+
❌ // Increment counter by one
|
|
98
|
+
counter += 1
|
|
136
99
|
|
|
137
|
-
//
|
|
138
|
-
|
|
139
|
-
if (user.role === "admin") { ... }
|
|
100
|
+
❌ // Check if user is admin
|
|
101
|
+
if user.role == "admin"
|
|
140
102
|
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
const amountInCents = Math.round(price * 100);
|
|
103
|
+
✅ // Stripe requires amount in cents, not dollars
|
|
104
|
+
amountInCents = round(price * 100)
|
|
144
105
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
await auditLog.record(changeEvent);
|
|
106
|
+
✅ // FDA regulation 21 CFR Part 11 requires audit trail
|
|
107
|
+
auditLog.record(changeEvent)
|
|
148
108
|
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
await db.execute(batchUpdateQuery);
|
|
109
|
+
✅ // WARNING: This query locks the orders table — avoid during peak hours
|
|
110
|
+
db.execute(batchUpdateQuery)
|
|
152
111
|
```
|
|
153
112
|
|
|
154
113
|
**Delete these comments immediately:**
|
|
155
114
|
- `// TODO: fix this later` — fix it now or create a tracked issue
|
|
156
115
|
- `// This is a hack` — then don't commit the hack
|
|
157
116
|
- `// I don't know why this works` — figure it out before shipping
|
|
158
|
-
- Commented-out code — delete it;
|
|
117
|
+
- Commented-out code — delete it; version control has your history
|
|
159
118
|
|
|
160
119
|
### 5. Error Handling
|
|
161
120
|
|
|
162
121
|
Errors are not edge cases — they're expected behavior. Handle them explicitly.
|
|
163
122
|
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
} catch (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
await processPayment(order);
|
|
182
|
-
} catch (error) {
|
|
183
|
-
if (error instanceof InsufficientFundsError) {
|
|
184
|
-
return { success: false, code: "INSUFFICIENT_FUNDS", retry: false };
|
|
185
|
-
}
|
|
186
|
-
if (error instanceof PaymentGatewayError) {
|
|
187
|
-
logger.error("Payment gateway failure", { orderId: order.id, error });
|
|
188
|
-
return { success: false, code: "GATEWAY_ERROR", retry: true };
|
|
189
|
-
}
|
|
190
|
-
throw error; // Unknown errors bubble up
|
|
191
|
-
}
|
|
123
|
+
```
|
|
124
|
+
❌ try { save(order) } catch { log("error") }
|
|
125
|
+
→ What error? What happens to the order?
|
|
126
|
+
|
|
127
|
+
❌ try { processPayment(order) } catch { throw Error("Something went wrong") }
|
|
128
|
+
→ Useless to the caller
|
|
129
|
+
|
|
130
|
+
✅ try {
|
|
131
|
+
processPayment(order)
|
|
132
|
+
} catch InsufficientFundsError:
|
|
133
|
+
return { success: false, code: "INSUFFICIENT_FUNDS", retry: false }
|
|
134
|
+
catch PaymentGatewayError:
|
|
135
|
+
logger.error("Payment gateway failure", { orderId: order.id })
|
|
136
|
+
return { success: false, code: "GATEWAY_ERROR", retry: true }
|
|
137
|
+
catch unknown:
|
|
138
|
+
rethrow → Unknown errors bubble up
|
|
192
139
|
```
|
|
193
140
|
|
|
194
141
|
### 6. Don't Repeat Yourself (DRY) — But Don't Over-Abstract
|
|
195
142
|
|
|
196
143
|
**DRY violation** — same logic copy-pasted in 3+ places:
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
144
|
+
```
|
|
145
|
+
tax1 = price1 * 0.08
|
|
146
|
+
tax2 = price2 * 0.08
|
|
147
|
+
tax3 = price3 * 0.08
|
|
148
|
+
→ Extract: calculateTax(price)
|
|
202
149
|
```
|
|
203
150
|
|
|
204
151
|
**Over-abstraction** — premature DRY that couples unrelated things:
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
function handleEntity(type: "user" | "order" | "product", action: "create" | "update" | "delete", data: unknown) { ... }
|
|
152
|
+
```
|
|
153
|
+
❌ handleEntity(type, action, data) → "universal" handler for everything
|
|
208
154
|
```
|
|
209
155
|
|
|
210
156
|
**Rule of Three**: Duplicate once is acceptable. Duplicate twice means extract.
|