claude-code-swarm 0.3.3 → 0.3.5
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +22 -1
- package/.claude-plugin/run-agent-inbox-mcp.sh +76 -0
- package/.claude-plugin/run-minimem-mcp.sh +98 -0
- package/.claude-plugin/run-opentasks-mcp.sh +65 -0
- package/CLAUDE.md +200 -36
- package/README.md +65 -0
- package/e2e/helpers/cleanup.mjs +17 -3
- package/e2e/helpers/map-mock-server.mjs +201 -25
- package/e2e/helpers/sidecar.mjs +222 -0
- package/e2e/helpers/workspace.mjs +2 -1
- package/e2e/tier5-sidecar-inbox.test.mjs +900 -0
- package/e2e/tier6-inbox-mcp.test.mjs +173 -0
- package/e2e/tier6-live-agent.test.mjs +759 -0
- package/e2e/vitest.config.e2e.mjs +1 -1
- package/hooks/hooks.json +15 -8
- package/package.json +13 -1
- package/references/agent-inbox/CLAUDE.md +151 -0
- package/references/agent-inbox/README.md +238 -0
- package/references/agent-inbox/docs/CLAUDE-CODE-SWARM-PROPOSAL.md +137 -0
- package/references/agent-inbox/docs/DESIGN.md +1156 -0
- package/references/agent-inbox/hooks/inbox-hook.mjs +119 -0
- package/references/agent-inbox/hooks/register-hook.mjs +69 -0
- package/references/agent-inbox/package-lock.json +3347 -0
- package/references/agent-inbox/package.json +58 -0
- package/references/agent-inbox/rules/agent-inbox.md +78 -0
- package/references/agent-inbox/src/federation/address.ts +61 -0
- package/references/agent-inbox/src/federation/connection-manager.ts +573 -0
- package/references/agent-inbox/src/federation/delivery-queue.ts +222 -0
- package/references/agent-inbox/src/federation/index.ts +6 -0
- package/references/agent-inbox/src/federation/routing-engine.ts +188 -0
- package/references/agent-inbox/src/federation/trust.ts +71 -0
- package/references/agent-inbox/src/index.ts +390 -0
- package/references/agent-inbox/src/ipc/ipc-server.ts +207 -0
- package/references/agent-inbox/src/jsonrpc/mail-server.ts +382 -0
- package/references/agent-inbox/src/map/map-client.ts +414 -0
- package/references/agent-inbox/src/mcp/mcp-server.ts +272 -0
- package/references/agent-inbox/src/mesh/delivery-bridge.ts +110 -0
- package/references/agent-inbox/src/mesh/mesh-connector.ts +41 -0
- package/references/agent-inbox/src/mesh/mesh-transport.ts +157 -0
- package/references/agent-inbox/src/mesh/type-mapper.ts +239 -0
- package/references/agent-inbox/src/push/notifier.ts +233 -0
- package/references/agent-inbox/src/registry/warm-registry.ts +255 -0
- package/references/agent-inbox/src/router/message-router.ts +175 -0
- package/references/agent-inbox/src/storage/interface.ts +48 -0
- package/references/agent-inbox/src/storage/memory.ts +145 -0
- package/references/agent-inbox/src/storage/sqlite.ts +671 -0
- package/references/agent-inbox/src/traceability/traceability.ts +183 -0
- package/references/agent-inbox/src/types.ts +303 -0
- package/references/agent-inbox/test/federation/address.test.ts +101 -0
- package/references/agent-inbox/test/federation/connection-manager.test.ts +546 -0
- package/references/agent-inbox/test/federation/delivery-queue.test.ts +159 -0
- package/references/agent-inbox/test/federation/integration.test.ts +857 -0
- package/references/agent-inbox/test/federation/routing-engine.test.ts +117 -0
- package/references/agent-inbox/test/federation/sdk-integration.test.ts +744 -0
- package/references/agent-inbox/test/federation/trust.test.ts +89 -0
- package/references/agent-inbox/test/ipc-jsonrpc.test.ts +113 -0
- package/references/agent-inbox/test/ipc-server.test.ts +197 -0
- package/references/agent-inbox/test/mail-server.test.ts +285 -0
- package/references/agent-inbox/test/map-client.test.ts +408 -0
- package/references/agent-inbox/test/mesh/delivery-bridge.test.ts +178 -0
- package/references/agent-inbox/test/mesh/e2e-mesh.test.ts +527 -0
- package/references/agent-inbox/test/mesh/e2e-real-meshpeer.test.ts +629 -0
- package/references/agent-inbox/test/mesh/federation-mesh.test.ts +269 -0
- package/references/agent-inbox/test/mesh/mesh-connector.test.ts +66 -0
- package/references/agent-inbox/test/mesh/mesh-transport.test.ts +191 -0
- package/references/agent-inbox/test/mesh/meshpeer-integration.test.ts +442 -0
- package/references/agent-inbox/test/mesh/mock-mesh.ts +125 -0
- package/references/agent-inbox/test/mesh/mock-meshpeer.ts +266 -0
- package/references/agent-inbox/test/mesh/type-mapper.test.ts +226 -0
- package/references/agent-inbox/test/message-router.test.ts +184 -0
- package/references/agent-inbox/test/push-notifier.test.ts +139 -0
- package/references/agent-inbox/test/registry/warm-registry.test.ts +171 -0
- package/references/agent-inbox/test/sqlite-prefix.test.ts +192 -0
- package/references/agent-inbox/test/sqlite-storage.test.ts +243 -0
- package/references/agent-inbox/test/storage.test.ts +196 -0
- package/references/agent-inbox/test/traceability.test.ts +123 -0
- package/references/agent-inbox/test/wake.test.ts +330 -0
- package/references/agent-inbox/tsconfig.json +20 -0
- package/references/agent-inbox/tsup.config.ts +10 -0
- package/references/agent-inbox/vitest.config.ts +8 -0
- package/references/minimem/.claude/settings.json +7 -0
- package/references/minimem/.sudocode/issues.jsonl +18 -0
- package/references/minimem/.sudocode/specs.jsonl +1 -0
- package/references/minimem/CLAUDE.md +329 -0
- package/references/minimem/README.md +565 -0
- package/references/minimem/claude-plugin/.claude-plugin/plugin.json +10 -0
- package/references/minimem/claude-plugin/.mcp.json +7 -0
- package/references/minimem/claude-plugin/README.md +158 -0
- package/references/minimem/claude-plugin/commands/recall.md +47 -0
- package/references/minimem/claude-plugin/commands/remember.md +41 -0
- package/references/minimem/claude-plugin/hooks/__tests__/hooks.test.ts +272 -0
- package/references/minimem/claude-plugin/hooks/hooks.json +27 -0
- package/references/minimem/claude-plugin/hooks/session-end.sh +86 -0
- package/references/minimem/claude-plugin/hooks/session-start.sh +85 -0
- package/references/minimem/claude-plugin/skills/memory/SKILL.md +108 -0
- package/references/minimem/media/banner.png +0 -0
- package/references/minimem/package-lock.json +5373 -0
- package/references/minimem/package.json +76 -0
- package/references/minimem/scripts/postbuild.js +49 -0
- package/references/minimem/src/__tests__/edge-cases.test.ts +371 -0
- package/references/minimem/src/__tests__/errors.test.ts +265 -0
- package/references/minimem/src/__tests__/helpers.ts +199 -0
- package/references/minimem/src/__tests__/internal.test.ts +407 -0
- package/references/minimem/src/__tests__/knowledge-frontmatter.test.ts +148 -0
- package/references/minimem/src/__tests__/knowledge.test.ts +148 -0
- package/references/minimem/src/__tests__/minimem.integration.test.ts +1127 -0
- package/references/minimem/src/__tests__/session.test.ts +190 -0
- package/references/minimem/src/cli/__tests__/commands.test.ts +760 -0
- package/references/minimem/src/cli/__tests__/contained-layout.test.ts +286 -0
- package/references/minimem/src/cli/commands/__tests__/conflicts.test.ts +141 -0
- package/references/minimem/src/cli/commands/append.ts +76 -0
- package/references/minimem/src/cli/commands/config.ts +262 -0
- package/references/minimem/src/cli/commands/conflicts.ts +415 -0
- package/references/minimem/src/cli/commands/daemon.ts +169 -0
- package/references/minimem/src/cli/commands/index.ts +12 -0
- package/references/minimem/src/cli/commands/init.ts +166 -0
- package/references/minimem/src/cli/commands/mcp.ts +221 -0
- package/references/minimem/src/cli/commands/push-pull.ts +213 -0
- package/references/minimem/src/cli/commands/search.ts +223 -0
- package/references/minimem/src/cli/commands/status.ts +84 -0
- package/references/minimem/src/cli/commands/store.ts +189 -0
- package/references/minimem/src/cli/commands/sync-init.ts +290 -0
- package/references/minimem/src/cli/commands/sync.ts +70 -0
- package/references/minimem/src/cli/commands/upsert.ts +197 -0
- package/references/minimem/src/cli/config.ts +611 -0
- package/references/minimem/src/cli/index.ts +299 -0
- package/references/minimem/src/cli/shared.ts +189 -0
- package/references/minimem/src/cli/sync/__tests__/central.test.ts +152 -0
- package/references/minimem/src/cli/sync/__tests__/conflicts.test.ts +209 -0
- package/references/minimem/src/cli/sync/__tests__/daemon.test.ts +118 -0
- package/references/minimem/src/cli/sync/__tests__/detection.test.ts +207 -0
- package/references/minimem/src/cli/sync/__tests__/integration.test.ts +476 -0
- package/references/minimem/src/cli/sync/__tests__/registry.test.ts +363 -0
- package/references/minimem/src/cli/sync/__tests__/state.test.ts +255 -0
- package/references/minimem/src/cli/sync/__tests__/validation.test.ts +193 -0
- package/references/minimem/src/cli/sync/__tests__/watcher.test.ts +178 -0
- package/references/minimem/src/cli/sync/central.ts +292 -0
- package/references/minimem/src/cli/sync/conflicts.ts +205 -0
- package/references/minimem/src/cli/sync/daemon.ts +407 -0
- package/references/minimem/src/cli/sync/detection.ts +138 -0
- package/references/minimem/src/cli/sync/index.ts +107 -0
- package/references/minimem/src/cli/sync/operations.ts +373 -0
- package/references/minimem/src/cli/sync/registry.ts +279 -0
- package/references/minimem/src/cli/sync/state.ts +358 -0
- package/references/minimem/src/cli/sync/validation.ts +206 -0
- package/references/minimem/src/cli/sync/watcher.ts +237 -0
- package/references/minimem/src/cli/version.ts +34 -0
- package/references/minimem/src/core/index.ts +9 -0
- package/references/minimem/src/core/indexer.ts +628 -0
- package/references/minimem/src/core/searcher.ts +221 -0
- package/references/minimem/src/db/schema.ts +183 -0
- package/references/minimem/src/db/sqlite-vec.ts +24 -0
- package/references/minimem/src/embeddings/__tests__/embeddings.test.ts +431 -0
- package/references/minimem/src/embeddings/batch-gemini.ts +392 -0
- package/references/minimem/src/embeddings/batch-openai.ts +409 -0
- package/references/minimem/src/embeddings/embeddings.ts +434 -0
- package/references/minimem/src/index.ts +132 -0
- package/references/minimem/src/internal.ts +299 -0
- package/references/minimem/src/minimem.ts +1291 -0
- package/references/minimem/src/search/__tests__/hybrid.test.ts +247 -0
- package/references/minimem/src/search/graph.ts +234 -0
- package/references/minimem/src/search/hybrid.ts +151 -0
- package/references/minimem/src/search/search.ts +256 -0
- package/references/minimem/src/server/__tests__/mcp.test.ts +347 -0
- package/references/minimem/src/server/__tests__/tools.test.ts +364 -0
- package/references/minimem/src/server/mcp.ts +326 -0
- package/references/minimem/src/server/tools.ts +720 -0
- package/references/minimem/src/session.ts +460 -0
- package/references/minimem/src/store/__tests__/manifest.test.ts +177 -0
- package/references/minimem/src/store/__tests__/materialize.test.ts +52 -0
- package/references/minimem/src/store/__tests__/store-graph.test.ts +228 -0
- package/references/minimem/src/store/index.ts +27 -0
- package/references/minimem/src/store/manifest.ts +203 -0
- package/references/minimem/src/store/materialize.ts +185 -0
- package/references/minimem/src/store/store-graph.ts +252 -0
- package/references/minimem/tsconfig.json +19 -0
- package/references/minimem/tsup.config.ts +26 -0
- package/references/minimem/vitest.config.ts +29 -0
- package/references/openteams/src/cli/generate.ts +23 -1
- package/references/openteams/src/generators/agent-prompt-generator.test.ts +94 -0
- package/references/openteams/src/generators/agent-prompt-generator.ts +42 -13
- package/references/openteams/src/generators/package-generator.ts +9 -1
- package/references/openteams/src/generators/skill-generator.test.ts +28 -0
- package/references/openteams/src/generators/skill-generator.ts +10 -4
- package/references/skill-tree/.claude/settings.json +6 -0
- package/references/skill-tree/.sudocode/issues.jsonl +19 -0
- package/references/skill-tree/.sudocode/specs.jsonl +3 -0
- package/references/skill-tree/CLAUDE.md +132 -0
- package/references/skill-tree/README.md +396 -0
- package/references/skill-tree/docs/GAPS_v1.md +221 -0
- package/references/skill-tree/docs/INTEGRATION_PLAN.md +467 -0
- package/references/skill-tree/docs/TODOS.md +91 -0
- package/references/skill-tree/docs/anthropic_skill_guide.md +1364 -0
- package/references/skill-tree/docs/design/federated-skill-trees.md +524 -0
- package/references/skill-tree/docs/design/multi-agent-sync.md +759 -0
- package/references/skill-tree/docs/scraper/BRAINSTORM.md +583 -0
- package/references/skill-tree/docs/scraper/POC_PLAN.md +420 -0
- package/references/skill-tree/docs/scraper/README.md +170 -0
- package/references/skill-tree/examples/basic-usage.ts +157 -0
- package/references/skill-tree/package-lock.json +1852 -0
- package/references/skill-tree/package.json +66 -0
- package/references/skill-tree/plan.md +78 -0
- package/references/skill-tree/scraper/README.md +123 -0
- package/references/skill-tree/scraper/docs/DESIGN.md +683 -0
- package/references/skill-tree/scraper/docs/PLAN.md +336 -0
- package/references/skill-tree/scraper/drizzle.config.ts +10 -0
- package/references/skill-tree/scraper/package-lock.json +6329 -0
- package/references/skill-tree/scraper/package.json +68 -0
- package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-description.md +7 -0
- package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-name.md +7 -0
- package/references/skill-tree/scraper/test/fixtures/minimal-skill/SKILL.md +27 -0
- package/references/skill-tree/scraper/test/fixtures/skill-json/SKILL.json +21 -0
- package/references/skill-tree/scraper/test/fixtures/skill-with-meta/SKILL.md +54 -0
- package/references/skill-tree/scraper/test/fixtures/skill-with-meta/_meta.json +24 -0
- package/references/skill-tree/scraper/test/fixtures/valid-skill/SKILL.md +93 -0
- package/references/skill-tree/scraper/test/fixtures/valid-skill/_meta.json +22 -0
- package/references/skill-tree/scraper/tsup.config.ts +14 -0
- package/references/skill-tree/scraper/vitest.config.ts +17 -0
- package/references/skill-tree/scripts/convert-to-vitest.ts +166 -0
- package/references/skill-tree/skills/skill-writer/SKILL.md +339 -0
- package/references/skill-tree/skills/skill-writer/references/examples.md +326 -0
- package/references/skill-tree/skills/skill-writer/references/patterns.md +210 -0
- package/references/skill-tree/skills/skill-writer/references/quality-checklist.md +123 -0
- package/references/skill-tree/test/run-all.ts +106 -0
- package/references/skill-tree/test/utils.ts +128 -0
- package/references/skill-tree/vitest.config.ts +16 -0
- package/references/swarmkit/src/commands/init/phases/configure.ts +0 -22
- package/references/swarmkit/src/commands/init/phases/global-setup.ts +5 -3
- package/references/swarmkit/src/commands/init/wizard.ts +2 -2
- package/references/swarmkit/src/packages/setup.test.ts +53 -7
- package/references/swarmkit/src/packages/setup.ts +37 -1
- package/scripts/bootstrap.mjs +26 -1
- package/scripts/generate-agents.mjs +5 -1
- package/scripts/map-hook.mjs +97 -64
- package/scripts/map-sidecar.mjs +179 -25
- package/scripts/team-loader.mjs +12 -41
- package/skills/swarm/SKILL.md +89 -25
- package/src/__tests__/agent-generator.test.mjs +6 -13
- package/src/__tests__/bootstrap.test.mjs +124 -1
- package/src/__tests__/config.test.mjs +200 -27
- package/src/__tests__/e2e-live-map.test.mjs +536 -0
- package/src/__tests__/e2e-mesh-sidecar.test.mjs +570 -0
- package/src/__tests__/e2e-native-task-hooks.test.mjs +376 -0
- package/src/__tests__/e2e-sidecar-bridge.test.mjs +477 -0
- package/src/__tests__/helpers.mjs +13 -0
- package/src/__tests__/inbox.test.mjs +22 -89
- package/src/__tests__/index.test.mjs +35 -9
- package/src/__tests__/integration.test.mjs +513 -0
- package/src/__tests__/map-events.test.mjs +514 -150
- package/src/__tests__/mesh-connection.test.mjs +308 -0
- package/src/__tests__/opentasks-client.test.mjs +517 -0
- package/src/__tests__/paths.test.mjs +185 -41
- package/src/__tests__/sidecar-client.test.mjs +35 -0
- package/src/__tests__/sidecar-server.test.mjs +124 -0
- package/src/__tests__/skilltree-client.test.mjs +80 -0
- package/src/agent-generator.mjs +104 -33
- package/src/bootstrap.mjs +150 -10
- package/src/config.mjs +81 -17
- package/src/context-output.mjs +58 -8
- package/src/inbox.mjs +9 -54
- package/src/index.mjs +39 -8
- package/src/map-connection.mjs +4 -3
- package/src/map-events.mjs +350 -80
- package/src/mesh-connection.mjs +148 -0
- package/src/opentasks-client.mjs +269 -0
- package/src/paths.mjs +182 -27
- package/src/sessionlog.mjs +14 -9
- package/src/sidecar-client.mjs +81 -27
- package/src/sidecar-server.mjs +175 -16
- package/src/skilltree-client.mjs +173 -0
- package/src/template.mjs +68 -4
- package/vitest.config.mjs +1 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-writer
|
|
3
|
+
description: Comprehensive guide for creating high-quality skills for Claude. Use when building a new skill, writing a SKILL.md, designing skill frontmatter, planning skill structure, debugging trigger issues, or reviewing an existing skill for improvements. Covers standalone skills, MCP-enhanced skills, and skill-tree programmatic skills.
|
|
4
|
+
metadata:
|
|
5
|
+
author: skill-tree
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
category: meta
|
|
8
|
+
tags: [skill-creation, authoring, best-practices]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Skill Writer
|
|
12
|
+
|
|
13
|
+
Create well-structured, effective skills that trigger reliably, follow Anthropic's progressive disclosure model, and produce consistent results.
|
|
14
|
+
|
|
15
|
+
## Core Concepts
|
|
16
|
+
|
|
17
|
+
A skill is a folder containing instructions that teach Claude to handle specific tasks or workflows. Skills eliminate the need to re-explain preferences, processes, and domain expertise in every conversation.
|
|
18
|
+
|
|
19
|
+
### Progressive Disclosure (Three Levels)
|
|
20
|
+
|
|
21
|
+
1. **YAML frontmatter** (always in system prompt): Enough for Claude to decide *when* to load the skill
|
|
22
|
+
2. **SKILL.md body** (loaded when relevant): Full instructions and guidance
|
|
23
|
+
3. **Linked files** (loaded as needed): References, scripts, assets in subdirectories
|
|
24
|
+
|
|
25
|
+
This minimizes token usage while maintaining specialized expertise.
|
|
26
|
+
|
|
27
|
+
### Design Principles
|
|
28
|
+
|
|
29
|
+
- **Composability**: Skills run alongside other skills. Never assume exclusive context.
|
|
30
|
+
- **Portability**: Skills work across Claude.ai, Claude Code, and API without modification (given environment dependencies are met).
|
|
31
|
+
- **Progressive complexity**: Start simple, add depth through references.
|
|
32
|
+
|
|
33
|
+
## Instructions
|
|
34
|
+
|
|
35
|
+
### Step 1: Define Use Cases
|
|
36
|
+
|
|
37
|
+
Before writing anything, identify 2-3 concrete use cases.
|
|
38
|
+
|
|
39
|
+
For each use case, document:
|
|
40
|
+
- **Trigger**: What the user says or does
|
|
41
|
+
- **Steps**: The multi-step workflow required
|
|
42
|
+
- **Result**: The concrete outcome produced
|
|
43
|
+
|
|
44
|
+
Determine which category the skill falls into:
|
|
45
|
+
|
|
46
|
+
| Category | Purpose | Example |
|
|
47
|
+
|----------|---------|---------|
|
|
48
|
+
| Document/Asset Creation | Consistent, high-quality output | frontend-design, docx, pptx |
|
|
49
|
+
| Workflow Automation | Multi-step processes with methodology | skill-creator, sprint-planner |
|
|
50
|
+
| MCP Enhancement | Workflow guidance for MCP tool access | sentry-code-review |
|
|
51
|
+
|
|
52
|
+
### Step 2: Create the Folder Structure
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
your-skill-name/
|
|
56
|
+
├── SKILL.md # Required - main instruction file
|
|
57
|
+
├── scripts/ # Optional - executable code (Python, Bash)
|
|
58
|
+
├── references/ # Optional - detailed docs loaded as needed
|
|
59
|
+
└── assets/ # Optional - templates, fonts, icons
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Critical naming rules:
|
|
63
|
+
- Folder: **kebab-case only** (`my-skill-name`)
|
|
64
|
+
- File: **exactly** `SKILL.md` (case-sensitive, no variations)
|
|
65
|
+
- No `README.md` inside the skill folder
|
|
66
|
+
- No spaces, underscores, or capitals in folder name
|
|
67
|
+
|
|
68
|
+
### Step 3: Write the YAML Frontmatter
|
|
69
|
+
|
|
70
|
+
The frontmatter is *the most important part* - it determines whether Claude loads the skill.
|
|
71
|
+
|
|
72
|
+
Minimal required format:
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
---
|
|
76
|
+
name: your-skill-name
|
|
77
|
+
description: What it does. Use when user asks to [specific phrases].
|
|
78
|
+
---
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### The `name` Field
|
|
82
|
+
|
|
83
|
+
- kebab-case only, no spaces or capitals
|
|
84
|
+
- Must match the folder name
|
|
85
|
+
- Never use "claude" or "anthropic" as a prefix (reserved)
|
|
86
|
+
|
|
87
|
+
#### The `description` Field (Critical)
|
|
88
|
+
|
|
89
|
+
Structure: `[What it does] + [When to use it] + [Key capabilities]`
|
|
90
|
+
|
|
91
|
+
Must include BOTH:
|
|
92
|
+
1. What the skill does
|
|
93
|
+
2. When to use it (trigger conditions with specific phrases)
|
|
94
|
+
|
|
95
|
+
Constraints:
|
|
96
|
+
- Under 1024 characters
|
|
97
|
+
- No XML angle brackets (`<` or `>`)
|
|
98
|
+
- Include specific tasks/phrases users would actually say
|
|
99
|
+
- Mention relevant file types if applicable
|
|
100
|
+
|
|
101
|
+
**Good descriptions:**
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
# Specific + actionable + trigger phrases
|
|
105
|
+
description: Analyzes Figma design files and generates developer
|
|
106
|
+
handoff documentation. Use when user uploads .fig files, asks for
|
|
107
|
+
"design specs", "component documentation", or "design-to-code handoff".
|
|
108
|
+
|
|
109
|
+
# Clear value proposition + triggers
|
|
110
|
+
description: End-to-end customer onboarding workflow for PayFlow.
|
|
111
|
+
Handles account creation, payment setup, and subscription management.
|
|
112
|
+
Use when user says "onboard new customer", "set up subscription",
|
|
113
|
+
or "create PayFlow account".
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Bad descriptions:**
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
# Too vague - won't trigger
|
|
120
|
+
description: Helps with projects.
|
|
121
|
+
|
|
122
|
+
# Missing triggers - Claude won't know when to load
|
|
123
|
+
description: Creates sophisticated multi-page documentation systems.
|
|
124
|
+
|
|
125
|
+
# Too technical, no user-facing triggers
|
|
126
|
+
description: Implements the Project entity model with hierarchical
|
|
127
|
+
relationships.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Optional Fields
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
license: MIT # For open-source skills
|
|
134
|
+
compatibility: Requires Python 3.10+ # 1-500 chars, environment needs
|
|
135
|
+
allowed-tools: "Bash(python:*) WebFetch" # Restrict tool access
|
|
136
|
+
metadata: # Custom key-value pairs
|
|
137
|
+
author: Your Name
|
|
138
|
+
version: 1.0.0
|
|
139
|
+
mcp-server: server-name
|
|
140
|
+
tags: [automation, productivity]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### Security Restrictions
|
|
144
|
+
|
|
145
|
+
Forbidden in frontmatter:
|
|
146
|
+
- XML angle brackets (`<` `>`) - prevents prompt injection
|
|
147
|
+
- Skills named with "claude" or "anthropic" prefix
|
|
148
|
+
|
|
149
|
+
### Step 4: Write the Instructions Body
|
|
150
|
+
|
|
151
|
+
After the frontmatter, write instructions in Markdown.
|
|
152
|
+
|
|
153
|
+
#### Recommended Structure
|
|
154
|
+
|
|
155
|
+
```markdown
|
|
156
|
+
# Skill Name
|
|
157
|
+
|
|
158
|
+
## Instructions
|
|
159
|
+
|
|
160
|
+
### Step 1: [First Major Step]
|
|
161
|
+
Clear explanation of what happens.
|
|
162
|
+
|
|
163
|
+
Example:
|
|
164
|
+
\`\`\`bash
|
|
165
|
+
python scripts/fetch_data.py --project-id PROJECT_ID
|
|
166
|
+
\`\`\`
|
|
167
|
+
Expected output: [describe what success looks like]
|
|
168
|
+
|
|
169
|
+
(Add more steps as needed)
|
|
170
|
+
|
|
171
|
+
## Examples
|
|
172
|
+
|
|
173
|
+
### Example 1: [Common Scenario]
|
|
174
|
+
User says: "Set up a new marketing campaign"
|
|
175
|
+
Actions:
|
|
176
|
+
1. Fetch existing campaigns via MCP
|
|
177
|
+
2. Create new campaign with provided parameters
|
|
178
|
+
Result: Campaign created with confirmation link
|
|
179
|
+
|
|
180
|
+
## Troubleshooting
|
|
181
|
+
|
|
182
|
+
### Error: [Common error message]
|
|
183
|
+
Cause: [Why it happens]
|
|
184
|
+
Solution: [How to fix]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### Writing Style Rules
|
|
188
|
+
|
|
189
|
+
- **Imperative/infinitive form**: "To accomplish X, execute Y" or "Load this skill when Z"
|
|
190
|
+
- **Avoid second person**: Do NOT write "You should..." or "If you need..."
|
|
191
|
+
- **Be specific and actionable**: Include exact commands, parameters, expected outputs
|
|
192
|
+
- **Use bullet points and numbered lists** for scanability
|
|
193
|
+
- **Put critical instructions at the top** using `## Important` or `## Critical` headers
|
|
194
|
+
|
|
195
|
+
#### Error Handling
|
|
196
|
+
|
|
197
|
+
Always include error handling:
|
|
198
|
+
|
|
199
|
+
```markdown
|
|
200
|
+
## Common Issues
|
|
201
|
+
|
|
202
|
+
### MCP Connection Failed
|
|
203
|
+
If "Connection refused" appears:
|
|
204
|
+
1. Verify MCP server is running: Check Settings > Extensions
|
|
205
|
+
2. Confirm API key is valid
|
|
206
|
+
3. Try reconnecting: Settings > Extensions > [Service] > Reconnect
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### Progressive Disclosure in Practice
|
|
210
|
+
|
|
211
|
+
Keep SKILL.md focused on core instructions (under 5,000 words). Move detailed documentation to `references/`:
|
|
212
|
+
|
|
213
|
+
```markdown
|
|
214
|
+
Before writing queries, consult `references/api-patterns.md` for:
|
|
215
|
+
- Rate limiting guidance
|
|
216
|
+
- Pagination patterns
|
|
217
|
+
- Error codes and handling
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### Combating Instruction Drift
|
|
221
|
+
|
|
222
|
+
For critical validations, prefer bundling a script over relying on language instructions:
|
|
223
|
+
|
|
224
|
+
```markdown
|
|
225
|
+
CRITICAL: Before calling create_project, verify:
|
|
226
|
+
- Project name is non-empty
|
|
227
|
+
- At least one team member assigned
|
|
228
|
+
- Start date is not in the past
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
For deterministic checks, use `scripts/validate.py` instead of prose instructions.
|
|
232
|
+
|
|
233
|
+
### Step 5: Choose an Implementation Pattern
|
|
234
|
+
|
|
235
|
+
Select the pattern that fits the skill's workflow. See `references/patterns.md` for detailed examples.
|
|
236
|
+
|
|
237
|
+
| Pattern | Use When |
|
|
238
|
+
|---------|----------|
|
|
239
|
+
| Sequential Workflow | Multi-step processes in specific order |
|
|
240
|
+
| Multi-MCP Coordination | Workflows spanning multiple services |
|
|
241
|
+
| Iterative Refinement | Output quality improves with iteration |
|
|
242
|
+
| Context-Aware Selection | Same outcome, different tools per context |
|
|
243
|
+
| Domain Intelligence | Specialized knowledge beyond tool access |
|
|
244
|
+
|
|
245
|
+
### Step 6: Test the Skill
|
|
246
|
+
|
|
247
|
+
#### Triggering Tests
|
|
248
|
+
Run 10-20 test queries. Target: skill triggers on 90%+ of relevant queries.
|
|
249
|
+
|
|
250
|
+
Should trigger:
|
|
251
|
+
- Obvious task descriptions
|
|
252
|
+
- Paraphrased requests
|
|
253
|
+
- Domain-specific terminology
|
|
254
|
+
|
|
255
|
+
Should NOT trigger:
|
|
256
|
+
- Unrelated topics
|
|
257
|
+
- Queries better served by other skills
|
|
258
|
+
|
|
259
|
+
Debug triggering: Ask Claude "When would you use the [skill name] skill?" and compare against expected triggers.
|
|
260
|
+
|
|
261
|
+
#### Functional Tests
|
|
262
|
+
- Valid outputs generated
|
|
263
|
+
- API/MCP calls succeed
|
|
264
|
+
- Error handling works
|
|
265
|
+
- Edge cases covered
|
|
266
|
+
|
|
267
|
+
#### Performance Comparison
|
|
268
|
+
Compare with and without the skill:
|
|
269
|
+
- Number of back-and-forth messages
|
|
270
|
+
- Failed API calls
|
|
271
|
+
- Total tokens consumed
|
|
272
|
+
- User corrections needed
|
|
273
|
+
|
|
274
|
+
### Step 7: Iterate
|
|
275
|
+
|
|
276
|
+
Skills are living documents. Watch for:
|
|
277
|
+
|
|
278
|
+
**Undertriggering** (skill doesn't load when it should):
|
|
279
|
+
- Add more trigger phrases to the description
|
|
280
|
+
- Include technical keywords and synonyms
|
|
281
|
+
|
|
282
|
+
**Overtriggering** (skill loads for unrelated queries):
|
|
283
|
+
- Add negative triggers: "Do NOT use for simple data exploration"
|
|
284
|
+
- Be more specific about scope
|
|
285
|
+
- Clarify boundaries with other skills
|
|
286
|
+
|
|
287
|
+
**Execution issues** (inconsistent results):
|
|
288
|
+
- Make instructions more specific
|
|
289
|
+
- Add error handling
|
|
290
|
+
- Move verbose content to references
|
|
291
|
+
|
|
292
|
+
## Skill-Tree Programmatic Skills
|
|
293
|
+
|
|
294
|
+
When creating skills for the skill-tree library (as opposed to SKILL.md files), structure them with these fields:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
{
|
|
298
|
+
id: "kebab-case-id",
|
|
299
|
+
name: "Human-Readable Name",
|
|
300
|
+
version: "1.0.0",
|
|
301
|
+
description: "Short description for semantic matching (1-2 sentences)",
|
|
302
|
+
problem: "What problem this skill solves",
|
|
303
|
+
triggerConditions: [
|
|
304
|
+
{ type: "error", value: "Cannot find module", description: "ES module import failure" },
|
|
305
|
+
{ type: "keyword", value: "typescript, import", description: "TypeScript imports" },
|
|
306
|
+
{ type: "pattern", value: "\\.(ts|tsx)$", description: "TypeScript files" }
|
|
307
|
+
],
|
|
308
|
+
solution: "Step-by-step solution in imperative form",
|
|
309
|
+
verification: "How to verify the skill worked",
|
|
310
|
+
examples: [
|
|
311
|
+
{ scenario: "Description", before: "Before state", after: "After state" }
|
|
312
|
+
],
|
|
313
|
+
tags: ["typescript", "modules"],
|
|
314
|
+
status: "active"
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Trigger condition types:
|
|
319
|
+
- `error`: Error message patterns (regex)
|
|
320
|
+
- `keyword`: Comma-separated keywords
|
|
321
|
+
- `pattern`: Regex for file paths or content
|
|
322
|
+
- `context`: Contextual description
|
|
323
|
+
- `custom`: Freeform condition
|
|
324
|
+
|
|
325
|
+
## Quality Checklist
|
|
326
|
+
|
|
327
|
+
Before shipping, verify against `references/quality-checklist.md`.
|
|
328
|
+
|
|
329
|
+
Quick validation:
|
|
330
|
+
- [ ] Folder is kebab-case, SKILL.md exists (exact spelling)
|
|
331
|
+
- [ ] Frontmatter has `---` delimiters, `name` and `description` fields
|
|
332
|
+
- [ ] Description includes WHAT it does and WHEN to use it
|
|
333
|
+
- [ ] No XML tags anywhere in frontmatter
|
|
334
|
+
- [ ] Instructions are specific and actionable (not vague)
|
|
335
|
+
- [ ] Error handling included for common failure modes
|
|
336
|
+
- [ ] Examples provided for primary use cases
|
|
337
|
+
- [ ] SKILL.md is under 5,000 words
|
|
338
|
+
- [ ] Detailed docs moved to references/
|
|
339
|
+
- [ ] Tested: triggers correctly, doesn't overtrigger, produces correct output
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# Skill Examples
|
|
2
|
+
|
|
3
|
+
Complete examples demonstrating different skill categories and patterns.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Example 1: Document Creation Skill (Category 1)
|
|
8
|
+
|
|
9
|
+
A standalone skill for generating API documentation.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
api-docs-generator/
|
|
13
|
+
├── SKILL.md
|
|
14
|
+
├── references/
|
|
15
|
+
│ └── style-guide.md
|
|
16
|
+
└── assets/
|
|
17
|
+
└── doc-template.md
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### SKILL.md
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
---
|
|
24
|
+
name: api-docs-generator
|
|
25
|
+
description: >-
|
|
26
|
+
Generates consistent API documentation from code and OpenAPI specs.
|
|
27
|
+
Use when user asks to "document this API", "generate API docs",
|
|
28
|
+
"create endpoint documentation", or uploads .yaml/.json OpenAPI files.
|
|
29
|
+
metadata:
|
|
30
|
+
author: api-team
|
|
31
|
+
version: 1.2.0
|
|
32
|
+
tags: [documentation, api, openapi]
|
|
33
|
+
---
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
# API Documentation Generator
|
|
38
|
+
|
|
39
|
+
## Instructions
|
|
40
|
+
|
|
41
|
+
### Step 1: Identify API Source
|
|
42
|
+
Determine the documentation source:
|
|
43
|
+
- OpenAPI/Swagger spec file (.yaml or .json)
|
|
44
|
+
- Source code with route definitions
|
|
45
|
+
- Existing partial documentation to extend
|
|
46
|
+
|
|
47
|
+
### Step 2: Extract Endpoints
|
|
48
|
+
For each endpoint, capture:
|
|
49
|
+
- HTTP method and path
|
|
50
|
+
- Request parameters (path, query, body)
|
|
51
|
+
- Response schema and status codes
|
|
52
|
+
- Authentication requirements
|
|
53
|
+
|
|
54
|
+
### Step 3: Generate Documentation
|
|
55
|
+
Apply the style guide from `references/style-guide.md`.
|
|
56
|
+
|
|
57
|
+
For each endpoint, produce:
|
|
58
|
+
1. One-line description
|
|
59
|
+
2. Full URL with base path
|
|
60
|
+
3. Request example with curl
|
|
61
|
+
4. Response example with JSON
|
|
62
|
+
5. Error responses table
|
|
63
|
+
|
|
64
|
+
### Step 4: Validate
|
|
65
|
+
- All endpoints from source are documented
|
|
66
|
+
- Examples are syntactically valid
|
|
67
|
+
- Cross-references between related endpoints exist
|
|
68
|
+
|
|
69
|
+
## Examples
|
|
70
|
+
|
|
71
|
+
### Example: REST API with OpenAPI spec
|
|
72
|
+
User says: "Generate docs for this API"
|
|
73
|
+
Given: openapi.yaml with 5 endpoints
|
|
74
|
+
Result: Markdown documentation with curl examples for each endpoint
|
|
75
|
+
|
|
76
|
+
## Troubleshooting
|
|
77
|
+
|
|
78
|
+
### Missing endpoints
|
|
79
|
+
Cause: Spec uses $ref to external files
|
|
80
|
+
Solution: Resolve all $ref references before processing
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Example 2: Workflow Automation Skill (Category 2)
|
|
86
|
+
|
|
87
|
+
A skill for standardized code review workflows.
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
code-review/
|
|
91
|
+
├── SKILL.md
|
|
92
|
+
├── scripts/
|
|
93
|
+
│ └── check-coverage.sh
|
|
94
|
+
└── references/
|
|
95
|
+
└── review-standards.md
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### SKILL.md
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
---
|
|
102
|
+
name: code-review
|
|
103
|
+
description: >-
|
|
104
|
+
Conducts structured code reviews with consistent methodology.
|
|
105
|
+
Use when user asks to "review this PR", "review my code",
|
|
106
|
+
"check this for issues", or "do a code review". Covers security,
|
|
107
|
+
performance, maintainability, and test coverage.
|
|
108
|
+
metadata:
|
|
109
|
+
author: engineering
|
|
110
|
+
version: 2.0.0
|
|
111
|
+
tags: [code-review, quality, security]
|
|
112
|
+
---
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# Code Review
|
|
117
|
+
|
|
118
|
+
## Instructions
|
|
119
|
+
|
|
120
|
+
### Step 1: Understand the Change
|
|
121
|
+
1. Read the PR description or user's explanation of the change
|
|
122
|
+
2. Identify the affected files and their roles
|
|
123
|
+
3. Determine the change category: feature, bugfix, refactor, or config
|
|
124
|
+
|
|
125
|
+
### Step 2: Security Review
|
|
126
|
+
Check for OWASP Top 10 vulnerabilities:
|
|
127
|
+
- SQL injection in database queries
|
|
128
|
+
- XSS in user-facing output
|
|
129
|
+
- Authentication/authorization gaps
|
|
130
|
+
- Secrets or credentials in code
|
|
131
|
+
- Input validation at system boundaries
|
|
132
|
+
|
|
133
|
+
### Step 3: Code Quality Review
|
|
134
|
+
Consult `references/review-standards.md` for project-specific standards.
|
|
135
|
+
|
|
136
|
+
Check:
|
|
137
|
+
- Functions under 50 lines
|
|
138
|
+
- Clear naming conventions
|
|
139
|
+
- Error handling for external calls
|
|
140
|
+
- No dead code or commented-out blocks
|
|
141
|
+
- DRY violations (3+ repetitions)
|
|
142
|
+
|
|
143
|
+
### Step 4: Test Coverage
|
|
144
|
+
Run `scripts/check-coverage.sh` if available.
|
|
145
|
+
|
|
146
|
+
Verify:
|
|
147
|
+
- New code has corresponding tests
|
|
148
|
+
- Edge cases are covered
|
|
149
|
+
- Tests are meaningful (not just coverage padding)
|
|
150
|
+
|
|
151
|
+
### Step 5: Produce Review Summary
|
|
152
|
+
Structure the review as:
|
|
153
|
+
1. **Summary**: One paragraph on overall assessment
|
|
154
|
+
2. **Critical Issues**: Must fix before merge (security, correctness)
|
|
155
|
+
3. **Suggestions**: Improvements that can be addressed later
|
|
156
|
+
4. **Positive Notes**: What was done well
|
|
157
|
+
|
|
158
|
+
## Examples
|
|
159
|
+
|
|
160
|
+
### Example: Feature PR with 3 files changed
|
|
161
|
+
User says: "Review this PR"
|
|
162
|
+
Actions:
|
|
163
|
+
1. Read diff for all 3 files
|
|
164
|
+
2. Check for security issues in new endpoint
|
|
165
|
+
3. Verify test coverage for new functionality
|
|
166
|
+
4. Flag missing input validation
|
|
167
|
+
Result: Structured review with 1 critical issue and 2 suggestions
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Example 3: MCP Enhancement Skill (Category 3)
|
|
173
|
+
|
|
174
|
+
A skill that enhances a project management MCP with workflow expertise.
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
linear-sprint-planner/
|
|
178
|
+
├── SKILL.md
|
|
179
|
+
└── references/
|
|
180
|
+
└── velocity-formulas.md
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### SKILL.md
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
---
|
|
187
|
+
name: linear-sprint-planner
|
|
188
|
+
description: >-
|
|
189
|
+
Plans and creates sprints in Linear with best practices for agile
|
|
190
|
+
teams. Use when user says "plan this sprint", "create sprint tasks",
|
|
191
|
+
"set up next sprint", or "help me with sprint planning". Requires
|
|
192
|
+
Linear MCP server connection.
|
|
193
|
+
compatibility: Requires Linear MCP server
|
|
194
|
+
metadata:
|
|
195
|
+
author: agile-team
|
|
196
|
+
version: 1.0.0
|
|
197
|
+
mcp-server: linear
|
|
198
|
+
tags: [linear, sprint, agile, project-management]
|
|
199
|
+
---
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```markdown
|
|
203
|
+
# Linear Sprint Planner
|
|
204
|
+
|
|
205
|
+
## Instructions
|
|
206
|
+
|
|
207
|
+
### Step 1: Gather Sprint Context
|
|
208
|
+
Call Linear MCP to fetch:
|
|
209
|
+
1. Current project status: `linear_get_projects`
|
|
210
|
+
2. Backlog items: `linear_list_issues` with status "Backlog"
|
|
211
|
+
3. Team members: `linear_get_team_members`
|
|
212
|
+
4. Previous sprint velocity (see `references/velocity-formulas.md`)
|
|
213
|
+
|
|
214
|
+
### Step 2: Analyze Capacity
|
|
215
|
+
Calculate available capacity:
|
|
216
|
+
- Team members x working days x focus factor (0.7)
|
|
217
|
+
- Subtract known PTO or meetings
|
|
218
|
+
- Compare against historical velocity
|
|
219
|
+
|
|
220
|
+
### Step 3: Prioritize and Select Items
|
|
221
|
+
From the backlog, recommend items for the sprint:
|
|
222
|
+
1. Priority items first (P0, P1)
|
|
223
|
+
2. Dependencies resolved (blocked items excluded)
|
|
224
|
+
3. Total story points within capacity
|
|
225
|
+
4. Mix of feature work and tech debt (80/20 suggested)
|
|
226
|
+
|
|
227
|
+
Present the recommended sprint plan to the user for approval.
|
|
228
|
+
|
|
229
|
+
### Step 4: Create Sprint in Linear
|
|
230
|
+
After user approval:
|
|
231
|
+
1. Create sprint: `linear_create_cycle` with start/end dates
|
|
232
|
+
2. Move selected issues: `linear_update_issue` for each item
|
|
233
|
+
3. Assign owners based on expertise and load balancing
|
|
234
|
+
4. Add labels: `linear_add_label` for sprint tracking
|
|
235
|
+
|
|
236
|
+
### Step 5: Generate Sprint Summary
|
|
237
|
+
Create a summary with:
|
|
238
|
+
- Sprint goal (one sentence)
|
|
239
|
+
- Total story points committed
|
|
240
|
+
- Team member assignments
|
|
241
|
+
- Key risks or dependencies
|
|
242
|
+
- Definition of done
|
|
243
|
+
|
|
244
|
+
## Troubleshooting
|
|
245
|
+
|
|
246
|
+
### Linear MCP not connected
|
|
247
|
+
If "Connection refused" or tool calls fail:
|
|
248
|
+
1. Verify Linear MCP is connected: Settings > Extensions
|
|
249
|
+
2. Check API key permissions (needs read/write)
|
|
250
|
+
3. Test independently: "Use Linear MCP to list my projects"
|
|
251
|
+
|
|
252
|
+
### No backlog items found
|
|
253
|
+
Cause: Filter too restrictive or wrong project selected
|
|
254
|
+
Solution: List all projects first, confirm the correct one
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Example 4: Skill-Tree Programmatic Skill
|
|
260
|
+
|
|
261
|
+
For the skill-tree library, skills are structured as TypeScript objects:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
const typescriptImportFix: Skill = {
|
|
265
|
+
id: "typescript-import-fix",
|
|
266
|
+
name: "TypeScript ES Module Import Fix",
|
|
267
|
+
version: "1.0.0",
|
|
268
|
+
description: "Fix TypeScript ES module import errors by adding .js extensions",
|
|
269
|
+
|
|
270
|
+
problem: "When using ES modules with TypeScript, relative imports fail without explicit .js extensions. The TypeScript compiler does not add extensions during compilation, causing 'Cannot find module' errors at runtime.",
|
|
271
|
+
|
|
272
|
+
triggerConditions: [
|
|
273
|
+
{
|
|
274
|
+
type: "error",
|
|
275
|
+
value: "Cannot find module",
|
|
276
|
+
description: "Node.js module resolution failure"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
type: "error",
|
|
280
|
+
value: "ERR_MODULE_NOT_FOUND",
|
|
281
|
+
description: "ES module not found error"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
type: "keyword",
|
|
285
|
+
value: "typescript, import, esm, module",
|
|
286
|
+
description: "TypeScript module-related discussion"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
type: "pattern",
|
|
290
|
+
value: "from ['\"]\\./.*['\"]",
|
|
291
|
+
description: "Relative import without .js extension"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
|
|
295
|
+
solution: `1. Identify all relative imports in TypeScript files
|
|
296
|
+
2. Add .js extension to each relative import path:
|
|
297
|
+
- import { foo } from './bar' → import { foo } from './bar.js'
|
|
298
|
+
- import { baz } from '../utils' → import { baz } from '../utils.js'
|
|
299
|
+
3. Ensure tsconfig.json has "module": "ESNext" or "Node16"
|
|
300
|
+
4. Ensure package.json has "type": "module"
|
|
301
|
+
5. Rebuild the project: npx tsc --noEmit to verify`,
|
|
302
|
+
|
|
303
|
+
verification: "Run the application. All imports resolve without 'Cannot find module' errors. TypeScript compilation succeeds with no module-related diagnostics.",
|
|
304
|
+
|
|
305
|
+
examples: [
|
|
306
|
+
{
|
|
307
|
+
scenario: "Fixing imports in a utility file",
|
|
308
|
+
before: `import { helper } from './utils'\nimport { Config } from '../types'`,
|
|
309
|
+
after: `import { helper } from './utils.js'\nimport { Config } from '../types.js'`
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
|
|
313
|
+
notes: "This only applies to relative imports. Package imports (from 'lodash') do not need extensions. Index files should use './dir/index.js' explicitly.",
|
|
314
|
+
|
|
315
|
+
author: "skill-tree",
|
|
316
|
+
tags: ["typescript", "esm", "modules", "imports"],
|
|
317
|
+
status: "active",
|
|
318
|
+
createdAt: new Date(),
|
|
319
|
+
updatedAt: new Date(),
|
|
320
|
+
metrics: {
|
|
321
|
+
usageCount: 0,
|
|
322
|
+
successRate: 0,
|
|
323
|
+
feedbackScores: []
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
```
|