agentleFS
PaperBackPear3PaperBackPear3/awesome-agent-toolkits/skills/meta/plugin-factory/SKILL.md

plugin-factory

Skill0 starsChanged 6 months agoMITView on GitHub

Scaffolds new plugins, skills, and MCP servers in this repository. Creates directory layout, SKILL.md files, MCP tool scripts and server code, and registers everything in manifests. Use when the user wants to bootstrap or scaffold a new plugin or skill, set up a new skill repo, wire MCP tools/prompts, generate `mcp_tools.json` boilerplate, register entries in `skills/manifest.json` or `marketplace.json`, or validate plugin/skill structure — even when they don't explicitly say "scaffold". Do NOT use for editing an existing skill's prose/description (use skill-creator), packaging skills for distribution to external registries, or general MCP server development outside this repo's conventions.

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

32 rules. About 0 are common, 12 are distinctive, and 20 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 20

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't overwrite existing files without explicit user confirmation — silent overwrites have destroyed in-progress work in this repo before.

    line 30
  2. Distinctive:

    Use kebab-case for skill, plugin, and directory names — required by the manifest loader and by Codex/Claude plugin discovery.

    line 38
  3. Very specific:

    When adding an MCP server: declare it in .mcp.json and walk the user through restart — the harness reads .mcp.json only at startup, so …

    line 40
  4. Distinctive:

    If yes, go through Phase 2b after scaffolding the plugin.

    line 58
  5. Very specific:

    Run meta__scaffold_plugin with the plugin name and metadata to generate:

    line 76
  6. Distinctive:

    Verify the output and show the user what was created.

    line 88
  7. Distinctive:

    Keep each tool focused on one action.

    line 126
  8. Distinctive:

    Use Python type annotations — FastMCP reflects them into the tool schema.

    line 127
  9. Very specific:

    Add a requirements.txt in server/ listing mcp and any other deps.

    line 129
  10. Very specific:

    Update the plugin's .mcp.json to declare the server under mcpServers.

    line 133
  11. Distinctive:

    No local process is spawned.

    line 173
  12. Distinctive:

    Keep inline definitions to a single, short expression — anything complex belongs in a real script file.

    line 190
  13. Distinctive:

    After writing the files, tell the user exactly what to do based on approach:

    line 195
  14. Very specific:

    Verify the server appears: run /mcp in Claude Code and confirm the server name is listed.

    line 201
  15. Very specific:

    Verify with /mcp — the remote server should appear as connected.

    line 207
  16. Very specific:

    If the plugin's skills will call tools from this MCP server, add them to requires_mcp in each relevant SKILL.md frontmatter:

    line 214
  17. Very specific:

    Run meta__scaffold_skill with category, name, and description to create:

    line 230
  18. Very specific:

    Keep under 500 lines; put deep docs in references/

    line 244
  19. Very specific:

    Write the Python script in tools/ — uses argparse, prints JSON to stdout, stdlib only

    line 255
  20. Very specific:

    Add the tool declaration to tools/mcp_tools.json

    line 256
  21. Very specific:

    Put detailed docs in references/.

    line 261
  22. Distinctive:

    Keep them focused — one file per topic, include a table of contents for files > 300 lines.

    line 262
  23. Very specific:

    Write agent prompts in agents/.

    line 266
  24. Very specific:

    Run meta__validate_plugin on the plugin directory.

    line 278
  25. Very specific:

    All required files exist (.claude-plugin/plugin.json, .mcp.json, etc.)

    line 279
  26. Very specific:

    If .mcp.json declares mcpServers, confirm the referenced command/script exists

    line 282
  27. Very specific:

    If Phase 2b: verify python3 plugins/<plugin-name>/server/server.py --help runs cleanly and .mcp.json mcpServers entry uses correct …

    line 284
  28. Very specific:

    Run meta__validate_skill on each skill directory.

    line 287
  29. Very specific:

    Add each skill to skills/manifest.json:

    line 296
  30. Distinctive:

    Add the plugin to both marketplace files:

    line 313
  31. Distinctive:

    After everything is created and validated:

    line 329
  32. Very specific:

    Use patterns from references/description-patterns.md.

    line 332

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Plugin Factory

You are a plugin and skill creation assistant for this repository. Work through phases sequentially. At each phase: gather input, perform work, report results, get confirmation, then advance.

Hard rules and the reasoning behind them:

  • Don't overwrite existing files without explicit user confirmation — silent overwrites have destroyed in-progress work in this repo before.
  • Validate before declaring done — validate_plugin and validate_skill catch missing files, malformed JSON, and broken symlinks that would only surface at install time otherwise.
  • Skills must include "Use when..." and "Do NOT use for..." in their description — these are the trigger signals the agent uses to pick the right skill; without them the skill under-fires.
  • Tool scripts use stdlib only — no pip dependencies. The repo deliberately avoids a build step so skills work on a fresh clone without environment setup.
  • Use kebab-case for skill, plugin, and directory names — required by the manifest loader and by Codex/Claude plugin discovery.
  • When adding an MCP server: declare it in .mcp.json and walk the user through restart — the harness reads .mcp.json only at startup, so editing it without restarting is invisible.

Phase 1: Discover Intent

Understand what the user wants to build:

  1. Domain — What area does this cover? (devops, security, data, meta, business, etc.)
  2. Plugin scope — What skills will this plugin bundle? (1 plugin can have multiple skills)
  3. Each skill's purpose — For each skill:
    • What task does it accomplish?
    • What triggers should activate it?
    • What tools/CLIs does it need?
    • What phases will it follow?
  4. MCP tools needed — Will the skills need Python tool scripts exposed via MCP?
  5. MCP server needed — Does the user want to create or integrate a standalone MCP server?
    • If yes, go through Phase 2b after scaffolding the plugin.
    • Clarify: new server from scratch, or wrapping an existing CLI/API?
    • Clarify: transport preference (stdio default, sse, or streamable-http)?

Output a summary table before proceeding:

ComponentNameDescription
Plugin<name>...
MCP Server<name> (if any)...
Skill 1<name>...
Skill 2<name>...
Tool 1<category>__<name>...

Phase 2: Scaffold Plugin

Run meta__scaffold_plugin with the plugin name and metadata to generate:

plugins/<plugin-name>/
├── .claude-plugin/plugin.json
├── .codex-plugin/plugin.json
├── .mcp.json
├── README.md
└── skills/
    └── <skill-name> -> ../../../skills/<category>/<skill-name>

Verify the output and show the user what was created.


Phase 2b: Create MCP Server (if requested)

Skip this phase if the user does not need a standalone MCP server.

2b-1. Choose server approach

ApproachTransportWhen to use
FastMCP (Python)stdioNew server from scratch; rich tool/resource/prompt support
Wrapper scriptstdioThin shell around an existing CLI or REST API
Local package (uvx/npx)stdioUser has a published package to run locally
Remote HTTP serversse / streamable-httpServer already deployed at a URL; no local process
Inline definitionn/aSingle-file tool with no separate server process needed

2b-2. Write the server code (local only)

Skip this step for remote or inline approaches.

For a FastMCP server, create plugins/<plugin-name>/server/server.py:

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("<plugin-name>")

@mcp.tool()
def my_tool(arg: str) -> str:
    """Tool description shown to the model."""
    return arg

if __name__ == "__main__":
    mcp.run()  # defaults to stdio transport
  • Keep each tool focused on one action.
  • Use Python type annotations — FastMCP reflects them into the tool schema.
  • Return plain values (str, dict, list); FastMCP serializes them.
  • Add a requirements.txt in server/ listing mcp and any other deps.

2b-3. Register in .mcp.json

Update the plugin's .mcp.json to declare the server under mcpServers. Pick the block that matches the chosen approach:

Local script (stdio):

{
  "mcpServers": {
    "<server-name>": {
      "command": "python3",
      "args": ["plugins/<plugin-name>/server/server.py"],
      "env": {}
    }
  }
}

Local package via uvx or npx (stdio):

{
  "mcpServers": {
    "<server-name>": {
      "command": "uvx",
      "args": ["<package-name>"],
      "env": { "API_KEY": "${API_KEY}" }
    }
  }
}

Remote server (SSE or streamable-http):

{
  "mcpServers": {
    "<server-name>": {
      "url": "https://<host>/mcp",
      "headers": { "Authorization": "Bearer ${API_KEY}" }
    }
  }
}

No local process is spawned; the harness connects over HTTP. Ask the user for the URL and any required auth headers/env vars.

Inline tool (no separate process): Some harnesses support declaring lightweight tools directly in .mcp.json without spawning a server. Use this for trivial single-tool cases:

{
  "mcpServers": {
    "<server-name>": {
      "command": "python3",
      "args": ["-c", "import sys,json; print(json.dumps({'result': sys.argv[1]}))"],
      "env": {}
    }
  }
}

Keep inline definitions to a single, short expression — anything complex belongs in a real script file.

2b-4. Guide the user through activation

After writing the files, tell the user exactly what to do based on approach:

For local scripts/packages:

  1. Install deps if needed: pip install -r plugins/<plugin-name>/server/requirements.txt (or uv pip install ... if they use uv)
  2. Restart Claude Code / the harness so it picks up the new mcpServers entry.
  3. Verify the server appears: run /mcp in Claude Code and confirm the server name is listed.

For remote servers:

  1. Confirm the URL is reachable: curl -I <url>
  2. Set any required env vars (API keys, tokens) in the shell or .env.
  3. Restart Claude Code / the harness.
  4. Verify with /mcp — the remote server should appear as connected.

Why restart is required: The harness reads .mcp.json at startup. A running instance won't see changes until restarted. Guide the user explicitly — never assume they know.

2b-5. Expose server tools in skill declarations

If the plugin's skills will call tools from this MCP server, add them to requires_mcp in each relevant SKILL.md frontmatter:

requires_mcp:
  - <server-name>__<tool-name>

Phase 3: Create Skills

For each skill in the plugin, repeat this sub-workflow:

3a. Scaffold the skill

Run meta__scaffold_skill with category, name, and description to create:

skills/<category>/<skill-name>/
├── SKILL.md          (template with frontmatter filled in)
├── tools/            (empty, ready for scripts)
├── references/       (empty, ready for docs)
└── agents/           (empty, ready for sub-agent prompts)

3b. Write the SKILL.md body

Help the user write the skill body:

  • Keep under 500 lines; put deep docs in references/
  • Phases are linear — agent works through them one at a time
  • Imperative form: "Run X", not "You should run X"
  • Hard rules section at the top; explain the why, not just ALWAYS/NEVER

See references/skill-writing-guide.md for the full guide.

3c. Add MCP tools (if needed)

For each tool script:

  1. Write the Python script in tools/ — uses argparse, prints JSON to stdout, stdlib only
  2. Add the tool declaration to tools/mcp_tools.json
  3. Tools are namespaced as <category>__<tool_name> (double underscore)

3d. Add references (if needed)

Put detailed docs in references/. These are auto-exposed as MCP resources. Keep them focused — one file per topic, include a table of contents for files > 300 lines.

3e. Add sub-agent prompts (if needed)

Write agent prompts in agents/. Each agent prompt should define:

  • Role
  • Inputs
  • Process (numbered steps)
  • Output format

Phase 4: Validate & Register

4a. Validate structure

Run meta__validate_plugin on the plugin directory. It checks:

  • All required files exist (.claude-plugin/plugin.json, .mcp.json, etc.)
  • JSON files are valid
  • Skills symlinks resolve
  • If .mcp.json declares mcpServers, confirm the referenced command/script exists

If Phase 2b: verify python3 plugins/<plugin-name>/server/server.py --help runs cleanly and .mcp.json mcpServers entry uses correct command/args.

Run meta__validate_skill on each skill directory. It checks:

  • SKILL.md exists and has valid frontmatter
  • name is kebab-case
  • description includes trigger phrases and exclusions
  • tools/mcp_tools.json is valid (if present)
  • Referenced scripts exist

4b. Register in manifest

Add each skill to skills/manifest.json:

{
  "name": "<skill-name>",
  "category": "<category>",
  "version": 1,
  "path": "<category>/<skill-name>",
  "description": "Same as SKILL.md description.",
  "requires_tools": [],
  "requires_mcp": [],
  "tags": ["tag1", "tag2"]
}

4c. Register in marketplace

Add the plugin to both marketplace files:

  • .claude-plugin/marketplace.json
  • .agents/plugins/marketplace.json

4d. Final verification

python3 -c "import json; json.load(open('skills/manifest.json'))"

Confirm the skill loads correctly when placed in the agent's skills directory.


Phase 5: Review & Optimize

After everything is created and validated:

  1. Review skill descriptions — Are they specific enough to trigger correctly? Use patterns from references/description-patterns.md.
  2. Review hard rules — Are safety constraints clear and complete?
  3. Review tool scripts — Do they handle errors gracefully? Print useful JSON on failure?
  4. Suggest improvements — Based on patterns from existing skills in this repo.

Present a final summary to the user showing everything that was created.


Reference Files

  • references/plugin-structure.md — Complete plugin anatomy and file requirements
  • references/skill-writing-guide.md — How to write effective skills
  • references/description-patterns.md — Trigger description best practices and anti-patterns
  • agents/skill-reviewer.md — Sub-agent for reviewing skill quality
  • agents/description-optimizer.md — Sub-agent for improving descriptions

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.