Package Skills, Hooks and MCP Into a Claude Code Plugin

A SKILL.md that turns the skills, subagents, hooks and MCP servers in your .claude folder into an installable Claude Code plugin with a marketplace file, then validates and test-installs it.

Skill prompt

Prompt

Installs to .agents/skills/package-skills-hooks-and-mcp-into-a-claude-code-plugin/

mkdir -p .agents/skills/package-skills-hooks-and-mcp-into-a-claude-code-plugin && curl -sL "https://prompts-gpt.com/prompts/package-skills-hooks-and-mcp-into-a-claude-code-plugin/raw" -o .agents/skills/package-skills-hooks-and-mcp-into-a-claude-code-plugin/SKILL.md
SKILL.md
Preview
---
name: package-skills-hooks-and-mcp-into-a-claude-code-plugin
description: "A SKILL.md that turns the skills, subagents, hooks and MCP servers in your .claude folder into an installable Claude Code plugin with a marketplace file, then validates and test-installs it."
---

# Package Skills, Hooks and MCP Into a Claude Code Plugin

A SKILL.md that turns the skills, subagents, hooks and MCP servers in your .claude folder into an installable Claude Code plugin with a marketplace file, then validates and test-installs it.

## Prompt

```
---
name: plugin-packager
description: Packages a project's Claude Code skills, subagents, commands, hooks and MCP servers into a plugin with plugin.json and a marketplace.json, then validates and test-installs it. Use when someone asks to "make a plugin", "share my skills with the team", "turn .claude into a plugin" or "create a plugin marketplace".
---

# Plugin packager

## Steps

1. Inventory. List `.claude/skills/*/SKILL.md`, `.claude/agents/*.md`, `.claude/commands/*.md`, the `hooks` section of `.claude/settings.json`, and `.mcp.json`. Ask which items belong in the plugin; leave out anything with personal paths or secrets.
2. Name it in kebab-case. Avoid names starting with `claude-` or `anthropic-`, so it is not mistaken for an official Anthropic plugin.
3. Build the layout in a new folder, the marketplace root:
   - `plugins/NAME/.claude-plugin/plugin.json` holding `name`, `version`, `description` and `author` with a `name`. Nothing else goes inside `.claude-plugin/`.
   - `plugins/NAME/skills/SKILL-NAME/SKILL.md`, `plugins/NAME/agents/`, `plugins/NAME/commands/`.
   - `plugins/NAME/hooks/hooks.json`: the event map wrapped in a top-level `hooks` key. Without that wrapper the file does not load.
   - `plugins/NAME/.mcp.json` for MCP servers.
   - `.claude-plugin/marketplace.json` at the root with `name`, `owner` (with `name`) and `plugins`, each entry having `name` and `source` like `./plugins/NAME`.
4. Fix paths. Scripts move into `plugins/NAME/scripts/`. In hook commands, replace project paths with the `CLAUDE_PLUGIN_ROOT` variable in double quotes; in `.mcp.json` args, use its substitution form from the plugin reference. Paths in plugin.json start with `./` and never use `..`.
5. Keep the marketplace entry name and the plugin.json name identical, or installs by name fail.
6. Secrets: replace hard-coded tokens with a `userConfig` option marked `sensitive`.
7. Validate: `claude plugin validate ./plugins/NAME`, then `claude plugin validate .` for the marketplace. Fix every error and warning.
8. Test: `claude plugin marketplace add ./`, `claude plugin install NAME@MARKETPLACE`, start a session, run one namespaced skill (`/NAME:SKILL-NAME`) and trigger one hook.

## Output

The file tree, plugin.json and marketplace.json, validator output, the install test result, and the commands a teammate runs to install from the hosted repository.

## Stop and ask

- A hook or MCP server needs a secret or an absolute path on this machine.
- Two items have the same name.
```

## Usage Notes

Save as .claude/skills/plugin-packager/SKILL.md and ask Claude Code to "turn our .claude folder into a plugin". Field names and validate commands checked against the Claude Code plugin docs in Nov 2026; re-run claude plugin validate after any Claude Code update.

Example output

Example for: a team repo with 2 skills, 1 subagent, 1 PreToolUse hook and 1 MCP server. Plugin name review-kit, marketplace team-tools.

Tree

team-tools/
├── .claude-plugin/marketplace.json
└── plugins/review-kit/
    ├── .claude-plugin/plugin.json
    ├── skills/pr-review/SKILL.md
    ├── skills/db-review/SKILL.md
    ├── agents/test-writer.md
    ├── hooks/hooks.json
    ├── scripts/destructive-guard.sh
    └── .mcp.json

plugin.json

{
  "name": "review-kit",
  "version": "1.0.0",
  "description": "PR and database review skills, a test-writer subagent and a destructive-command guard",
  "author": { "name": "Platform team" }
}

marketplace.json

{
  "name": "team-tools",
  "owner": { "name": "Platform team" },
  "plugins": [
    { "name": "review-kit", "source": "./plugins/review-kit", "description": "Review skills and safety hook" }
  ]
}

Path fixes: hook command changed from "$CLAUDE_PROJECT_DIR"/.claude/hooks/destructive-guard.sh to "$CLAUDE_PLUGIN_ROOT"/scripts/destructive-guard.sh. The MCP server had a token in env; moved to a sensitive userConfig option api_token.

Validator: first run reported hooks.json missing the top-level hooks key; fixed. Second run: Validation passed, for the plugin and for the marketplace.

Install test: marketplace added, review-kit installed at user scope, /review-kit:pr-review ran, the guard blocked git reset --hard in a test session.

For teammates

claude plugin marketplace add your-org/team-tools
claude plugin install review-kit@team-tools
Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • It names the two mistakes that most often break a first plugin: hooks.json without its hooks wrapper, and a marketplace entry name that differs from plugin.json.
  • Running claude plugin validate and a real install is the acceptance test, so the result is proven to load rather than assumed.
  • Moving tokens into a sensitive userConfig option keeps secrets out of a repository the whole team clones.

Save as .claude/skills/plugin-packager/SKILL.md and ask Claude Code to "turn our .claude folder into a plugin". Field names and validate commands checked against the Claude Code plugin docs in Nov 2026; re-run claude plugin validate after any Claude Code update.

Common edits

  • Skip the marketplace and load the folder with claude --plugin-dir while you are still changing it.
  • Host plugins from other repositories by giving the marketplace entry a github or git-subdir source instead of a relative path.

Reuse it: Use in a workflowAdapt in the builder

More in Claude Code

Block Dangerous Bash Commands: PreToolUse Hook With Tests

A SKILL.md that installs a Claude Code PreToolUse hook blocking rm -rf, force pushes, hard resets and DROP TABLE, plus a test script that proves each pattern blocks or allows.

Create MCP Tool Configuration for Claude Code

Generate a secure, ready-to-use MCP server configuration file for Claude Code to enable local database and observability access safely.

Writing

Rewrite a flat opening into three sharper angles

Turn a predictable opening paragraph into three distinct hooks that pull readers in immediately. Ideal for essays, articles, and newsletters.

Agent OrchestrationClaude Code

Subagent Fan-Out Plan for a Large Codebase Migration

Plans a big migration so an orchestrating agent can split it into independent chunks for parallel subagents, each with a clear brief, a verification command and merge rules.

Short-Form Hook Test Plan for Reels, TikTok, and Shorts

Generates a set of testable hook variants and a measurement plan for a vertical video so a creator can decide which version to publish first and what to learn from results.