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. Onlyhook,modsandmcpneedsrc/TypeScript; the others are plain markdown inplugin/. - hook event (if
hookchosen): 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.mdfromtemplates/SKILL.md(frontmattername,description; body = instructions). - hook →
src/hooks/<event-kebab>.mtsfromtemplates/hook.mtsandplugin/hooks/hooks.jsonfromtemplates/hooks.json(set the event name and the.mjspath). Addtests/<event-kebab>.test.mtsfromtemplates/hook.test.mts. - mods →
src/hooks/register.mtsexportingregister(on, options)with structural$/ontypes (model:inline-headroom/src/hooks/register.mts), andplugin/hooks/hooks.json{"modules": ["./register.mjs"]}(merged into the same file whenhookis also chosen). Tests intests/register.test.mtswithcreateKitfromclaude-engine-vitest(pnpm --filter <name> add -D claude-engine-vitest@workspace:*). - agent →
plugin/agents/<agent-name>.mdwith frontmattername,description,tools. - mcp →
src/mcp/server.mts(zero-dep stdio JSON-RPC) andplugin/.mcp.jsonpointing at${CLAUDE_PLUGIN_ROOT}/mcp/server.mjs. Dual-era from the start (answerinitializeandserver/discover): follow.claude/rules/mcp-dual-era.md, modeldprint/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.jsonis the only place forversion,description,author,keywordsandclaudePlugin(required,{}at least: marks the package as a plugin for CI; holds plugin-only manifest fields such asuserConfig);pnpm buildgenerates the manifestplugin/.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
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.
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.
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.
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.
__SKILL_NAME__
__SKILL_DESCRIPTION__ Use when the user asks to …
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.