agentsclimarketplace

New hook

Skill jajupmochi/agent-harness/.claude/skills/new-hook

Linlin's curated AI agent harness configuration: workflow rules, skills, hooks, plugin recommendations, tooling preferences, and project templates. Loadable into any new project so a fresh /init can pick the relevant subset.

Install
npx -y skills add jajupmochi/agent-harness --skill new-hook

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Scaffold a new hook under hooks/<kebab-name>/. Creates README.md (what/when/install/variants) and settings.snippet.json (drop-in JSON), plus updates INVENTORY.md and hooks/README.md in the same edit batch. Hooks are sensitive — pipe-test the raw command before wrapping.

SKILL.md

3.6 KB, as published. Nobody here has run it

/new-hook

Scaffold a new hook recipe. Hooks are deterministic shell commands tied to Claude Code lifecycle events.

Usage

/new-hook <kebab-name>

E.g.: /new-hook prettier-format-on-edit or /new-hook block-secrets-on-edit

Pre-flight

  • Verify hooks/<kebab-name>/ does not already exist
  • Confirm the hook isn't redundant with an existing one
  • Critical: hooks are sensitive — verify you've pipe-tested the raw command before wrapping (see "Construction flow" below)

Construction flow

Per the official update-config skill (Anthropic-managed), hook construction follows:

  1. Dedup check — search existing .claude/settings.json files for similar hooks; reuse if possible
  2. Construct for THIS project — write the raw command first
  3. Pipe-test raw — run the bare command and verify it produces correct output
  4. Wrap in JSON — embed in settings.snippet.json with matcher and hooks array
  5. Validate JSONjq empty settings.snippet.json (no error = valid)
  6. Live-proof — for Pre|PostToolUse on triggerable matchers, trigger an actual matching tool call and verify the hook fires
  7. Cleanup — remove test artifacts; document the variant in README
  8. Handoff — show the user the complete files

Steps for this skill

  1. Create directory:

    mkdir -p hooks/<kebab-name>
    
  2. Ask the user for:

    • Event: PreToolUse | PostToolUse | Stop | SubagentStop
    • Matcher: tool name pattern (e.g., Write|Edit, Bash, *)
    • Command: the bare shell command (will be wrapped in JSON "command" field)
    • Context: which project types it applies to
    • Variants: are there alternative ways to achieve the same effect (different toolchain, different config)?
  3. Pipe-test the raw command before writing files:

    echo '{"tool_input":{"file_path":"<example-file>"}}' | <YOUR-COMMAND>
    

    Confirm output matches expectations.

  4. Write hooks/<kebab-name>/README.md:

    # <kebab-name>
    
    > <one-line: event + matcher + what it does>
    
    ## What it does
    
    <full description>
    
    ## Why
    
    <bug it prevents / time it saves>
    
    ## Install
    
    <install steps + jq merge command>
    
    ## Variants
    
    <alternative implementations>
    
    ## Caveats
    
    <gotchas, edge cases>
    
    ## Companion
    
    <related hooks/rules/skills>
    
  5. Write hooks/<kebab-name>/settings.snippet.json:

    {
      "hooks": {
        "<EVENT>": [
          {
            "matcher": "<MATCHER>",
            "hooks": [
              {
                "type": "command",
                "command": "<wrapped command — escape JSON correctly>",
                "timeout": 30,
                "statusMessage": "<optional one-line status>"
              }
            ]
          }
        ]
      }
    }
    
  6. Validate JSON:

    jq empty hooks/<kebab-name>/settings.snippet.json
    
  7. Update hooks/README.md — add a row to the hook index table.

  8. Update INVENTORY.md AND INVENTORY.zh.md — add a row to the Hooks section.

  9. Show the user the diff and ask for confirmation before committing.

Companion

  • docs/CONTRIBUTING.md §"Adding a hook"
  • Anthropic's update-config skill — canonical hook construction flow with live-proof
  • Anthropic's hookify plugin — generate hooks from conversation analysis

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.