Some Assembly Required · Level 5 of 5

Pack It as a Plugin

In this level, you'll move tidy-imports and tidy-imports-check into a plugin, so any project can install them with one command.

Colour key: 5.1 A Plugin Folder and plugin.json 5.2 Paths That Travel 5.3 Install From a Marketplace

Scroll and the sheet below builds the files one step at a time, pinning each step's notes. One scroll moves one step; the step buttons, the arrow keys or j and k do the same.

Where Level 4 Left It

Specimen tidy-imports/SKILL.md Where Level 4 Left It

Here are both skills at the end of level 4, still in the project's .claude/skills/ folder; step 5.1 moves them into a plugin.

The files at the start

.claude/skills/tidy-imports/SKILL.md

---name: tidy-importsdescription: Sort the import statements at the top of a filewhen_to_use: "After you add or remove imports in a file, or when the user asks to sort or tidy a file's imports."arguments: [path]argument-hint: "[file]"model: sonneteffort: lowdisable-model-invocation: false # Claude may start it after changing a file's imports; it stops for a yes before rewriting a file git has no copy ofallowed-tools: ["Bash(${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh:*)", "Bash(git status:*)"]disallowed-tools: [Edit, Write, NotebookEdit] # the script changes the file; Claude never does---Tidy the imports in $path.... lines 16 to 21 left outRun `git status --porcelain -- "$path"`. If it printsanything, the file has changes git holds no copy of, andthe rewrite cannot be undone from git. Show the check'sreport, say this and stop. Run the script only after theuser replies yes.Run the script on the file, by exactly this path:... lines 30 to 40 left out

.claude/skills/tidy-imports-check/SKILL.md

---name: tidy-imports-checkdescription: Report whether the import statements at the top of a file are sorted, without changing the filewhen_to_use: "Before tidy-imports rewrites a file, or when the user asks whether a file's imports are in order."arguments: [path]argument-hint: "[file]"model: sonneteffort: lowdisable-model-invocation: false # tidy-imports calls this skill, so Claude must be able to invoke itallowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/check-imports.sh:*)disallowed-tools: [Edit, Write, NotebookEdit] # reads, never writes---Check the imports in $path.Run the script on the file, by exactly this path:```bash${CLAUDE_SKILL_DIR}/scripts/check-imports.sh "$path"```Report its output as it stands. Do not sort, fix or changeanything, even when the imports are out of order.

A plugin is a folder with a manifest at .claude-plugin/plugin.json and its parts beside it 5.1c. Skills go in skills/, one folder each, exactly as they were in .claude/skills/. Call the plugin tidy 5.1a; its two skills then run as /tidy:tidy-imports and /tidy:tidy-imports-check.

Before anything else, test it with claude --plugin-dir ./tidy, which loads the plugin for that one session without installing it.

The files after step 5.1

tidy/.claude-plugin/plugin.json

{	"name": "tidy",	"version": "0.1.0",	"description": "Sort the import statements at the top of a file, with a read-only check first",	"author": {		"name": "noor"	},	"license": "MIT"}
  1. 5.1a "name": "tidy" is the only required field. Write it in kebab-case: it becomes the prefix on every skill the plugin holds.

  2. 5.1b "version": "0.1.0" keeps people who install the plugin from a hosted marketplace on this version until you change the number.

tidy

tidy/	.claude-plugin/		plugin.json	skills/		tidy-imports/			SKILL.md			scripts/sort-imports.sh		tidy-imports-check/			SKILL.md			scripts/check-imports.sh
  1. 5.1c .claude-plugin/ holds the manifest and nothing else, while skills/ sits at the plugin root beside it.

On someone else's machine, a path into .claude/skills/ points at a folder that isn't there. ${CLAUDE_SKILL_DIR} already avoids that 5.2a: inside a plugin it fills in the skill's own folder, wherever Claude Code installed the plugin (a new folder in its cache for each version), so both scripts work as they are. For a file several skills share, use ${CLAUDE_PLUGIN_ROOT}, the plugin's own folder. The one change tidy-imports needs is the call to the check, which now uses its plugin name 5.2b.

Both scripts are unchanged from 4.1 and 2.3.

The files after step 5.2

tidy/skills/tidy-imports/SKILL.md

---name: tidy-importsdescription: Sort the import statements at the top of a filewhen_to_use: "After you add or remove imports in a file, or when the user asks to sort or tidy a file's imports."arguments: [path]argument-hint: "[file]"model: sonneteffort: lowdisable-model-invocation: false # Claude may start it after changing a file's imports; it stops for a yes before rewriting a file git has no copy ofallowed-tools: ["Bash(${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh:*)", "Bash(git status:*)"]disallowed-tools: [Edit, Write, NotebookEdit] # the script changes the file; Claude never does---Tidy the imports in $path.Read .claude/tidy-imports.log if it exists. If $path isalready listed there, say so before going on.Load the tidy:tidy-imports-check skill on $path. If itreports the imports already sorted, say so and stop. If thecheck cannot run, say why and stop.... lines 22 to 30 left out```bash${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh "$path"```... lines 34 to 40 left out
  1. 5.2a ${CLAUDE_SKILL_DIR} needs no change in a plugin: it fills in the skill's own folder there too, so the rule and the command still match.

  2. 5.2b Load the tidy:tidy-imports-check skill uses the full plugin name, the form every plugin skill carries.

  3. 5.2c .claude/tidy-imports.log stays a project path, because the plugin's own folder changes with every version and is no place to keep state.

tidy/skills/tidy-imports-check/SKILL.md

---name: tidy-imports-checkdescription: Report whether the import statements at the top of a file are sorted, without changing the filewhen_to_use: "Before tidy:tidy-imports rewrites a file, or when the user asks whether a file's imports are in order."arguments: [path]argument-hint: "[file]"model: sonneteffort: lowdisable-model-invocation: false # tidy:tidy-imports calls this skill, so Claude must be able to invoke itallowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/check-imports.sh:*)disallowed-tools: [Edit, Write, NotebookEdit] # reads, never writes---Check the imports in $path.Run the script on the file, by exactly this path:```bash${CLAUDE_SKILL_DIR}/scripts/check-imports.sh "$path"```Report its output as it stands. Do not sort, fix or changeanything, even when the imports are out of order.

A marketplace is a folder or repository with .claude-plugin/marketplace.json, listing plugins and where each one lives. Say noor keeps one called noor-tools, with tidy under plugins/: anyone can add that marketplace once and install from it.

Delete the old .claude/skills/tidy-imports/ and .claude/skills/tidy-imports-check/ folders from the project once the plugin works. While they stay, /tidy-imports still runs the project copy.

The files after step 5.3

noor-tools/.claude-plugin/marketplace.json

{	"name": "noor-tools",	"owner": {		"name": "noor"	},	"plugins": [		{			"name": "tidy",			"source": "./plugins/tidy",			"description": "Sort the import statements at the top of a file, with a read-only check first"		}	]}
  1. 5.3a The entry's "name": "tidy" matches the plugin's own name. Installs use the entry name and skill prefixes use the manifest name, so if they differ, the install breaks.

  2. 5.3b "source": "./plugins/tidy" is written from the marketplace root, the folder that holds .claude-plugin/.

Install it in a session

/plugin marketplace add ./noor-tools/plugin install tidy@noor-tools
  1. 5.3c tidy@noor-tools is the plugin's entry name, an @ and the marketplace name.

  2. 5.3d /plugin marketplace add also takes a GitHub owner/repo, so once noor-tools is pushed, /plugin marketplace add noor/noor-tools adds it on any machine.

Or from your shell

claude plugin marketplace add ./noor-toolsclaude plugin install tidy@noor-tools

Then, in any project

/tidy:tidy-imports src/app.ts

The Real Thing

goblin-scout is a plugin in this repository that keeps a project plan, the roadbook, as a map of what waits on what. Its skills run as /goblin-scout:<skill>.

The manifest's "types" line belongs to the plugin's mod: a hooks module that ships beside the skills and runs inside Claude Code, where it can draw panes. Mods, and plugins in general, get an article of their own later.

{    "name": "goblin-scout",    "version": "3.0.0",    ...    "license": "Zlib",    ...    "types": "./types/index.d.ts"}
  1. R.a "name": "goblin-scout" is the prefix every skill in the plugin carries, so start-roadbook runs as /goblin-scout:start-roadbook, as in step 5.1.