@soleri/forge 9.3.0 → 9.4.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 (58) hide show
  1. package/dist/compose-claude-md.js +118 -7
  2. package/dist/compose-claude-md.js.map +1 -1
  3. package/dist/scaffolder.js +39 -1
  4. package/dist/scaffolder.js.map +1 -1
  5. package/dist/skills/agent-dev/SKILL.md +122 -0
  6. package/dist/skills/agent-guide/SKILL.md +116 -0
  7. package/dist/skills/agent-issues/SKILL.md +268 -0
  8. package/dist/skills/agent-persona/SKILL.md +66 -0
  9. package/dist/skills/deep-review/SKILL.md +12 -0
  10. package/dist/skills/deliver-and-ship/SKILL.md +123 -0
  11. package/dist/skills/discovery-phase/SKILL.md +69 -0
  12. package/dist/skills/env-setup/SKILL.md +151 -0
  13. package/dist/skills/executing-plans/SKILL.md +12 -0
  14. package/dist/skills/finishing-a-development-branch/SKILL.md +76 -0
  15. package/dist/skills/fix-and-learn/SKILL.md +12 -0
  16. package/dist/skills/mcp-doctor/SKILL.md +154 -0
  17. package/dist/skills/subagent-driven-development/SKILL.md +77 -0
  18. package/dist/skills/using-git-worktrees/SKILL.md +80 -0
  19. package/dist/skills/vault-curate/SKILL.md +99 -0
  20. package/dist/skills/verification-before-completion/SKILL.md +12 -0
  21. package/dist/skills/yolo-mode/SKILL.md +80 -0
  22. package/dist/templates/clean-worktrees.d.ts +5 -0
  23. package/dist/templates/clean-worktrees.js +59 -0
  24. package/dist/templates/clean-worktrees.js.map +1 -0
  25. package/dist/templates/setup-script.js +26 -1
  26. package/dist/templates/setup-script.js.map +1 -1
  27. package/dist/templates/shared-rules.js +221 -11
  28. package/dist/templates/shared-rules.js.map +1 -1
  29. package/dist/templates/skills.js +3 -29
  30. package/dist/templates/skills.js.map +1 -1
  31. package/dist/templates/vitest-config.js +1 -0
  32. package/dist/templates/vitest-config.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/compose-claude-md.ts +126 -9
  35. package/src/scaffolder.ts +41 -1
  36. package/src/skills/agent-dev/SKILL.md +122 -0
  37. package/src/skills/agent-guide/SKILL.md +116 -0
  38. package/src/skills/agent-issues/SKILL.md +268 -0
  39. package/src/skills/agent-persona/SKILL.md +66 -0
  40. package/src/skills/deep-review/SKILL.md +12 -0
  41. package/src/skills/deliver-and-ship/SKILL.md +123 -0
  42. package/src/skills/discovery-phase/SKILL.md +69 -0
  43. package/src/skills/env-setup/SKILL.md +151 -0
  44. package/src/skills/executing-plans/SKILL.md +12 -0
  45. package/src/skills/finishing-a-development-branch/SKILL.md +76 -0
  46. package/src/skills/fix-and-learn/SKILL.md +12 -0
  47. package/src/skills/mcp-doctor/SKILL.md +154 -0
  48. package/src/skills/subagent-driven-development/SKILL.md +77 -0
  49. package/src/skills/using-git-worktrees/SKILL.md +80 -0
  50. package/src/skills/vault-curate/SKILL.md +99 -0
  51. package/src/skills/verification-before-completion/SKILL.md +12 -0
  52. package/src/skills/yolo-mode/SKILL.md +80 -0
  53. package/src/templates/clean-worktrees.ts +58 -0
  54. package/src/templates/setup-script.ts +26 -1
  55. package/src/templates/shared-rules.ts +224 -11
  56. package/src/templates/skills.ts +3 -29
  57. package/src/templates/vitest-config.ts +1 -0
  58. package/vitest.config.ts +1 -0
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: agent-issues
3
+ description: >
4
+ Use when creating GitHub issues, bugs, tasks, or milestones that will be
5
+ worked on by AI coding agents. Triggers on: "create issue", "file bug",
6
+ "gh issue", "add milestone", "create task", "report bug", "gh tasks",
7
+ "create tasks", "create tickets", "file tickets", or when generating
8
+ structured work items from conversation context.
9
+ ---
10
+
11
+
12
+ # Agent-Optimized Issue Creation
13
+
14
+ Create GitHub issues that AI agents can parse, execute, and verify without ambiguity. Every issue is a self-contained work order — an agent reading it has everything needed to start, execute, and prove completion.
15
+
16
+ ## Core Principle
17
+
18
+ **Human issues describe problems. Agent issues describe solutions as testable outcomes.**
19
+
20
+ An agent cannot act on "improve avatar handling." It can act on: "Add PNG upload to `POST /v1/avatar` in `apps/api/src/routes/avatar.ts`, return `{ avatarUrl }`, reject files > 2MB with 413."
21
+
22
+ ## When to Use
23
+
24
+ - Creating any GitHub issue via `gh issue create`
25
+ - Filing bugs from conversation context or error logs
26
+ - Breaking plans into trackable work items
27
+ - Creating milestones with sub-issues
28
+ - Converting vault patterns or anti-patterns into actionable fixes
29
+
30
+ ## Issue Template by Type
31
+
32
+ ### Bug
33
+
34
+ ```markdown
35
+ # Objective
36
+ <one sentence: what's broken and what "fixed" looks like>
37
+
38
+ ## Type: bug
39
+ ## Component: <package or module name>
40
+ ## Priority: P0 | P1 | P2 | P3
41
+
42
+ ## Context
43
+ - Impact: <who/what is affected>
44
+ - Related: <links to issues, PRs, vault entries>
45
+ - First seen: <date or commit>
46
+
47
+ ## Steps to Reproduce
48
+ 1. <exact command or action>
49
+ 2. <exact command or action>
50
+ 3. Observe: <what happens>
51
+
52
+ ## Expected vs Actual
53
+ | | Behavior |
54
+ |--|----------|
55
+ | **Expected** | <correct behavior> |
56
+ | **Actual** | <broken behavior> |
57
+
58
+ ## Error Output
59
+ ```
60
+ <paste exact error, stack trace, or log output>
61
+ ```
62
+
63
+ ## Root Cause (if known)
64
+ - File: `path/to/file.ts` — `functionName()` or line reference
65
+ - Why: <brief technical explanation>
66
+
67
+ ## Scope
68
+ | In | Out |
69
+ |----|-----|
70
+ | Fix the specific bug | Refactoring surrounding code |
71
+ | Add regression test | Performance optimization |
72
+
73
+ ## Code Locations
74
+ - Bug site: `path/to/file.ts` — `symbolName`
75
+ - Test file: `path/to/file.test.ts`
76
+ - Related: `path/to/related.ts` — `relatedSymbol`
77
+
78
+ ## Acceptance Criteria
79
+ - [ ] Bug no longer reproduces with steps above
80
+ - [ ] Regression test added that fails without fix, passes with fix
81
+ - [ ] No new lint/type errors
82
+ - [ ] Existing tests pass
83
+
84
+ ## Verification
85
+ ```bash
86
+ <exact test command>
87
+ <exact build/lint command>
88
+ ```
89
+ ```
90
+
91
+ ### Feature
92
+
93
+ ```markdown
94
+ # Objective
95
+ <one sentence: what capability is added and why>
96
+
97
+ ## Type: feature
98
+ ## Component: <package or module name>
99
+ ## Priority: P0 | P1 | P2 | P3
100
+
101
+ ## Context
102
+ - Why: <user need or business reason>
103
+ - Related: <links to issues, PRs, vault entries, specs>
104
+
105
+ ## Scope
106
+ | In | Out |
107
+ |----|-----|
108
+ | <specific deliverable> | <what NOT to touch> |
109
+
110
+ ## Constraints
111
+ - Backward compatibility: <requirements>
112
+ - Dependencies: <allowed/forbidden>
113
+ - Performance: <budgets if any>
114
+ - Security: <requirements if any>
115
+
116
+ ## Code Locations
117
+ - Entry point: `path/to/file.ts` — `functionOrClass`
118
+ - Integration point: `path/to/other.ts` — `symbol`
119
+ - Test location: `path/to/test.ts`
120
+
121
+ ## Proposed Approach (optional)
122
+ 1. <step>
123
+ 2. <step>
124
+
125
+ ## Acceptance Criteria
126
+ - [ ] Given <precondition>, when <action>, then <result>
127
+ - [ ] Given <precondition>, when <action>, then <result>
128
+ - [ ] Tests added for new behavior
129
+ - [ ] Types exported if public API
130
+
131
+ ## Verification
132
+ ```bash
133
+ <exact test command>
134
+ <exact build command>
135
+ ```
136
+
137
+ ## Definition of Done
138
+ - [ ] Acceptance criteria satisfied
139
+ - [ ] `npm test` passes
140
+ - [ ] `npm run typecheck` passes
141
+ - [ ] Changes scoped to "In Scope" only
142
+ ```
143
+
144
+ ### Milestone
145
+
146
+ ```markdown
147
+ # Milestone: <short title>
148
+
149
+ ## Objective
150
+ <one sentence: what this milestone achieves>
151
+
152
+ ## Timeline
153
+ - Target: <date>
154
+ - Depends on: <blocking milestones or external factors>
155
+
156
+ ## Sub-Issues
157
+
158
+ | # | Type | Title | Priority | Depends On |
159
+ |---|------|-------|----------|------------|
160
+ | 1 | feature | <title> | P1 | — |
161
+ | 2 | feature | <title> | P1 | #1 |
162
+ | 3 | bug | <title> | P2 | — |
163
+
164
+ ## Completion Criteria
165
+ - [ ] All sub-issues closed
166
+ - [ ] Integration test passes end-to-end
167
+ - [ ] <milestone-level verification>
168
+ ```
169
+
170
+ ## Field Guide
171
+
172
+ ### Writing Good Objectives
173
+
174
+ | Bad | Good |
175
+ |-----|------|
176
+ | "Fix the login" | "Login returns 401 instead of session token when OAuth callback has valid code" |
177
+ | "Add dark mode" | "Add `prefers-color-scheme` media query support to all semantic color tokens" |
178
+ | "Improve performance" | "Reduce cold-start vault search from 800ms to <200ms by lazy-loading FTS index" |
179
+
180
+ ### Writing Good Acceptance Criteria
181
+
182
+ Use Given/When/Then for behavioral criteria. Use plain checkboxes for structural criteria.
183
+
184
+ **Behavioral:**
185
+ - [ ] Given a user with valid OAuth code, when POST /auth/callback, then returns 200 with session token
186
+
187
+ **Structural:**
188
+ - [ ] Unit test covers happy path + error case
189
+ - [ ] No new `any` types introduced
190
+ - [ ] Public API documented in JSDoc
191
+
192
+ ### Writing Good Code Locations
193
+
194
+ Always include:
195
+ 1. **File path** — repo-root relative
196
+ 2. **Anchor** — function name, class name, route, or config key
197
+ 3. **Context** — what the agent should look at there
198
+
199
+ ```
200
+ - Handler: `packages/core/src/auth/callback.ts` — `handleOAuthCallback()`
201
+ - Token logic: `packages/core/src/auth/session.ts` — `createSession()`
202
+ - Test: `packages/core/src/__tests__/auth.test.ts` — "OAuth callback" describe block
203
+ ```
204
+
205
+ ### Constraints That Prevent Agent Overreach
206
+
207
+ Be explicit about boundaries. Agents optimize globally unless told not to.
208
+
209
+ ```
210
+ ## Constraints
211
+ - Do NOT modify the public API surface of `@soleri/core`
212
+ - Do NOT add new npm dependencies
213
+ - Do NOT refactor surrounding code — fix only the bug
214
+ - Backward compatible: existing agent.yaml files must still work
215
+ ```
216
+
217
+ ## Workflow
218
+
219
+ 1. **Gather context** — search vault, read error logs, check git blame
220
+ 2. **Identify code locations** — grep codebase for relevant symbols
221
+ 3. **Choose template** — bug, feature, or milestone
222
+ 4. **Fill template** — every field. Skip none.
223
+ 5. **Create issue** — `gh issue create --title "..." --body "..." --label "..."`
224
+
225
+ ## Integration with Planning
226
+
227
+ When creating issues from a plan, the plan is the source of truth — GitHub issues are the projection. Each task becomes a lean issue pointing back to the plan.
228
+
229
+ ### Plan-Sourced Task Template
230
+
231
+ ```markdown
232
+ # Objective
233
+ <one sentence: what this task delivers>
234
+
235
+ ## Plan: `<plan-id>` | Task <N> of <total>
236
+ ## Parent: #<epic-issue-number>
237
+ ## Complexity: Low | Medium | High
238
+ ## Depends on: <task dependencies or "nothing">
239
+
240
+ ## Code Locations
241
+ - `path/to/file.ts` — `symbolOrFunction`
242
+
243
+ ## Acceptance Criteria
244
+ - [ ] <testable outcome>
245
+ - [ ] <testable outcome>
246
+ - [ ] Tests pass
247
+
248
+ ## Verification
249
+ ```bash
250
+ <exact command>
251
+ ```
252
+ ```
253
+
254
+ ### Rules for Plan-Sourced Issues
255
+
256
+ 1. **Plan ID is mandatory** — every task issue must include `## Plan: \`<plan-id>\`` so the full plan is one API call away
257
+ 2. **Keep issues lean** — task description + code locations + acceptance criteria
258
+ 3. **One issue per task** — don't bundle multiple plan tasks into one issue
259
+ 4. **Parent/epic issue** — create a parent issue that lists all task issues
260
+ 5. **Map complexity to priority** — High → P1, Medium → P2, Low → P3
261
+ 6. **Include task number** — "Task 3 of 11" helps track progress
262
+
263
+ ## Labels
264
+
265
+ Always apply at least:
266
+ - Type: `bug`, `feature`, `refactor`, `chore`
267
+ - Priority: `P0`, `P1`, `P2`, `P3` (if using priority labels)
268
+ - Component: package or module name (if using component labels)
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: agent-persona
3
+ description: >
4
+ Use when the user activates the agent's persona via its greeting phrase, or says
5
+ "activate persona", "be yourself", "stay in character", or any activation phrase
6
+ defined in the agent's persona configuration. Reinforces character persistence
7
+ through the session and survives context compaction.
8
+ ---
9
+
10
+ # Agent Persona — Stay in Character
11
+
12
+ This skill reinforces persona persistence. The MCP activation loads the runtime payload — this skill ensures the character sticks across the full session, including after context compaction.
13
+
14
+ ## How It Works
15
+
16
+ Every agent has a persona defined in `agent.yaml`. The persona contains:
17
+
18
+ - **name** — the agent's display name
19
+ - **role** — what the agent does
20
+ - **tone** — `precise`, `mentor`, or `pragmatic`
21
+ - **greeting** — the activation response
22
+ - **principles** — core values that guide behavior
23
+
24
+ ## Activation
25
+
26
+ When the user triggers activation (greeting phrase or explicit request):
27
+
28
+ ```
29
+ YOUR_AGENT_core op:activate
30
+ params: { projectPath: "." }
31
+ ```
32
+
33
+ The activation response contains the full persona payload. Adopt it immediately.
34
+
35
+ ## Rules
36
+
37
+ 1. **Stay in character for EVERY response** until the user explicitly deactivates
38
+ 2. **Technical accuracy is the priority** — persona is the wrapper, not a replacement for correctness
39
+ 3. **Tone consistency** — match the configured tone (`precise` = concise and exact, `mentor` = educational and encouraging, `pragmatic` = direct and practical)
40
+ 4. If character drifts after context compaction, the persona information in the compacted summary should restore it — follow it
41
+
42
+ ## Context Compaction Survival
43
+
44
+ Long sessions trigger context compaction. To survive:
45
+
46
+ - The persona activation state is included in compaction summaries
47
+ - After compaction, check if persona was active and re-adopt the character
48
+ - Never break character just because the conversation was compacted
49
+
50
+ ## Deactivation
51
+
52
+ When the user says "deactivate", "stop persona", "be normal", or uses the agent's deactivation phrase:
53
+
54
+ ```
55
+ YOUR_AGENT_core op:activate
56
+ params: { deactivate: true }
57
+ ```
58
+
59
+ Return to neutral assistant mode.
60
+
61
+ ## Anti-Patterns
62
+
63
+ - **Dropping character mid-session** — if activated, stay activated
64
+ - **Over-persona, under-substance** — character adds flavor, not replaces technical depth
65
+ - **Forcing persona on unwilling users** — only activate when explicitly triggered
66
+ - **Ignoring tone setting** — a `precise` agent should not use flowery language; a `mentor` agent should not be terse
@@ -188,6 +188,18 @@ Only capture if genuinely reusable — not every review finding is vault-worthy.
188
188
  - Skipping git history (temporal smells are the most actionable)
189
189
  - Treating all smells as equal severity (prioritize by impact)
190
190
 
191
+ ## Rationalization Prevention
192
+
193
+ Do NOT rationalize away findings. If a smell or issue is detected, report it honestly.
194
+
195
+ - **HARD-GATE: All three passes must complete before presenting the report. Do not skip a pass.**
196
+ - **HARD-GATE: Critical (red) findings must be flagged -- never downgrade severity to avoid difficult conversations.**
197
+ - Do not say "this is probably fine" to dismiss a code smell you detected.
198
+ - Do not omit findings because "the code works" -- working code can still be poorly architected.
199
+ - Do not soften severity because the code is recent or written by the user.
200
+ - If git history shows high churn, report it. Do not skip temporal smells for convenience.
201
+ - Present the full picture. A review that hides problems is worse than no review.
202
+
191
203
  ## Quick Reference
192
204
 
193
205
  | Pass | Focus | Key Activities |
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: deliver-and-ship
3
+ description: >
4
+ Use when the user says "ship it", "ready to deploy", "package", "release",
5
+ "pre-PR check", "delivery checklist", "is this ready", "final review", or mentions
6
+ shipping, deploying, packaging, or releasing work. Runs pre-delivery quality gates
7
+ to ensure nothing ships without passing stability, knowledge capture, and code quality checks.
8
+ ---
9
+
10
+ # Deliver & Ship — Quality Gate Runner
11
+
12
+ Run all pre-delivery quality gates before shipping. This ensures nothing leaves without passing stability checks, knowledge capture, and code quality verification.
13
+
14
+ ## When to Use
15
+
16
+ When work is considered "done" and ready to be committed, PR'd, or deployed. This is the last checkpoint before code leaves the developer's hands.
17
+
18
+ ## Orchestration Sequence
19
+
20
+ ### Step 1: Code Quality
21
+
22
+ Run the project's linter, formatter, and type checker on all modified files:
23
+
24
+ 1. Check for lint/format scripts in `package.json` (or equivalent)
25
+ 2. Run `typecheck` / `tsc --noEmit` if TypeScript
26
+ 3. Run any project-specific quality gates (clippy for Rust, mypy for Python, etc.)
27
+
28
+ Any type error or lint failure is a blocker.
29
+
30
+ ### Step 2: Test Suite
31
+
32
+ Run the full test suite to catch regressions:
33
+
34
+ ```
35
+ YOUR_AGENT_core op:admin_health
36
+ ```
37
+
38
+ Verify the agent itself is healthy, then run project tests. All tests must pass.
39
+
40
+ ### Step 3: Stability Assessment
41
+
42
+ Classify the changes as safe or breaking:
43
+
44
+ - **Safe**: Internal refactors, bug fixes, additive features (new exports, new ops)
45
+ - **Breaking**: Removed exports, changed signatures, renamed public APIs, schema migrations
46
+ - Breaking changes need migration guidance in the commit/PR description
47
+
48
+ ### Step 4: Knowledge Audit
49
+
50
+ Check if patterns discovered during this work session should be captured before shipping:
51
+
52
+ ```
53
+ YOUR_AGENT_core op:memory_search
54
+ params: { query: "current session" }
55
+ ```
56
+
57
+ ```
58
+ YOUR_AGENT_core op:brain_stats
59
+ ```
60
+
61
+ Look for:
62
+
63
+ - Bug fixes that reveal an anti-pattern worth capturing
64
+ - New patterns that should be in the vault for next time
65
+ - Architectural decisions that need documenting
66
+
67
+ Uncaptured knowledge is lost knowledge. If something should be captured:
68
+
69
+ ```
70
+ YOUR_AGENT_core op:capture_knowledge
71
+ params: {
72
+ title: "<what was learned>",
73
+ description: "<the pattern or anti-pattern>",
74
+ type: "pattern",
75
+ tags: ["<relevant-tags>"]
76
+ }
77
+ ```
78
+
79
+ ### Step 5: Commit Quality
80
+
81
+ Verify commit messages follow conventional commits:
82
+
83
+ - `feat:` for new features
84
+ - `fix:` for bug fixes
85
+ - `refactor:` for refactors
86
+ - `chore:` for maintenance
87
+ - No AI attribution (blocked by engine rules)
88
+
89
+ ### Step 6: Delivery Report
90
+
91
+ Present a checklist:
92
+
93
+ - [ ] Code quality: pass/fail (Step 1)
94
+ - [ ] Tests: pass/fail (Step 2)
95
+ - [ ] Stability: safe change / breaking change (Step 3)
96
+ - [ ] Knowledge: captured / needs capture (Step 4)
97
+ - [ ] Commits: clean / needs cleanup (Step 5)
98
+
99
+ All items must pass before recommending "ship it."
100
+
101
+ ## Domain-Specific Gates
102
+
103
+ Agents with domain-specific facades may add extra gates. For example:
104
+
105
+ - **Design system agents**: token validation, contrast checks, accessibility audit
106
+ - **API agents**: schema validation, backward compatibility checks
107
+ - **Security agents**: dependency audit, secret scanning
108
+
109
+ These are additive — they don't replace the generic gates above.
110
+
111
+ ## Exit Criteria
112
+
113
+ Delivery is approved when all gates pass. If any gate fails, report the failure and recommend fixes before shipping. Never approve delivery with blocking issues.
114
+
115
+ ## Agent Tools Reference
116
+
117
+ | Op | When to Use |
118
+ | ------------------- | -------------------------------------- |
119
+ | `admin_health` | Verify agent/system health |
120
+ | `memory_search` | Check for uncaptured session knowledge |
121
+ | `brain_stats` | Review learning state |
122
+ | `capture_knowledge` | Persist patterns before shipping |
123
+ | `capture_quick` | Fast capture for simple learnings |
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: discovery-phase
3
+ description: >
4
+ Use for structured exploration before committing to a plan — "I don't know where to start",
5
+ "what are our options", "investigate", "research this", "explore options", "discovery". Ideal
6
+ when requirements are unclear, entering a new domain, or facing architectural decisions. Produces
7
+ a discovery document with options, tradeoffs, and a recommendation.
8
+ ---
9
+
10
+ # Discovery Phase
11
+
12
+ Structured exploration before committing to a plan. Define the question, research prior art, explore the codebase, identify constraints, draft options with tradeoffs, and recommend a path forward.
13
+
14
+ <HARD-GATE>
15
+ Do NOT create a plan, write code, or take any implementation action until the discovery document is complete and the user has reviewed it. Discovery produces knowledge, not artifacts.
16
+ </HARD-GATE>
17
+
18
+ ## Checklist
19
+
20
+ 1. **Define the question** — restate what we're exploring as one specific, answerable sentence
21
+ 2. **Search vault for prior art** — `YOUR_AGENT_core op:search_intelligent params: { query: "<question>", mode: "scan" }`. Also `op:memory_search` with `crossProject: true`.
22
+ 3. **Explore codebase** — read relevant files, configs, architecture, recent commits
23
+ 4. **Identify constraints** — hard (must-haves) vs soft (nice-to-haves), unknowns that block a decision
24
+ 5. **Draft 2-4 options** — each with pros, cons, risk, and effort (S/M/L)
25
+ 6. **Recommend** — pick one, state the primary reason, note what would change the answer
26
+ 7. **Capture to vault** — persist the discovery finding
27
+ 8. **Transition** — hand off to brainstorming or writing-plans skill
28
+
29
+ ## Option Format
30
+
31
+ For each option:
32
+
33
+ | Field | Content |
34
+ | ----- | ------- |
35
+ | **Approach** | One-sentence summary |
36
+ | **Pros** | What it gives us |
37
+ | **Cons** | What it costs |
38
+ | **Risk** | What could go wrong |
39
+ | **Effort** | S / M / L |
40
+
41
+ ## After Discovery
42
+
43
+ ```
44
+ YOUR_AGENT_core op:capture_knowledge
45
+ params: {
46
+ title: "<topic> — discovery finding",
47
+ description: "<question, options considered, recommendation, rationale>",
48
+ type: "decision",
49
+ category: "<domain>",
50
+ tags: ["discovery", "decision"]
51
+ }
52
+ ```
53
+
54
+ Save to `docs/discoveries/YYYY-MM-DD-<topic>.md` and commit. Then transition to the next skill.
55
+
56
+ ## Anti-Patterns
57
+
58
+ - **Skipping discovery** — jumping to implementation when the problem space is unclear
59
+ - **Analysis paralysis** — timebox to 30-60 min; if no clear winner, pick the most reversible option
60
+ - **Boiling the ocean** — scope to one question; split compound questions into separate discoveries
61
+
62
+ ## Quick Reference
63
+
64
+ | Op | When to Use |
65
+ | -------------------- | ---------------------------------- |
66
+ | `search_intelligent` | Search vault for prior art |
67
+ | `memory_search` | Check session history and projects |
68
+ | `capture_knowledge` | Persist discovery finding |
69
+ | `route_intent` | Classify what comes after |
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: env-setup
3
+ description: >
4
+ Use when a developer needs to set up, fix, or restore a local development environment.
5
+ Triggers on post-clone setup, project onboarding, first-time running a repo, pulled changes
6
+ that broke the build, missing or misconfigured dependencies, MODULE_NOT_FOUND or Cannot find
7
+ module errors, gyp ERR or native module build failures, missing .env files or unknown required
8
+ environment variables, database setup, Docker compose issues, or connection refused during
9
+ local dev. Covers Node.js, Python, Rust, Go, Ruby, PHP, and Docker-based projects.
10
+ ---
11
+
12
+ # Environment Setup
13
+
14
+ Detect what a project needs, diagnose what's missing, and produce an actionable setup checklist.
15
+
16
+ ## Overview
17
+
18
+ Scan the project root for configuration files, detect the tech stack and dependencies, identify gaps between what's required and what's present, then generate ordered setup steps. Offer to execute each step.
19
+
20
+ ## When to Use
21
+
22
+ - Just cloned a repo and need to get it running
23
+ - Getting errors after pulling changes (missing deps, env vars, DB migrations)
24
+ - Onboarding to an unfamiliar project
25
+ - Setting up a project on a new machine
26
+ - Docker/container environment not starting
27
+ - Missing `.env` file or environment variables
28
+
29
+ ## Detection Phase
30
+
31
+ Scan the project root and identify:
32
+
33
+ ### Package Managers & Dependencies
34
+
35
+ | File | Stack | Install Command |
36
+ | ------------------ | ------- | ------------------------------------------------------------ |
37
+ | `package.json` | Node.js | `npm install` / `yarn` / `pnpm install` (check for lockfile) |
38
+ | `requirements.txt` | Python | `pip install -r requirements.txt` |
39
+ | `pyproject.toml` | Python | `pip install -e .` or `poetry install` or `uv sync` |
40
+ | `Pipfile` | Python | `pipenv install` |
41
+ | `Cargo.toml` | Rust | `cargo build` |
42
+ | `go.mod` | Go | `go mod download` |
43
+ | `Gemfile` | Ruby | `bundle install` |
44
+ | `composer.json` | PHP | `composer install` |
45
+
46
+ **Lockfile priority:** If a lockfile exists (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `Pipfile.lock`, `poetry.lock`), use the matching package manager. Don't mix.
47
+
48
+ ### Environment Variables
49
+
50
+ 1. Check for `.env.example`, `.env.sample`, `.env.template`
51
+ 2. Check for existing `.env` — if missing, copy from template
52
+ 3. Parse template for required variables (lines without defaults or with placeholder values)
53
+ 4. Flag variables that need real values (API keys, secrets, database URLs)
54
+ 5. **If no template exists:** grep source for `process.env.`, `os.environ`, `env::var`, `os.Getenv` to discover env vars the project actually uses.
55
+
56
+ ### Native Dependencies
57
+
58
+ | Indicator | What It Means |
59
+ | ---------------------------------------- | -------------------------------------- |
60
+ | `better-sqlite3`, `sqlite3` in deps | Needs C++ compiler |
61
+ | `node-gyp` in deps or scripts | Needs Python 3 + C++ toolchain |
62
+ | `sharp` in deps | Needs `libvips` |
63
+ | `Cargo.toml` with `[build-dependencies]` | Needs Rust toolchain for build scripts |
64
+ | `setup.py` with `ext_modules` | Needs C compiler for Python extensions |
65
+
66
+ ### Databases
67
+
68
+ | File/Config | Database | Setup Needed |
69
+ | ---------------------------------------- | ---------------- | ---------------------------- |
70
+ | `docker-compose.yml` with postgres/mysql | PostgreSQL/MySQL | Container + migrations |
71
+ | `prisma/schema.prisma` | Prisma-managed | `npx prisma migrate dev` |
72
+ | `drizzle.config.*` | Drizzle-managed | `npx drizzle-kit push` |
73
+ | `alembic.ini` | SQLAlchemy | `alembic upgrade head` |
74
+ | `config/database.yml` | Rails | `rails db:create db:migrate` |
75
+
76
+ ### Infrastructure
77
+
78
+ | File | What It Means |
79
+ | --------------------------------------------- | ------------------------------------------- |
80
+ | `docker-compose.yml` | Services to start with `docker compose up` |
81
+ | `Dockerfile` | Can build container locally |
82
+ | `Makefile` | Check for `setup`, `install`, `dev` targets |
83
+ | `.tool-versions` / `.node-version` / `.nvmrc` | Required runtime version |
84
+ | `turbo.json` / `nx.json` / `lerna.json` | Monorepo setup |
85
+
86
+ ### IDE & Tool Integration
87
+
88
+ | File | Integration |
89
+ | ------------------------ | ---------------------------- |
90
+ | `.vscode/` | VS Code settings, extensions |
91
+ | `.mcp.json` / `mcp.json` | MCP server config |
92
+ | `.editorconfig` | Cross-editor formatting |
93
+
94
+ ## Diagnosis Phase
95
+
96
+ After detection, check what's present vs needed:
97
+
98
+ 1. **Runtime version** — does installed version match version files?
99
+ 2. **Dependencies installed?** — does `node_modules/`, `venv/`, `vendor/` exist?
100
+ 3. **Native build tools?** — are compilers available?
101
+ 4. **Env file present?** — does `.env` exist when a template does?
102
+ 5. **Database reachable?** — can the configured DB URL connect?
103
+ 6. **Docker running?** — is Docker daemon running if needed?
104
+ 7. **Build artifacts** — does the project need an initial build step?
105
+
106
+ ## Checklist Generation
107
+
108
+ Produce steps in dependency order:
109
+
110
+ ```
111
+ ## Setup Checklist
112
+
113
+ 1. [ ] Install runtime (Node 20.x via nvm)
114
+ 2. [ ] Install dependencies (pnpm install)
115
+ 3. [ ] Copy environment file (cp .env.example .env)
116
+ 4. [ ] Fill in required env vars: DATABASE_URL, API_KEY
117
+ 5. [ ] Start Docker services (docker compose up -d)
118
+ 6. [ ] Run database migrations (npx prisma migrate dev)
119
+ 7. [ ] Build the project (pnpm build)
120
+ 8. [ ] Start dev server (pnpm dev)
121
+ ```
122
+
123
+ **Order matters:** runtime -> deps -> env -> infrastructure -> migrations -> build -> run.
124
+
125
+ After presenting the checklist, offer: "Want me to run these steps for you?"
126
+
127
+ ## Execution Phase
128
+
129
+ If the user says yes, execute steps sequentially. Stop and ask if:
130
+
131
+ - A step fails
132
+ - A step requires manual input (API keys, passwords)
133
+ - A step would modify system-level config (global installs, PATH changes)
134
+
135
+ ## Monorepo Handling
136
+
137
+ If monorepo detected (turbo.json, nx.json, pnpm-workspace.yaml):
138
+
139
+ 1. Install root dependencies first
140
+ 2. Ask which package/app the user wants to work on
141
+ 3. Check for package-specific setup
142
+ 4. Run package-specific setup after root
143
+
144
+ ## Common Mistakes
145
+
146
+ - **Wrong package manager** — using `npm install` when `yarn.lock` exists. Always check lockfiles first.
147
+ - **Skipping env file** — project crashes on first API call. Always check for templates.
148
+ - **Missing native build tools** — `npm install` fails with gyp errors. Check before installing.
149
+ - **Missing runtime version** — subtle bugs from wrong Node/Python version.
150
+ - **Docker not running** — cryptic "connection refused" errors.
151
+ - **Stale dependencies** — after `git pull`, always re-install if lockfile changed.