@kinqs/brainrouter-mcp-server 0.3.4
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/.env.example +144 -0
- package/README.md +56 -0
- package/agents/README.md +120 -0
- package/agents/code-reviewer.md +97 -0
- package/agents/security-auditor.md +101 -0
- package/agents/test-engineer.md +95 -0
- package/dist/__tests__/agent_mode.test.d.ts +1 -0
- package/dist/__tests__/api-routes.test.d.ts +1 -0
- package/dist/__tests__/api-routes.test.js +170 -0
- package/dist/__tests__/crypto.test.d.ts +1 -0
- package/dist/__tests__/crypto.test.js +28 -0
- package/dist/__tests__/host-integrations.test.d.ts +1 -0
- package/dist/__tests__/host-integrations.test.js +82 -0
- package/dist/__tests__/integration.test.d.ts +1 -0
- package/dist/__tests__/integration.test.js +50 -0
- package/dist/__tests__/loader.test.d.ts +1 -0
- package/dist/__tests__/loader.test.js +89 -0
- package/dist/__tests__/neural-spark.test.d.ts +1 -0
- package/dist/__tests__/neural-spark.test.js +112 -0
- package/dist/__tests__/pagination.test.d.ts +1 -0
- package/dist/__tests__/pagination.test.js +23 -0
- package/dist/__tests__/redaction.test.d.ts +1 -0
- package/dist/__tests__/redaction.test.js +17 -0
- package/dist/__tests__/registry.test.d.ts +1 -0
- package/dist/__tests__/registry.test.js +56 -0
- package/dist/__tests__/retry.test.d.ts +1 -0
- package/dist/__tests__/retry.test.js +30 -0
- package/dist/__tests__/skill-activation.test.d.ts +1 -0
- package/dist/__tests__/skill-activation.test.js +112 -0
- package/dist/__tests__/working-memory.test.d.ts +1 -0
- package/dist/__tests__/working-memory.test.js +200 -0
- package/dist/__tests__/workspace-paths.test.d.ts +1 -0
- package/dist/__tests__/workspace-paths.test.js +56 -0
- package/dist/__tests__/writer.test.d.ts +1 -0
- package/dist/__tests__/writer.test.js +94 -0
- package/dist/api/auth/crypto.d.ts +4 -0
- package/dist/api/auth/crypto.js +54 -0
- package/dist/api/middleware/auth.d.ts +12 -0
- package/dist/api/middleware/auth.js +90 -0
- package/dist/api/pagination.d.ts +18 -0
- package/dist/api/pagination.js +32 -0
- package/dist/api/routes/auth.d.ts +1 -0
- package/dist/api/routes/auth.js +130 -0
- package/dist/api/routes/chat-completions.d.ts +7 -0
- package/dist/api/routes/chat-completions.js +474 -0
- package/dist/api/routes/contradictions.d.ts +1 -0
- package/dist/api/routes/contradictions.js +28 -0
- package/dist/api/routes/evidence.d.ts +1 -0
- package/dist/api/routes/evidence.js +59 -0
- package/dist/api/routes/governance.d.ts +1 -0
- package/dist/api/routes/governance.js +95 -0
- package/dist/api/routes/graph.d.ts +1 -0
- package/dist/api/routes/graph.js +25 -0
- package/dist/api/routes/hooks.d.ts +1 -0
- package/dist/api/routes/hooks.js +88 -0
- package/dist/api/routes/memories.d.ts +1 -0
- package/dist/api/routes/memories.js +92 -0
- package/dist/api/routes/persona.d.ts +1 -0
- package/dist/api/routes/persona.js +9 -0
- package/dist/api/routes/scenes.d.ts +1 -0
- package/dist/api/routes/scenes.js +35 -0
- package/dist/api/routes/skills.d.ts +1 -0
- package/dist/api/routes/skills.js +14 -0
- package/dist/api/routes/stats.d.ts +1 -0
- package/dist/api/routes/stats.js +8 -0
- package/dist/api/routes/users.d.ts +1 -0
- package/dist/api/routes/users.js +82 -0
- package/dist/api/routes/working.d.ts +1 -0
- package/dist/api/routes/working.js +88 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +492 -0
- package/dist/integrations/claude-code.d.ts +12 -0
- package/dist/integrations/claude-code.js +35 -0
- package/dist/integrations/codex.d.ts +12 -0
- package/dist/integrations/codex.js +34 -0
- package/dist/integrations/generic-mcp.d.ts +52 -0
- package/dist/integrations/generic-mcp.js +118 -0
- package/dist/loader.d.ts +29 -0
- package/dist/loader.js +200 -0
- package/dist/memory/capture.d.ts +35 -0
- package/dist/memory/capture.js +230 -0
- package/dist/memory/config.d.ts +2 -0
- package/dist/memory/config.js +3 -0
- package/dist/memory/engine.d.ts +203 -0
- package/dist/memory/engine.js +626 -0
- package/dist/memory/llm-semaphore.d.ts +41 -0
- package/dist/memory/llm-semaphore.js +81 -0
- package/dist/memory/memory-type-config.d.ts +11 -0
- package/dist/memory/memory-type-config.js +65 -0
- package/dist/memory/pipeline/cognitive-contradiction.d.ts +7 -0
- package/dist/memory/pipeline/cognitive-contradiction.js +59 -0
- package/dist/memory/pipeline/cognitive-dedup.d.ts +23 -0
- package/dist/memory/pipeline/cognitive-dedup.js +38 -0
- package/dist/memory/pipeline/cognitive-extractor.d.ts +21 -0
- package/dist/memory/pipeline/cognitive-extractor.js +183 -0
- package/dist/memory/pipeline/contextual-focus-builder.d.ts +13 -0
- package/dist/memory/pipeline/contextual-focus-builder.js +135 -0
- package/dist/memory/pipeline/focus-direction-shift.d.ts +10 -0
- package/dist/memory/pipeline/focus-direction-shift.js +27 -0
- package/dist/memory/pipeline/graph-builder.d.ts +11 -0
- package/dist/memory/pipeline/graph-builder.js +88 -0
- package/dist/memory/pipeline/graph-recall.d.ts +13 -0
- package/dist/memory/pipeline/graph-recall.js +55 -0
- package/dist/memory/pipeline/identity-distiller.d.ts +15 -0
- package/dist/memory/pipeline/identity-distiller.js +40 -0
- package/dist/memory/pipeline/l1-contradiction.d.ts +7 -0
- package/dist/memory/pipeline/l1-contradiction.js +66 -0
- package/dist/memory/pipeline/l1-dedup.d.ts +23 -0
- package/dist/memory/pipeline/l1-dedup.js +39 -0
- package/dist/memory/pipeline/l1-extractor.d.ts +21 -0
- package/dist/memory/pipeline/l1-extractor.js +180 -0
- package/dist/memory/pipeline/l2-direction-shift.d.ts +10 -0
- package/dist/memory/pipeline/l2-direction-shift.js +27 -0
- package/dist/memory/pipeline/l2-scene.d.ts +15 -0
- package/dist/memory/pipeline/l2-scene.js +140 -0
- package/dist/memory/pipeline/l3-distiller.d.ts +15 -0
- package/dist/memory/pipeline/l3-distiller.js +40 -0
- package/dist/memory/pipeline/neural-spark.d.ts +27 -0
- package/dist/memory/pipeline/neural-spark.js +78 -0
- package/dist/memory/pipeline/skill-prewarm.d.ts +63 -0
- package/dist/memory/pipeline/skill-prewarm.js +127 -0
- package/dist/memory/pipeline/task-queue.d.ts +54 -0
- package/dist/memory/pipeline/task-queue.js +117 -0
- package/dist/memory/prompts/cognitive-contradiction.d.ts +1 -0
- package/dist/memory/prompts/cognitive-contradiction.js +25 -0
- package/dist/memory/prompts/cognitive-extraction.d.ts +10 -0
- package/dist/memory/prompts/cognitive-extraction.js +114 -0
- package/dist/memory/prompts/core-identity.d.ts +6 -0
- package/dist/memory/prompts/core-identity.js +60 -0
- package/dist/memory/prompts/focus-direction-shift.d.ts +5 -0
- package/dist/memory/prompts/focus-direction-shift.js +32 -0
- package/dist/memory/prompts/focus-scene-cluster.d.ts +2 -0
- package/dist/memory/prompts/focus-scene-cluster.js +33 -0
- package/dist/memory/prompts/focus-scene.d.ts +7 -0
- package/dist/memory/prompts/focus-scene.js +40 -0
- package/dist/memory/prompts/graph-extraction-batch.d.ts +14 -0
- package/dist/memory/prompts/graph-extraction-batch.js +54 -0
- package/dist/memory/prompts/graph-extraction.d.ts +2 -0
- package/dist/memory/prompts/graph-extraction.js +53 -0
- package/dist/memory/prompts/l1-contradiction-batch.d.ts +16 -0
- package/dist/memory/prompts/l1-contradiction-batch.js +47 -0
- package/dist/memory/prompts/l1-contradiction.d.ts +1 -0
- package/dist/memory/prompts/l1-contradiction.js +25 -0
- package/dist/memory/prompts/l1-extraction.d.ts +10 -0
- package/dist/memory/prompts/l1-extraction.js +114 -0
- package/dist/memory/prompts/l2-direction-shift.d.ts +5 -0
- package/dist/memory/prompts/l2-direction-shift.js +32 -0
- package/dist/memory/prompts/l2-scene-cluster.d.ts +2 -0
- package/dist/memory/prompts/l2-scene-cluster.js +33 -0
- package/dist/memory/prompts/l2-scene.d.ts +7 -0
- package/dist/memory/prompts/l2-scene.js +40 -0
- package/dist/memory/prompts/l3-persona.d.ts +6 -0
- package/dist/memory/prompts/l3-persona.js +60 -0
- package/dist/memory/recall.d.ts +47 -0
- package/dist/memory/recall.js +427 -0
- package/dist/memory/redaction.d.ts +1 -0
- package/dist/memory/redaction.js +24 -0
- package/dist/memory/retry.d.ts +13 -0
- package/dist/memory/retry.js +53 -0
- package/dist/memory/scheduler.d.ts +9 -0
- package/dist/memory/scheduler.js +16 -0
- package/dist/memory/skill-hints-loader.d.ts +30 -0
- package/dist/memory/skill-hints-loader.js +100 -0
- package/dist/memory/store/embedding.d.ts +16 -0
- package/dist/memory/store/embedding.js +68 -0
- package/dist/memory/store/reranker.d.ts +24 -0
- package/dist/memory/store/reranker.js +83 -0
- package/dist/memory/store/sqlite.d.ts +167 -0
- package/dist/memory/store/sqlite.js +1816 -0
- package/dist/memory/store/types.d.ts +101 -0
- package/dist/memory/store/types.js +1 -0
- package/dist/memory/types.d.ts +207 -0
- package/dist/memory/types.js +7 -0
- package/dist/memory/validation.d.ts +441 -0
- package/dist/memory/validation.js +129 -0
- package/dist/memory/working/canvas.d.ts +5 -0
- package/dist/memory/working/canvas.js +43 -0
- package/dist/memory/working/offload.d.ts +71 -0
- package/dist/memory/working/offload.js +211 -0
- package/dist/memory/working/step-log.d.ts +16 -0
- package/dist/memory/working/step-log.js +35 -0
- package/dist/registry.d.ts +34 -0
- package/dist/registry.js +305 -0
- package/dist/resolver.d.ts +17 -0
- package/dist/resolver.js +126 -0
- package/dist/scripts/validate-foreign-workspace-path.d.ts +1 -0
- package/dist/scripts/validate-foreign-workspace-path.js +39 -0
- package/dist/tools/agent_memory_tools.d.ts +485 -0
- package/dist/tools/agent_memory_tools.js +793 -0
- package/dist/tools/create_skill.d.ts +46 -0
- package/dist/tools/create_skill.js +46 -0
- package/dist/tools/get_doc.d.ts +21 -0
- package/dist/tools/get_doc.js +24 -0
- package/dist/tools/get_persona.d.ts +15 -0
- package/dist/tools/get_persona.js +20 -0
- package/dist/tools/get_reference.d.ts +15 -0
- package/dist/tools/get_reference.js +20 -0
- package/dist/tools/get_skill.d.ts +34 -0
- package/dist/tools/get_skill.js +65 -0
- package/dist/tools/get_template_doc.d.ts +21 -0
- package/dist/tools/get_template_doc.js +24 -0
- package/dist/tools/list_docs.d.ts +15 -0
- package/dist/tools/list_docs.js +16 -0
- package/dist/tools/list_skills.d.ts +18 -0
- package/dist/tools/list_skills.js +17 -0
- package/dist/tools/list_template_docs.d.ts +15 -0
- package/dist/tools/list_template_docs.js +16 -0
- package/dist/tools/memory-engineering.d.ts +225 -0
- package/dist/tools/memory-engineering.js +284 -0
- package/dist/tools/memory-explain.d.ts +34 -0
- package/dist/tools/memory-explain.js +109 -0
- package/dist/tools/memory-governance.d.ts +171 -0
- package/dist/tools/memory-governance.js +224 -0
- package/dist/tools/memory-hooks.d.ts +67 -0
- package/dist/tools/memory-hooks.js +102 -0
- package/dist/tools/memory-working.d.ts +98 -0
- package/dist/tools/memory-working.js +101 -0
- package/dist/tools/memory_capture_turn.d.ts +66 -0
- package/dist/tools/memory_capture_turn.js +85 -0
- package/dist/tools/memory_consolidate.d.ts +55 -0
- package/dist/tools/memory_consolidate.js +176 -0
- package/dist/tools/memory_contradictions.d.ts +53 -0
- package/dist/tools/memory_contradictions.js +52 -0
- package/dist/tools/memory_graph_query.d.ts +51 -0
- package/dist/tools/memory_graph_query.js +35 -0
- package/dist/tools/memory_mark_cited.d.ts +43 -0
- package/dist/tools/memory_mark_cited.js +63 -0
- package/dist/tools/memory_recall.d.ts +77 -0
- package/dist/tools/memory_recall.js +81 -0
- package/dist/tools/memory_register_skill_hints.d.ts +49 -0
- package/dist/tools/memory_register_skill_hints.js +55 -0
- package/dist/tools/memory_resolve_session.d.ts +24 -0
- package/dist/tools/memory_resolve_session.js +133 -0
- package/dist/tools/memory_search.d.ts +146 -0
- package/dist/tools/memory_search.js +84 -0
- package/dist/tools/search_skills.d.ts +18 -0
- package/dist/tools/search_skills.js +17 -0
- package/dist/tools/update_doc.d.ts +24 -0
- package/dist/tools/update_doc.js +35 -0
- package/dist/tools/update_skill.d.ts +30 -0
- package/dist/tools/update_skill.js +80 -0
- package/dist/types.d.ts +81 -0
- package/dist/types.js +4 -0
- package/dist/writer.d.ts +30 -0
- package/dist/writer.js +220 -0
- package/docs/TEMPLATE ONLY +1 -0
- package/docs/api/API.md +64 -0
- package/docs/api/security/SECURITY.md +58 -0
- package/docs/deployment/DockerDeployment.md +30 -0
- package/docs/design/Design.md +59 -0
- package/docs/design/themes/apple.md +101 -0
- package/docs/design/themes/dieter-grid.md +100 -0
- package/docs/design/themes/gallery-white.md +100 -0
- package/docs/design/themes/pinterest.md +101 -0
- package/docs/design/themes/realty-open-house.md +101 -0
- package/docs/design/themes/vodafone.md +101 -0
- package/docs/hooks/Hooks.md +30 -0
- package/docs/schema/Schema.md +35 -0
- package/docs/strategy/ScalingStrategy.md +19 -0
- package/package.json +88 -0
- package/references/accessibility-checklist.md +160 -0
- package/references/orchestration-patterns.md +370 -0
- package/references/performance-checklist.md +153 -0
- package/references/security-checklist.md +134 -0
- package/references/testing-patterns.md +236 -0
- package/skills/agent/adr-skill/SKILL.md +299 -0
- package/skills/agent/agentic-engineering-workflow/SKILL.md +95 -0
- package/skills/agent/bootstrap-skill/SKILL.md +103 -0
- package/skills/agent/context-engineering/SKILL.md +307 -0
- package/skills/agent/debugging-and-error-recovery/SKILL.md +308 -0
- package/skills/agent/developer-growth-analysis/SKILL.md +328 -0
- package/skills/agent/doubt-driven-skill/SKILL.md +249 -0
- package/skills/agent/handover-skill/SKILL.md +112 -0
- package/skills/agent/idea-refine-skill/SKILL.md +185 -0
- package/skills/agent/idea-refine-skill/examples.md +238 -0
- package/skills/agent/idea-refine-skill/frameworks.md +99 -0
- package/skills/agent/idea-refine-skill/refinement-criteria.md +113 -0
- package/skills/agent/interview-skill/SKILL.md +226 -0
- package/skills/agent/planning-skill/SKILL.md +270 -0
- package/skills/agent/skill-authoring/SKILL.md +189 -0
- package/skills/agent/source-driven-skill/SKILL.md +197 -0
- package/skills/agent/spec-driven-skill/SKILL.md +221 -0
- package/skills/agent/sync-skill/SKILL.md +92 -0
- package/skills/agent/using-agent-skills/SKILL.md +189 -0
- package/skills/api/a11y-skill/SKILL.md +88 -0
- package/skills/api/api-skill/SKILL.md +123 -0
- package/skills/api/auth-skill/SKILL.md +80 -0
- package/skills/api/debug-skill/SKILL.md +535 -0
- package/skills/api/performance-skill/SKILL.md +100 -0
- package/skills/api/testing-skill/SKILL.md +100 -0
- package/skills/codebase/code-review-and-quality/SKILL.md +228 -0
- package/skills/codebase/code-simplification/SKILL.md +352 -0
- package/skills/codebase/code-structure-cleanup/SKILL.md +142 -0
- package/skills/codebase/concerns-skill/SKILL.md +89 -0
- package/skills/codebase/conventions-skill/SKILL.md +95 -0
- package/skills/codebase/doc-management-skill/SKILL.md +47 -0
- package/skills/codebase/git-workflow-skill/SKILL.md +312 -0
- package/skills/communication/1-3-1-rule/SKILL.md +120 -0
- package/skills/design/brutalist-skill/SKILL.md +131 -0
- package/skills/design/concept-diagrams/SKILL.md +387 -0
- package/skills/design/concept-diagrams/examples/apartment-floor-plan-conversion.md +244 -0
- package/skills/design/concept-diagrams/examples/automated-password-reset-flow.md +276 -0
- package/skills/design/concept-diagrams/examples/autonomous-llm-research-agent-flow.md +240 -0
- package/skills/design/concept-diagrams/examples/banana-journey-tree-to-smoothie.md +161 -0
- package/skills/design/concept-diagrams/examples/commercial-aircraft-structure.md +209 -0
- package/skills/design/concept-diagrams/examples/cpu-ooo-microarchitecture.md +236 -0
- package/skills/design/concept-diagrams/examples/electricity-grid-flow.md +182 -0
- package/skills/design/concept-diagrams/examples/feature-film-production-pipeline.md +172 -0
- package/skills/design/concept-diagrams/examples/hospital-emergency-department-flow.md +165 -0
- package/skills/design/concept-diagrams/examples/ml-benchmark-grouped-bar-chart.md +114 -0
- package/skills/design/concept-diagrams/examples/place-order-uml-sequence.md +325 -0
- package/skills/design/concept-diagrams/examples/smart-city-infrastructure.md +173 -0
- package/skills/design/concept-diagrams/examples/smartphone-layer-anatomy.md +154 -0
- package/skills/design/concept-diagrams/examples/sn2-reaction-mechanism.md +247 -0
- package/skills/design/concept-diagrams/examples/wind-turbine-structure.md +338 -0
- package/skills/design/concept-diagrams/references/dashboard-patterns.md +43 -0
- package/skills/design/concept-diagrams/references/infrastructure-patterns.md +144 -0
- package/skills/design/concept-diagrams/references/physical-shape-cookbook.md +42 -0
- package/skills/design/concept-diagrams/templates/template.html +174 -0
- package/skills/design/gpt-tasteskill/SKILL.md +114 -0
- package/skills/design/minimalist-skill/SKILL.md +116 -0
- package/skills/design/output-skill/SKILL.md +87 -0
- package/skills/design/redesign-skill/SKILL.md +213 -0
- package/skills/design/soft-skill/SKILL.md +132 -0
- package/skills/design/stitch-skill/EXAMPLE.md +121 -0
- package/skills/design/stitch-skill/SKILL.md +222 -0
- package/skills/design/taste-skill/SKILL.md +269 -0
- package/skills/devops/ci-cd-skill/SKILL.md +402 -0
- package/skills/devops/docker-skill/SKILL.md +297 -0
- package/skills/devops/domain-skill/SKILL.md +234 -0
- package/skills/lifecycle/changelog-generator/SKILL.md +135 -0
- package/skills/lifecycle/incremental-skill/SKILL.md +257 -0
- package/skills/lifecycle/migration-skill/SKILL.md +218 -0
- package/skills/lifecycle/shipping-skill/SKILL.md +321 -0
- package/skills/memory/agent-memory/SKILL.md +122 -0
- package/skills/qa/browser-testing-skill/SKILL.md +314 -0
- package/skills/ux/adversarial-ux-skill/SKILL.md +168 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-authoring
|
|
3
|
+
description: Defines the canonical structure, format, and writing principles for BrainRouter SKILL.md files. Use when creating a new skill, reviewing an existing skill for compliance, or understanding what sections a skill must contain.
|
|
4
|
+
hints:
|
|
5
|
+
- Keep skills project-agnostic, professional, and targeted at engineers or VibeCoders.
|
|
6
|
+
- Standardize frontmatter name to match folder basename exactly.
|
|
7
|
+
- Exclude custom branding, metadata keys, or trailing placeholders (like [trigger condition]).
|
|
8
|
+
- Write high-rebuttal anti-rationalizations and actionable verification checklists.
|
|
9
|
+
- Structure all supporting reference or template files under subfolders (e.g. templates/, scripts/).
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Skill Anatomy
|
|
13
|
+
|
|
14
|
+
This document describes the structure and format of agent-skills skill files. Use this as a guide when contributing new skills or understanding existing ones.
|
|
15
|
+
|
|
16
|
+
## File Location
|
|
17
|
+
|
|
18
|
+
Skills live in the following directory structure depending on their scope:
|
|
19
|
+
|
|
20
|
+
- **Universal Skills**: `skills/<category>/<skill-name>/SKILL.md`
|
|
21
|
+
- **Project-Specific Skills**: `projects/<project-name>/skills/<category>/<skill-name>/SKILL.md`
|
|
22
|
+
|
|
23
|
+
In the global MCP repository (BrainRouter), both folders are used to organize universal and project-level knowledge. In a local project repository, skills are typically stored in the `skills/` directory.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
[root]/
|
|
27
|
+
skills/
|
|
28
|
+
api/
|
|
29
|
+
auth-skill/
|
|
30
|
+
SKILL.md
|
|
31
|
+
projects/
|
|
32
|
+
YourProject/
|
|
33
|
+
skills/
|
|
34
|
+
api/
|
|
35
|
+
storage-skill/
|
|
36
|
+
SKILL.md
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`SKILL.md` is the only required file. You can also include a `scripts/` directory for runnable helpers or additional supporting markdown files.
|
|
40
|
+
|
|
41
|
+
## SKILL.md Format
|
|
42
|
+
|
|
43
|
+
### Frontmatter (Required)
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
---
|
|
47
|
+
name: skill-name-with-hyphens
|
|
48
|
+
description: Guides agents through [task/workflow]. Use when [specific trigger conditions].
|
|
49
|
+
hints: |
|
|
50
|
+
- Always execute step A before step B.
|
|
51
|
+
- Assert that all tests pass before completing.
|
|
52
|
+
---
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Rules:**
|
|
56
|
+
- `name`: Lowercase, hyphen-separated. Must match the directory name.
|
|
57
|
+
- `description`: Start with what the skill does in third person, then include one or more clear "Use when" trigger conditions. Include both *what* and *when*. Maximum 1024 characters.
|
|
58
|
+
- `hints`: (Recommended for L2 Pre-warming) A concise, bulleted list of essential instructions that should be injected into the LLM system prompt context when this skill is pre-warmed. Keep this under 5-6 bullet points (approx. 300 characters) to optimize token consumption.
|
|
59
|
+
|
|
60
|
+
**Why this matters:** Agents discover skills by reading descriptions. The description is injected into the system prompt, so it must tell the agent both what the skill provides and when to activate it. Do not summarize the workflow — if the description contains process steps, the agent may follow the summary instead of reading the full skill.
|
|
61
|
+
|
|
62
|
+
The `hints` field is parsed by BrainRouter's L2 pre-warming engine. When the skill's activation potential is spiked, these hints are automatically injected into the LLM prompt context to keep the model primed with core rules.
|
|
63
|
+
|
|
64
|
+
### Standard Sections (Recommended Pattern)
|
|
65
|
+
|
|
66
|
+
The frontmatter contract above is required. The section layout below is a recommended pattern, not a rigid template: equivalent headings are acceptable when they serve the same purpose clearly.
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
# Skill Title
|
|
70
|
+
|
|
71
|
+
## Overview
|
|
72
|
+
One-two sentences explaining what this skill does and why it matters.
|
|
73
|
+
|
|
74
|
+
## When to Use
|
|
75
|
+
- Bullet list of triggering conditions (symptoms, task types)
|
|
76
|
+
- When NOT to use (exclusions)
|
|
77
|
+
|
|
78
|
+
## [Core Process / The Workflow / Steps]
|
|
79
|
+
The main workflow, broken into numbered steps or phases.
|
|
80
|
+
Include code examples where they help.
|
|
81
|
+
Use flowcharts (ASCII) where decision points exist.
|
|
82
|
+
|
|
83
|
+
## [Specific Techniques / Patterns]
|
|
84
|
+
Detailed guidance for specific scenarios.
|
|
85
|
+
Code examples, templates, configuration.
|
|
86
|
+
|
|
87
|
+
## Common Rationalizations
|
|
88
|
+
| Rationalization | Reality |
|
|
89
|
+
|---|---|
|
|
90
|
+
| Excuse agents use to skip steps | Why the excuse is wrong |
|
|
91
|
+
|
|
92
|
+
## Red Flags
|
|
93
|
+
- Behavioral patterns indicating the skill is being violated
|
|
94
|
+
- Things to watch for during review
|
|
95
|
+
|
|
96
|
+
## Verification
|
|
97
|
+
After completing the skill's process, confirm:
|
|
98
|
+
- [ ] Checklist of exit criteria
|
|
99
|
+
- [ ] Evidence requirements
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Section Purposes
|
|
103
|
+
|
|
104
|
+
### Overview
|
|
105
|
+
The "elevator pitch" for the skill. Should answer: What does this skill do, and why should an agent follow it?
|
|
106
|
+
|
|
107
|
+
### When to Use
|
|
108
|
+
Helps agents and humans decide if this skill applies to the current task. Include both positive triggers ("Use when X") and negative exclusions ("NOT for Y").
|
|
109
|
+
|
|
110
|
+
### Core Process
|
|
111
|
+
The heart of the skill. This is the step-by-step workflow the agent follows. Must be specific and actionable — not vague advice.
|
|
112
|
+
|
|
113
|
+
**Good:** "Run `npm test` and verify all tests pass"
|
|
114
|
+
**Bad:** "Make sure the tests work"
|
|
115
|
+
|
|
116
|
+
### Common Rationalizations
|
|
117
|
+
The most distinctive feature of well-crafted skills. These are excuses agents use to skip important steps, paired with rebuttals. They prevent the agent from rationalizing its way out of following the process.
|
|
118
|
+
|
|
119
|
+
Think of every time an agent has said "I'll add tests later" or "This is simple enough to skip the spec" — those go here with a factual counter-argument.
|
|
120
|
+
|
|
121
|
+
### Red Flags
|
|
122
|
+
Observable signs that the skill is being violated. Useful during code review and self-monitoring.
|
|
123
|
+
|
|
124
|
+
### Verification
|
|
125
|
+
The exit criteria. A checklist the agent uses to confirm the skill's process is complete. Every checkbox should be verifiable with evidence (test output, build result, screenshot, etc.).
|
|
126
|
+
|
|
127
|
+
## Supporting Files
|
|
128
|
+
|
|
129
|
+
Create supporting files only when:
|
|
130
|
+
- Reference material exceeds 100 lines (keep the main SKILL.md focused)
|
|
131
|
+
- Code tools or scripts are needed
|
|
132
|
+
- Checklists are long enough to justify separate files
|
|
133
|
+
|
|
134
|
+
Keep patterns and principles inline when under 50 lines.
|
|
135
|
+
|
|
136
|
+
If a skill does not need runnable helpers, do not create an empty `scripts/` directory just to mirror other skills. Empty directories add noise without changing how the skill works.
|
|
137
|
+
|
|
138
|
+
## Writing Principles
|
|
139
|
+
|
|
140
|
+
1. **Process over knowledge.** Skills are workflows, not reference docs. Steps, not facts.
|
|
141
|
+
2. **Specific over general.** "Run `npm test`" beats "verify the tests".
|
|
142
|
+
3. **Evidence over assumption.** Every verification checkbox requires proof.
|
|
143
|
+
4. **Anti-rationalization.** Every skip-worthy step needs a counter-argument in the rationalizations table.
|
|
144
|
+
5. **Progressive disclosure.** Main SKILL.md is the entry point. Supporting files are loaded only when needed.
|
|
145
|
+
6. **Token-conscious.** Every section must justify its inclusion. If removing it wouldn't change agent behavior, remove it.
|
|
146
|
+
|
|
147
|
+
## L2 Skill Pre-Warming & SNN Routing
|
|
148
|
+
|
|
149
|
+
BrainRouter implements a Spiking Neural Network (SNN) model to dynamically pre-warm skills. This mechanism keeps relevant skills active in the agent's prompt context without blowing up the token window:
|
|
150
|
+
1. **Spikes**: Invoking a skill or querying memories related to it spikes its activation potential by `+1.0` (up to a maximum cap of `4.0`).
|
|
151
|
+
2. **Decay**: The potential decays exponentially over idle turns and time ($Potential_{new} = Potential_{old} \times e^{-\lambda \Delta t}$).
|
|
152
|
+
3. **Threshold Gate**: If a skill's potential is `>= 0.3`, it crosses the gate and is considered "active."
|
|
153
|
+
4. **Context Injection**: Active skills automatically have their `hints` frontmatter or registered memory hints injected into the LLM system prompt context under the `<skill-prewarm>` block.
|
|
154
|
+
|
|
155
|
+
When writing or updating skills, authors should:
|
|
156
|
+
- Ensure that the frontmatter `hints` are present, concise, and target specific error prevention or structural patterns.
|
|
157
|
+
- Register newly-added dynamic skill hints by invoking `mcp_brainrouter_memory_register_skill_hints` if the skill relies on user-customized memory overrides.
|
|
158
|
+
|
|
159
|
+
## Naming Conventions
|
|
160
|
+
|
|
161
|
+
- Skill directories: `lowercase-hyphen-separated`
|
|
162
|
+
- Skill files: `SKILL.md` (always uppercase)
|
|
163
|
+
- Supporting files: `lowercase-hyphen-separated.md`
|
|
164
|
+
- References: stored in `references/` at the project root, not inside skill directories
|
|
165
|
+
|
|
166
|
+
## Cross-Skill References
|
|
167
|
+
|
|
168
|
+
Reference other skills by name:
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
Follow the `test-driven-development` skill for writing tests.
|
|
172
|
+
If the build breaks, use the `debugging-and-error-recovery` skill.
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Don't duplicate content between skills — reference and link instead.
|
|
176
|
+
|
|
177
|
+
## Required vs Recommended
|
|
178
|
+
|
|
179
|
+
Required:
|
|
180
|
+
|
|
181
|
+
- A `skills/<skill-name>/SKILL.md` file
|
|
182
|
+
- Valid YAML frontmatter with `name` and `description`
|
|
183
|
+
- A description that includes both what the skill does and when to use it
|
|
184
|
+
|
|
185
|
+
Recommended:
|
|
186
|
+
|
|
187
|
+
- The standard section flow shown above
|
|
188
|
+
- Equivalent headings such as `How It Works`, `Core Process`, or `Workflow` when they read more naturally for the skill
|
|
189
|
+
- Supporting files only when they keep the main `SKILL.md` focused
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: source-driven-skill
|
|
3
|
+
description: Grounds every implementation decision in official documentation or local source code. Use when building with any framework, library, or SDK where correctness matters. Use when an agent is likely to hallucinate API names, or when docs are weak and the library source is available locally.
|
|
4
|
+
hints: |
|
|
5
|
+
- Read package.json (or equivalent) to detect exact versions before fetching docs.
|
|
6
|
+
- Fetch the specific doc page for the feature — not the homepage, not the full docs.
|
|
7
|
+
- If an openSrc/ directory is present in the workspace, inspect its contents for reference implementations before writing code.
|
|
8
|
+
- Cite every framework-specific decision with a full URL in code comments.
|
|
9
|
+
- Flag anything that could not be verified as UNVERIFIED — never silently guess.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Source-Driven Development
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Every framework-specific code decision must be backed by an authoritative source — either official documentation or the library's local source code. Training data goes stale, APIs get deprecated, and best practices evolve. This skill ensures every pattern traces back to a source the user can check, eliminating hallucinated APIs and broken deprecated patterns.
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
- Building with any framework, library, or SDK where the API surface matters.
|
|
21
|
+
- The agent is about to write framework-specific code from memory.
|
|
22
|
+
- Docs are weak, stale, or incomplete — but the library's source is available on disk.
|
|
23
|
+
- Building boilerplate or patterns that will be copied across the project.
|
|
24
|
+
- Reviewing code that uses framework-specific patterns.
|
|
25
|
+
|
|
26
|
+
**When NOT to use:**
|
|
27
|
+
- Pure logic that works the same across all versions (loops, conditionals, data structures).
|
|
28
|
+
- Renaming variables, fixing typos, or moving files — correctness is not version-dependent.
|
|
29
|
+
- The user explicitly wants speed over verification ("just do it quickly").
|
|
30
|
+
|
|
31
|
+
## The Process
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
DETECT ──→ SOURCE ──→ IMPLEMENT ──→ CITE
|
|
35
|
+
│ │ │ │
|
|
36
|
+
▼ ▼ ▼ ▼
|
|
37
|
+
Stack & Fetch docs Follow the Show your
|
|
38
|
+
versions or search documented sources
|
|
39
|
+
local repo patterns
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 1: Detect Stack and Versions
|
|
43
|
+
|
|
44
|
+
Read the project's dependency file to identify exact versions:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
package.json → Node / React / Vue / Angular / Svelte
|
|
48
|
+
composer.json → PHP / Symfony / Laravel
|
|
49
|
+
requirements.txt → Python / Django / Flask
|
|
50
|
+
go.mod → Go
|
|
51
|
+
Cargo.toml → Rust
|
|
52
|
+
Gemfile → Ruby / Rails
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
State what you found explicitly before doing anything else:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
STACK DETECTED:
|
|
59
|
+
- React 19.1.0 (from package.json)
|
|
60
|
+
- Vite 6.2.0
|
|
61
|
+
→ Fetching official docs for the relevant patterns.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If versions are missing or ambiguous, **ask the user**. The version determines which patterns are correct.
|
|
65
|
+
|
|
66
|
+
### Step 2: Get the Source
|
|
67
|
+
|
|
68
|
+
#### Option A — Official Documentation (default)
|
|
69
|
+
|
|
70
|
+
Fetch the **specific documentation page** for the feature being implemented. Not the homepage. Not the full docs.
|
|
71
|
+
|
|
72
|
+
**Source hierarchy (in order of authority):**
|
|
73
|
+
|
|
74
|
+
| Priority | Source | Example |
|
|
75
|
+
|----------|--------|---------|
|
|
76
|
+
| 1 | Official documentation | react.dev, docs.djangoproject.com |
|
|
77
|
+
| 2 | Official blog / changelog | react.dev/blog, nextjs.org/blog |
|
|
78
|
+
| 3 | Web standards references | MDN, web.dev |
|
|
79
|
+
| 4 | Browser/runtime compatibility | caniuse.com, node.green |
|
|
80
|
+
|
|
81
|
+
**Never cite as primary sources:** Stack Overflow, blog posts, tutorials, AI-generated summaries, or training data.
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
BAD: Fetch the React homepage
|
|
85
|
+
GOOD: Fetch react.dev/reference/react/useActionState
|
|
86
|
+
|
|
87
|
+
BAD: Search "django authentication best practices"
|
|
88
|
+
GOOD: Fetch docs.djangoproject.com/en/6.0/topics/auth/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Option B — Local Source & Open Source References (when docs are weak or missing)
|
|
92
|
+
|
|
93
|
+
If reference repositories or libraries are available locally in the workspace (for example, in an `openSrc/` folder or a `reference/repos/` folder), search them directly. This is the most current and practical source possible to discover working API usage patterns and connection/error-handling structures.
|
|
94
|
+
|
|
95
|
+
**Setup / Discovery:**
|
|
96
|
+
1. Check if an `openSrc/` folder exists at the workspace root. If present, list its directories to see what reference repositories (such as `claude-code`, `agentmemory`, `openai-node`, etc.) are available.
|
|
97
|
+
2. Place or look for local reference repos under: `openSrc/` or `reference/repos/github.com/company/project`
|
|
98
|
+
3. Add a note to your `AGENT.md` or `CLAUDE.md`:
|
|
99
|
+
|
|
100
|
+
```md
|
|
101
|
+
When working with <library/tool>, reference the local open-source repos under:
|
|
102
|
+
`openSrc/<repo-name>` or `reference/repos/<repo-name>`.
|
|
103
|
+
Do not guess API signatures. Search the source first, then implement.
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Feature prompt template / workflow:**
|
|
107
|
+
|
|
108
|
+
```md
|
|
109
|
+
Build <feature>. We use <library/tool>.
|
|
110
|
+
|
|
111
|
+
Before coding:
|
|
112
|
+
1. If available, search the `openSrc/` directory or `reference/repos/` for reference implementation examples of this library.
|
|
113
|
+
2. Identify the specific files/functions/patterns you are using as a model.
|
|
114
|
+
3. Implement only the minimal service function and one calling component.
|
|
115
|
+
4. Keep the diff small and clean.
|
|
116
|
+
5. Explain which reference source files you inspected.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Step 3: Implement Following the Source
|
|
120
|
+
|
|
121
|
+
- Use the API signatures from the source, not from memory.
|
|
122
|
+
- If the source shows a new way to do something, use the new way.
|
|
123
|
+
- If the source marks something as deprecated, don't use it.
|
|
124
|
+
- If the source doesn't cover something, flag it as unverified.
|
|
125
|
+
|
|
126
|
+
**When source conflicts with existing project code:**
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
CONFLICT DETECTED:
|
|
130
|
+
The existing codebase uses useState for form loading state,
|
|
131
|
+
but React 19 docs recommend useActionState for this pattern.
|
|
132
|
+
Source: react.dev/reference/react/useActionState
|
|
133
|
+
|
|
134
|
+
Options:
|
|
135
|
+
A) Use the modern pattern (useActionState) — consistent with current docs
|
|
136
|
+
B) Match existing code (useState) — consistent with codebase
|
|
137
|
+
→ Which approach do you prefer?
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Surface the conflict. Don't silently pick one.
|
|
141
|
+
|
|
142
|
+
### Step 4: Cite Your Sources
|
|
143
|
+
|
|
144
|
+
Every framework-specific decision gets a citation — in code and in conversation.
|
|
145
|
+
|
|
146
|
+
**In code comments:**
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// React 19 form handling with useActionState
|
|
150
|
+
// Source: https://react.dev/reference/react/useActionState#usage
|
|
151
|
+
const [state, formAction, isPending] = useActionState(submitOrder, initialState);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Citation rules:**
|
|
155
|
+
- Full URLs — not shortened
|
|
156
|
+
- Deep links with anchors preferred (e.g. `/useActionState#usage`)
|
|
157
|
+
- Quote the relevant passage for non-obvious decisions
|
|
158
|
+
- If you cannot find documentation, say so explicitly:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
UNVERIFIED: I could not find official documentation for this pattern.
|
|
162
|
+
This is based on training data and may be outdated. Verify before using in production.
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Common Rationalizations
|
|
166
|
+
|
|
167
|
+
| Rationalization | Reality |
|
|
168
|
+
|---|---|
|
|
169
|
+
| "I'm confident about this API" | Confidence is not evidence. Training data contains outdated patterns that look correct but break against current versions. Verify. |
|
|
170
|
+
| "Fetching docs wastes tokens" | Hallucinating an API wastes more. One fetch prevents hours of debugging a wrong function signature. |
|
|
171
|
+
| "The docs won't have what I need" | If the docs don't cover it, that's valuable signal — the pattern may not be officially recommended. Check local source next. |
|
|
172
|
+
| "I'll just mention it might be outdated" | A disclaimer doesn't help. Either verify and cite, or clearly flag it as UNVERIFIED. Hedging is the worst option. |
|
|
173
|
+
| "This is a simple task, no need to check" | Simple tasks with wrong patterns become templates. The user copies your deprecated form handler into ten components before discovering the modern approach. |
|
|
174
|
+
| "I can't find the API so I'll add a new dependency" | Search the local source first. The API may exist and simply be undocumented. |
|
|
175
|
+
|
|
176
|
+
## Red Flags
|
|
177
|
+
|
|
178
|
+
- Writing framework-specific code without checking docs or local source for that version.
|
|
179
|
+
- Using "I believe" or "I think" about an API instead of citing the source.
|
|
180
|
+
- Citing Stack Overflow or blog posts as primary sources.
|
|
181
|
+
- Using deprecated APIs because they appear in training data.
|
|
182
|
+
- Not reading `package.json` (or equivalent) before implementing.
|
|
183
|
+
- Delivering code without citations for framework-specific decisions.
|
|
184
|
+
- Installing an alternative package because the agent couldn't find the existing API.
|
|
185
|
+
|
|
186
|
+
## Verification
|
|
187
|
+
|
|
188
|
+
After implementing with source-driven development, confirm:
|
|
189
|
+
|
|
190
|
+
- [ ] Framework and library versions were identified from the dependency file.
|
|
191
|
+
- [ ] Official documentation or local source was consulted for framework-specific patterns.
|
|
192
|
+
- [ ] All citations are official sources — not blog posts or training data.
|
|
193
|
+
- [ ] Code follows the patterns shown in the current version's documentation.
|
|
194
|
+
- [ ] Non-trivial decisions include source citations with full URLs.
|
|
195
|
+
- [ ] No deprecated APIs are used (checked against migration guides).
|
|
196
|
+
- [ ] Conflicts between source and existing code were surfaced to the user.
|
|
197
|
+
- [ ] Anything that could not be verified is explicitly flagged as UNVERIFIED.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-driven-skill
|
|
3
|
+
description: Creates specs before coding. Use when starting a new project, feature, or significant change and no specification exists yet. Use when requirements are unclear, ambiguous, or only exist as a vague idea.
|
|
4
|
+
hints:
|
|
5
|
+
- Never write code for a new feature or major refactoring without a written specification.
|
|
6
|
+
- Review openSrc/ templates or existing specs in docs/specs/ if they exist to reuse standard structures.
|
|
7
|
+
- Define explicit, testable Definition of Done (DoD) criteria in every specification.
|
|
8
|
+
- Establish boundary conditions (Always, Ask First, Never) to govern agent behaviors.
|
|
9
|
+
- Commit the spec as a living markdown file in the repository (e.g. docs/specs/) before implementing.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Spec-Driven Development
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Write a structured specification before writing any code. The spec is the shared source of truth between you and the human engineer — it defines what we're building, why, and how we'll know it's done. Code without a spec is guessing.
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
- Starting a new project or feature
|
|
21
|
+
- Requirements are ambiguous or incomplete
|
|
22
|
+
- The change touches multiple files or modules
|
|
23
|
+
- You're about to make an architectural decision
|
|
24
|
+
- The task would take more than 30 minutes to implement
|
|
25
|
+
|
|
26
|
+
**When NOT to use:** Single-line fixes, typo corrections, or changes where requirements are unambiguous and self-contained.
|
|
27
|
+
|
|
28
|
+
## The Gated Workflow
|
|
29
|
+
|
|
30
|
+
Spec-driven development has four phases. Do not advance to the next phase until the current one is validated.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
SPECIFY ──→ PLAN ──→ TASKS ──→ IMPLEMENT
|
|
34
|
+
│ │ │ │
|
|
35
|
+
▼ ▼ ▼ ▼
|
|
36
|
+
Human Human Human Human
|
|
37
|
+
reviews reviews reviews reviews
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Phase 1: Specify
|
|
41
|
+
|
|
42
|
+
Start with a high-level vision. Ask the human clarifying questions until requirements are concrete.
|
|
43
|
+
|
|
44
|
+
**Surface assumptions immediately.** Before writing any spec content, list what you're assuming:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
ASSUMPTIONS I'M MAKING:
|
|
48
|
+
1. This is a web application (not native mobile)
|
|
49
|
+
2. Authentication uses session-based cookies (not JWT)
|
|
50
|
+
3. The database is PostgreSQL (based on existing Prisma schema)
|
|
51
|
+
4. We're targeting modern browsers only (no IE11)
|
|
52
|
+
→ Correct me now or I'll proceed with these.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Don't silently fill in ambiguous requirements. The spec's entire purpose is to surface misunderstandings *before* code gets written — assumptions are the most dangerous form of misunderstanding.
|
|
56
|
+
|
|
57
|
+
**Write a spec document covering these six core areas:**
|
|
58
|
+
|
|
59
|
+
1. **Objective** — What are we building and why? Who is the user? What does success look like?
|
|
60
|
+
|
|
61
|
+
2. **Commands** — Full executable commands with flags, not just tool names.
|
|
62
|
+
```
|
|
63
|
+
Build: npm run build
|
|
64
|
+
Test: npm test -- --coverage
|
|
65
|
+
Lint: npm run lint --fix
|
|
66
|
+
Dev: npm run dev
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
3. **Project Structure** — Where source code lives, where tests go, where docs belong.
|
|
70
|
+
```
|
|
71
|
+
src/ → Application source code
|
|
72
|
+
src/components → React components
|
|
73
|
+
src/lib → Shared utilities
|
|
74
|
+
tests/ → Unit and integration tests
|
|
75
|
+
e2e/ → End-to-end tests
|
|
76
|
+
docs/ → Documentation
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
4. **Code Style** — One real code snippet showing your style beats three paragraphs describing it. Include naming conventions, formatting rules, and examples of good output.
|
|
80
|
+
|
|
81
|
+
5. **Testing Strategy** — What framework, where tests live, coverage expectations, which test levels for which concerns.
|
|
82
|
+
|
|
83
|
+
6. **Boundaries** — Three-tier system:
|
|
84
|
+
- **Always do:** Run tests before commits, follow naming conventions, validate inputs
|
|
85
|
+
- **Ask first:** Database schema changes, adding dependencies, changing CI config
|
|
86
|
+
- **Never do:** Commit secrets, edit vendor directories, remove failing tests without approval
|
|
87
|
+
|
|
88
|
+
**Spec template:**
|
|
89
|
+
|
|
90
|
+
```markdown
|
|
91
|
+
# Spec: [Project/Feature Name]
|
|
92
|
+
|
|
93
|
+
## Objective
|
|
94
|
+
[What we're building and why. User stories or acceptance criteria.]
|
|
95
|
+
|
|
96
|
+
## Tech Stack
|
|
97
|
+
[Framework, language, key dependencies with versions]
|
|
98
|
+
|
|
99
|
+
## Commands
|
|
100
|
+
[Build, test, lint, dev — full commands]
|
|
101
|
+
|
|
102
|
+
## Project Structure
|
|
103
|
+
[Directory layout with descriptions]
|
|
104
|
+
|
|
105
|
+
## Code Style
|
|
106
|
+
[Example snippet + key conventions]
|
|
107
|
+
|
|
108
|
+
## Testing Strategy
|
|
109
|
+
[Framework, test locations, coverage requirements, test levels]
|
|
110
|
+
|
|
111
|
+
## Boundaries
|
|
112
|
+
- Always: [...]
|
|
113
|
+
- Ask first: [...]
|
|
114
|
+
- Never: [...]
|
|
115
|
+
|
|
116
|
+
## Success Criteria
|
|
117
|
+
[How we'll know this is done — specific, testable conditions]
|
|
118
|
+
|
|
119
|
+
## Open Questions
|
|
120
|
+
[Anything unresolved that needs human input]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Reframe instructions as success criteria.** When receiving vague requirements, translate them into concrete conditions:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
REQUIREMENT: "Make the dashboard faster"
|
|
127
|
+
|
|
128
|
+
REFRAMED SUCCESS CRITERIA:
|
|
129
|
+
- Dashboard LCP < 2.5s on 4G connection
|
|
130
|
+
- Initial data load completes in < 500ms
|
|
131
|
+
- No layout shift during load (CLS < 0.1)
|
|
132
|
+
→ Are these the right targets?
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This lets you loop, retry, and problem-solve toward a clear goal rather than guessing what "faster" means.
|
|
136
|
+
|
|
137
|
+
### Phase 2: Plan
|
|
138
|
+
|
|
139
|
+
With the validated spec, generate a technical implementation plan:
|
|
140
|
+
|
|
141
|
+
1. Identify the major components and their dependencies
|
|
142
|
+
2. Determine the implementation order (what must be built first)
|
|
143
|
+
3. Note risks and mitigation strategies
|
|
144
|
+
4. Identify what can be built in parallel vs. what must be sequential
|
|
145
|
+
5. Define verification checkpoints between phases
|
|
146
|
+
|
|
147
|
+
The plan should be reviewable: the human should be able to read it and say "yes, that's the right approach" or "no, change X."
|
|
148
|
+
|
|
149
|
+
### Phase 3: Tasks
|
|
150
|
+
|
|
151
|
+
Break the plan into discrete, implementable tasks:
|
|
152
|
+
|
|
153
|
+
- Each task should be completable in a single focused session
|
|
154
|
+
- Each task has explicit acceptance criteria
|
|
155
|
+
- Each task includes a verification step (test, build, manual check)
|
|
156
|
+
- Tasks are ordered by dependency, not by perceived importance
|
|
157
|
+
- No task should require changing more than ~5 files
|
|
158
|
+
|
|
159
|
+
**Task template:**
|
|
160
|
+
```markdown
|
|
161
|
+
- [ ] Task: [Description]
|
|
162
|
+
- Acceptance: [What must be true when done]
|
|
163
|
+
- Verify: [How to confirm — test command, build, manual check]
|
|
164
|
+
- Files: [Which files will be touched]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Phase 4: Implement
|
|
168
|
+
|
|
169
|
+
Execute tasks one at a time following `skills/incremental-implementation/SKILL.md` (`incremental-implementation`) and `skills/test-driven-development/SKILL.md` (`test-driven-development`). Use `skills/context-engineering/SKILL.md` (`context-engineering`) to load the right spec sections and source files at each step rather than flooding the agent with the entire spec.
|
|
170
|
+
|
|
171
|
+
## Keeping the Spec Alive
|
|
172
|
+
|
|
173
|
+
The spec is a living document, not a one-time artifact:
|
|
174
|
+
|
|
175
|
+
- **Update when decisions change** — If you discover the data model needs to change, update the spec first, then implement.
|
|
176
|
+
- **Update when scope changes** — Features added or cut should be reflected in the spec.
|
|
177
|
+
- **Commit the spec** — The spec belongs in version control alongside the code.
|
|
178
|
+
- **Reference the spec in PRs** — Link back to the spec section that each PR implements.
|
|
179
|
+
|
|
180
|
+
## Common Rationalizations
|
|
181
|
+
|
|
182
|
+
| Rationalization | Reality |
|
|
183
|
+
|---|---|
|
|
184
|
+
| "This is simple, I don't need a spec" | Simple tasks don't need *long* specs, but they still need acceptance criteria. A two-line spec is fine. |
|
|
185
|
+
| "I'll write the spec after I code it" | That's documentation, not specification. The spec's value is in forcing clarity *before* code. |
|
|
186
|
+
| "The spec will slow us down" | A 15-minute spec prevents hours of rework. Waterfall in 15 minutes beats debugging in 15 hours. |
|
|
187
|
+
| "Requirements will change anyway" | That's why the spec is a living document. An outdated spec is still better than no spec. |
|
|
188
|
+
| "The user knows what they want" | Even clear requests have implicit assumptions. The spec surfaces those assumptions. |
|
|
189
|
+
|
|
190
|
+
## Red Flags
|
|
191
|
+
|
|
192
|
+
- Starting to write code without any written requirements
|
|
193
|
+
- Asking "should I just start building?" before clarifying what "done" means
|
|
194
|
+
- Implementing features not mentioned in any spec or task list
|
|
195
|
+
- Making architectural decisions without documenting them
|
|
196
|
+
- Skipping the spec because "it's obvious what to build"
|
|
197
|
+
|
|
198
|
+
## Required Checks
|
|
199
|
+
|
|
200
|
+
Before proceeding to implementation, confirm:
|
|
201
|
+
|
|
202
|
+
- [ ] The spec covers all six core areas
|
|
203
|
+
- [ ] The human has reviewed and approved the spec
|
|
204
|
+
- [ ] Success criteria are specific and testable
|
|
205
|
+
- [ ] Boundaries (Always/Ask First/Never) are defined
|
|
206
|
+
- [ ] The spec is saved to a file in the repository
|
|
207
|
+
|
|
208
|
+
## Workflow
|
|
209
|
+
|
|
210
|
+
1. **Analyze Requirements:** Review user requests, existing code, and optional openSrc/ reference examples to identify ambiguities.
|
|
211
|
+
2. **Draft the Specification:** Create a document (e.g., `docs/specs/feature-spec.md`) detailing the Goal, User Stories, Architecture changes, In-Scope vs Out-of-Scope, and Boundaries.
|
|
212
|
+
3. **Formulate Definition of Done:** Establish concrete, testable criteria for success (e.g., unit tests, visual checks, command runs).
|
|
213
|
+
4. **Obtain User Approval:** Share the spec with the user, collect feedback, and get explicit sign-off before coding.
|
|
214
|
+
5. **Update Continuously:** If requirements evolve during implementation, update the specification first.
|
|
215
|
+
|
|
216
|
+
## Verification
|
|
217
|
+
|
|
218
|
+
After executing this skill, confirm:
|
|
219
|
+
- [ ] A written specification is committed to the repository.
|
|
220
|
+
- [ ] Definition of Done and boundaries are fully defined and approved by the user.
|
|
221
|
+
- [ ] The implementation plan maps directly to the spec sections.
|