Skip to content

Commit b682d10

Browse files
committed
Register plugin-dev and enforce hooks wrapper
Promote plugins/plugin-dev to a v1.0.0 marketplace plugin and update validation/docs to require the hooks wrapper format. Changes include: add plugin-dev entry to .claude-plugin/marketplace.json; update CI (.github/workflows/plugin-validation.yml) to include all plugins (no longer excluding plugin-dev) and to verify marketplace sync against all plugin dirs; add AGENTS.md to .gitignore; update copilot-instructions, PLUGIN_GUIDELINES, SKILL.md, and migration docs to document governance/atomic workflow and the mandatory wrapper format for hooks ({"hooks": {...}}); improve validation messaging and known-gotchas (CRLF frontmatter issue, validate-agent arithmetic bug notes); and enhance the hook validator (validate-hook-schema.sh) to detect and unwrap the wrapper format before schema checks. These changes align docs, CI, and validators with the new policy that plugin-dev is a first-class marketplace plugin and that hooks must be supplied in the required wrapper format.
1 parent b43f161 commit b682d10

8 files changed

Lines changed: 354 additions & 196 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
"description": "Marketplace for Nuno Salvacao's Claude Code plugins"
1212
},
1313
"plugins": [
14+
{
15+
"name": "plugin-dev",
16+
"description": "Comprehensive toolkit for developing Claude Code plugins — hooks, MCP integration, plugin structure, settings, commands, agents, and skills. Forked from anthropics/claude-plugins-official with improvements: wrapper-format support in validator and arithmetic bug fix.",
17+
"version": "1.0.0",
18+
"author": {
19+
"name": "Nuno Salvacao",
20+
"email": "nuno.salvacao@gmail.com"
21+
},
22+
"source": "./plugins/plugin-dev",
23+
"category": "development"
24+
},
1425
{
1526
"name": "strategy-toolkit",
1627
"description": "Strategic ideation and execution planning toolkit with reproducible frameworks",

.github/copilot-instructions.md

Lines changed: 131 additions & 58 deletions
Large diffs are not rendered by default.

.github/workflows/plugin-validation.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,14 @@ jobs:
5151
set -euo pipefail
5252
while IFS= read -r dir; do
5353
[ -f "$dir/README.md" ] || { echo "❌ Missing README: $dir/README.md"; exit 1; }
54-
done < <(find plugins -mindepth 1 -maxdepth 1 -type d | grep -v '/plugin-dev$' | sort)
54+
done < <(find plugins -mindepth 1 -maxdepth 1 -type d | sort)
5555
echo "✅ All plugins have README.md"
5656
5757
# ── marketplace.json sync ─────────────────────────────────────────────────
5858
- name: marketplace.json sync with plugins/
5959
run: |
6060
set -euo pipefail
61-
# plugin-dev is the official toolkit, not a marketplace plugin
62-
mapfile -t dirs < <(find plugins -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | grep -v '^plugin-dev$' | sort)
61+
mapfile -t dirs < <(find plugins -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort)
6362
mapfile -t listed < <(jq -r '.plugins[].name' .claude-plugin/marketplace.json | sort)
6463
errors=0
6564
for plugin in "${dirs[@]}"; do

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ CLAUDE.md
4848
dashboard.html
4949
/memory
5050
TASKS.md
51+
AGENTS.md

docs/PLUGIN_GUIDELINES.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,50 @@ Before opening a PR for a plugin:
7272
- [ ] Side effects and generated files are documented
7373
- [ ] Marketplace entry has been added/updated
7474

75+
## Governance Workflow (Atomic Delivery)
76+
77+
Use this loop for any plugin change (new plugin, plugin update, docs, scripts, hooks, agents, skills).
78+
79+
1. **Plan one logical change** with explicit scope and files.
80+
2. **Split into atomic subtasks** with clear done conditions.
81+
3. **Choose verification mode** (behavior changes: test-first where practical; docs/schema/metadata changes: validation-first).
82+
4. **Implement minimal change** for the current subtask.
83+
5. **Run relevant local validators** for touched artifacts.
84+
6. **Check repository consistency** (`plugins/` and `.claude-plugin/marketplace.json` alignment, frontmatter completeness, hook schema compatibility).
85+
7. **Commit atomically** with a Conventional Commit message.
86+
8. **Push and open PR**, then wait for online GitHub review and full CI pass in `.github/workflows/plugin-validation.yml`.
87+
9. **Do not merge as agent**. Merge is manual and happens only after explicit reviewer/user approval.
88+
89+
### Atomic Commit Rules
90+
91+
- One commit should map to one logical objective.
92+
- Keep coupled updates together when required for consistency (for example validator logic + matching documentation).
93+
- Do not batch unrelated roadmap/plugin tasks in one commit.
94+
- Allowed commit types: `feat`, `fix`, `docs`, `refactor`, `chore`, `plugin`, `update`.
95+
96+
### Validation Baseline
97+
98+
Run what applies to your change:
99+
100+
- `jq empty .claude-plugin/marketplace.json`
101+
- `jq empty plugins/<name>/.claude-plugin/plugin.json`
102+
- `bash plugins/plugin-dev/skills/hook-development/scripts/validate-hook-schema.sh <hooks.json>`
103+
- `bash plugins/plugin-dev/skills/hook-development/scripts/hook-linter.sh <script.sh>`
104+
- `bash plugins/plugin-dev/skills/agent-development/scripts/validate-agent.sh <agent.md>`
105+
- `bash plugins/plugin-dev/skills/plugin-settings/scripts/parse-frontmatter.sh <file> <field>`
106+
- `shellcheck <script.sh>`
107+
- `markdownlint-cli2 <changed-docs>`
108+
109+
### Mandatory Cross-Doc Read Order (Agents)
110+
111+
Before implementation and before any commit/PR operation, agents must read and follow:
112+
113+
1. `AGENTS.md`
114+
2. `.github/copilot-instructions.md`
115+
3. `CLAUDE.md`
116+
4. This document (`docs/PLUGIN_GUIDELINES.md`)
117+
5. Roadmap workflow details when applicable (`.ideas/plugin-dev-roadmap.md`)
118+
75119
## Versioning Guidance
76120

77121
- Start new plugins at `0.1.0`

plugins/plugin-dev/skills/hook-development/SKILL.md

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,22 @@ Execute bash commands for deterministic checks:
6161

6262
### Plugin hooks.json Format
6363

64-
**For plugin hooks** in `hooks/hooks.json`, use direct format (canonical):
64+
**For plugin hooks** in `hooks/hooks.json`, use wrapper format:
6565

6666
```json
6767
{
68-
"PreToolUse": [...],
69-
"Stop": [...],
70-
"SessionStart": [...]
68+
"hooks": {
69+
"PreToolUse": [...],
70+
"Stop": [...],
71+
"SessionStart": [...]
72+
}
7173
}
7274
```
7375

7476
**Key points:**
75-
- Direct format (shown above) is **canonical and preferred** for new plugins
76-
- Each hook event is a top-level key (PreToolUse, Stop, SessionStart, etc.)
77-
- Legacy wrapper format `{"hooks": {...}}` is also accepted by validation but not recommended for new code
78-
- Older documentation referenced the wrapper format; this has been superseded
77+
- `hooks` field is **required** wrapper containing actual hook events
78+
- `description` field is optional (brief explanation of what the hooks do)
79+
- This is the **plugin-specific format** — distinct from settings format
7980

8081
**Example:**
8182
```json
@@ -341,40 +342,42 @@ In plugins, define hooks in `hooks/hooks.json`:
341342

342343
```json
343344
{
344-
"PreToolUse": [
345-
{
346-
"matcher": "Write|Edit",
347-
"hooks": [
348-
{
349-
"type": "prompt",
350-
"prompt": "Validate file write safety"
351-
}
352-
]
353-
}
354-
],
355-
"Stop": [
356-
{
357-
"matcher": "*",
358-
"hooks": [
359-
{
360-
"type": "prompt",
361-
"prompt": "Verify task completion"
362-
}
363-
]
364-
}
365-
],
366-
"SessionStart": [
367-
{
368-
"matcher": "*",
369-
"hooks": [
370-
{
371-
"type": "command",
372-
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/load-context.sh",
373-
"timeout": 10
374-
}
375-
]
376-
}
377-
]
345+
"hooks": {
346+
"PreToolUse": [
347+
{
348+
"matcher": "Write|Edit",
349+
"hooks": [
350+
{
351+
"type": "prompt",
352+
"prompt": "Validate file write safety"
353+
}
354+
]
355+
}
356+
],
357+
"Stop": [
358+
{
359+
"matcher": "*",
360+
"hooks": [
361+
{
362+
"type": "prompt",
363+
"prompt": "Verify task completion"
364+
}
365+
]
366+
}
367+
],
368+
"SessionStart": [
369+
{
370+
"matcher": "*",
371+
"hooks": [
372+
{
373+
"type": "command",
374+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/load-context.sh",
375+
"timeout": 10
376+
}
377+
]
378+
}
379+
]
380+
}
378381
}
379382
```
380383

0 commit comments

Comments
 (0)