@amsterdamdatalabs/enact-extensions 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -20
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +89 -0
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +219 -18
- package/dist/install.js.map +1 -1
- package/dist/validate/index.d.ts +21 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +77 -0
- package/dist/validate/index.js.map +1 -1
- package/extensions/cmux/.agents/plugin.json +37 -0
- package/extensions/cmux/skills/cmux/SKILL.md +82 -0
- package/extensions/cmux/skills/cmux/agents/openai.yaml +4 -0
- package/extensions/cmux/skills/cmux/references/handles-and-identify.md +35 -0
- package/extensions/cmux/skills/cmux/references/panes-surfaces.md +37 -0
- package/extensions/cmux/skills/cmux/references/trigger-flash-and-health.md +23 -0
- package/extensions/cmux/skills/cmux/references/windows-workspaces.md +31 -0
- package/extensions/cmux/skills/cmux-vm-monitor/SKILL.md +122 -0
- package/extensions/cmux/skills/cmux-vm-monitor/agents/openai.yaml +4 -0
- package/extensions/cmux/skills/cmux-vm-monitor/references/cmux-commands.md +66 -0
- package/extensions/cmux/skills/cmux-vm-monitor/scripts/codex_vm_monitor.sh +45 -0
- package/extensions/cmux/skills/cmux-workspace/SKILL.md +93 -0
- package/extensions/dev-state/.agents/plugin.json +35 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/SKILL.md +194 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/agents/openai.yaml +4 -0
- package/extensions/dev-state/skills/dev-state-plan-graduation/references/reference.md +130 -0
- package/extensions/devops/.agents/plugin.json +36 -0
- package/extensions/devops/skills/azure-devops-cli/SKILL.md +431 -0
- package/extensions/devops/skills/azure-devops-cli/agents/openai.yaml +4 -0
- package/extensions/devops/skills/ci-pipeline-strategy/SKILL.md +217 -0
- package/extensions/devops/skills/ci-pipeline-strategy/agents/openai.yaml +4 -0
- package/{plugins/net-revenue-management/.codex-plugin → extensions/net-revenue-management/.agents}/plugin.json +10 -6
- package/extensions/plugin-dev/.agents/plugin.json +42 -0
- package/extensions/plugin-dev/.mcp.json +3 -0
- package/extensions/plugin-dev/agents/agent-creator.md +199 -0
- package/extensions/plugin-dev/agents/plugin-validator.md +91 -0
- package/extensions/plugin-dev/agents/skill-reviewer.md +212 -0
- package/extensions/plugin-dev/commands/_archive/create-marketplace.md +427 -0
- package/extensions/plugin-dev/commands/_archive/plugin-dev-guide.md +12 -0
- package/extensions/plugin-dev/commands/create-plugin.md +498 -0
- package/extensions/plugin-dev/commands/start.md +81 -0
- package/extensions/plugin-dev/hooks/hooks.json +3 -0
- package/extensions/plugin-dev/skills/agent-development/SKILL.md +641 -0
- package/extensions/plugin-dev/skills/agent-development/examples/agent-creation-prompt.md +250 -0
- package/extensions/plugin-dev/skills/agent-development/examples/complete-agent-examples.md +461 -0
- package/extensions/plugin-dev/skills/agent-development/references/advanced-agent-fields.md +246 -0
- package/extensions/plugin-dev/skills/agent-development/references/agent-creation-system-prompt.md +216 -0
- package/extensions/plugin-dev/skills/agent-development/references/permission-modes-rules.md +226 -0
- package/extensions/plugin-dev/skills/agent-development/references/system-prompt-design.md +464 -0
- package/extensions/plugin-dev/skills/agent-development/references/triggering-examples.md +474 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/create-agent-skeleton.sh +176 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/test-agent-trigger.sh +227 -0
- package/extensions/plugin-dev/skills/agent-development/scripts/validate-agent.sh +227 -0
- package/extensions/plugin-dev/skills/command-development/SKILL.md +763 -0
- package/extensions/plugin-dev/skills/command-development/examples/plugin-commands.md +612 -0
- package/extensions/plugin-dev/skills/command-development/examples/simple-commands.md +527 -0
- package/extensions/plugin-dev/skills/command-development/references/advanced-workflows.md +762 -0
- package/extensions/plugin-dev/skills/command-development/references/documentation-patterns.md +769 -0
- package/extensions/plugin-dev/skills/command-development/references/frontmatter-reference.md +508 -0
- package/extensions/plugin-dev/skills/command-development/references/interactive-commands.md +966 -0
- package/extensions/plugin-dev/skills/command-development/references/marketplace-considerations.md +943 -0
- package/extensions/plugin-dev/skills/command-development/references/plugin-features-reference.md +637 -0
- package/extensions/plugin-dev/skills/command-development/references/plugin-integration.md +191 -0
- package/extensions/plugin-dev/skills/command-development/references/skill-tool.md +447 -0
- package/extensions/plugin-dev/skills/command-development/references/testing-strategies.md +723 -0
- package/extensions/plugin-dev/skills/command-development/scripts/check-frontmatter.sh +234 -0
- package/extensions/plugin-dev/skills/command-development/scripts/validate-command.sh +160 -0
- package/extensions/plugin-dev/skills/hook-development/SKILL.md +861 -0
- package/extensions/plugin-dev/skills/hook-development/examples/load-context.sh +55 -0
- package/extensions/plugin-dev/skills/hook-development/examples/validate-bash.sh +57 -0
- package/extensions/plugin-dev/skills/hook-development/examples/validate-write.sh +48 -0
- package/extensions/plugin-dev/skills/hook-development/references/advanced.md +871 -0
- package/extensions/plugin-dev/skills/hook-development/references/hook-input-schemas.md +145 -0
- package/extensions/plugin-dev/skills/hook-development/references/migration.md +392 -0
- package/extensions/plugin-dev/skills/hook-development/references/patterns.md +430 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/README.md +181 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/hook-linter.sh +153 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/test-hook.sh +276 -0
- package/extensions/plugin-dev/skills/hook-development/scripts/validate-hook-schema.sh +159 -0
- package/extensions/plugin-dev/skills/mcp-integration/SKILL.md +775 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/http-server.json +20 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/sse-server.json +19 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/stdio-server.json +38 -0
- package/extensions/plugin-dev/skills/mcp-integration/examples/ws-server.json +26 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/authentication.md +601 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/server-discovery.md +190 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/server-types.md +572 -0
- package/extensions/plugin-dev/skills/mcp-integration/references/tool-usage.md +623 -0
- package/extensions/plugin-dev/skills/plugin-dev-guide/SKILL.md +222 -0
- package/extensions/plugin-dev/skills/plugin-structure/SKILL.md +705 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/advanced-plugin.md +774 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/minimal-plugin.md +83 -0
- package/extensions/plugin-dev/skills/plugin-structure/examples/standard-plugin.md +611 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/advanced-topics.md +289 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/component-patterns.md +592 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/github-actions.md +233 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/headless-ci-mode.md +193 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/manifest-reference.md +625 -0
- package/extensions/plugin-dev/skills/plugin-structure/references/output-styles.md +116 -0
- package/extensions/plugin-dev/skills/skill-development/SKILL.md +564 -0
- package/extensions/plugin-dev/skills/skill-development/examples/complete-skill.md +465 -0
- package/extensions/plugin-dev/skills/skill-development/examples/frontmatter-templates.md +167 -0
- package/extensions/plugin-dev/skills/skill-development/examples/minimal-skill.md +111 -0
- package/extensions/plugin-dev/skills/skill-development/references/advanced-frontmatter.md +225 -0
- package/extensions/plugin-dev/skills/skill-development/references/commands-vs-skills.md +39 -0
- package/extensions/plugin-dev/skills/skill-development/references/skill-creation-workflow.md +379 -0
- package/extensions/plugin-dev/skills/skill-development/references/skill-creator-original.md +210 -0
- package/package.json +8 -11
- package/scripts/enact-extensions.mjs +751 -16
- package/scripts/hooks/session-start-drift-check.mjs +58 -0
- package/scripts/lib/build-index.mjs +50 -0
- package/scripts/lib/bundle-hash.mjs +137 -0
- package/scripts/lib/hooks.mjs +389 -0
- package/scripts/lib/ledger.mjs +162 -0
- package/scripts/lib/list-bundles.mjs +70 -0
- package/scripts/lib/outdated.mjs +144 -0
- package/scripts/lib/provision-mcp.mjs +369 -0
- package/scripts/lib/resolve-bundle.mjs +121 -0
- package/scripts/lib/run-install.mjs +321 -39
- package/scripts/lib/run-uninstall.mjs +220 -0
- package/scripts/lib/run-update.mjs +152 -0
- package/scripts/lib/run-validate.mjs +12 -18
- package/scripts/lib/serve.mjs +454 -0
- package/scripts/postinstall.mjs +63 -0
- package/scripts/setup-enact-context.sh +2 -2
- package/spec/index.json +59 -0
- package/web/assets/README.md +111 -0
- package/web/assets/logo-full.png +0 -0
- package/web/assets/logo-slim.png +0 -0
- package/web/assets/tokens/base.css +45 -0
- package/web/assets/tokens/colors.css +248 -0
- package/web/assets/tokens/effects.css +24 -0
- package/web/assets/tokens/fonts.css +8 -0
- package/web/assets/tokens/index.css +18 -0
- package/web/assets/tokens/spacing.css +50 -0
- package/web/index.html +1188 -0
- package/.agents/plugins/marketplace.json +0 -20
- package/catalog/enact-context.json +0 -9
- package/catalog/enact-factory.json +0 -7
- package/catalog/enact-operator.json +0 -7
- package/catalog/enact-wiki.json +0 -7
- package/catalog/net-revenue-management.json +0 -8
- package/scripts/rename-supervisor-to-operator.pl +0 -66
- package/scripts/sync-manifests.mjs +0 -23
- package/scripts/validate-catalog.mjs +0 -37
- package/scripts/validate-plugin.mjs +0 -10
- /package/{plugins → extensions}/net-revenue-management/.mcp.json +0 -0
- /package/{plugins → extensions}/net-revenue-management/skills/net-revenue-risks/SKILL.md +0 -0
- /package/{plugins → extensions}/net-revenue-management/skills/net-revenue-scenario/SKILL.md +0 -0
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plugin-structure
|
|
3
|
+
description: Use when the user asks to create/scaffold a plugin, understand Enact multi-platform plugin structure, set up plugin.json manifests, organize skills/commands/hooks, validate plugins, or configure Claude/Codex/Cursor plugin layouts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Enact multi-platform plugin structure
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Enact plugins use **one component tree** and **multiple host manifests**. Edit the canonical Enact manifest, then sync derived copies.
|
|
11
|
+
|
|
12
|
+
**Key concepts:**
|
|
13
|
+
|
|
14
|
+
- Canonical manifest: `.agents/plugin.json` (see `spec/enact.json`)
|
|
15
|
+
- Derived manifests: `.claude-plugin/`, `.codex-plugin/`, `.cursor-plugin/` — same `skills/`, `commands/`, `hooks/`
|
|
16
|
+
- Regenerate hosts: `enact-extensions sync` (from plugin root; cwd default)
|
|
17
|
+
- Validate all: `enact-extensions validate`
|
|
18
|
+
|
|
19
|
+
## Directory structure (all hosts)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
plugin-name/
|
|
23
|
+
├── .agents/
|
|
24
|
+
│ └── plugin.json # Canonical Enact manifest (source of truth)
|
|
25
|
+
├── .claude-plugin/plugin.json
|
|
26
|
+
├── .codex-plugin/plugin.json
|
|
27
|
+
├── .cursor-plugin/plugin.json
|
|
28
|
+
├── skills/
|
|
29
|
+
│ └── skill-name/SKILL.md
|
|
30
|
+
├── commands/ # Slash commands (optional)
|
|
31
|
+
├── agents/ # Subagents (optional)
|
|
32
|
+
├── hooks/hooks.json
|
|
33
|
+
├── .mcp.json
|
|
34
|
+
└── assets/ # logos (optional)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Critical rules:**
|
|
38
|
+
|
|
39
|
+
1. **Components live at plugin root** — never inside `.agents/` or host manifest dirs (only `plugin.json` goes there).
|
|
40
|
+
2. **One copy** of `skills/`, `commands/`, `hooks/` — do not duplicate per host.
|
|
41
|
+
3. **kebab-case** names for dirs, skills, and plugin `name`.
|
|
42
|
+
4. Set `targets` in `.agents/plugin.json`: `["claude","codex","cursor"]` as needed.
|
|
43
|
+
|
|
44
|
+
## Canonical manifest (`.agents/plugin.json`)
|
|
45
|
+
|
|
46
|
+
Required: `name`. Recommended: `version`, `description`, `targets`, component paths, `interface` (registry UI), `factory` (Enact Factory plugins).
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"name": "my-plugin",
|
|
51
|
+
"version": "0.1.0",
|
|
52
|
+
"description": "What this plugin does",
|
|
53
|
+
"targets": ["claude", "codex", "cursor"],
|
|
54
|
+
"skills": "./skills/",
|
|
55
|
+
"commands": "./commands/",
|
|
56
|
+
"hooks": "./hooks/hooks.json",
|
|
57
|
+
"mcpServers": "./.mcp.json"
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Schemas: `spec/*.json`.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Claude Code specifics
|
|
66
|
+
|
|
67
|
+
Claude loads `.claude-plugin/plugin.json`. Portable paths may use `${CLAUDE_PLUGIN_ROOT}` in hooks and scripts.
|
|
68
|
+
|
|
69
|
+
Legacy single-host layout (still valid if you only ship Claude):
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
plugin-name/
|
|
73
|
+
├── .claude-plugin/plugin.json
|
|
74
|
+
├── commands/
|
|
75
|
+
├── skills/
|
|
76
|
+
└── hooks/hooks.json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Plugin manifest (Claude-only reference)
|
|
80
|
+
|
|
81
|
+
For Claude-only plugins, the manifest lives at `.claude-plugin/plugin.json`:
|
|
82
|
+
|
|
83
|
+
### Required Fields
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"name": "plugin-name"
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Name requirements:**
|
|
92
|
+
|
|
93
|
+
- Use kebab-case format (lowercase with hyphens)
|
|
94
|
+
- Must be unique across installed plugins
|
|
95
|
+
- No spaces or special characters
|
|
96
|
+
- Example: `code-review-assistant`, `test-runner`, `api-docs`
|
|
97
|
+
|
|
98
|
+
### Recommended Metadata
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"name": "plugin-name",
|
|
103
|
+
"version": "1.0.0",
|
|
104
|
+
"description": "Brief explanation of plugin purpose",
|
|
105
|
+
"author": {
|
|
106
|
+
"name": "Author Name",
|
|
107
|
+
"email": "author@example.com",
|
|
108
|
+
"url": "https://example.com"
|
|
109
|
+
},
|
|
110
|
+
"homepage": "https://docs.example.com",
|
|
111
|
+
"repository": "https://github.com/user/plugin-name",
|
|
112
|
+
"license": "MIT",
|
|
113
|
+
"keywords": ["testing", "automation", "ci-cd"]
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Version format**: Follow semantic versioning (MAJOR.MINOR.PATCH)
|
|
118
|
+
**Keywords**: Use for plugin discovery and categorization
|
|
119
|
+
|
|
120
|
+
### Component Path Configuration
|
|
121
|
+
|
|
122
|
+
Specify custom paths for components (supplements default directories):
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"name": "plugin-name",
|
|
127
|
+
"commands": "./custom-commands",
|
|
128
|
+
"agents": ["./agents", "./specialized-agents"],
|
|
129
|
+
"hooks": "./config/hooks.json",
|
|
130
|
+
"mcpServers": "./.mcp.json"
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Important**: Custom paths supplement defaults—they don't replace them. Components in both default directories and custom paths will load.
|
|
135
|
+
|
|
136
|
+
**Path rules:**
|
|
137
|
+
|
|
138
|
+
- Must be relative to plugin root
|
|
139
|
+
- Must start with `./`
|
|
140
|
+
- Cannot use absolute paths
|
|
141
|
+
- Support arrays for multiple locations
|
|
142
|
+
|
|
143
|
+
## Component Organization
|
|
144
|
+
|
|
145
|
+
### Commands
|
|
146
|
+
|
|
147
|
+
**Location**: `commands/` directory
|
|
148
|
+
**Format**: Markdown files with YAML frontmatter
|
|
149
|
+
**Auto-discovery**: All `.md` files in `commands/` load automatically
|
|
150
|
+
|
|
151
|
+
Simple, user-invocable prompts stored as single `.md` files. Use when you don't need bundled resources. Both commands and skills are invoked via the Skill tool—commands are essentially simple skills.
|
|
152
|
+
|
|
153
|
+
**Example structure**:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
commands/
|
|
157
|
+
├── review.md # /review command
|
|
158
|
+
├── test.md # /test command
|
|
159
|
+
└── deploy.md # /deploy command
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**File format**:
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
---
|
|
166
|
+
name: command-name
|
|
167
|
+
description: Command description
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
Command implementation instructions...
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Usage**: Commands integrate as native slash commands in Claude Code
|
|
174
|
+
|
|
175
|
+
### Agents
|
|
176
|
+
|
|
177
|
+
**Location**: `agents/` directory
|
|
178
|
+
**Format**: Markdown files with YAML frontmatter
|
|
179
|
+
**Auto-discovery**: All `.md` files in `agents/` load automatically
|
|
180
|
+
|
|
181
|
+
**Example structure**:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
agents/
|
|
185
|
+
├── code-reviewer.md
|
|
186
|
+
├── test-generator.md
|
|
187
|
+
└── refactorer.md
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**File format**:
|
|
191
|
+
|
|
192
|
+
```markdown
|
|
193
|
+
---
|
|
194
|
+
description: Agent role and expertise
|
|
195
|
+
capabilities:
|
|
196
|
+
- Specific task 1
|
|
197
|
+
- Specific task 2
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
Detailed agent instructions and knowledge...
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Usage**: Users can invoke agents manually, or Claude Code selects them automatically based on task context
|
|
204
|
+
|
|
205
|
+
### Skills
|
|
206
|
+
|
|
207
|
+
**Location**: `skills/` directory with subdirectories per skill
|
|
208
|
+
**Format**: Each skill in its own directory with `SKILL.md` file
|
|
209
|
+
**Auto-discovery**: All `SKILL.md` files in skill subdirectories load automatically
|
|
210
|
+
|
|
211
|
+
Complex prompts with bundled resources (scripts, references, examples). Use when you need progressive disclosure or supporting files. Both skills and commands are invoked via the Skill tool.
|
|
212
|
+
|
|
213
|
+
**Example structure**:
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
skills/
|
|
217
|
+
├── api-testing/
|
|
218
|
+
│ ├── SKILL.md
|
|
219
|
+
│ ├── scripts/
|
|
220
|
+
│ │ └── test-runner.py
|
|
221
|
+
│ └── references/
|
|
222
|
+
│ └── api-spec.md
|
|
223
|
+
└── database-migrations/
|
|
224
|
+
├── SKILL.md
|
|
225
|
+
└── examples/
|
|
226
|
+
└── migration-template.sql
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**SKILL.md format**:
|
|
230
|
+
|
|
231
|
+
```markdown
|
|
232
|
+
---
|
|
233
|
+
name: Skill Name
|
|
234
|
+
description: When to use this skill
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
Skill instructions and guidance...
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Tool restrictions** (optional): Skills can include `allowed-tools` in frontmatter to limit tool access:
|
|
241
|
+
|
|
242
|
+
```yaml
|
|
243
|
+
---
|
|
244
|
+
name: safe-reader
|
|
245
|
+
description: Read-only file access skill
|
|
246
|
+
allowed-tools: Read, Grep, Glob # Optional: restricts available tools
|
|
247
|
+
---
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Use for read-only workflows, security-sensitive tasks, or limited-scope operations.
|
|
251
|
+
|
|
252
|
+
**Supporting files**: Skills can include scripts, references, examples, or assets in subdirectories
|
|
253
|
+
|
|
254
|
+
**Usage**: Claude Code autonomously activates skills based on task context matching the description
|
|
255
|
+
|
|
256
|
+
### Hooks
|
|
257
|
+
|
|
258
|
+
**Location**: `hooks/hooks.json` or inline in `plugin.json`
|
|
259
|
+
**Format**: JSON configuration defining event handlers
|
|
260
|
+
**Registration**: Hooks register automatically when plugin enables
|
|
261
|
+
|
|
262
|
+
**Example structure**:
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
hooks/
|
|
266
|
+
├── hooks.json # Hook configuration
|
|
267
|
+
└── scripts/
|
|
268
|
+
├── validate.sh # Hook script
|
|
269
|
+
└── check-style.sh # Hook script
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Configuration format**:
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"hooks": {
|
|
277
|
+
"PreToolUse": [
|
|
278
|
+
{
|
|
279
|
+
"matcher": "Write|Edit",
|
|
280
|
+
"hooks": [
|
|
281
|
+
{
|
|
282
|
+
"type": "command",
|
|
283
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/validate.sh",
|
|
284
|
+
"timeout": 30
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Available events**: PreToolUse, PermissionRequest, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification
|
|
294
|
+
|
|
295
|
+
**Usage**: Hooks execute automatically in response to Claude Code events
|
|
296
|
+
|
|
297
|
+
### MCP Servers
|
|
298
|
+
|
|
299
|
+
**Location**: `.mcp.json` at plugin root or inline in `plugin.json`
|
|
300
|
+
**Format**: JSON configuration for MCP server definitions
|
|
301
|
+
**Auto-start**: Servers start automatically when plugin enables
|
|
302
|
+
|
|
303
|
+
**Example format**:
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"mcpServers": {
|
|
308
|
+
"server-name": {
|
|
309
|
+
"command": "node",
|
|
310
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/servers/server.js"],
|
|
311
|
+
"env": {
|
|
312
|
+
"API_KEY": "${API_KEY}"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Usage**: MCP servers integrate seamlessly with Claude Code's tool system
|
|
320
|
+
|
|
321
|
+
### LSP Servers
|
|
322
|
+
|
|
323
|
+
**Location**: Inline in `plugin.json` under `lspServers` field
|
|
324
|
+
**Format**: JSON configuration for Language Server Protocol servers
|
|
325
|
+
**Auto-start**: Servers start when files matching extensions are opened
|
|
326
|
+
|
|
327
|
+
**Example format**:
|
|
328
|
+
|
|
329
|
+
```json
|
|
330
|
+
{
|
|
331
|
+
"lspServers": {
|
|
332
|
+
"python": {
|
|
333
|
+
"command": "pyright-langserver",
|
|
334
|
+
"args": ["--stdio"],
|
|
335
|
+
"extensionToLanguage": {
|
|
336
|
+
".py": "python",
|
|
337
|
+
".pyi": "python"
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Usage**: LSP servers provide code intelligence (go-to-definition, find references, hover)
|
|
345
|
+
|
|
346
|
+
For detailed LSP configuration, see the `lsp-integration` skill.
|
|
347
|
+
|
|
348
|
+
### Output Styles
|
|
349
|
+
|
|
350
|
+
**Location**: Path reference in `plugin.json` under `outputStyles` field
|
|
351
|
+
**Format**: String path or array of paths to style files/directories
|
|
352
|
+
**Purpose**: Customize how Claude formats responses
|
|
353
|
+
|
|
354
|
+
**Example format**:
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"outputStyles": "./styles/"
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Or with multiple paths:
|
|
363
|
+
|
|
364
|
+
```json
|
|
365
|
+
{
|
|
366
|
+
"outputStyles": ["./styles/default.md", "./styles/compact.md"]
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Usage**: Plugins can define consistent output formatting for their domain. Style files in the referenced path are loaded to customize Claude's output behavior.
|
|
371
|
+
|
|
372
|
+
For comprehensive output styles guidance including frontmatter schema, file locations, and when to use styles vs other components, see `references/output-styles.md`.
|
|
373
|
+
|
|
374
|
+
## Portable Path References
|
|
375
|
+
|
|
376
|
+
### ${CLAUDE_PLUGIN_ROOT}
|
|
377
|
+
|
|
378
|
+
Use `${CLAUDE_PLUGIN_ROOT}` environment variable for all intra-plugin path references:
|
|
379
|
+
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/run.sh"
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Why it matters**: Plugins install in different locations depending on:
|
|
387
|
+
|
|
388
|
+
- User installation method (marketplace, local, npm)
|
|
389
|
+
- Operating system conventions
|
|
390
|
+
- User preferences
|
|
391
|
+
|
|
392
|
+
**Where to use it**:
|
|
393
|
+
|
|
394
|
+
- Hook command paths
|
|
395
|
+
- MCP server command arguments
|
|
396
|
+
- Script execution references
|
|
397
|
+
- Resource file paths
|
|
398
|
+
|
|
399
|
+
**Never use**:
|
|
400
|
+
|
|
401
|
+
- Hardcoded absolute paths (`/Users/name/plugins/...`)
|
|
402
|
+
- Relative paths from working directory (`./scripts/...` in commands)
|
|
403
|
+
- Home directory shortcuts (`~/plugins/...`)
|
|
404
|
+
|
|
405
|
+
### Path Resolution Rules
|
|
406
|
+
|
|
407
|
+
**In manifest JSON fields** (hooks, MCP servers):
|
|
408
|
+
|
|
409
|
+
```json
|
|
410
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/tool.sh"
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
**In component files** (commands, agents, skills):
|
|
414
|
+
|
|
415
|
+
```markdown
|
|
416
|
+
Reference scripts at: ${CLAUDE_PLUGIN_ROOT}/scripts/helper.py
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**In executed scripts**:
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
#!/bin/bash
|
|
423
|
+
# ${CLAUDE_PLUGIN_ROOT} available as environment variable
|
|
424
|
+
source "${CLAUDE_PLUGIN_ROOT}/lib/common.sh"
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## File Naming Conventions
|
|
428
|
+
|
|
429
|
+
### Component Files
|
|
430
|
+
|
|
431
|
+
**Commands**: Use kebab-case `.md` files
|
|
432
|
+
|
|
433
|
+
- `code-review.md` → `/code-review`
|
|
434
|
+
- `run-tests.md` → `/run-tests`
|
|
435
|
+
- `api-docs.md` → `/api-docs`
|
|
436
|
+
|
|
437
|
+
**Agents**: Use kebab-case `.md` files describing role
|
|
438
|
+
|
|
439
|
+
- `test-generator.md`
|
|
440
|
+
- `code-reviewer.md`
|
|
441
|
+
- `performance-analyzer.md`
|
|
442
|
+
|
|
443
|
+
**Skills**: Use kebab-case directory names
|
|
444
|
+
|
|
445
|
+
- `api-testing/`
|
|
446
|
+
- `database-migrations/`
|
|
447
|
+
- `error-handling/`
|
|
448
|
+
|
|
449
|
+
### Supporting Files
|
|
450
|
+
|
|
451
|
+
**Scripts**: Use descriptive kebab-case names with appropriate extensions
|
|
452
|
+
|
|
453
|
+
- `validate-input.sh`
|
|
454
|
+
- `generate-report.py`
|
|
455
|
+
- `process-data.js`
|
|
456
|
+
|
|
457
|
+
**Documentation**: Use kebab-case markdown files
|
|
458
|
+
|
|
459
|
+
- `api-reference.md`
|
|
460
|
+
- `migration-guide.md`
|
|
461
|
+
- `best-practices.md`
|
|
462
|
+
|
|
463
|
+
**Configuration**: Use standard names
|
|
464
|
+
|
|
465
|
+
- `hooks.json`
|
|
466
|
+
- `.mcp.json`
|
|
467
|
+
- `plugin.json`
|
|
468
|
+
|
|
469
|
+
## Auto-Discovery Mechanism
|
|
470
|
+
|
|
471
|
+
Claude Code automatically discovers and loads components:
|
|
472
|
+
|
|
473
|
+
1. **Plugin manifest**: Reads `.claude-plugin/plugin.json` when plugin enables
|
|
474
|
+
2. **Commands**: Scans `commands/` directory for `.md` files
|
|
475
|
+
3. **Agents**: Scans `agents/` directory for `.md` files
|
|
476
|
+
4. **Skills**: Scans `skills/` for subdirectories containing `SKILL.md`
|
|
477
|
+
5. **Hooks**: Loads configuration from `hooks/hooks.json` or manifest
|
|
478
|
+
6. **MCP servers**: Loads configuration from `.mcp.json` or manifest
|
|
479
|
+
|
|
480
|
+
**Discovery timing**:
|
|
481
|
+
|
|
482
|
+
- Plugin installation: Components register with Claude Code
|
|
483
|
+
- Plugin enable: Components become available for use
|
|
484
|
+
- No restart required: Changes take effect on next Claude Code session
|
|
485
|
+
|
|
486
|
+
**Override behavior**: Custom paths in `plugin.json` supplement (not replace) default directories
|
|
487
|
+
|
|
488
|
+
## Best Practices
|
|
489
|
+
|
|
490
|
+
### Organization
|
|
491
|
+
|
|
492
|
+
1. **Logical grouping**: Group related components together
|
|
493
|
+
- Put test-related commands, agents, and skills together
|
|
494
|
+
- Create subdirectories in `scripts/` for different purposes
|
|
495
|
+
|
|
496
|
+
2. **Minimal manifest**: Keep `plugin.json` lean
|
|
497
|
+
- Only specify custom paths when necessary
|
|
498
|
+
- Rely on auto-discovery for standard layouts
|
|
499
|
+
- Use inline configuration only for simple cases
|
|
500
|
+
|
|
501
|
+
3. **Documentation**: Include README files
|
|
502
|
+
- Plugin root: Overall purpose and usage
|
|
503
|
+
- Component directories: Specific guidance
|
|
504
|
+
- Script directories: Usage and requirements
|
|
505
|
+
|
|
506
|
+
### Naming
|
|
507
|
+
|
|
508
|
+
1. **Consistency**: Use consistent naming across components
|
|
509
|
+
- If command is `test-runner`, name related agent `test-runner-agent`
|
|
510
|
+
- Match skill directory names to their purpose
|
|
511
|
+
|
|
512
|
+
2. **Clarity**: Use descriptive names that indicate purpose
|
|
513
|
+
- Good: `api-integration-testing/`, `code-quality-checker.md`
|
|
514
|
+
- Avoid: `utils/`, `misc.md`, `temp.sh`
|
|
515
|
+
|
|
516
|
+
3. **Length**: Balance brevity with clarity
|
|
517
|
+
- Commands: 2-3 words (`review-pr`, `run-ci`)
|
|
518
|
+
- Agents: Describe role clearly (`code-reviewer`, `test-generator`)
|
|
519
|
+
- Skills: Topic-focused (`error-handling`, `api-design`)
|
|
520
|
+
|
|
521
|
+
### Portability
|
|
522
|
+
|
|
523
|
+
1. **Always use ${CLAUDE_PLUGIN_ROOT}**: Never hardcode paths
|
|
524
|
+
2. **Test on multiple systems**: Verify on macOS, Linux, Windows
|
|
525
|
+
3. **Document dependencies**: List required tools and versions
|
|
526
|
+
4. **Avoid system-specific features**: Use portable bash/Python constructs
|
|
527
|
+
|
|
528
|
+
### Maintenance
|
|
529
|
+
|
|
530
|
+
1. **Version consistently**: Update version in plugin.json for releases
|
|
531
|
+
2. **Deprecate gracefully**: Mark old components clearly before removal
|
|
532
|
+
3. **Document breaking changes**: Note changes affecting existing users
|
|
533
|
+
4. **Test thoroughly**: Verify all components work after changes
|
|
534
|
+
|
|
535
|
+
## Common Patterns
|
|
536
|
+
|
|
537
|
+
### Minimal Plugin
|
|
538
|
+
|
|
539
|
+
Single command with no dependencies:
|
|
540
|
+
|
|
541
|
+
```
|
|
542
|
+
my-plugin/
|
|
543
|
+
├── .claude-plugin/
|
|
544
|
+
│ └── plugin.json # Just name field
|
|
545
|
+
└── commands/
|
|
546
|
+
└── hello.md # Single command
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### Full-Featured Plugin
|
|
550
|
+
|
|
551
|
+
Complete plugin with all component types:
|
|
552
|
+
|
|
553
|
+
```
|
|
554
|
+
my-plugin/
|
|
555
|
+
├── .claude-plugin/
|
|
556
|
+
│ └── plugin.json
|
|
557
|
+
├── commands/ # User-facing commands
|
|
558
|
+
├── agents/ # Specialized subagents
|
|
559
|
+
├── skills/ # Auto-activating skills
|
|
560
|
+
├── hooks/ # Event handlers
|
|
561
|
+
│ ├── hooks.json
|
|
562
|
+
│ └── scripts/
|
|
563
|
+
├── .mcp.json # External integrations
|
|
564
|
+
└── scripts/ # Shared utilities
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Skill-Focused Plugin
|
|
568
|
+
|
|
569
|
+
Plugin providing only skills:
|
|
570
|
+
|
|
571
|
+
```
|
|
572
|
+
my-plugin/
|
|
573
|
+
├── .claude-plugin/
|
|
574
|
+
│ └── plugin.json
|
|
575
|
+
└── skills/
|
|
576
|
+
├── skill-one/
|
|
577
|
+
│ └── SKILL.md
|
|
578
|
+
└── skill-two/
|
|
579
|
+
└── SKILL.md
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
## Plugin Caching
|
|
583
|
+
|
|
584
|
+
Claude Code caches plugin content for performance. Understanding caching behavior helps with development and debugging.
|
|
585
|
+
|
|
586
|
+
### What Gets Cached
|
|
587
|
+
|
|
588
|
+
- Plugin manifest (plugin.json)
|
|
589
|
+
- Component files (commands, agents, skills)
|
|
590
|
+
- Configuration files (hooks.json, .mcp.json)
|
|
591
|
+
|
|
592
|
+
### Cache Invalidation
|
|
593
|
+
|
|
594
|
+
Cached content refreshes when:
|
|
595
|
+
|
|
596
|
+
- Claude Code session restarts
|
|
597
|
+
- Plugin is reinstalled or updated
|
|
598
|
+
- User runs `/plugins refresh` (if available)
|
|
599
|
+
|
|
600
|
+
### Why External Paths Fail
|
|
601
|
+
|
|
602
|
+
**Important:** Paths outside the plugin directory may not work reliably because:
|
|
603
|
+
|
|
604
|
+
1. **Security boundary** - Plugins are sandboxed to their directory
|
|
605
|
+
2. **Caching** - External paths aren't monitored for changes
|
|
606
|
+
3. **Portability** - External paths break on different machines
|
|
607
|
+
|
|
608
|
+
**Always use:**
|
|
609
|
+
|
|
610
|
+
- `${CLAUDE_PLUGIN_ROOT}` for paths within the plugin
|
|
611
|
+
- Bundled resources instead of external file references
|
|
612
|
+
- Environment variables for user-specific paths
|
|
613
|
+
|
|
614
|
+
### Development Workflow
|
|
615
|
+
|
|
616
|
+
During development, reload plugins by:
|
|
617
|
+
|
|
618
|
+
1. Exiting Claude Code
|
|
619
|
+
2. Making changes to plugin files
|
|
620
|
+
3. Restarting Claude Code
|
|
621
|
+
|
|
622
|
+
Or use `--plugin-dir` for testing without installation:
|
|
623
|
+
|
|
624
|
+
```bash
|
|
625
|
+
claude --plugin-dir /path/to/plugin
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
## Runtime Contexts
|
|
629
|
+
|
|
630
|
+
Plugins behave differently depending on the runtime context. Interactive sessions support slash commands and user prompts; headless mode (`claude -p`) and GitHub Actions provide non-interactive environments where some features are unavailable.
|
|
631
|
+
|
|
632
|
+
- **Headless/CI mode:** See `references/headless-ci-mode.md` for designing plugins that work in `claude -p` and CI pipelines
|
|
633
|
+
- **GitHub Actions:** See `references/github-actions.md` for integrating plugins with `claude-code-action@v1`
|
|
634
|
+
- **Advanced topics:** See `references/advanced-topics.md` for caching behavior, installation scopes, CLI management, keybindings, status line, and auto-update behavior
|
|
635
|
+
|
|
636
|
+
## Plugin Validation
|
|
637
|
+
|
|
638
|
+
Claude Code provides built-in validation tools:
|
|
639
|
+
|
|
640
|
+
- **`claude plugin validate`** (CLI) / **`/plugin validate`** (TUI): Validates plugin and marketplace structure, checking JSON syntax, required fields, component discovery, and path resolution
|
|
641
|
+
- **`claude --debug`**: Shows detailed plugin loading logs, including which components were discovered, registration errors, and hook execution details
|
|
642
|
+
- **`claude --verbose`**: Use `--verbose` for additional debugging output during plugin loading, including hook registration and MCP server connections
|
|
643
|
+
- **`/plugins`**: View installed plugins, their status, and any errors in the Errors tab
|
|
644
|
+
|
|
645
|
+
Use validation early and often during development.
|
|
646
|
+
|
|
647
|
+
### Additional Source Types
|
|
648
|
+
|
|
649
|
+
Beyond relative paths and git sources, plugins can also be installed from:
|
|
650
|
+
|
|
651
|
+
- **npm**: `claude plugin install npm-package-name`
|
|
652
|
+
- **pip**: `claude plugin install pip-package-name`
|
|
653
|
+
|
|
654
|
+
These package managers handle versioning and dependency resolution automatically.
|
|
655
|
+
|
|
656
|
+
## Troubleshooting
|
|
657
|
+
|
|
658
|
+
**Component not loading**:
|
|
659
|
+
|
|
660
|
+
- Verify file is in correct directory with correct extension
|
|
661
|
+
- Check YAML frontmatter syntax (commands, agents, skills)
|
|
662
|
+
- Ensure skill has `SKILL.md` (not `README.md` or other name)
|
|
663
|
+
- Confirm plugin is enabled in Claude Code settings
|
|
664
|
+
|
|
665
|
+
**Path resolution errors**:
|
|
666
|
+
|
|
667
|
+
- Replace all hardcoded paths with `${CLAUDE_PLUGIN_ROOT}`
|
|
668
|
+
- Verify paths are relative and start with `./` in manifest
|
|
669
|
+
- Check that referenced files exist at specified paths
|
|
670
|
+
- Test with `echo $CLAUDE_PLUGIN_ROOT` in hook scripts
|
|
671
|
+
|
|
672
|
+
**Auto-discovery not working**:
|
|
673
|
+
|
|
674
|
+
- Confirm directories are at plugin root (not in `.claude-plugin/`)
|
|
675
|
+
- Check file naming follows conventions (kebab-case, correct extensions)
|
|
676
|
+
- Verify custom paths in manifest are correct
|
|
677
|
+
- Restart Claude Code to reload plugin configuration
|
|
678
|
+
|
|
679
|
+
**Conflicts between plugins**:
|
|
680
|
+
|
|
681
|
+
- Use unique, descriptive component names
|
|
682
|
+
- Namespace commands with plugin name if needed
|
|
683
|
+
- Document potential conflicts in plugin README
|
|
684
|
+
- Consider command prefixes for related functionality
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
## Additional Resources
|
|
689
|
+
|
|
690
|
+
### Reference Files
|
|
691
|
+
|
|
692
|
+
- **`references/component-patterns.md`** - Detailed patterns for each component type
|
|
693
|
+
- **`references/manifest-reference.md`** - Complete plugin.json field reference
|
|
694
|
+
- **`references/headless-ci-mode.md`** - Headless and CI mode plugin compatibility
|
|
695
|
+
- **`references/github-actions.md`** - GitHub Actions integration for plugins
|
|
696
|
+
- **`references/advanced-topics.md`** - Caching, installation scopes, CLI commands, and more
|
|
697
|
+
- **`references/output-styles.md`** - Output style frontmatter schema, file locations, and usage guidance
|
|
698
|
+
|
|
699
|
+
### Example Files
|
|
700
|
+
|
|
701
|
+
Working examples in `examples/`:
|
|
702
|
+
|
|
703
|
+
- **`minimal-plugin.md`** - Single command plugin structure
|
|
704
|
+
- **`standard-plugin.md`** - Typical plugin with multiple components
|
|
705
|
+
- **`advanced-plugin.md`** - Full-featured plugin with all component types
|