Skip to content

docs(plugin-structure): fix hooks.json format with required wrapper#92

Merged
sjnims merged 1 commit intomainfrom
docs/90-fix-hooks-json-format
Dec 10, 2025
Merged

docs(plugin-structure): fix hooks.json format with required wrapper#92
sjnims merged 1 commit intomainfrom
docs/90-fix-hooks-json-format

Conversation

@sjnims
Copy link
Copy Markdown
Owner

@sjnims sjnims commented Dec 10, 2025

Summary

Fixes incorrect hooks.json examples in the plugin-structure skill that were missing the required "hooks" wrapper object.

Problem

Fixes #90

All hooks.json examples in the plugin-structure skill showed an incorrect format that would cause plugins created from these examples to have broken hooks. The examples were missing the required "hooks" wrapper:

Before (incorrect):

{
  "PreToolUse": [...]
}

After (correct):

{
  "hooks": {
    "PreToolUse": [...]
  }
}

Solution

Updated all 4 affected files to use the correct wrapper format, consistent with the hook-development skill and official documentation:

  • plugins/plugin-dev/skills/plugin-structure/SKILL.md
  • plugins/plugin-dev/skills/plugin-structure/examples/standard-plugin.md
  • plugins/plugin-dev/skills/plugin-structure/examples/advanced-plugin.md
  • plugins/plugin-dev/skills/plugin-structure/references/component-patterns.md

Alternatives Considered

None - this is a documentation correctness fix with a single correct answer.

Changes

  • Added "hooks" wrapper object to all hooks.json code examples
  • No functional changes, documentation only

Testing

  • All tests passing (N/A - documentation only)
  • Linting passes

🤖 Generated with Claude Code

All hooks.json examples in the plugin-structure skill were missing the
required "hooks" wrapper object, which would cause plugins created from
these examples to have broken hooks.

Updated 4 files to use the correct format:
- SKILL.md
- examples/standard-plugin.md
- examples/advanced-plugin.md
- references/component-patterns.md

Fixes #90

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude Bot commented Dec 10, 2025

Claude finished @sjnims's task in 1m 38s —— View job


PR Review: Fix hooks.json format ✅

I've completed my review of PR #92. This is a critical documentation fix that corrects incorrect hooks.json examples.


Summary

Verdict: Approved ✅ - This PR correctly fixes a critical documentation error that would have caused broken hooks in user plugins.


What's Good

  1. Correct Format Applied: All hooks.json examples now properly use the required "hooks" wrapper object, which is the correct format per the hook-development skill and official documentation.

  2. Comprehensive Coverage: The fix was applied consistently across all 4 affected files:

    • plugins/plugin-dev/skills/plugin-structure/SKILL.md
    • plugins/plugin-dev/skills/plugin-structure/examples/standard-plugin.md
    • plugins/plugin-dev/skills/plugin-structure/examples/advanced-plugin.md
    • plugins/plugin-dev/skills/plugin-structure/references/component-patterns.md
  3. Proper Indentation: All JSON examples maintain correct indentation after adding the wrapper object.

  4. Markdown Quality: All files pass markdownlint validation with no errors or warnings.

  5. Accurate Diff: The changes are surgical - only the hooks.json format was modified, no other content was altered.


Technical Verification

Before (Incorrect)

{
  "PreToolUse": [...],
  "Stop": [...]
}

After (Correct)

{
  "hooks": {
    "PreToolUse": [...],
    "Stop": [...]
  }
}

This format matches:

  • The hook-development skill examples ✅
  • The CLAUDE.md documentation stating "Plugin hooks use wrapper format with hooks field" ✅
  • Official Claude Code plugin specifications ✅

Checklist Verification

  • Fixes Issue [Docs]: Incorrect hooks.json format in plugin-structure skill examples #90: Addresses the documented problem
  • Markdown Linting: All 4 files pass markdownlint
  • Consistent Format: All examples updated uniformly
  • No Functional Changes: Documentation-only, as claimed
  • Proper Commit Message: Follows conventional commit format
  • Impact: Critical fix preventing broken hooks in user plugins

Impact Assessment

Severity: High - This was preventing users from correctly implementing hooks
Scope: Documentation only - no code changes needed
Risk: Zero - Pure documentation correction with no side effects

This PR should be merged immediately to prevent users from creating broken plugins using the incorrect format from these examples.


Tasks Completed

  • Get PR diff to understand changes
  • Read changed files to verify corrections
  • Run markdownlint on changed .md files
  • Review hooks.json format against requirements
  • Post comprehensive review summary

@claude claude Bot added documentation Improvements or additions to documentation component:skill Skills layer effort:small < 1 hour labels Dec 10, 2025
@sjnims sjnims self-assigned this Dec 10, 2025
@sjnims sjnims merged commit 29f2607 into main Dec 10, 2025
7 checks passed
@sjnims sjnims deleted the docs/90-fix-hooks-json-format branch December 10, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:skill Skills layer documentation Improvements or additions to documentation effort:small < 1 hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs]: Incorrect hooks.json format in plugin-structure skill examples

1 participant