home / skills / gigaverse-app / skillet / metaskill-packaging

metaskill-packaging skill

/metaskill/skills/metaskill-packaging

This skill guides packaging and structuring Claude Code plugins, enabling clean plugin.json placement and organized components for distribution.

npx playbooks add skill gigaverse-app/skillet --skill metaskill-packaging

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
8.3 KB
---
name: metaskill-packaging
description: Package skills, agents, commands, and hooks as Claude Code plugins. Use when creating plugins, packaging skills for distribution, setting up plugin structure, dogfooding plugins, or when user mentions "plugin structure", "plugin.json", "package plugin", "distribute plugin", "marketplace", "dogfood", "install plugin", "plugin placement", "--plugin-dir".
---

# Plugin Building and Packaging

Package your skills, agents, commands, and hooks as distributable plugins.

## Plugin Structure

**CRITICAL RULE:** Only `plugin.json` goes inside `.claude-plugin/`. All components go at the plugin ROOT:

```
my-plugin/                      <- Plugin name = neutral noun
├── .claude-plugin/
│   └── plugin.json             # ONLY this file here!
├── commands/                   # Slash commands (*.md) - imperative verbs
├── agents/                     # Agent definitions (*.md) - role nouns
├── skills/                     # Skills (*/SKILL.md) - ending in -ing
├── hooks/                      # Event handlers (hooks.json)
├── .mcp.json                   # MCP servers (optional)
├── .lsp.json                   # LSP servers (optional)
└── README.md
```

```
# ❌ WRONG - components inside .claude-plugin/
.claude-plugin/
├── plugin.json
├── commands/         ← NO!
└── skills/           ← NO!

# ✅ CORRECT - components at plugin root
.claude-plugin/
└── plugin.json
commands/             ← YES!
skills/               ← YES!
```

## plugin.json Manifest

**Required fields:**

```json
{
  "name": "my-plugin",
  "version": "1.0.0",
  "description": "What this plugin does"
}
```

**With recommended metadata:**

```json
{
  "name": "my-plugin",
  "version": "1.0.0",
  "description": "What this plugin does",
  "author": {
    "name": "Your Name",
    "email": "[email protected]"
  },
  "license": "MIT",
  "keywords": ["keyword1", "keyword2"],
  "repository": "https://github.com/user/repo",
  "homepage": "https://github.com/user/repo#readme"
}
```

**See `references/plugin-json-schema.md` for the complete field reference.**

## Naming Conventions

**See `/metaskill-naming` for the full naming convention.**

Quick reference:

| Component | Form | Example |
|-----------|------|---------|
| Plugin name | Neutral noun | metaskill, codeforge, datakit |
| Skills | -ing (gerund) | metaskill-authoring, metaskill-triggering |
| Agents | Role noun | metaskill-trigger-tester, metaskill-analyzer |
| Commands | Imperative verb | /metaskill-create, /quick-start |

**Plugin name = Common prefix of all atoms**

```
# ✅ GOOD - neutral noun prefix, correct suffixes
metaskill/
├── skills/
│   ├── metaskill-authoring/     # -ing
│   └── metaskill-triggering/    # -ing
├── agents/
│   └── metaskill-trigger-tester.md  # role noun
└── commands/
    └── quick-start.md           # imperative

# ❌ BAD - verb-form prefix
skill-authoring/
├── skills/
│   └── skill-authoring-trigger/  # prefix already -ing!
```

**No type postfixes:**

```
# ❌ BAD - redundant type postfix
skills/code-review-skill/
agents/tester-agent.md
commands/lint-command.md

# ✅ GOOD - no type postfix
skills/code-reviewing/
agents/tester.md
commands/lint.md
```

## Dogfooding Approaches

### Quick Iteration (Active Development)

```bash
claude --plugin-dir ./my-plugin
```

- Loads plugin immediately
- Restart Claude Code to pick up changes
- Best for rapid iteration

### Marketplace Testing (Pre-Release)

```bash
# Add your repo as a local marketplace (once)
/plugin marketplace add /path/to/your/repo

# Install the plugin
/plugin install your-repo@my-plugin

# After changes, reinstall to test
/plugin uninstall your-repo@my-plugin
/plugin install your-repo@my-plugin
```

- Tests the full installation flow
- Verifies the user experience
- Use before releasing

## Plugin Placement in Repos

### Single Plugin at Repo Root

For a repo that IS the plugin:

```
my-plugin-repo/
├── .claude-plugin/
│   └── plugin.json
├── skills/
│   └── my-plugin-authoring/
├── agents/
└── README.md
```

### Plugin Inside a Project (Dogfooding)

For internal tooling within a larger project:

```
my-project/
├── src/
├── tests/
├── .claude/                  # Project's Claude config
│   └── settings.json
└── plugins/
    └── my-internal-plugin/
        ├── .claude-plugin/
        │   └── plugin.json
        └── skills/
```

Load with: `claude --plugin-dir ./plugins/my-internal-plugin`

### Multiple Plugins in One Repo

Use `marketplace.json` to reference multiple plugins:

```
my-repo/
├── .claude-plugin/
│   └── marketplace.json      # References plugins below
├── plugins/
│   ├── plugin-a/
│   │   ├── .claude-plugin/
│   │   │   └── plugin.json
│   │   └── skills/
│   └── plugin-b/
│       ├── .claude-plugin/
│       │   └── plugin.json
│       └── agents/
└── README.md
```

**marketplace.json** (required fields):

```json
{
  "name": "my-marketplace",
  "owner": {
    "name": "Your Name"
  },
  "plugins": [
    { "name": "plugin-a", "source": "./plugins/plugin-a" },
    { "name": "plugin-b", "source": "./plugins/plugin-b" }
  ]
}
```

**With full metadata:**

```json
{
  "name": "my-marketplace",
  "owner": {
    "name": "Your Name",
    "email": "[email protected]"
  },
  "metadata": {
    "description": "Description of your marketplace",
    "version": "1.0.0"
  },
  "plugins": [
    {
      "name": "plugin-a",
      "source": "./plugins/plugin-a",
      "description": "What plugin-a does",
      "version": "1.0.0",
      "author": { "name": "Your Name", "email": "[email protected]" },
      "license": "MIT",
      "keywords": ["keyword1", "keyword2"],
      "category": "development"
    }
  ]
}
```

**See `references/marketplace-json-schema.md` for the complete field reference.**

Users can then:
```bash
/plugin marketplace add /path/to/my-repo
/plugin install my-marketplace@plugin-a
```

## Internal vs External Plugins

### Internal (Dogfooding within Repo)

Place in a `plugins/` or `tools/` directory:

```
my-project/
├── plugins/
│   └── internal-tooling/     # For this project only
│       ├── .claude-plugin/
│       │   └── plugin.json
│       └── skills/
```

- Not meant for distribution
- Project-specific utilities
- Load with `--plugin-dir`

### External (Open Source / Distribution)

Option A: Dedicated plugin repo
```
my-plugin/                    # Repo IS the plugin
├── .claude-plugin/
│   └── plugin.json
└── skills/
```

Option B: Plugin marketplace repo
```
my-plugins/                   # Repo contains multiple plugins
├── .claude-plugin/
│   └── marketplace.json
└── plugins/
    ├── plugin-a/
    └── plugin-b/
```

## Plugin Components Reference

| Directory | Contents | Naming Pattern |
|-----------|----------|----------------|
| `.claude-plugin/` | `plugin.json` only | N/A |
| `skills/` | `*/SKILL.md` | prefix-action-ing |
| `agents/` | `*.md` | prefix-role-noun |
| `commands/` | `*.md` | imperative-verb |
| `hooks/` | `hooks.json` | N/A |
| `.mcp.json` | MCP servers | N/A |
| `.lsp.json` | LSP servers | N/A |

## Common Mistakes

### Components in Wrong Location

```
# ❌ WRONG
.claude-plugin/
├── plugin.json
└── skills/          # NO! Skills outside .claude-plugin/

# ✅ CORRECT
.claude-plugin/
└── plugin.json
skills/              # YES! At plugin root
```

### Missing plugin.json

```
# ❌ WRONG - no manifest
my-plugin/
└── skills/

# ✅ CORRECT - has manifest
my-plugin/
├── .claude-plugin/
│   └── plugin.json
└── skills/
```

### Verb-Form Prefix

```
# ❌ WRONG - prefix is already -ing
skill-authoring/
├── skills/
│   └── skill-authoring-triggering/  # Double verb!

# ✅ CORRECT - neutral noun prefix
metaskill/
├── skills/
│   └── metaskill-triggering/        # Noun + -ing
```

## Related Skills

- For naming conventions, see `/metaskill-naming`
- For skill structure and writing, see `/metaskill-authoring`
- For skill group patterns, see `/metaskill-grouping`
- For trigger optimization, see `/metaskill-triggering`
- To test if triggers work, use the `metaskill-trigger-tester` agent

Overview

This skill packages skills, agents, commands, and hooks into Claude Code plugins so they can be installed, distributed, and dogfooded. It enforces correct plugin layout and manifest requirements, and provides workflows for rapid iteration, marketplace testing, and repo placement. Use it to create consistent, distributable plugins that follow naming and structure conventions.

How this skill works

The skill validates and organizes plugin files so only plugin.json lives in .claude-plugin/ while all components (skills, agents, commands, hooks) remain at the plugin root. It guides construction of plugin.json with required and recommended metadata and enforces naming patterns for plugin names, skills (-ing), agents (role nouns), and commands (imperative verbs). It also documents dogfooding commands and marketplace manifest formats to test installation flows.

When to use it

  • Creating a new Claude Code plugin for distribution
  • Packaging skills, agents, commands, or hooks into a plugin
  • Setting up or validating plugin structure and plugin.json
  • Dogfooding changes locally during development (--plugin-dir)
  • Preparing a plugin for marketplace testing or release

Best practices

  • Keep only plugin.json inside .claude-plugin/; place all components at the plugin root
  • Use a neutral noun for the plugin name and consistent prefixes across atoms
  • Name skills with -ing (gerund), agents as role nouns, and commands as imperative verbs
  • Include recommended metadata in plugin.json (author, license, repository, keywords)
  • Use marketplace.json for repos containing multiple plugins and to test install/uninstall flows

Example use cases

  • Rapid development: load a plugin locally with claude --plugin-dir ./my-plugin for fast iteration
  • Marketplace pre-release: add repo with /plugin marketplace add and test install/uninstall to verify UX
  • Monorepo placement: include internal plugins under plugins/ and load with --plugin-dir for dogfooding
  • Multiple-plugin repo: create .claude-plugin/marketplace.json to expose several plugins from one repository
  • Distribution repo: keep the repo root as the plugin with .claude-plugin/plugin.json and top-level skills/agents/commands

FAQ

What must go inside .claude-plugin/?

Only plugin.json belongs in .claude-plugin/. All components (skills, agents, commands, hooks) must be placed at the plugin root.

What fields are required in plugin.json?

At minimum include name, version, and description. Recommended fields include author, license, keywords, repository, and homepage.

How do I test changes locally?

For quick iteration load the folder with claude --plugin-dir ./path/to/plugin. Restart Claude Code to pick up file changes; for full-install testing use the marketplace add/install flow.