AGENT SKILL

scaffold-plugin

Scaffold a new Claude Code plugin in this repository with the repo layout (<name>/package.json, plugin/, src/, tests/). Use when the user asks to create, add, scaffold or start a new plugin here.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
scaffold-plugin
description
Scaffold a new Claude Code plugin in this repository with the repo layout (<name>/package.json, plugin/, src/, tests/). Use when the user asks to create, add, scaffold or start a new plugin here.
argument-hint
[plugin-name] [one-line description]
disable-model-invocation
false

03 SKILL.md 正文

scaffold-plugin

Creates <name>/ at the repo root following the layout in the root CLAUDE.md. Never overwrites an existing plugin directory.

Step 1 — Collect inputs

Use AskUserQuestion for anything missing. Parse $ARGUMENTS first (<name> [description]).

  • name — kebab-case, ^[a-z][a-z0-9-]*$. Abort if <name>/ already exists.
  • description — one sentence.
  • components (multi-select): skill, hook (command hook), mods (function-hooks module), agent, mcp. Only hook, mods and mcp need src/ TypeScript; the others are plain markdown in plugin/.
  • hook event (if hook chosen): e.g. SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop.

Step 2 — Create the directory tree

From the repo root, copy templates from ${CLAUDE_SKILL_DIR}/templates/ and substitute __NAME__, __DESCRIPTION__, __AUTHOR__ (__AUTHOR__ = current git config user.name):

name=<name>
mkdir -p "$name"/{plugin/.claude-plugin,src,tests}
T="${CLAUDE_SKILL_DIR}/templates"
sed -e "s/__NAME__/$name/g" -e "s/__DESCRIPTION__/<description>/g" -e "s/__AUTHOR__/$(git config user.name)/g" "$T/package.json" > "$name/package.json"
sed "s/__NAME__/$name/g" "$T/CLAUDE.md" > "$name/CLAUDE.md"
sed "s/__NAME__/$name/g" "$T/README.md" > "$name/plugin/README.md"

Per selected component:

  • skill → plugin/skills/<skill-name>/SKILL.md from templates/SKILL.md (frontmatter name, description; body = instructions).
  • hook → src/hooks/<event-kebab>.mts from templates/hook.mts and plugin/hooks/hooks.json from templates/hooks.json (set the event name and the .mjs path). Add tests/<event-kebab>.test.mts from templates/hook.test.mts.
  • mods → src/hooks/register.mts exporting register(on, options) with structural $/on types (model: inline-headroom/src/hooks/register.mts), and plugin/hooks/hooks.json {"modules": ["./register.mjs"]} (merged into the same file when hook is also chosen). Tests in tests/register.test.mts with createKit from claude-engine-vitest (pnpm --filter <name> add -D claude-engine-vitest@workspace:*).
  • agent → plugin/agents/<agent-name>.md with frontmatter name, description, tools.
  • mcp → src/mcp/server.mts (zero-dep stdio JSON-RPC) and plugin/.mcp.json pointing at ${CLAUDE_PLUGIN_ROOT}/mcp/server.mjs. Dual-era from the start (answer initialize and server/discover): follow .claude/rules/mcp-dual-era.md, model dprint/src/mcp/server.mts. Add a test for both eras.

If no src/ files were created, still keep src/ and the package.json — the build then only generates plugin/.claude-plugin/plugin.json from package.json.

Step 3 — Build and verify

pnpm install
pnpm --filter <name> build
pnpm exec oxlint
pnpm --filter <name> test
claude plugin validate <name>/plugin

All four must pass. Fix template substitutions, never hand-edit plugin/**/*.mjs or plugin/.claude-plugin/plugin.json.

Step 4 — Report

List the created files and the three commands above. Do not commit unless asked.

Rules recap

  • <name>/package.json is the only place for version, description, author, keywords and claudePlugin (required, {} at least: marks the package as a plugin for CI; holds plugin-only manifest fields such as userConfig); pnpm build generates the manifest plugin/.claude-plugin/plugin.json.
  • src/**/*.mts → plugin/**/*.mjs, same relative path.
  • Scripts used by several components (skills, hooks, MCP) go in src/bin/*.mts → plugin/bin/*.mjs.
  • Runtime code: node: builtins only.

04 同仓库更多 Skills

kwitsch
kwitsch/claude-plugins-development

universal-lint

User-invoked. Takes a free-text description of a set of files ("all files in src/", "files changed in PR 123", or an explicit list) and lints each of them exactly as this plugin's Write/Edit hook would — read-only, no autofix — printing one aggregated findings report. Self-contained: depends on no other plugin.

★ 0
kwitsch
kwitsch/claude-plugins-development

solve

Single entry point for any coding task (change, feature, refactor, bug). Triages the task through the jev-api tools and routes it to the right track, loading the phase references it needs. Flags --headless (the decider agent answers every question) and --size=<S|M|L|XL>. Use when the user hands over a task to implement or fix.

★ 0
kwitsch
kwitsch/claude-plugins-development

dprint

Runs dprint for the project. The first argument selects the action - init checks for the plugin's minimum dprint version, installs or updates dprint at user level after confirmation via AskUserQuestion, offers to create a dprint config when none exists and to add dprint plugins for file types the config does not cover; check [scope] runs dprint check; fmt [scope] runs dprint fmt and rewrites files; without an argument it runs fmt on the whole current directory. Use init when the user wants dprint set up, installed, updated, checked or its plugins completed; check when they want formatting verified with dprint; fmt only when they ask to format files with dprint. When invoking this skill yourself, always pass init, check or fmt as the first argument.

★ 0
kwitsch
kwitsch/claude-plugins-development

split-hooks-lib

Split the hooks module of a function-hooks plugin of this repository into a readable entry register.mts plus helper modules that the build bundles into one compressed plugin/hooks/lib.mjs, to keep the shipped size small. Use when the user asks to split a plugin's register.mts, to make a plugin smaller, to move a plugin to register.mjs plus lib.mjs, or when a hooks module has grown too large for one file.

★ 0
kwitsch
kwitsch/claude-plugins-development

__SKILL_NAME__

__SKILL_DESCRIPTION__ Use when the user asks to …

★ 0
kwitsch
kwitsch/claude-plugins-development

refactor-plugin

Refactor one plugin of this repository end to end in a fresh worktree on its own branch cut from a freshly fetched origin/main - perf-worklist, then bughunt, then a merge-ready PR. Use when the user asks to refactor, overhaul or run the full performance and bug hunt pass on a plugin.

★ 0