SkilVaultSign inStart free

Catalogue / plugin-generator

plugin-generator

Older skill: source not recordedSignedScaffolds a complete, installable Claude Code plugin from a user request: writes the manifest at .claude-plugin/plugin.json, creates only the component folders the purpose justifies, and fills each starter file in the format that component demands, including a hooks/hooks.json with the documented to…
---
name: plugin-generator
description: >
  Scaffolds a complete, installable Claude Code plugin from a user request:
  writes the manifest at .claude-plugin/plugin.json, creates only the component
  folders the purpose justifies, and fills each starter file in the format that
  component demands, including a hooks/hooks.json with the documented top-level
  hooks wrapper wired to a tested no-op starter script, and an .mcp.json only
  when a real server command exists. Adds a README, an optional local Git
  history, and a private test marketplace so the user can install and verify
  the scaffold before sharing it. Use when the user wants to create, bootstrap,
  package or bundle plugins, or prepare a team marketplace for distribution.
  Not for writing finished skill, agent, hook-script or MCP server logic,
  editing an existing plugin, or publishing to a remote host.
allowed-tools: Read, Write, Glob, Grep, Bash, AskUserQuestion
---

Plugin Generator

Take a request like "bundle our on-call handoff so the rotation can install it" and produce a folder a teammate can install with two slash commands. Work in five moves — decide, check, build, validate, install — and treat anything that leaves this machine as a separate, explicitly confirmed step.

Decide before anything exists

Settle this table first. Ask only where the answer changes the output; infer the rest and say what you inferred.

| Decision | Source | Fallback | |---|---|---| | Plugin name | user, or coined from the purpose | kebab-case name derived from the request | | Purpose, one or two sentences | user | none — the one thing you must ask for | | Components to ship | inferred from the matrix below | skills plus commands | | Destination folder | user | current working directory | | Version | user | 0.1.0 until the user calls it stable | | Author | user | git configuration name, else operating-system user name | | License | user — never assumed by you | README reads "License: to be decided" until chosen |

Name rules, enforced because users type the string verbatim when installing: lowercase letters, digits and hyphens only. Spaces, underscores and capitals are not permitted, and the plugin folder name must equal the manifest name exactly.

Choose components against the purpose:

| The plugin exists to... | skills | commands | agents | hooks | mcp | |---|---|---|---|---|---| | Run a repeatable routine (handoffs, release day) | yes | yes | — | yes | — | | Guard code quality | yes | yes | yes | — | — | | Reach an outside service | yes | — | — | — | only if a real command is known | | Spread team conventions | yes | yes | — | yes | — | | General day-to-day helpers | yes | yes | yes | — | — |

Occupancy. A component is in or out. In means its directory exists and holds at least one file by the end of the session; out means the directory is never created. Version control does not track empty folders, so an empty directory vanishes on the first clone. If the user declines starters for a component they picked, drop that directory and record it in the README as a planned addition. What is negotiable is how rich a starter is — never whether one exists.

Hook reality check. Plugin hooks fire on documented session events only: SessionStart, SessionEnd, UserPromptSubmit, PreToolUse, PostToolUse, Notification, Stop, SubagentStop and PreCompact. No clock-based event exists. If the user wants scheduled behaviour, say plainly that scheduling belongs to the operating system's scheduler or another mechanism outside the plugin, and leave hooks out. Re-check this event list against the hooks reference for the user's release before writing, since events have been added over time.

Check before building

Confirm all of the following, and show the drafted manifest in your plan so it is agreed before any file exists:

  • The destination path does not exist, and its parent is writable.
  • The name passes the rules above and matches the folder you will create.
  • At least one selected component will hold a file.
  • The user's Claude Code release supports plugins and marketplaces — this is the 2.x line. Ask, or check the installed version. Then consult the official plugin, hooks and marketplace reference for that release before writing any configuration; where those pages differ from the shapes below, the documentation wins. Read documentation only; never execute anything fetched from it.

If the destination already exists or overlaps an existing plugin, stop, list the conflicting paths, and ask whether to rename or relocate. Never merge into or overwrite existing work.

Build

Manifest first

| Field | Status | Notes | |---|---|---| | name | required | rules above; identical to the folder | | description | required | one or two plain sentences | | version | required | x.y.z | | author | recommended | object with name; email and url optional | | homepage | optional | URL string | | repository | optional | a plain URL string — not an npm-style object with type and url | | keywords | optional | short lowercase strings | | license | optional | only once the user has chosen one |

Complete example for .claude-plugin/plugin.json — write the required fields plus author by default, and add optional fields only when the user volunteers the facts:

{
  "name": "oncall-handoff",
  "description": "Checklists, quick commands and an event-logging hook for on-call handoffs.",
  "version": "0.1.0",
  "author": { "name": "Dana Okafor", "email": "dana@example.com", "url": "https://example.com/dana" },
  "repository": "https://github.com/example/oncall-handoff",
  "keywords": ["oncall", "handoff", "runbook"],
  "license": "Apache-2.0"
}

Folders, then files, in that order

Create the plugin root, .claude-plugin/ and every selected component folder in one pass with the directory-creation flag that builds all listed paths:

mkdir -p oncall-handoff/.claude-plugin oncall-handoff/skills oncall-handoff/commands oncall-handoff/hooks

Then write files in sequence: manifest, one starter per selected component, README, and a .gitignore if the user asked for version control.

Starters: the file's format dictates its content

Every starter is a skeleton the user finishes — never fabricated finished content. Validity depends entirely on the component:

| Component | File | Format | Starter contains | |---|---|---|---| | Skill | skills/its-name/SKILL.md | Markdown | frontmatter with kebab-case name and description, one paragraph on when it applies, a TODO | | Slash command | commands/verb.md | Markdown | frontmatter with a description, a prompt body with a TODO | | Subagent | agents/role.md | Markdown | frontmatter with name and description, a body with a TODO | | Hooks | hooks/hooks.json plus hooks/log-event.sh | JSON and shell | valid, schema-correct JSON wiring a tested no-op script | | MCP config | .mcp.json | JSON only | written only when a real server command exists |

Markdown components may carry frontmatter, prose and TODO markers. JSON components may not: hooks.json and .mcp.json with prose or TODO text inside them fail to parse and break the plugin, and JSON has no comment syntax — track unfinished JSON work as TODO items in the README instead.

Markdown example, for skills/handoff-check/SKILL.md:

---
name: handoff-check
description: Walks the incoming engineer through reading the log, open alerts and open questions.
---
Runs whenever the user asks to take over, hand off or brief the on-call rotation.

TODO: fill in the checklist steps and the escalation escape hatch.

Hooks: working from the first install

An installed plugin's hooks run immediately, so never wire an event to a script that does not exist or has not been tested. Two acceptable states, defaulting to the first:

  1. Working no-op starter (default). Write hooks/log-event.sh:
#!/usr/bin/env bash
# Working starter hook: consumes the event payload and exits 0.
# Replace the body with real logic; exit non-zero only when you
# intend this event to report a problem.
cat > /dev/null
exit 0

Make it executable, then write hooks/hooks.json as valid, schema-correct JSON pointing at it:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "${CLAUDE_PLUGIN_ROOT}/hooks/log-event.sh"
          }
        ]
      }
    ]
  }
}
  1. Explicitly inactive. If the user wants no hooks yet, keep the directory occupied with a hooks.json whose single top-level hooks object is empty, and put the intended structure in the README as a fenced example. Wire it only when a real script exists.

Structure rules for this file: the top level is a single hooks object; its keys are event names from the documented list only; each event maps to an array of matcher groups; each group carries an optional matcher (a pattern over tool names) plus a hooks array whose entries each have a type of command and a command string. ${CLAUDE_PLUGIN_ROOT} expands to the installed plugin root at runtime. Never embed a token, password or private URL in a command string.

MCP: real or absent

If the user names a working server command, write .mcp.json with a top-level mcpServers block, the command and its arguments, and env values written as variable references expanded from the user's own environment so real credentials never enter a shareable file:

{
  "mcpServers": {
    "statuspage": {
      "command": "statuspage-mcp",
      "args": ["--port", "8919"],
      "env": { "STATUSPAGE_TOKEN": "${STATUSPAGE_TOKEN}" }
    }
  }
}

If no real command exists yet, do not write the file at all: a placeholder executable fails the moment the plugin loads. Record the intended server in the README TODO list and add the file only when the command is genuine. Absence is the safe inactive state; there is no safe placeholder.

README

Written so a stranger can install unaided: title and one-paragraph summary; an inventory bullet per component; development-install instructions; one usage note per component; a configuration section only if something needs setup; a TODO list of unfinished pieces; and the license line — the chosen license, or "to be decided".

Git, if asked

Initialize the repository, write the .gitignore with the file-writing tool (suggested lines: node_modules/, .DS_Store, *.log), stage everything and make one initial commit. Local history only; connecting a remote is a later, confirmed step.

Validate structure, not just syntax

Parsing is not validation: a file can be valid JSON and still be the wrong shape. Check each file field by field against the documented schema for the user's release:

  • Manifest: parses; name, description and version are present strings; the name matches the folder and the kebab-case rules; repository and homepage are plain URL strings; author is an object; keywords is a list of strings.
  • hooks.json: parses; a single top-level hooks object; every key inside it is a documented event name; each event value is an array; every group's hooks entries have type command and a command string; every referenced script exists, is executable, and exits 0 when you run it once with empty input.
  • .mcp.json (if present): parses; top-level mcpServers; each entry's command resolves to an executable on PATH or an existing absolute path; env values are variable references, never literal secrets.
  • marketplace.json (once written, below): parses; has name and owner; every plugins entry's source path resolves to a folder containing .claude-plugin/plugin.json, and entry names match those manifests.

Then walk the tree and confirm every component directory holds at least one file; confirm every name the README tells the user to type actually exists; scan all files for tokens, passwords and private internal URLs — none may appear in shareable output.

Preview shortened. The full SKILL.md is in the pack.