@rune-kit/rune 2.1.1

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 (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +357 -0
  3. package/agents/.gitkeep +0 -0
  4. package/agents/architect.md +29 -0
  5. package/agents/asset-creator.md +11 -0
  6. package/agents/audit.md +11 -0
  7. package/agents/autopsy.md +11 -0
  8. package/agents/brainstorm.md +11 -0
  9. package/agents/browser-pilot.md +11 -0
  10. package/agents/coder.md +29 -0
  11. package/agents/completion-gate.md +11 -0
  12. package/agents/constraint-check.md +11 -0
  13. package/agents/context-engine.md +11 -0
  14. package/agents/cook.md +11 -0
  15. package/agents/db.md +11 -0
  16. package/agents/debug.md +11 -0
  17. package/agents/dependency-doctor.md +11 -0
  18. package/agents/deploy.md +11 -0
  19. package/agents/design.md +11 -0
  20. package/agents/docs-seeker.md +11 -0
  21. package/agents/fix.md +11 -0
  22. package/agents/hallucination-guard.md +11 -0
  23. package/agents/incident.md +11 -0
  24. package/agents/integrity-check.md +11 -0
  25. package/agents/journal.md +11 -0
  26. package/agents/launch.md +11 -0
  27. package/agents/logic-guardian.md +11 -0
  28. package/agents/marketing.md +11 -0
  29. package/agents/onboard.md +11 -0
  30. package/agents/perf.md +11 -0
  31. package/agents/plan.md +11 -0
  32. package/agents/preflight.md +11 -0
  33. package/agents/problem-solver.md +11 -0
  34. package/agents/rescue.md +11 -0
  35. package/agents/research.md +11 -0
  36. package/agents/researcher.md +29 -0
  37. package/agents/review-intake.md +11 -0
  38. package/agents/review.md +11 -0
  39. package/agents/reviewer.md +28 -0
  40. package/agents/safeguard.md +11 -0
  41. package/agents/sast.md +11 -0
  42. package/agents/scanner.md +28 -0
  43. package/agents/scope-guard.md +11 -0
  44. package/agents/scout.md +11 -0
  45. package/agents/sentinel.md +11 -0
  46. package/agents/sequential-thinking.md +11 -0
  47. package/agents/session-bridge.md +11 -0
  48. package/agents/skill-forge.md +11 -0
  49. package/agents/skill-router.md +11 -0
  50. package/agents/surgeon.md +11 -0
  51. package/agents/team.md +11 -0
  52. package/agents/test.md +11 -0
  53. package/agents/trend-scout.md +11 -0
  54. package/agents/verification.md +11 -0
  55. package/agents/video-creator.md +11 -0
  56. package/agents/watchdog.md +11 -0
  57. package/agents/worktree.md +11 -0
  58. package/commands/.gitkeep +0 -0
  59. package/commands/rune.md +168 -0
  60. package/compiler/__tests__/openclaw-adapter.test.js +140 -0
  61. package/compiler/__tests__/parser.test.js +55 -0
  62. package/compiler/adapters/antigravity.js +59 -0
  63. package/compiler/adapters/claude.js +37 -0
  64. package/compiler/adapters/cursor.js +67 -0
  65. package/compiler/adapters/generic.js +60 -0
  66. package/compiler/adapters/index.js +45 -0
  67. package/compiler/adapters/openclaw.js +150 -0
  68. package/compiler/adapters/windsurf.js +60 -0
  69. package/compiler/bin/rune.js +288 -0
  70. package/compiler/doctor.js +153 -0
  71. package/compiler/emitter.js +240 -0
  72. package/compiler/parser.js +208 -0
  73. package/compiler/transformer.js +69 -0
  74. package/compiler/transforms/branding.js +27 -0
  75. package/compiler/transforms/cross-references.js +29 -0
  76. package/compiler/transforms/frontmatter.js +38 -0
  77. package/compiler/transforms/hooks.js +68 -0
  78. package/compiler/transforms/subagents.js +36 -0
  79. package/compiler/transforms/tool-names.js +60 -0
  80. package/contexts/dev.md +34 -0
  81. package/contexts/research.md +43 -0
  82. package/contexts/review.md +55 -0
  83. package/extensions/ai-ml/PACK.md +517 -0
  84. package/extensions/analytics/PACK.md +557 -0
  85. package/extensions/backend/PACK.md +678 -0
  86. package/extensions/chrome-ext/PACK.md +995 -0
  87. package/extensions/content/PACK.md +381 -0
  88. package/extensions/devops/PACK.md +520 -0
  89. package/extensions/ecommerce/PACK.md +280 -0
  90. package/extensions/gamedev/PACK.md +393 -0
  91. package/extensions/mobile/PACK.md +273 -0
  92. package/extensions/saas/PACK.md +805 -0
  93. package/extensions/security/PACK.md +536 -0
  94. package/extensions/trading/PACK.md +597 -0
  95. package/extensions/ui/PACK.md +947 -0
  96. package/package.json +47 -0
  97. package/skills/.gitkeep +0 -0
  98. package/skills/adversary/SKILL.md +271 -0
  99. package/skills/asset-creator/SKILL.md +157 -0
  100. package/skills/audit/SKILL.md +466 -0
  101. package/skills/autopsy/SKILL.md +200 -0
  102. package/skills/ba/SKILL.md +279 -0
  103. package/skills/brainstorm/SKILL.md +266 -0
  104. package/skills/browser-pilot/SKILL.md +168 -0
  105. package/skills/completion-gate/SKILL.md +151 -0
  106. package/skills/constraint-check/SKILL.md +165 -0
  107. package/skills/context-engine/SKILL.md +176 -0
  108. package/skills/cook/SKILL.md +636 -0
  109. package/skills/db/SKILL.md +256 -0
  110. package/skills/debug/SKILL.md +240 -0
  111. package/skills/dependency-doctor/SKILL.md +235 -0
  112. package/skills/deploy/SKILL.md +174 -0
  113. package/skills/design/DESIGN-REFERENCE.md +365 -0
  114. package/skills/design/SKILL.md +462 -0
  115. package/skills/doc-processor/SKILL.md +254 -0
  116. package/skills/docs/SKILL.md +336 -0
  117. package/skills/docs-seeker/SKILL.md +166 -0
  118. package/skills/fix/SKILL.md +192 -0
  119. package/skills/git/SKILL.md +285 -0
  120. package/skills/hallucination-guard/SKILL.md +204 -0
  121. package/skills/incident/SKILL.md +241 -0
  122. package/skills/integrity-check/SKILL.md +169 -0
  123. package/skills/journal/SKILL.md +190 -0
  124. package/skills/launch/SKILL.md +330 -0
  125. package/skills/logic-guardian/SKILL.md +240 -0
  126. package/skills/marketing/SKILL.md +229 -0
  127. package/skills/mcp-builder/SKILL.md +311 -0
  128. package/skills/onboard/SKILL.md +298 -0
  129. package/skills/perf/SKILL.md +297 -0
  130. package/skills/plan/SKILL.md +520 -0
  131. package/skills/preflight/SKILL.md +231 -0
  132. package/skills/problem-solver/SKILL.md +284 -0
  133. package/skills/rescue/SKILL.md +434 -0
  134. package/skills/research/SKILL.md +122 -0
  135. package/skills/review/SKILL.md +354 -0
  136. package/skills/review-intake/SKILL.md +222 -0
  137. package/skills/safeguard/SKILL.md +188 -0
  138. package/skills/sast/SKILL.md +190 -0
  139. package/skills/scaffold/SKILL.md +276 -0
  140. package/skills/scope-guard/SKILL.md +150 -0
  141. package/skills/scout/SKILL.md +232 -0
  142. package/skills/sentinel/SKILL.md +320 -0
  143. package/skills/sentinel-env/SKILL.md +226 -0
  144. package/skills/sequential-thinking/SKILL.md +234 -0
  145. package/skills/session-bridge/SKILL.md +287 -0
  146. package/skills/skill-forge/SKILL.md +317 -0
  147. package/skills/skill-router/SKILL.md +267 -0
  148. package/skills/surgeon/SKILL.md +203 -0
  149. package/skills/team/SKILL.md +397 -0
  150. package/skills/test/SKILL.md +271 -0
  151. package/skills/trend-scout/SKILL.md +145 -0
  152. package/skills/verification/SKILL.md +201 -0
  153. package/skills/video-creator/SKILL.md +201 -0
  154. package/skills/watchdog/SKILL.md +166 -0
  155. package/skills/worktree/SKILL.md +140 -0
@@ -0,0 +1,311 @@
1
+ ---
2
+ name: mcp-builder
3
+ description: Build Model Context Protocol servers from specifications. Generates tool definitions, resource handlers, and test suites for MCP servers in TypeScript or Python (FastMCP).
4
+ metadata:
5
+ author: runedev
6
+ version: "0.2.0"
7
+ layer: L2
8
+ model: sonnet
9
+ group: creation
10
+ tools: "Read, Write, Edit, Bash, Glob, Grep"
11
+ ---
12
+
13
+ # mcp-builder
14
+
15
+ ## Purpose
16
+
17
+ MCP server builder. Generates complete, tested MCP servers from a natural language description or specification. Handles tool definitions, resource handlers, input validation, error handling, configuration, tests, and documentation. Supports TypeScript (official SDK) and Python (FastMCP).
18
+
19
+ ## Triggers
20
+
21
+ - Called by `cook` when MCP-related task detected (keywords: "MCP server", "MCP tool", "model context protocol")
22
+ - Called by `scaffold` when MCP Server template selected
23
+ - `/rune mcp-builder <description>` — manual invocation
24
+ - Auto-trigger: when project contains `mcp.json`, `@modelcontextprotocol/sdk`, or `fastmcp` in dependencies
25
+
26
+ ## Calls (outbound)
27
+
28
+ - `ba` (L2): if user description is vague — elicit requirements for what tools/resources the server should expose
29
+ - `research` (L3): look up target API documentation, existing MCP servers for reference
30
+ - `test` (L2): generate and run test suite for the server
31
+ - `docs` (L2): generate server documentation (tool catalog, installation, configuration)
32
+ - `verification` (L3): verify server builds and tests pass
33
+
34
+ ## Called By (inbound)
35
+
36
+ - `cook` (L1): when MCP-related task detected
37
+ - `scaffold` (L1): MCP Server template in Phase 5
38
+ - User: `/rune mcp-builder` direct invocation
39
+
40
+ ## Executable Steps
41
+
42
+ ### Step 1 — Spec Elicitation
43
+
44
+ If description is detailed enough (tools, resources, target API specified), proceed.
45
+ If vague, ask targeted questions:
46
+
47
+ 1. **What tools should this MCP server expose?** (actions the AI can perform)
48
+ 2. **What resources does it manage?** (data the AI can read)
49
+ 3. **What external APIs does it connect to?** (if any)
50
+ 4. **TypeScript or Python?** (default: TypeScript with @modelcontextprotocol/sdk)
51
+ 5. **Authentication?** (API keys, OAuth, none)
52
+
53
+ If user provides a detailed spec or existing API docs → extract answers, confirm.
54
+
55
+ ### Step 2 — Architecture Design
56
+
57
+ Determine server structure based on spec:
58
+
59
+ **TypeScript (default):**
60
+ ```
61
+ mcp-server-<name>/
62
+ ├── src/
63
+ │ ├── index.ts — server entry point, tool/resource registration
64
+ │ ├── tools/
65
+ │ │ ├── <tool-name>.ts — one file per tool
66
+ │ │ └── index.ts — tool registry
67
+ │ ├── resources/
68
+ │ │ ├── <resource>.ts — one file per resource type
69
+ │ │ └── index.ts — resource registry
70
+ │ ├── lib/
71
+ │ │ ├── client.ts — external API client (if applicable)
72
+ │ │ └── types.ts — shared types
73
+ │ └── config.ts — environment variable validation
74
+ ├── tests/
75
+ │ ├── tools/
76
+ │ │ └── <tool-name>.test.ts
77
+ │ └── resources/
78
+ │ └── <resource>.test.ts
79
+ ├── package.json
80
+ ├── tsconfig.json
81
+ ├── .env.example
82
+ └── README.md
83
+ ```
84
+
85
+ **Python (FastMCP):**
86
+ ```
87
+ mcp-server-<name>/
88
+ ├── src/
89
+ │ ├── server.py — FastMCP server with tool/resource decorators
90
+ │ ├── tools/
91
+ │ │ └── <tool_name>.py
92
+ │ ├── resources/
93
+ │ │ └── <resource>.py
94
+ │ ├── lib/
95
+ │ │ ├── client.py — external API client
96
+ │ │ └── types.py — Pydantic models
97
+ │ └── config.py — settings via pydantic-settings
98
+ ├── tests/
99
+ │ ├── test_<tool_name>.py
100
+ │ └── test_<resource>.py
101
+ ├── pyproject.toml
102
+ ├── .env.example
103
+ └── README.md
104
+ ```
105
+
106
+ ### Step 3 — Generate Server Code
107
+
108
+ #### Tool Generation
109
+
110
+ For each tool:
111
+
112
+ **TypeScript:**
113
+ ```typescript
114
+ import { z } from 'zod';
115
+
116
+ export const toolName = {
117
+ name: 'tool_name',
118
+ description: 'What this tool does — used by AI to decide when to call it',
119
+ inputSchema: z.object({
120
+ param1: z.string().describe('Description for AI'),
121
+ param2: z.number().optional().describe('Optional parameter'),
122
+ }),
123
+ async handler(input: { param1: string; param2?: number }) {
124
+ // Implementation
125
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
126
+ },
127
+ };
128
+ ```
129
+
130
+ **Python (FastMCP):**
131
+ ```python
132
+ from fastmcp import FastMCP
133
+
134
+ mcp = FastMCP("server-name")
135
+
136
+ @mcp.tool()
137
+ async def tool_name(param1: str, param2: int | None = None) -> str:
138
+ """What this tool does — used by AI to decide when to call it."""
139
+ # Implementation
140
+ return json.dumps(result)
141
+ ```
142
+
143
+ #### Resource Generation
144
+
145
+ For each resource:
146
+ - URI template with parameters
147
+ - Read handler that returns structured content
148
+ - List handler for collections
149
+
150
+ #### Configuration
151
+
152
+ Generate `.env.example` with all required environment variables:
153
+ ```env
154
+ # Required
155
+ API_KEY=your_api_key_here
156
+ API_BASE_URL=https://api.example.com
157
+
158
+ # Optional
159
+ LOG_LEVEL=info
160
+ CACHE_TTL=300
161
+ ```
162
+
163
+ Generate config validation:
164
+ ```typescript
165
+ // config.ts
166
+ import { z } from 'zod';
167
+
168
+ const envSchema = z.object({
169
+ API_KEY: z.string().min(1, 'API_KEY is required'),
170
+ API_BASE_URL: z.string().url().default('https://api.example.com'),
171
+ LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
172
+ });
173
+
174
+ export const config = envSchema.parse(process.env);
175
+ ```
176
+
177
+ ### Step 4 — Generate Tests
178
+
179
+ For each tool:
180
+ - **Happy path**: valid input → expected output
181
+ - **Validation**: invalid input → proper error message
182
+ - **Error handling**: API failure → graceful error response
183
+ - **Edge cases**: empty input, max limits, special characters
184
+
185
+ For each resource:
186
+ - **Read**: valid URI → expected content
187
+ - **Not found**: invalid URI → proper error
188
+ - **List**: collection URI → paginated results
189
+
190
+ ```typescript
191
+ describe('tool_name', () => {
192
+ it('should return results for valid input', async () => {
193
+ const result = await toolName.handler({ param1: 'test' });
194
+ expect(result.content[0].type).toBe('text');
195
+ // Assert expected structure
196
+ });
197
+
198
+ it('should handle API errors gracefully', async () => {
199
+ // Mock API failure
200
+ const result = await toolName.handler({ param1: 'trigger-error' });
201
+ expect(result.isError).toBe(true);
202
+ });
203
+ });
204
+ ```
205
+
206
+ ### Step 5 — Generate Documentation
207
+
208
+ Produce README.md with:
209
+ - Server description and purpose
210
+ - Tool catalog (name, description, parameters, example usage)
211
+ - Resource catalog (URI templates, content types)
212
+ - Installation instructions (npm/pip, Claude Code config, Cursor config)
213
+ - Configuration reference (all env vars with descriptions)
214
+ - Example usage showing AI interactions
215
+
216
+ Claude Code installation snippet:
217
+ ```json
218
+ {
219
+ "mcpServers": {
220
+ "server-name": {
221
+ "command": "node",
222
+ "args": ["path/to/dist/index.js"],
223
+ "env": {
224
+ "API_KEY": "your_key"
225
+ }
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
231
+ ### Step 6 — Verify
232
+
233
+ Invoke `rune:verification`:
234
+ - TypeScript: `tsc --noEmit` + `npm test`
235
+ - Python: `mypy src/` + `pytest`
236
+ - Ensure all tools respond correctly
237
+ - Ensure configuration validation works
238
+
239
+ ## Output Format
240
+
241
+ ### Generated Project Structure
242
+
243
+ **TypeScript:**
244
+ ```
245
+ mcp-server-<name>/
246
+ ├── src/
247
+ │ ├── index.ts — server entry, tool/resource registration
248
+ │ ├── tools/<name>.ts — one file per tool (Zod input schema + handler)
249
+ │ ├── resources/<name>.ts — one file per resource (URI template + reader)
250
+ │ ├── lib/client.ts — external API client
251
+ │ ├── lib/types.ts — shared TypeScript interfaces
252
+ │ └── config.ts — env var validation (Zod schema)
253
+ ├── tests/tools/<name>.test.ts — per-tool tests (happy, validation, error, edge)
254
+ ├── tests/resources/<name>.test.ts
255
+ ├── package.json, tsconfig.json, .env.example, README.md
256
+ ```
257
+
258
+ **Python (FastMCP):**
259
+ ```
260
+ mcp-server-<name>/
261
+ ├── src/
262
+ │ ├── server.py — FastMCP server with @mcp.tool() decorators
263
+ │ ├── tools/<name>.py — tool implementations
264
+ │ ├── resources/<name>.py
265
+ │ ├── lib/client.py — external API client
266
+ │ ├── lib/types.py — Pydantic models
267
+ │ └── config.py — pydantic-settings
268
+ ├── tests/test_<name>.py
269
+ ├── pyproject.toml, .env.example, README.md
270
+ ```
271
+
272
+ ### README Structure
273
+ - Server description + tool catalog (name, description, params, example)
274
+ - Resource catalog (URI templates, content types)
275
+ - Installation: Claude Code, Cursor, Windsurf config snippets
276
+ - Configuration reference (env vars with descriptions)
277
+
278
+ ## Constraints
279
+
280
+ 1. MUST validate all tool inputs with Zod (TS) or Pydantic (Python) — never trust AI-provided inputs
281
+ 2. MUST handle API errors gracefully — return MCP error responses, don't crash the server
282
+ 3. MUST generate .env.example — never hardcode API keys or secrets
283
+ 4. MUST generate tests — no MCP server without test suite
284
+ 5. MUST generate installation docs for at least Claude Code — other IDEs are bonus
285
+ 6. MUST use official MCP SDK (@modelcontextprotocol/sdk for TS, fastmcp for Python)
286
+ 7. Tool descriptions MUST be AI-friendly — clear, specific, include parameter semantics
287
+
288
+ ## Sharp Edges
289
+
290
+ | Failure Mode | Severity | Mitigation |
291
+ |---|---|---|
292
+ | Tool descriptions too vague for AI to use effectively | HIGH | Step 3: descriptions must explain WHEN to use the tool, not just WHAT it does |
293
+ | Missing input validation → server crashes on bad input | HIGH | Constraint 1: Zod/Pydantic validation on all inputs |
294
+ | Hardcoded API keys in generated code | CRITICAL | Constraint 3: always use env vars + .env.example |
295
+ | Tests mock everything → no real integration coverage | MEDIUM | Generate both unit tests (mocked) and integration test template (real API) |
296
+ | Generated server doesn't match MCP spec | HIGH | Use official SDK — don't hand-roll protocol handling |
297
+ | Installation docs only for Claude Code | LOW | Include Cursor/Windsurf config examples too |
298
+
299
+ ## Done When
300
+
301
+ - Server specification elicited (tools, resources, target API, language)
302
+ - Architecture designed (file structure, module boundaries)
303
+ - Server code generated (tools, resources, config, types)
304
+ - Test suite generated (happy path, validation, errors, edge cases)
305
+ - Documentation generated (README with tool catalog, installation, config)
306
+ - Verification passed (types + tests)
307
+ - Ready to install in Claude Code / Cursor / other IDEs
308
+
309
+ ## Cost Profile
310
+
311
+ ~3000-6000 tokens input, ~2000-5000 tokens output. Sonnet — MCP server generation is a structured code task, not architectural reasoning.
@@ -0,0 +1,298 @@
1
+ ---
2
+ name: onboard
3
+ description: Auto-generate project context for AI sessions. Scans codebase, creates CLAUDE.md and .rune/ setup so every future session starts with full context.
4
+ metadata:
5
+ author: runedev
6
+ version: "0.2.0"
7
+ layer: L2
8
+ model: sonnet
9
+ group: quality
10
+ tools: "Read, Write, Edit, Glob, Grep"
11
+ ---
12
+
13
+ # onboard
14
+
15
+ ## Purpose
16
+
17
+ Auto-generate project context for AI sessions. Scans the codebase and creates a CLAUDE.md project config plus .rune/ state directory so every future session starts with full context. Saves 10-20 minutes of re-explaining per session on undocumented projects.
18
+
19
+ ## Triggers
20
+
21
+ - `/rune onboard` — manual invocation on any project
22
+ - Called by `rescue` as Phase 0 (understand before refactoring)
23
+ - Auto-trigger: when no CLAUDE.md exists in project root
24
+
25
+ ## Calls (outbound)
26
+
27
+ - `scout` (L2): deep codebase scan — structure, frameworks, patterns, dependencies
28
+ - `autopsy` (L2): when project appears messy or undocumented — health assessment
29
+
30
+ ## Called By (inbound)
31
+
32
+ - User: `/rune onboard` manual invocation
33
+ - `rescue` (L1): Phase 0 — understand legacy project before refactoring
34
+ - `cook` (L1): if no CLAUDE.md found, onboard first
35
+
36
+ ## Output Files
37
+
38
+ ```
39
+ project/
40
+ ├── CLAUDE.md # Project config for AI sessions
41
+ └── .rune/
42
+ ├── conventions.md # Detected patterns & style
43
+ ├── decisions.md # Empty, ready for session-bridge
44
+ ├── progress.md # Empty, ready for session-bridge
45
+ ├── session-log.md # Empty, ready for session-bridge
46
+ └── DEVELOPER-GUIDE.md # Human-readable onboarding for new developers
47
+ ```
48
+
49
+ ## Executable Steps
50
+
51
+ ### Step 1 — Full Scan
52
+ Invoke `rune:scout` on the project root. Collect:
53
+ - Top-level directory structure (depth 2)
54
+ - All config files: `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `composer.json`, `.nvmrc`, `.python-version`, `Pipfile.lock`, `poetry.lock`, `uv.lock`
55
+ - Python environment markers: `.venv/`, `venv/`, `conda-meta/`, `.python-version`
56
+ - Entry point files: `main.*`, `index.*`, `app.*`, `server.*`
57
+ - Test directory names and test file patterns
58
+ - CI/CD config files: `.github/workflows/`, `Makefile`, `Dockerfile`
59
+ - README.md if present
60
+
61
+ Do not read every source file — scout gives the skeleton. Use `Read` only on config files and entry points.
62
+
63
+ ### Step 2 — Detect Tech Stack
64
+ From the scan output, determine with confidence:
65
+ - **Language**: TypeScript | JavaScript | Python | Rust | Go | other
66
+ - **Framework**: Next.js | Vite+React | SvelteKit | Express | FastAPI | Django | none | other
67
+ - **Package manager**: npm | pnpm | yarn | pip | poetry | cargo | go modules
68
+ - **Test framework**: Vitest | Jest | pytest | cargo test | go test | none
69
+ - **Build tool**: tsc | vite | webpack | esbuild | cargo | none
70
+ - **Linter/formatter**: ESLint | Biome | Ruff | Black | Clippy | none
71
+ - **Python environment** (if Python project): detect from project markers:
72
+ - `.venv/` or `venv/` directory → venv
73
+ - `poetry.lock` → poetry
74
+ - `uv.lock` → uv
75
+ - `.python-version` → pyenv
76
+ - `conda-meta/` or `environment.yml` → conda
77
+ - `Pipfile.lock` → pipenv
78
+ - None found → none (note: recommend setting up a virtual environment)
79
+
80
+ If a field cannot be determined with confidence, write "unknown" — do not guess.
81
+
82
+ ### Step 3 — Extract Conventions
83
+ Read 3–5 representative source files (pick files with the most connections in the project — typically the main module, a route/controller file, and a utility file). Extract:
84
+ - **Naming patterns**: camelCase | snake_case | PascalCase for files, functions, variables
85
+ - **Import style**: named imports | default imports | barrel files (index.ts)
86
+ - **Error handling pattern**: try/catch | Result type | error boundary | unhandled
87
+ - **State management**: React Context | Zustand | Redux | Svelte stores | none
88
+ - **API pattern**: REST | tRPC | GraphQL | SDK | none
89
+ - **Test structure**: co-located (`file.test.ts`) | separate directory (`tests/`) | none
90
+
91
+ Write extracted conventions as bullet points — be specific, not generic.
92
+
93
+ ### Step 4 — Generate CLAUDE.md
94
+ Use `Write` to create `CLAUDE.md` at the project root. Populate every section using data from Steps 2–3. Do not leave template placeholders — if data is unknown, write "unknown" or omit the section. Use the template below as the exact structure.
95
+
96
+ If a `CLAUDE.md` already exists, use `Read` to load it first, then merge — preserve any human-written sections (comments starting with `<!-- manual -->`) and update auto-detected sections only.
97
+
98
+ ### Step 5 — Initialize .rune/ Directory
99
+ Use `Bash` to create the directory: `mkdir -p .rune`
100
+
101
+ Use `Write` to create each file:
102
+ - `.rune/conventions.md` — paste the extracted conventions from Step 3 in full detail
103
+ - `.rune/decisions.md` — create with header `# Architecture Decisions` and one placeholder row in a markdown table (Date | Decision | Rationale | Status)
104
+ - `.rune/progress.md` — create with header `# Progress Log` and one placeholder entry
105
+ - `.rune/session-log.md` — create with header `# Session Log` and current date as first entry
106
+
107
+ ### Step 6b — Generate DEVELOPER-GUIDE.md
108
+
109
+ Use the data from Steps 2–3 to generate `.rune/DEVELOPER-GUIDE.md` — a human-readable onboarding guide for new team members joining the project. This is NOT AI context. This is plain English for humans.
110
+
111
+ Use `Write` to create `.rune/DEVELOPER-GUIDE.md` with this template:
112
+
113
+ ```markdown
114
+ # Developer Guide: [Project Name]
115
+
116
+ ## What This Does
117
+ [2 sentences max. What problem does this project solve? Who uses it?]
118
+
119
+ ## Quick Setup
120
+ [Copy-paste commands to get from zero to running locally]
121
+ ```bash
122
+ # [Python projects] Activate virtual environment
123
+ [detected activation command — e.g., source .venv/bin/activate | poetry shell | uv venv && source .venv/bin/activate]
124
+
125
+ # Install dependencies
126
+ [detected command — e.g., pip install -e ".[dev]" | poetry install | npm install]
127
+
128
+ # Run development server
129
+ [detected command]
130
+
131
+ # Run tests
132
+ [detected command]
133
+ ```
134
+
135
+ ## Key Files
136
+ [5–10 most important files with one-line description each]
137
+ - `[path]` — [what it does]
138
+
139
+ ## How to Contribute
140
+ 1. Fork or branch from main
141
+ 2. Make changes, run tests: `[test command]`
142
+ 3. Open a PR — describe what and why
143
+
144
+ ## Common Issues
145
+ [Top 3 "it doesn't work" situations with fixes. Only include issues you can infer from the codebase — e.g., missing .env, wrong Node version, database not running]
146
+
147
+ [Python projects — always include these if applicable:]
148
+ - **ModuleNotFoundError** → Virtual environment not activated. Run: `[activation command]`
149
+ - **ImportError: cannot import name X** → Dependencies outdated. Run: `[install command]`
150
+ - **PYTHONPATH issues** → If using src layout, install in editable mode: `pip install -e .`
151
+
152
+ ## Who to Ask
153
+ [If git log reveals consistent contributors, list them. Otherwise omit this section.]
154
+ ```
155
+
156
+ If `.rune/DEVELOPER-GUIDE.md` already exists, skip and log **INFO**: "Skipped existing .rune/DEVELOPER-GUIDE.md — manual content preserved."
157
+
158
+ ### Step 6c — Suggest L4 Extension Packs
159
+
160
+ Based on the detected tech stack from Step 2, recommend relevant L4 extension packs. Use the mapping table below to find applicable packs. Only suggest packs that match the detected stack — do not suggest all packs.
161
+
162
+ | Detected Stack | Suggest Pack | Why |
163
+ |----------------|-------------|-----|
164
+ | React, Next.js, Vue, Svelte, SvelteKit | `@rune/ui` | Frontend component patterns, design system, accessibility audit |
165
+ | Express, Fastify, FastAPI, Django, NestJS, Go HTTP | `@rune/backend` | API patterns, auth flows, middleware, rate limiting |
166
+ | Docker, GitHub Actions, Kubernetes, Terraform, CI/CD config | `@rune/devops` | Container patterns, deployment pipelines, infrastructure as code |
167
+ | React Native, Expo, Flutter, SwiftUI | `@rune/mobile` | Mobile architecture, navigation patterns, offline sync |
168
+ | Security-focused codebase (auth, payments, HIPAA/PCI markers) | `@rune/security` | Threat modeling, OWASP flows, compliance patterns |
169
+ | Trading, finance, pricing, portfolio, market data | `@rune/trading` | Market data validation, risk calculation, backtesting patterns |
170
+ | Subscription billing, tenant isolation, feature flags | `@rune/saas` | Multi-tenancy, billing integration, feature flag patterns |
171
+ | Cart, checkout, product catalog, inventory, payments | `@rune/ecommerce` | Cart patterns, payment flows, inventory management |
172
+ | ML models, training pipelines, embeddings, LLM integration | `@rune/ai-ml` | Model evaluation, prompt patterns, inference optimization |
173
+ | Game loop, physics, entity systems, multiplayer | `@rune/gamedev` | Game architecture, ECS patterns, netcode |
174
+ | CMS, blog, newsletter, SEO, content workflows | `@rune/content` | Content modeling, SEO patterns, editorial workflows |
175
+ | Analytics, dashboards, metrics, data pipelines, BI | `@rune/analytics` | Data modeling, visualization patterns, pipeline architecture |
176
+
177
+ If 0 packs match: omit this section from the report (no suggestions is correct for a generic project).
178
+
179
+ **Community pack discovery**: Also check if `.rune/community-packs/registry.json` exists. If it does, list installed community packs alongside core pack suggestions. If community packs are installed, include them under a `### Installed Community Packs` subsection.
180
+
181
+ If ≥1 packs match: include in the Onboard Report under a `### Suggested L4 Packs` section:
182
+
183
+ ```
184
+ ### Suggested L4 Packs
185
+ Based on your detected stack ([detected frameworks]), these extension packs may be useful:
186
+
187
+ - **@rune/[pack]** — [one-line reason based on detected stack]
188
+ Install: [link or command when available]
189
+ ```
190
+
191
+ ### Step 7 — Commit
192
+ Use `Bash` to stage and commit the generated files:
193
+ ```bash
194
+ git add CLAUDE.md .rune/ && git commit -m "chore: initialize rune project context"
195
+ ```
196
+
197
+ If `git` is not available or the directory is not a git repo, skip this step and add an INFO note to the report: "Not a git repository — files written but not committed."
198
+
199
+ If any of the `.rune/` files already exist, do not overwrite them (they may contain human-written decisions). Log **INFO**: "Skipped existing .rune/[file] — manual content preserved."
200
+
201
+ ## CLAUDE.md Template
202
+
203
+ ```markdown
204
+ # [Project Name] — Project Configuration
205
+
206
+ ## Overview
207
+ [Auto-detected description from README or entry point comments]
208
+
209
+ ## Tech Stack
210
+ - Framework: [detected]
211
+ - Language: [detected]
212
+ - Package Manager: [detected]
213
+ - Test Framework: [detected]
214
+ - Build Tool: [detected]
215
+ - Linter: [detected]
216
+ - Python Environment: [detected — venv/poetry/uv/conda/pyenv/pipenv/none] (only if Python project)
217
+
218
+ ## Directory Structure
219
+ [Generated tree with one-line annotations per directory]
220
+
221
+ ## Conventions
222
+ - Naming: [detected patterns — specific, not generic]
223
+ - Error handling: [detected pattern]
224
+ - State management: [detected pattern]
225
+ - API pattern: [detected pattern]
226
+ - Test structure: [detected pattern]
227
+
228
+ ## Commands
229
+ - Install: [detected command]
230
+ - Dev: [detected command]
231
+ - Build: [detected command]
232
+ - Test: [detected command]
233
+ - Lint: [detected command]
234
+
235
+ ## Key Files
236
+ - Entry point: [absolute path]
237
+ - Config: [absolute paths]
238
+ - Routes/API: [absolute paths]
239
+ ```
240
+
241
+ ## Output Format
242
+
243
+ ```
244
+ ## Onboard Report
245
+ - **Project**: [name] | **Framework**: [detected] | **Language**: [detected]
246
+ - **Files**: [count] | **LOC**: [estimate] | **Modules**: [count]
247
+
248
+ ### Generated
249
+ - CLAUDE.md (project configuration)
250
+ - .rune/conventions.md (detected patterns)
251
+ - .rune/decisions.md (initialized)
252
+ - .rune/progress.md (initialized)
253
+ - .rune/session-log.md (initialized)
254
+ - .rune/DEVELOPER-GUIDE.md (human onboarding guide)
255
+
256
+ ### Skipped (already exist)
257
+ - [list of files not overwritten]
258
+
259
+ ### Observations
260
+ - [notable patterns or anomalies found]
261
+ - [potential issues detected]
262
+ - [recommendations for the developer]
263
+
264
+ ### Suggested L4 Packs
265
+ - **@rune/[pack]** — [reason] (only shown if applicable packs detected)
266
+ ```
267
+
268
+ ## Constraints
269
+
270
+ 1. MUST scan actual project files — never generate CLAUDE.md from assumptions
271
+ 2. MUST detect and respect existing CLAUDE.md content — merge, don't overwrite
272
+ 3. MUST include: build commands, test commands, lint commands, project structure
273
+ 4. MUST NOT include obvious/generic advice ("write clean code", "use meaningful names")
274
+ 5. MUST verify generated commands actually work by running them
275
+ 6. MUST NOT overwrite existing .rune/ files — always preserve human-written content
276
+
277
+ ## Sharp Edges
278
+
279
+ Known failure modes for this skill. Check these before declaring done.
280
+
281
+ | Failure Mode | Severity | Mitigation |
282
+ |---|---|---|
283
+ | CLAUDE.md generated from README alone (no file scan) | CRITICAL | Step 1 MUST invoke scout — never skip actual file scanning |
284
+ | DEVELOPER-GUIDE.md contains generic placeholder text not derived from project | HIGH | Every section must reference actual detected commands, files, and patterns — no generic advice |
285
+ | Overwriting existing .rune/ files with manual content | CRITICAL | Check file existence before every Write — skip and log INFO if exists |
286
+ | Common Issues section fabricated (no actual issues detected) | MEDIUM | Only list issues inferable from codebase (missing .env, Node version, etc.) — omit section if none found |
287
+
288
+ ## Done When
289
+
290
+ - CLAUDE.md written (or merged) with all detected tech stack fields populated
291
+ - .rune/ directory initialized with conventions, decisions, progress, session-log
292
+ - .rune/DEVELOPER-GUIDE.md written with setup commands from actual scan
293
+ - All generated commands verified to exist in package.json/Makefile/etc.
294
+ - Onboard Report emitted with Generated + Skipped + Observations sections
295
+
296
+ ## Cost Profile
297
+
298
+ ~2000-5000 tokens input, ~1000-2000 tokens output. Sonnet for analysis quality.