specweave 0.23.16 → 0.23.18
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 +11 -0
- package/CLAUDE.md +22 -7
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +57 -0
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-content.js +3 -0
- package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
- package/dist/src/core/progress/progress-tracker.d.ts +4 -1
- package/dist/src/core/progress/progress-tracker.d.ts.map +1 -1
- package/dist/src/core/progress/progress-tracker.js +33 -4
- package/dist/src/core/progress/progress-tracker.js.map +1 -1
- package/dist/src/core/spec-content-sync.d.ts +1 -1
- package/dist/src/core/spec-content-sync.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.js +39 -7
- package/dist/src/integrations/ado/ado-dependency-loader.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh +1 -1
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh.bak +245 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
- package/plugins/specweave/hooks/lib/sync-spec-content.sh.bak +149 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +34 -4
- package/plugins/specweave/hooks/lib/validate-spec-status.sh +1 -1
- package/plugins/specweave/hooks/lib/validate-spec-status.sh.bak +163 -0
- package/plugins/specweave/hooks/post-first-increment.sh +1 -1
- package/plugins/specweave/hooks/post-first-increment.sh.bak +61 -0
- package/plugins/specweave/hooks/post-spec-update.sh +1 -1
- package/plugins/specweave/hooks/post-spec-update.sh.bak +158 -0
- package/plugins/specweave/hooks/post-user-story-complete.sh +1 -1
- package/plugins/specweave/hooks/post-user-story-complete.sh.bak +179 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh +1 -1
- package/plugins/specweave/hooks/pre-command-deduplication.sh.bak +83 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
- package/plugins/specweave/hooks/user-prompt-submit.sh.bak +386 -0
- package/plugins/specweave/skills/specweave-framework/SKILL.md +1 -1
- package/plugins/specweave-ado/agents/ado-manager/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-multi-project-mapper/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-sync-judge/AGENT.md +23 -0
- package/plugins/specweave-backend/agents/database-optimizer/AGENT.md +23 -0
- package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +23 -0
- package/plugins/specweave-diagrams/agents/diagrams-architect/AGENT.md +23 -0
- package/plugins/specweave-github/agents/github-manager/AGENT.md +23 -0
- package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +25 -0
- package/plugins/specweave-github/agents/user-story-updater/AGENT.md +25 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.js +49 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +67 -0
- package/plugins/specweave-infrastructure/agents/devops/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/network-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/performance-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/sre/AGENT.md +26 -0
- package/plugins/specweave-jira/agents/jira-manager/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +26 -0
- package/plugins/specweave-kubernetes/agents/kubernetes-architect/AGENT.md +26 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +2 -2
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/mlops-engineer/AGENT.md +26 -0
- package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +26 -0
- package/plugins/specweave-payments/agents/payment-integration/AGENT.md +26 -0
- package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +19 -0
- package/plugins/specweave-plugin-dev/skills/plugin-expert/SKILL.md +1231 -0
- package/plugins/specweave-release/agents/release-manager/AGENT.md +27 -0
- package/plugins/specweave/skills/plugin-expert/SKILL.md +0 -340
|
@@ -0,0 +1,1231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plugin-expert
|
|
3
|
+
description: Expert on CREATING custom Claude Code plugins. Covers SKILL.md authoring, YAML frontmatter syntax, AGENT.md structure, hook registration in plugin.json, allowed-tools configuration, and marketplace.json format. Use when DEVELOPING custom plugins, writing skills, creating agents, or building plugin systems. Activates for skill authoring, agent creation, hook development, plugin.json configuration, SKILL.md format, AGENT.md structure, custom plugin development, YAML frontmatter syntax, allowed-tools field, hook registration, marketplace.json structure.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Plugin Expert - Complete Claude Code Plugin Authority
|
|
7
|
+
|
|
8
|
+
**Purpose**: The definitive, comprehensive source of truth for ALL aspects of Claude Code's plugin ecosystem.
|
|
9
|
+
|
|
10
|
+
**Scope**: Plugin structure, manifest format, commands, agents, skills, hooks, MCP servers, marketplaces, installation, development, troubleshooting, and team workflows.
|
|
11
|
+
|
|
12
|
+
**When to Use**: ALWAYS consult this skill for ANY plugin-related task, question, or development work.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 📋 Table of Contents
|
|
17
|
+
|
|
18
|
+
1. [Quick Reference](#quick-reference)
|
|
19
|
+
2. [Plugin System Architecture](#plugin-system-architecture)
|
|
20
|
+
3. [Plugin Manifest (plugin.json)](#plugin-manifest-pluginjson)
|
|
21
|
+
4. [Plugin Components](#plugin-components)
|
|
22
|
+
5. [Skills System](#skills-system)
|
|
23
|
+
6. [Agents System](#agents-system)
|
|
24
|
+
7. [Hooks System](#hooks-system)
|
|
25
|
+
8. [MCP Servers](#mcp-servers)
|
|
26
|
+
9. [Marketplace Management](#marketplace-management)
|
|
27
|
+
10. [marketplace.json Format](#marketplacejson-format)
|
|
28
|
+
11. [Team Workflows](#team-workflows)
|
|
29
|
+
12. [Development Best Practices](#development-best-practices)
|
|
30
|
+
13. [Troubleshooting](#troubleshooting)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Quick Reference
|
|
35
|
+
|
|
36
|
+
### Essential Commands
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Install plugin
|
|
40
|
+
/plugin install <plugin-name>
|
|
41
|
+
|
|
42
|
+
# List installed plugins
|
|
43
|
+
/plugin list --installed
|
|
44
|
+
|
|
45
|
+
# Add marketplace (GitHub)
|
|
46
|
+
/plugin marketplace add owner/repo
|
|
47
|
+
|
|
48
|
+
# Add marketplace (local)
|
|
49
|
+
/plugin marketplace add ./path/to/marketplace
|
|
50
|
+
|
|
51
|
+
# List marketplaces
|
|
52
|
+
/plugin marketplace list
|
|
53
|
+
|
|
54
|
+
# Uninstall plugin
|
|
55
|
+
/plugin uninstall <plugin-name>
|
|
56
|
+
|
|
57
|
+
# Update plugin
|
|
58
|
+
/plugin update <plugin-name>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Critical Rules
|
|
62
|
+
|
|
63
|
+
✅ **CORRECT**: `/plugin install specweave-github`
|
|
64
|
+
❌ **WRONG**: `/plugin install specweave-github@specweave` (no @marketplace syntax!)
|
|
65
|
+
|
|
66
|
+
✅ **CORRECT**: Marketplace auto-resolution from registered marketplaces
|
|
67
|
+
❌ **WRONG**: Manual marketplace specification in install commands
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Plugin System Architecture
|
|
72
|
+
|
|
73
|
+
### Directory Structure
|
|
74
|
+
|
|
75
|
+
**Standard plugin layout:**
|
|
76
|
+
```
|
|
77
|
+
plugin-name/
|
|
78
|
+
├── .claude-plugin/
|
|
79
|
+
│ └── plugin.json # REQUIRED: Plugin manifest
|
|
80
|
+
├── commands/ # OPTIONAL: Slash commands
|
|
81
|
+
│ └── my-command.md
|
|
82
|
+
├── agents/ # OPTIONAL: Custom agents
|
|
83
|
+
│ └── my-agent/
|
|
84
|
+
│ └── AGENT.md
|
|
85
|
+
├── skills/ # OPTIONAL: Agent skills
|
|
86
|
+
│ └── my-skill/
|
|
87
|
+
│ └── SKILL.md
|
|
88
|
+
├── hooks/ # OPTIONAL: Event handlers
|
|
89
|
+
│ └── hooks.json
|
|
90
|
+
└── .mcp.json # OPTIONAL: MCP server config
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Critical**: Components (commands/, agents/, skills/, hooks/) MUST be at plugin root, NOT inside `.claude-plugin/`
|
|
94
|
+
|
|
95
|
+
### Core Concepts
|
|
96
|
+
|
|
97
|
+
**Plugins** extend Claude Code with custom functionality across projects and teams.
|
|
98
|
+
|
|
99
|
+
**Components** (5 types):
|
|
100
|
+
1. **Commands** - User-invoked slash commands
|
|
101
|
+
2. **Agents** - Autonomous specialized agents
|
|
102
|
+
3. **Skills** - Model-invoked knowledge modules
|
|
103
|
+
4. **Hooks** - Event-driven automation
|
|
104
|
+
5. **MCP Servers** - External tool integration
|
|
105
|
+
|
|
106
|
+
**Marketplaces** - Catalogs of discoverable plugins with centralized version management
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Plugin Manifest (plugin.json)
|
|
111
|
+
|
|
112
|
+
### Location
|
|
113
|
+
`.claude-plugin/plugin.json` (required for all plugins)
|
|
114
|
+
|
|
115
|
+
### Format
|
|
116
|
+
|
|
117
|
+
**Minimal manifest:**
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"name": "plugin-identifier",
|
|
121
|
+
"description": "Clear description of functionality",
|
|
122
|
+
"version": "1.0.0",
|
|
123
|
+
"author": {
|
|
124
|
+
"name": "Your Name"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Complete manifest:**
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"name": "my-plugin",
|
|
133
|
+
"description": "Detailed plugin description",
|
|
134
|
+
"version": "1.2.3",
|
|
135
|
+
"author": {
|
|
136
|
+
"name": "Author Name",
|
|
137
|
+
"email": "author@example.com",
|
|
138
|
+
"url": "https://example.com"
|
|
139
|
+
},
|
|
140
|
+
"homepage": "https://github.com/user/plugin",
|
|
141
|
+
"repository": {
|
|
142
|
+
"type": "git",
|
|
143
|
+
"url": "https://github.com/user/plugin.git"
|
|
144
|
+
},
|
|
145
|
+
"license": "MIT",
|
|
146
|
+
"keywords": ["automation", "testing"],
|
|
147
|
+
"category": "development-tools",
|
|
148
|
+
"tags": ["ci-cd", "quality"]
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Required Fields
|
|
153
|
+
|
|
154
|
+
- `name` - Kebab-case identifier (e.g., "my-awesome-plugin")
|
|
155
|
+
- `description` - Clear, concise functionality description
|
|
156
|
+
- `version` - Semantic versioning (e.g., "1.2.3")
|
|
157
|
+
- `author.name` - Creator/maintainer name
|
|
158
|
+
|
|
159
|
+
### Optional Fields
|
|
160
|
+
|
|
161
|
+
- `author.email`, `author.url` - Contact information
|
|
162
|
+
- `homepage` - Project website/documentation
|
|
163
|
+
- `repository` - Source code location
|
|
164
|
+
- `license` - Open source license (MIT, Apache-2.0, etc.)
|
|
165
|
+
- `keywords` - Search/discovery terms
|
|
166
|
+
- `category` - Primary classification
|
|
167
|
+
- `tags` - Additional metadata tags
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Plugin Components
|
|
172
|
+
|
|
173
|
+
### 1. Commands (Slash Commands)
|
|
174
|
+
|
|
175
|
+
**Location**: `commands/` directory
|
|
176
|
+
|
|
177
|
+
**Format**: Markdown files with YAML frontmatter
|
|
178
|
+
|
|
179
|
+
**Example** (`commands/hello.md`):
|
|
180
|
+
```yaml
|
|
181
|
+
---
|
|
182
|
+
name: hello
|
|
183
|
+
description: Greet the user warmly
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
# Hello Command
|
|
187
|
+
|
|
188
|
+
Greet the user with a friendly message.
|
|
189
|
+
|
|
190
|
+
When invoked, say: "Hello! How can I help you today?"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Usage**: `/hello` (command name from frontmatter)
|
|
194
|
+
|
|
195
|
+
**Best Practices**:
|
|
196
|
+
- Keep commands focused on single actions
|
|
197
|
+
- Provide clear descriptions
|
|
198
|
+
- Include usage examples in the markdown body
|
|
199
|
+
|
|
200
|
+
### 2. Agents
|
|
201
|
+
|
|
202
|
+
**Location**: `agents/agent-name/` subdirectories
|
|
203
|
+
|
|
204
|
+
**Format**: `AGENT.md` files with instructions
|
|
205
|
+
|
|
206
|
+
**Example** (`agents/code-reviewer/AGENT.md`):
|
|
207
|
+
```markdown
|
|
208
|
+
# Code Reviewer Agent
|
|
209
|
+
|
|
210
|
+
You are an expert code reviewer focused on:
|
|
211
|
+
- Code quality and best practices
|
|
212
|
+
- Security vulnerabilities
|
|
213
|
+
- Performance optimization
|
|
214
|
+
- Documentation completeness
|
|
215
|
+
|
|
216
|
+
## Review Process
|
|
217
|
+
|
|
218
|
+
1. Read the code files
|
|
219
|
+
2. Analyze for issues
|
|
220
|
+
3. Provide structured feedback
|
|
221
|
+
4. Suggest improvements
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Invocation**: Via `Task` tool with `subagent_type`
|
|
225
|
+
|
|
226
|
+
**Naming convention**: `{plugin}:{directory}:{yaml-name}`
|
|
227
|
+
|
|
228
|
+
### 3. Skills (covered in detail below)
|
|
229
|
+
|
|
230
|
+
### 4. Hooks (covered in detail below)
|
|
231
|
+
|
|
232
|
+
### 5. MCP Servers (covered in detail below)
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Skills System
|
|
237
|
+
|
|
238
|
+
### What Are Skills?
|
|
239
|
+
|
|
240
|
+
**Skills** are model-invoked knowledge modules that Claude automatically activates based on task context. Unlike commands (user-invoked) or agents (explicitly called), skills are **autonomous**.
|
|
241
|
+
|
|
242
|
+
### Directory Structure
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
skills/
|
|
246
|
+
└── my-skill/ # Skill directory
|
|
247
|
+
├── SKILL.md # REQUIRED: Main skill file
|
|
248
|
+
├── templates/ # OPTIONAL: Supporting files
|
|
249
|
+
└── examples/ # OPTIONAL: Documentation
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### SKILL.md Format
|
|
253
|
+
|
|
254
|
+
**Complete template:**
|
|
255
|
+
```yaml
|
|
256
|
+
---
|
|
257
|
+
name: skill-name
|
|
258
|
+
description: What it does AND when to use it. Include trigger keywords users might say.
|
|
259
|
+
allowed-tools: Read, Grep, Glob
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
# Skill Title
|
|
263
|
+
|
|
264
|
+
## What I Know
|
|
265
|
+
|
|
266
|
+
Detailed knowledge and capabilities.
|
|
267
|
+
|
|
268
|
+
## When to Use This Skill
|
|
269
|
+
|
|
270
|
+
Specific scenarios and keywords that should activate this skill:
|
|
271
|
+
- "How do I..."
|
|
272
|
+
- "Help me with..."
|
|
273
|
+
- "I need to..."
|
|
274
|
+
|
|
275
|
+
## Instructions
|
|
276
|
+
|
|
277
|
+
Step-by-step guidance for Claude when this skill is active.
|
|
278
|
+
|
|
279
|
+
## Examples
|
|
280
|
+
|
|
281
|
+
Concrete examples of usage.
|
|
282
|
+
|
|
283
|
+
## References
|
|
284
|
+
|
|
285
|
+
Links to documentation, tools, or resources.
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### YAML Frontmatter Requirements
|
|
289
|
+
|
|
290
|
+
**Required fields:**
|
|
291
|
+
- `name` - Lowercase, hyphens only, max 64 chars (e.g., "react-expert")
|
|
292
|
+
- `description` - Functionality + activation triggers, max 1024 chars
|
|
293
|
+
|
|
294
|
+
**Optional field:**
|
|
295
|
+
- `allowed-tools` - Restricts available tools (security/scope control)
|
|
296
|
+
|
|
297
|
+
**Critical rules:**
|
|
298
|
+
1. Opening `---` MUST be on line 1
|
|
299
|
+
2. Closing `---` MUST appear before markdown content
|
|
300
|
+
3. No YAML frontmatter = skill won't load!
|
|
301
|
+
|
|
302
|
+
### Description Best Practices
|
|
303
|
+
|
|
304
|
+
**❌ Bad (too vague):**
|
|
305
|
+
```yaml
|
|
306
|
+
description: Helps with data processing
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**✅ Good (specific with triggers):**
|
|
310
|
+
```yaml
|
|
311
|
+
description: Analyze Excel spreadsheets, generate pivot tables, create charts. Activates when working with .xlsx files, data analysis, spreadsheet manipulation, Excel formulas, pivot tables, data visualization.
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Why it matters**: Claude uses the description to decide when to activate the skill!
|
|
315
|
+
|
|
316
|
+
### Allowed-Tools Field
|
|
317
|
+
|
|
318
|
+
**Purpose**: Restrict tool access for security or scope control
|
|
319
|
+
|
|
320
|
+
**Example** (read-only skill):
|
|
321
|
+
```yaml
|
|
322
|
+
allowed-tools: Read, Grep, Glob
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Example** (full development skill):
|
|
326
|
+
```yaml
|
|
327
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Available tools**: Read, Write, Edit, Bash, Grep, Glob, Task, WebFetch, WebSearch, TodoWrite, etc.
|
|
331
|
+
|
|
332
|
+
**Use cases**:
|
|
333
|
+
- Documentation skills (read-only)
|
|
334
|
+
- Analysis skills (no file modifications)
|
|
335
|
+
- Sensitive workflows (restricted capabilities)
|
|
336
|
+
|
|
337
|
+
### Skill Activation & Discovery
|
|
338
|
+
|
|
339
|
+
**Discovery locations:**
|
|
340
|
+
1. Personal skills: `~/.claude/skills/`
|
|
341
|
+
2. Project skills: `.claude/skills/` (shared via git)
|
|
342
|
+
3. Plugin skills: `plugins/*/skills/` (from installed plugins)
|
|
343
|
+
|
|
344
|
+
**Activation mechanism**:
|
|
345
|
+
- Claude reads skill descriptions
|
|
346
|
+
- Matches user request to description keywords
|
|
347
|
+
- Automatically activates relevant skills
|
|
348
|
+
- NO explicit user invocation needed
|
|
349
|
+
|
|
350
|
+
**Tips for better activation:**
|
|
351
|
+
- Include variations of keywords (e.g., "React, react, JSX, jsx, hooks, useState, useEffect")
|
|
352
|
+
- List common user phrasings
|
|
353
|
+
- Be specific about when to activate
|
|
354
|
+
- Use domain-specific terminology
|
|
355
|
+
|
|
356
|
+
### Skills vs Commands vs Agents
|
|
357
|
+
|
|
358
|
+
| Aspect | Skills | Commands | Agents |
|
|
359
|
+
|--------|--------|----------|--------|
|
|
360
|
+
| **Invocation** | Automatic (model-invoked) | Manual (`/command`) | Explicit (`Task` tool) |
|
|
361
|
+
| **File** | `SKILL.md` | Markdown with frontmatter | `AGENT.md` |
|
|
362
|
+
| **Location** | `skills/name/SKILL.md` | `commands/name.md` | `agents/name/AGENT.md` |
|
|
363
|
+
| **Activation** | Description matching | User types slash command | Code calls Task tool |
|
|
364
|
+
| **Purpose** | Knowledge/guidance | One-time actions | Complex workflows |
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Agents System
|
|
369
|
+
|
|
370
|
+
### What Are Agents?
|
|
371
|
+
|
|
372
|
+
**Agents** are specialized autonomous workers explicitly invoked via the `Task` tool with a `subagent_type` parameter.
|
|
373
|
+
|
|
374
|
+
### Directory Structure
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
agents/
|
|
378
|
+
└── my-agent/
|
|
379
|
+
└── AGENT.md # Agent instructions
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### AGENT.md Format
|
|
383
|
+
|
|
384
|
+
**Example:**
|
|
385
|
+
```markdown
|
|
386
|
+
# Agent Name
|
|
387
|
+
|
|
388
|
+
## Role
|
|
389
|
+
|
|
390
|
+
You are a specialist in [domain].
|
|
391
|
+
|
|
392
|
+
## Responsibilities
|
|
393
|
+
|
|
394
|
+
1. Task A
|
|
395
|
+
2. Task B
|
|
396
|
+
3. Task C
|
|
397
|
+
|
|
398
|
+
## Workflow
|
|
399
|
+
|
|
400
|
+
1. Step 1
|
|
401
|
+
2. Step 2
|
|
402
|
+
3. Step 3
|
|
403
|
+
|
|
404
|
+
## Output Format
|
|
405
|
+
|
|
406
|
+
Describe expected output structure.
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Invocation
|
|
410
|
+
|
|
411
|
+
**TypeScript/JavaScript:**
|
|
412
|
+
```typescript
|
|
413
|
+
Task({
|
|
414
|
+
subagent_type: "plugin-name:agent-directory:agent-name",
|
|
415
|
+
prompt: "Detailed task description",
|
|
416
|
+
model: "haiku" // optional: haiku, sonnet, opus
|
|
417
|
+
});
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**Naming convention**: `{plugin}:{directory}:{yaml-name}`
|
|
421
|
+
|
|
422
|
+
**Examples:**
|
|
423
|
+
- `specweave:pm:pm` - Project Manager agent
|
|
424
|
+
- `specweave-github:github-manager:github-manager`
|
|
425
|
+
- `specweave-ml:data-scientist:data-scientist`
|
|
426
|
+
|
|
427
|
+
### Agent Invocation Documentation
|
|
428
|
+
|
|
429
|
+
**MANDATORY section** in every AGENT.md:
|
|
430
|
+
|
|
431
|
+
```markdown
|
|
432
|
+
## How to Invoke This Agent
|
|
433
|
+
|
|
434
|
+
**Subagent Type**: `plugin-name:agent-name:agent-name`
|
|
435
|
+
|
|
436
|
+
**Usage Example**:
|
|
437
|
+
```typescript
|
|
438
|
+
Task({
|
|
439
|
+
subagent_type: "plugin-name:agent-name:agent-name",
|
|
440
|
+
prompt: "Your task description here"
|
|
441
|
+
});
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
**When to Use**:
|
|
445
|
+
- Scenario A
|
|
446
|
+
- Scenario B
|
|
447
|
+
- Scenario C
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Pre-commit hooks** validate this section exists!
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Hooks System
|
|
455
|
+
|
|
456
|
+
### What Are Hooks?
|
|
457
|
+
|
|
458
|
+
**Hooks** are event handlers that trigger automatically during Claude Code workflow events.
|
|
459
|
+
|
|
460
|
+
### Location
|
|
461
|
+
|
|
462
|
+
`hooks/` directory with individual hook scripts
|
|
463
|
+
|
|
464
|
+
### Hook Registration
|
|
465
|
+
|
|
466
|
+
**File**: `.claude-plugin/plugin.json`
|
|
467
|
+
|
|
468
|
+
**Format**:
|
|
469
|
+
```json
|
|
470
|
+
{
|
|
471
|
+
"name": "my-plugin",
|
|
472
|
+
"hooks": {
|
|
473
|
+
"PostToolUse": [
|
|
474
|
+
{
|
|
475
|
+
"matcher": "TodoWrite",
|
|
476
|
+
"hooks": [{
|
|
477
|
+
"type": "command",
|
|
478
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-task-completion.sh",
|
|
479
|
+
"timeout": 10
|
|
480
|
+
}]
|
|
481
|
+
}
|
|
482
|
+
],
|
|
483
|
+
"UserPromptSubmit": [
|
|
484
|
+
{
|
|
485
|
+
"hooks": [{
|
|
486
|
+
"type": "command",
|
|
487
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/validate-context.sh",
|
|
488
|
+
"timeout": 5
|
|
489
|
+
}]
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### Valid Hook Events (10 total)
|
|
497
|
+
|
|
498
|
+
1. **PostToolUse** - After any tool execution
|
|
499
|
+
2. **PreToolUse** - Before any tool execution
|
|
500
|
+
3. **PermissionRequest** - When permission needed
|
|
501
|
+
4. **Notification** - On system notifications
|
|
502
|
+
5. **UserPromptSubmit** - When user sends message
|
|
503
|
+
6. **Stop** - When main agent stops
|
|
504
|
+
7. **SubagentStop** - When subagent completes
|
|
505
|
+
8. **PreCompact** - Before context compaction
|
|
506
|
+
9. **SessionStart** - Session initialization
|
|
507
|
+
10. **SessionEnd** - Session termination
|
|
508
|
+
|
|
509
|
+
### Hook Configuration
|
|
510
|
+
|
|
511
|
+
**Fields:**
|
|
512
|
+
- `matcher` - Tool name to match (for Tool hooks only)
|
|
513
|
+
- `hooks` - Array of hook definitions
|
|
514
|
+
- `type` - Always "command" for shell scripts
|
|
515
|
+
- `command` - Path to executable (use `${CLAUDE_PLUGIN_ROOT}`)
|
|
516
|
+
- `timeout` - Execution timeout in seconds
|
|
517
|
+
|
|
518
|
+
**Example with matcher** (PostToolUse):
|
|
519
|
+
```json
|
|
520
|
+
{
|
|
521
|
+
"PostToolUse": [
|
|
522
|
+
{
|
|
523
|
+
"matcher": "TodoWrite",
|
|
524
|
+
"hooks": [{
|
|
525
|
+
"type": "command",
|
|
526
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/sync-tasks.sh",
|
|
527
|
+
"timeout": 10
|
|
528
|
+
}]
|
|
529
|
+
}
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**Example without matcher** (UserPromptSubmit):
|
|
535
|
+
```json
|
|
536
|
+
{
|
|
537
|
+
"UserPromptSubmit": [
|
|
538
|
+
{
|
|
539
|
+
"hooks": [{
|
|
540
|
+
"type": "command",
|
|
541
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/validate-input.sh",
|
|
542
|
+
"timeout": 5
|
|
543
|
+
}]
|
|
544
|
+
}
|
|
545
|
+
]
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### Hook Safety (CRITICAL!)
|
|
550
|
+
|
|
551
|
+
**MANDATORY safety mechanisms** (as of v0.24.3):
|
|
552
|
+
|
|
553
|
+
1. **Kill switch**:
|
|
554
|
+
```bash
|
|
555
|
+
if [ "${SPECWEAVE_DISABLE_HOOKS:-0}" = "1" ]; then
|
|
556
|
+
exit 0
|
|
557
|
+
fi
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
2. **Circuit breaker** (3-failure threshold):
|
|
561
|
+
```bash
|
|
562
|
+
if [ -f ".specweave/state/.hook-circuit-breaker" ]; then
|
|
563
|
+
exit 0
|
|
564
|
+
fi
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
3. **File locking** (prevent concurrent execution):
|
|
568
|
+
```bash
|
|
569
|
+
LOCK_DIR=".specweave/state/.hook-my-hook.lock"
|
|
570
|
+
if ! mkdir "$LOCK_DIR" 2>/dev/null; then
|
|
571
|
+
exit 0 # Another instance running
|
|
572
|
+
fi
|
|
573
|
+
trap 'rm -rf "$LOCK_DIR"' EXIT
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
4. **Debouncing** (5-second window):
|
|
577
|
+
```bash
|
|
578
|
+
DEBOUNCE_FILE=".specweave/state/.hook-debounce"
|
|
579
|
+
CURRENT_TIME=$(date +%s)
|
|
580
|
+
if [ -f "$DEBOUNCE_FILE" ]; then
|
|
581
|
+
LAST_TIME=$(cat "$DEBOUNCE_FILE")
|
|
582
|
+
TIME_DIFF=$((CURRENT_TIME - LAST_TIME))
|
|
583
|
+
if [ "$TIME_DIFF" -lt 5 ]; then
|
|
584
|
+
exit 0 # Too soon, skip
|
|
585
|
+
fi
|
|
586
|
+
fi
|
|
587
|
+
echo "$CURRENT_TIME" > "$DEBOUNCE_FILE"
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
5. **Error isolation** (NEVER propagate errors):
|
|
591
|
+
```bash
|
|
592
|
+
set +e # NEVER use set -e
|
|
593
|
+
# ... hook logic ...
|
|
594
|
+
exit 0 # ALWAYS exit 0
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
6. **Background work** (consolidate processes):
|
|
598
|
+
```bash
|
|
599
|
+
(
|
|
600
|
+
# Consolidate all heavy work here
|
|
601
|
+
node script1.js
|
|
602
|
+
node script2.js
|
|
603
|
+
) &
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
**Why this matters**: Hooks can crash Claude Code if not properly isolated!
|
|
607
|
+
|
|
608
|
+
**See**: CLAUDE.md → "9a. Hook Performance & Safety"
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
## MCP Servers
|
|
613
|
+
|
|
614
|
+
### What Are MCP Servers?
|
|
615
|
+
|
|
616
|
+
**MCP** (Model Context Protocol) servers integrate external tools and APIs into Claude Code.
|
|
617
|
+
|
|
618
|
+
### Configuration
|
|
619
|
+
|
|
620
|
+
**File**: `.mcp.json` in plugin root
|
|
621
|
+
|
|
622
|
+
**Example**:
|
|
623
|
+
```json
|
|
624
|
+
{
|
|
625
|
+
"mcpServers": {
|
|
626
|
+
"my-tool": {
|
|
627
|
+
"command": "npx",
|
|
628
|
+
"args": ["-y", "@example/mcp-server"],
|
|
629
|
+
"env": {
|
|
630
|
+
"API_KEY": "secret-value"
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### Best Practices
|
|
638
|
+
|
|
639
|
+
- Use environment variables for secrets
|
|
640
|
+
- Test MCP servers independently
|
|
641
|
+
- Provide fallback mechanisms
|
|
642
|
+
- Document required dependencies
|
|
643
|
+
|
|
644
|
+
**Official reference**: https://code.claude.com/docs/en/mcp-servers
|
|
645
|
+
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
## Marketplace Management
|
|
649
|
+
|
|
650
|
+
### What Are Marketplaces?
|
|
651
|
+
|
|
652
|
+
**Marketplaces** are catalogs of plugins that enable discovery, installation, and version management.
|
|
653
|
+
|
|
654
|
+
### Registration Methods
|
|
655
|
+
|
|
656
|
+
**1. GitHub marketplace:**
|
|
657
|
+
```bash
|
|
658
|
+
/plugin marketplace add owner/repo
|
|
659
|
+
# Example: /plugin marketplace add anton-abyzov/specweave
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
**2. Git URL:**
|
|
663
|
+
```bash
|
|
664
|
+
/plugin marketplace add https://gitlab.com/company/plugins.git
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
**3. Local path (development only):**
|
|
668
|
+
```bash
|
|
669
|
+
/plugin marketplace add ./path/to/marketplace
|
|
670
|
+
/plugin marketplace add ./.claude-plugin
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**4. Direct URL:**
|
|
674
|
+
```bash
|
|
675
|
+
/plugin marketplace add https://url.of/marketplace.json
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
### Marketplace Operations
|
|
679
|
+
|
|
680
|
+
```bash
|
|
681
|
+
# List all marketplaces
|
|
682
|
+
/plugin marketplace list
|
|
683
|
+
|
|
684
|
+
# Update marketplace metadata
|
|
685
|
+
/plugin marketplace update marketplace-name
|
|
686
|
+
|
|
687
|
+
# Remove marketplace (WARNING: uninstalls plugins!)
|
|
688
|
+
/plugin marketplace remove marketplace-name
|
|
689
|
+
|
|
690
|
+
# Validate marketplace.json syntax
|
|
691
|
+
claude plugin validate
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
### Local vs Remote Marketplaces
|
|
695
|
+
|
|
696
|
+
**Local marketplaces**:
|
|
697
|
+
- Development and testing
|
|
698
|
+
- Validate before distribution
|
|
699
|
+
- File path or directory-based
|
|
700
|
+
|
|
701
|
+
**Remote marketplaces**:
|
|
702
|
+
- GitHub/GitLab/Git hosting
|
|
703
|
+
- Version control integration
|
|
704
|
+
- Team collaboration
|
|
705
|
+
- Automatic updates
|
|
706
|
+
|
|
707
|
+
---
|
|
708
|
+
|
|
709
|
+
## marketplace.json Format
|
|
710
|
+
|
|
711
|
+
### Location
|
|
712
|
+
`.claude-plugin/marketplace.json` in repository root
|
|
713
|
+
|
|
714
|
+
### Complete Format
|
|
715
|
+
|
|
716
|
+
```json
|
|
717
|
+
{
|
|
718
|
+
"name": "marketplace-identifier",
|
|
719
|
+
"owner": {
|
|
720
|
+
"name": "Organization Name",
|
|
721
|
+
"email": "contact@example.com",
|
|
722
|
+
"url": "https://example.com"
|
|
723
|
+
},
|
|
724
|
+
"metadata": {
|
|
725
|
+
"description": "Marketplace description",
|
|
726
|
+
"version": "1.0.0",
|
|
727
|
+
"pluginRoot": "./plugins"
|
|
728
|
+
},
|
|
729
|
+
"plugins": [
|
|
730
|
+
{
|
|
731
|
+
"name": "plugin-one",
|
|
732
|
+
"source": "./plugins/plugin-one",
|
|
733
|
+
"description": "Plugin description",
|
|
734
|
+
"version": "1.2.3",
|
|
735
|
+
"author": {
|
|
736
|
+
"name": "Author Name"
|
|
737
|
+
},
|
|
738
|
+
"homepage": "https://github.com/user/plugin",
|
|
739
|
+
"repository": {
|
|
740
|
+
"type": "git",
|
|
741
|
+
"url": "https://github.com/user/plugin.git"
|
|
742
|
+
},
|
|
743
|
+
"license": "MIT",
|
|
744
|
+
"keywords": ["automation", "testing"],
|
|
745
|
+
"category": "development-tools",
|
|
746
|
+
"tags": ["ci-cd", "quality"]
|
|
747
|
+
}
|
|
748
|
+
]
|
|
749
|
+
}
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
### Required Fields
|
|
753
|
+
|
|
754
|
+
**Marketplace level:**
|
|
755
|
+
- `name` - Marketplace identifier (kebab-case)
|
|
756
|
+
- `owner` - Maintainer information object
|
|
757
|
+
- `plugins` - Array of plugin entries
|
|
758
|
+
|
|
759
|
+
**Plugin entry level:**
|
|
760
|
+
- `name` - Plugin identifier (kebab-case)
|
|
761
|
+
- `source` - Plugin location (string or object)
|
|
762
|
+
|
|
763
|
+
### Plugin Source Types
|
|
764
|
+
|
|
765
|
+
**1. Relative path** (same repository):
|
|
766
|
+
```json
|
|
767
|
+
{
|
|
768
|
+
"name": "my-plugin",
|
|
769
|
+
"source": "./plugins/my-plugin"
|
|
770
|
+
}
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
**2. GitHub repository**:
|
|
774
|
+
```json
|
|
775
|
+
{
|
|
776
|
+
"name": "github-plugin",
|
|
777
|
+
"source": {
|
|
778
|
+
"source": "github",
|
|
779
|
+
"repo": "owner/plugin-repo",
|
|
780
|
+
"path": ".claude-plugin"
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
**3. Git URL**:
|
|
786
|
+
```json
|
|
787
|
+
{
|
|
788
|
+
"name": "git-plugin",
|
|
789
|
+
"source": {
|
|
790
|
+
"source": "url",
|
|
791
|
+
"url": "https://gitlab.com/team/plugin.git",
|
|
792
|
+
"path": ".claude-plugin"
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
### Optional Metadata
|
|
798
|
+
|
|
799
|
+
**Marketplace metadata:**
|
|
800
|
+
- `metadata.description` - Brief marketplace description
|
|
801
|
+
- `metadata.version` - Marketplace version
|
|
802
|
+
- `metadata.pluginRoot` - Base path for relative sources
|
|
803
|
+
|
|
804
|
+
**Plugin metadata:**
|
|
805
|
+
- `description`, `version`, `author`, `homepage`
|
|
806
|
+
- `repository`, `license`, `keywords`
|
|
807
|
+
- `category`, `tags`
|
|
808
|
+
- `commands`, `agents`, `hooks`, `mcpServers` (component counts)
|
|
809
|
+
|
|
810
|
+
---
|
|
811
|
+
|
|
812
|
+
## Team Workflows
|
|
813
|
+
|
|
814
|
+
### .claude/settings.json Configuration
|
|
815
|
+
|
|
816
|
+
**Purpose**: Automatically install marketplaces and plugins when team members trust the repository.
|
|
817
|
+
|
|
818
|
+
**File location**: `.claude/settings.json` (project root, committed to git)
|
|
819
|
+
|
|
820
|
+
**Format:**
|
|
821
|
+
```json
|
|
822
|
+
{
|
|
823
|
+
"extraKnownMarketplaces": {
|
|
824
|
+
"specweave": {
|
|
825
|
+
"source": {
|
|
826
|
+
"source": "github",
|
|
827
|
+
"repo": "anton-abyzov/specweave",
|
|
828
|
+
"path": ".claude-plugin"
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
"company-internal": {
|
|
832
|
+
"source": {
|
|
833
|
+
"source": "github",
|
|
834
|
+
"repo": "company/internal-plugins",
|
|
835
|
+
"path": ".claude-plugin"
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
"plugins": {
|
|
840
|
+
"specweave": {
|
|
841
|
+
"enabled": true,
|
|
842
|
+
"version": "latest"
|
|
843
|
+
},
|
|
844
|
+
"specweave-github": {
|
|
845
|
+
"enabled": true,
|
|
846
|
+
"version": "latest"
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
### extraKnownMarketplaces Field
|
|
853
|
+
|
|
854
|
+
**Supported source types:**
|
|
855
|
+
- GitHub: `{"source": "github", "repo": "owner/repo"}`
|
|
856
|
+
- Git URL: `{"source": "url", "url": "https://..."}`
|
|
857
|
+
|
|
858
|
+
**NOT supported:**
|
|
859
|
+
- ❌ Local paths: `{"source": "./.claude-plugin"}` (CLI only!)
|
|
860
|
+
- ❌ Direct marketplace.json URLs
|
|
861
|
+
|
|
862
|
+
**Critical**: `extraKnownMarketplaces` in settings.json ONLY supports remote sources (GitHub, Git). Use CLI for local development.
|
|
863
|
+
|
|
864
|
+
### Team Rollout Process
|
|
865
|
+
|
|
866
|
+
1. Create `.claude/settings.json` in repository
|
|
867
|
+
2. Add `extraKnownMarketplaces` with company marketplace
|
|
868
|
+
3. Specify required plugins in `plugins` section
|
|
869
|
+
4. Commit to git
|
|
870
|
+
5. Team members trust the folder
|
|
871
|
+
6. Claude Code auto-installs marketplaces and plugins
|
|
872
|
+
|
|
873
|
+
### Best Practices for Organizations
|
|
874
|
+
|
|
875
|
+
- **Governance**: Establish plugin approval process
|
|
876
|
+
- **Internal marketplaces**: Proprietary tools and integrations
|
|
877
|
+
- **Training**: Team education on plugin discovery
|
|
878
|
+
- **Security**: Review plugins before team distribution
|
|
879
|
+
- **Documentation**: README with setup instructions
|
|
880
|
+
- **Versioning**: Pin critical plugins to specific versions
|
|
881
|
+
|
|
882
|
+
---
|
|
883
|
+
|
|
884
|
+
## Development Best Practices
|
|
885
|
+
|
|
886
|
+
### Plugin Development Workflow
|
|
887
|
+
|
|
888
|
+
**1. Local development:**
|
|
889
|
+
```bash
|
|
890
|
+
# Add local marketplace for testing
|
|
891
|
+
/plugin marketplace add ./.claude-plugin
|
|
892
|
+
|
|
893
|
+
# Install plugin locally
|
|
894
|
+
/plugin install my-plugin
|
|
895
|
+
|
|
896
|
+
# Iterate on plugin code
|
|
897
|
+
# ... make changes ...
|
|
898
|
+
|
|
899
|
+
# Update plugin
|
|
900
|
+
/plugin update my-plugin
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
**2. Testing:**
|
|
904
|
+
- Test each component individually (commands, agents, skills, hooks)
|
|
905
|
+
- Validate manifest: `claude plugin validate`
|
|
906
|
+
- Verify directory structure (components at root, not in `.claude-plugin/`)
|
|
907
|
+
- Test with different user scenarios
|
|
908
|
+
- Check skill activation with various keywords
|
|
909
|
+
|
|
910
|
+
**3. Distribution:**
|
|
911
|
+
- Push to GitHub/GitLab
|
|
912
|
+
- Create marketplace.json
|
|
913
|
+
- Add versioning (semantic versioning)
|
|
914
|
+
- Write comprehensive README
|
|
915
|
+
- Get peer feedback
|
|
916
|
+
- Publish to team/community
|
|
917
|
+
|
|
918
|
+
### Directory Structure Validation
|
|
919
|
+
|
|
920
|
+
**✅ CORRECT:**
|
|
921
|
+
```
|
|
922
|
+
my-plugin/
|
|
923
|
+
├── .claude-plugin/plugin.json ← Manifest here
|
|
924
|
+
├── commands/ ← Components at root
|
|
925
|
+
├── agents/
|
|
926
|
+
├── skills/
|
|
927
|
+
└── hooks/
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
**❌ WRONG:**
|
|
931
|
+
```
|
|
932
|
+
my-plugin/
|
|
933
|
+
└── .claude-plugin/
|
|
934
|
+
├── plugin.json
|
|
935
|
+
├── commands/ ← NOT inside .claude-plugin!
|
|
936
|
+
├── agents/
|
|
937
|
+
└── skills/
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
### Versioning
|
|
941
|
+
|
|
942
|
+
Use **semantic versioning**:
|
|
943
|
+
- `1.0.0` - Major version (breaking changes)
|
|
944
|
+
- `1.1.0` - Minor version (new features)
|
|
945
|
+
- `1.0.1` - Patch version (bug fixes)
|
|
946
|
+
|
|
947
|
+
Update version in:
|
|
948
|
+
1. `.claude-plugin/plugin.json`
|
|
949
|
+
2. `marketplace.json` (if hosting)
|
|
950
|
+
3. Git tags: `git tag -a v1.2.3 -m "Release 1.2.3"`
|
|
951
|
+
|
|
952
|
+
### Documentation Requirements
|
|
953
|
+
|
|
954
|
+
**README.md** should include:
|
|
955
|
+
- Plugin purpose and features
|
|
956
|
+
- Installation instructions
|
|
957
|
+
- Available commands/agents/skills
|
|
958
|
+
- Configuration options
|
|
959
|
+
- Usage examples
|
|
960
|
+
- Troubleshooting guide
|
|
961
|
+
- Contributing guidelines
|
|
962
|
+
- License information
|
|
963
|
+
|
|
964
|
+
**SKILL.md** for each skill:
|
|
965
|
+
- YAML frontmatter (name, description)
|
|
966
|
+
- What the skill knows
|
|
967
|
+
- When to use it
|
|
968
|
+
- Examples
|
|
969
|
+
- References
|
|
970
|
+
|
|
971
|
+
**AGENT.md** for each agent:
|
|
972
|
+
- Role and responsibilities
|
|
973
|
+
- Workflow steps
|
|
974
|
+
- Output format
|
|
975
|
+
- **How to Invoke This Agent** section (MANDATORY!)
|
|
976
|
+
|
|
977
|
+
### Testing Checklist
|
|
978
|
+
|
|
979
|
+
- [ ] `claude plugin validate` passes
|
|
980
|
+
- [ ] All commands work via `/command-name`
|
|
981
|
+
- [ ] Skills activate with correct keywords
|
|
982
|
+
- [ ] Agents invoke successfully with Task tool
|
|
983
|
+
- [ ] Hooks trigger on correct events
|
|
984
|
+
- [ ] MCP servers connect properly
|
|
985
|
+
- [ ] No security vulnerabilities (secrets, injection)
|
|
986
|
+
- [ ] Documentation is complete
|
|
987
|
+
- [ ] Version numbers are consistent
|
|
988
|
+
|
|
989
|
+
---
|
|
990
|
+
|
|
991
|
+
## Troubleshooting
|
|
992
|
+
|
|
993
|
+
### "Marketplace not found" Error
|
|
994
|
+
|
|
995
|
+
**Symptom**: `/plugin install plugin-name` fails
|
|
996
|
+
|
|
997
|
+
**Diagnosis**:
|
|
998
|
+
```bash
|
|
999
|
+
/plugin marketplace list
|
|
1000
|
+
# If specweave (or your marketplace) not listed...
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
**Fix**:
|
|
1004
|
+
```bash
|
|
1005
|
+
# Register marketplace
|
|
1006
|
+
/plugin marketplace add anton-abyzov/specweave
|
|
1007
|
+
|
|
1008
|
+
# Then retry
|
|
1009
|
+
/plugin install plugin-name
|
|
1010
|
+
```
|
|
1011
|
+
|
|
1012
|
+
### Plugin Not Auto-Activating
|
|
1013
|
+
|
|
1014
|
+
**Symptom**: Plugin installed but skills/agents don't work
|
|
1015
|
+
|
|
1016
|
+
**Causes**:
|
|
1017
|
+
1. Claude Code needs restart
|
|
1018
|
+
2. Skill description keywords don't match context
|
|
1019
|
+
3. Plugin has errors
|
|
1020
|
+
|
|
1021
|
+
**Fix**:
|
|
1022
|
+
```bash
|
|
1023
|
+
# 1. Verify installation
|
|
1024
|
+
/plugin list --installed
|
|
1025
|
+
|
|
1026
|
+
# 2. Restart Claude Code
|
|
1027
|
+
|
|
1028
|
+
# 3. Check skill descriptions
|
|
1029
|
+
# Read plugins/*/skills/*/SKILL.md
|
|
1030
|
+
# Ensure description has keywords matching your task
|
|
1031
|
+
|
|
1032
|
+
# 4. Check for plugin errors
|
|
1033
|
+
# Look in Claude Code logs
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
### Skill Not Activating
|
|
1037
|
+
|
|
1038
|
+
**Symptom**: Skill exists but Claude doesn't use it
|
|
1039
|
+
|
|
1040
|
+
**Debugging**:
|
|
1041
|
+
1. Check YAML frontmatter format (opening `---` on line 1)
|
|
1042
|
+
2. Verify `name` and `description` fields present
|
|
1043
|
+
3. Review description - is it specific enough?
|
|
1044
|
+
4. Check keywords - do they match your request?
|
|
1045
|
+
5. Verify file path: `~/.claude/skills/` or `.claude/skills/` or `plugins/*/skills/`
|
|
1046
|
+
|
|
1047
|
+
**Example of vague description** (won't activate):
|
|
1048
|
+
```yaml
|
|
1049
|
+
description: Helps with data
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
**Example of specific description** (will activate):
|
|
1053
|
+
```yaml
|
|
1054
|
+
description: Analyze Excel spreadsheets, generate pivot tables, create charts. Use when working with .xlsx files, data analysis, spreadsheet manipulation.
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
### Agent Not Found Error
|
|
1058
|
+
|
|
1059
|
+
**Symptom**: `Task` tool call fails with "Agent not found"
|
|
1060
|
+
|
|
1061
|
+
**Diagnosis**:
|
|
1062
|
+
```bash
|
|
1063
|
+
# Check subagent_type format
|
|
1064
|
+
# CORRECT: "plugin-name:agent-directory:agent-name"
|
|
1065
|
+
# WRONG: "plugin-name:agent-name" (missing directory)
|
|
1066
|
+
# WRONG: "skill-name" (skills use Skill tool, not Task tool!)
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
**Fix**:
|
|
1070
|
+
```typescript
|
|
1071
|
+
// ✅ CORRECT
|
|
1072
|
+
Task({ subagent_type: "specweave:pm:pm" });
|
|
1073
|
+
|
|
1074
|
+
// ❌ WRONG
|
|
1075
|
+
Task({ subagent_type: "specweave:pm" });
|
|
1076
|
+
Task({ subagent_type: "increment-planner" }); // This is a skill!
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
### Hook Not Triggering
|
|
1080
|
+
|
|
1081
|
+
**Symptom**: Hook script doesn't execute on expected event
|
|
1082
|
+
|
|
1083
|
+
**Diagnosis**:
|
|
1084
|
+
1. Check `.claude-plugin/plugin.json` hooks section
|
|
1085
|
+
2. Verify event name (PostToolUse, UserPromptSubmit, etc.)
|
|
1086
|
+
3. Check matcher (for tool hooks)
|
|
1087
|
+
4. Ensure hook script is executable: `chmod +x hooks/script.sh`
|
|
1088
|
+
|
|
1089
|
+
**Common mistakes**:
|
|
1090
|
+
```json
|
|
1091
|
+
// ❌ WRONG: Invalid event name
|
|
1092
|
+
{
|
|
1093
|
+
"hooks": {
|
|
1094
|
+
"TodoWrite": { ... } // NOT a valid event!
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// ✅ CORRECT: PostToolUse with matcher
|
|
1099
|
+
{
|
|
1100
|
+
"hooks": {
|
|
1101
|
+
"PostToolUse": [
|
|
1102
|
+
{
|
|
1103
|
+
"matcher": "TodoWrite",
|
|
1104
|
+
"hooks": [...]
|
|
1105
|
+
}
|
|
1106
|
+
]
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
### Installation Hangs or Fails
|
|
1112
|
+
|
|
1113
|
+
**Symptom**: `/plugin install` hangs or times out
|
|
1114
|
+
|
|
1115
|
+
**Causes**:
|
|
1116
|
+
1. Network issues (GitHub fetch failed)
|
|
1117
|
+
2. Marketplace not registered
|
|
1118
|
+
3. Plugin doesn't exist in marketplace
|
|
1119
|
+
|
|
1120
|
+
**Fix**:
|
|
1121
|
+
```bash
|
|
1122
|
+
# 1. Verify marketplace registered
|
|
1123
|
+
/plugin marketplace list
|
|
1124
|
+
|
|
1125
|
+
# 2. Check network connectivity
|
|
1126
|
+
# Try re-adding marketplace (refreshes cache)
|
|
1127
|
+
/plugin marketplace remove specweave
|
|
1128
|
+
/plugin marketplace add anton-abyzov/specweave
|
|
1129
|
+
|
|
1130
|
+
# 3. Verify plugin exists
|
|
1131
|
+
/plugin list # Shows all available plugins
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
### Validation Errors
|
|
1135
|
+
|
|
1136
|
+
**Symptom**: Pre-commit hooks fail or `claude plugin validate` fails
|
|
1137
|
+
|
|
1138
|
+
**Common errors**:
|
|
1139
|
+
1. Invalid JSON in plugin.json or marketplace.json
|
|
1140
|
+
2. Missing required fields
|
|
1141
|
+
3. Empty directories (agents/, skills/ with no content)
|
|
1142
|
+
4. Components in wrong location (inside `.claude-plugin/`)
|
|
1143
|
+
5. Missing YAML frontmatter in SKILL.md
|
|
1144
|
+
|
|
1145
|
+
**Fix**:
|
|
1146
|
+
```bash
|
|
1147
|
+
# Validate marketplace.json
|
|
1148
|
+
claude plugin validate
|
|
1149
|
+
|
|
1150
|
+
# Fix directory structure
|
|
1151
|
+
# Move commands/, agents/, skills/, hooks/ to plugin root
|
|
1152
|
+
|
|
1153
|
+
# Add YAML frontmatter to SKILL.md
|
|
1154
|
+
# Ensure opening --- on line 1
|
|
1155
|
+
|
|
1156
|
+
# Remove empty directories
|
|
1157
|
+
rmdir plugins/*/agents/empty-dir
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
### Hook Crashes Claude Code
|
|
1161
|
+
|
|
1162
|
+
**Symptom**: Claude Code becomes unresponsive or crashes when hook executes
|
|
1163
|
+
|
|
1164
|
+
**Emergency recovery**:
|
|
1165
|
+
```bash
|
|
1166
|
+
# 1. Kill switch
|
|
1167
|
+
export SPECWEAVE_DISABLE_HOOKS=1
|
|
1168
|
+
|
|
1169
|
+
# 2. Reset circuit breaker
|
|
1170
|
+
rm -f .specweave/state/.hook-circuit-breaker
|
|
1171
|
+
|
|
1172
|
+
# 3. Clear locks
|
|
1173
|
+
rm -rf .specweave/state/.hook-*.lock
|
|
1174
|
+
|
|
1175
|
+
# 4. Rebuild
|
|
1176
|
+
npm run rebuild
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1179
|
+
**Prevention**: Follow hook safety rules (see [Hooks System](#hooks-system))
|
|
1180
|
+
|
|
1181
|
+
---
|
|
1182
|
+
|
|
1183
|
+
## Official References
|
|
1184
|
+
|
|
1185
|
+
**Primary documentation** (ALWAYS defer to these):
|
|
1186
|
+
1. **Plugins**: https://code.claude.com/docs/en/plugins
|
|
1187
|
+
2. **Marketplaces**: https://code.claude.com/docs/en/plugin-marketplaces
|
|
1188
|
+
3. **Skills**: https://code.claude.com/docs/en/skills
|
|
1189
|
+
4. **Blog**: https://claude.com/blog/claude-code-plugins
|
|
1190
|
+
|
|
1191
|
+
**SpecWeave**:
|
|
1192
|
+
- **Repository**: https://github.com/anton-abyzov/specweave
|
|
1193
|
+
- **Marketplace**: https://github.com/anton-abyzov/specweave/.claude-plugin
|
|
1194
|
+
- **Documentation**: https://spec-weave.com
|
|
1195
|
+
|
|
1196
|
+
---
|
|
1197
|
+
|
|
1198
|
+
## Summary: When to Use What
|
|
1199
|
+
|
|
1200
|
+
**Use Skill** when:
|
|
1201
|
+
- You want Claude to automatically use knowledge
|
|
1202
|
+
- Knowledge should be available across all conversations
|
|
1203
|
+
- No explicit user command needed
|
|
1204
|
+
|
|
1205
|
+
**Use Command** when:
|
|
1206
|
+
- User should invoke explicitly with `/command`
|
|
1207
|
+
- One-time actions (like `/specweave:increment`)
|
|
1208
|
+
- Clear entry point needed
|
|
1209
|
+
|
|
1210
|
+
**Use Agent** when:
|
|
1211
|
+
- Complex multi-step workflows
|
|
1212
|
+
- Specialized expertise needed
|
|
1213
|
+
- Explicit Task tool invocation
|
|
1214
|
+
- Autonomous subagent execution
|
|
1215
|
+
|
|
1216
|
+
**Use Hook** when:
|
|
1217
|
+
- Event-driven automation
|
|
1218
|
+
- Workflow triggers (after todo write, before tool use, etc.)
|
|
1219
|
+
- Background synchronization
|
|
1220
|
+
- Validation and checks
|
|
1221
|
+
|
|
1222
|
+
**Use MCP Server** when:
|
|
1223
|
+
- External tool integration
|
|
1224
|
+
- API access needed
|
|
1225
|
+
- Third-party service connection
|
|
1226
|
+
|
|
1227
|
+
---
|
|
1228
|
+
|
|
1229
|
+
**Last Updated**: 2025-01-22 (v0.23.17)
|
|
1230
|
+
**Maintainer**: SpecWeave Contributors
|
|
1231
|
+
**License**: MIT
|