Plugin Scaffolder
Scaffold a complete, valid Claude Code plugin from a description — the .claude-plugin/plugin.json manifest, component directories (skills, agents, commands, hooks, MCP config), portable ${CLAUDE_PLUGIN_ROOT} wiring, a local test loop with --plugin-dir, and a marketplace.json for distribution. Use when turning scattered .claude/ customizations into one installable, versioned package.
npx agentscamp add skills/plugin-scaffolderInstall to ~/.claude/skills/plugin-scaffolder/SKILL.md
Describe the plugin — or point at an existing .claude/ directory worth packaging — and this skill scaffolds the whole thing: correct layout (manifest in .claude-plugin/, components at the root), a working sample of each component, portable path variables, validation via claude plugin validate, and the marketplace.json that makes it installable with /plugin install.
A Claude Code plugin is mostly layout discipline: the manifest goes in .claude-plugin/, every component directory goes at the plugin root, paths must use ${CLAUDE_PLUGIN_ROOT} to survive installation, and the marketplace entry has its own schema. This skill encodes that discipline — describe the plugin (or point at the .claude/ setup you want to package) and get a valid, testable scaffold.
When to use this skill
- You're starting a plugin and want the structure, manifest, and one working example of each component generated correctly the first time.
- You have customizations scattered across
.claude/agents/,.claude/skills/, hooks, and an.mcp.json, and want them migrated into one installable package. - You're setting up a team or personal marketplace repo and need the
marketplace.jsonwired so/plugin installworks.
When NOT to use this skill
- You're sharing a single procedure — one skill file needs no plugin around it.
- The customization is for exactly one repo and travels with it — checked-in
.claude/files already do that; packaging adds versioning overhead you don't need yet. See the plugins guide for the dividing line.
Instructions
- Inventory what the plugin carries. From the description (or by reading the existing
.claude/directory), list the components: skills, agents, commands, hooks, MCP servers, LSP config. Confirm the plugin's name (kebab-case, unique — it becomes the namespace prefix users type, e.g./my-plugin:release-notes). - Scaffold the layout exactly. Create
.claude-plugin/plugin.json— only the manifest lives in that folder — and component directories at the plugin root:skills/<name>/SKILL.md,agents/*.md,commands/*.md,hooks/hooks.json,.mcp.json. Manifest getsname(required), plusversion,description,author, andrepositoryso marketplaces render it properly. - Write working samples, not lorem ipsum. Each requested component gets a minimal but real implementation derived from the user's description — a skill with actual instructions, a hook with a functioning script. Migrating existing files? Copy them in, then fix what packaging breaks (next step).
- Make paths portable. Anything referencing files inside the plugin uses
${CLAUDE_PLUGIN_ROOT}(the install location changes and moves on update); anything writing caches or generated state uses${CLAUDE_PLUGIN_DATA}(survives updates); anything touching the user's project uses${CLAUDE_PROJECT_DIR}. Hardcoded relative paths are the #1 way plugins break after install. - Test, then validate. Run the local loop:
claude --plugin-dir ./<plugin>to load it for a session, exercise each component (the namespaced command, the hook trigger, the MCP connection), iterate with/reload-plugins. Finish withclaude plugin validate ./<plugin> --strictand fix every warning. - Wire distribution. Generate or update the
marketplace.json(in this repo or the user's marketplace repo) with the plugin's entry and source. State the consumer install path explicitly:/plugin marketplace add <owner>/<repo>then/plugin install <name>@<marketplace>— and for teams, note the project-scope install that gives every clone the plugin after a trust prompt.
WARNING
A plugin executes on other people's machines: its hooks run shell commands and its MCP servers receive credentials. Don't bundle secrets (use env expansion), pin any third-party servers it pulls in, and keep the manifest's repository honest so consumers can read the source they're trusting.
TIP
Keep version discipline from day one — bump version on every behavioral change. Marketplaces surface it, and "which version are you on?" is the first debugging question you'll ask a teammate.
Output
A complete plugin directory that passes claude plugin validate --strict: manifest, all requested components implemented, portable path variables throughout, plus the marketplace.json entry and a short INSTALL note covering the marketplace-add, install, and local --plugin-dir test commands.
Related
- Claude Code Plugins: Install, Use, and Build Your OwnHow Claude Code plugins work — what they can bundle, the /plugin and marketplace commands, the plugin.json manifest, and building and testing your own.
- Writing Your First SkillA step-by-step guide to packaging a reusable procedure as a Claude Code skill that loads exactly when it's needed.
- Writing Your First Custom AgentA step-by-step guide to authoring a focused, effective custom subagent.
- Hook WriterTurn a plain-language automation request — 'format every file Claude edits', 'block writes to migrations', 'notify me when input is needed' — into a working Claude Code hook: the right event, a safe tested script, and the settings.json registration at the right scope. Use when you want a hook but don't want to hand-write the matcher, stdin JSON parsing, and exit-code plumbing.
- Adding MCP Servers to Claude Code: Local, Remote, and Project-ScopedThe complete claude mcp add reference — stdio vs HTTP transports, local/project/user scopes, .mcp.json with env expansion, OAuth via /mcp, and the gotchas.