/tsh-core:authoring-claude-extensionsfrom TSH Core
Guides choosing the right Claude Code extension type (skill, subagent, hook, or plugin) and writing it correctly. Use when packaging workflows, reducing chat repetition, or sharing setup across repos.
Ships in TSH Core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Two jobs, in order: decide which primitive the need calls for, then build that primitive correctly. The first job is where the expensive mistakes happen — a correctly written extension in the wrong primitive still fails, and it fails invisibly, because the file looks right in review.
This skill covers skills, subagents, hooks, and plugins.
If the answer is a memory file —
CLAUDE.md, a.claude/rules/file, or a decision record — stop and usemanaging-claude-context. That skill owns the memory layer; this one owns the things you build.
Not covered at all: writing an MCP server, agent teams, code intelligence,
artifacts. Bundling an existing MCP server in a plugin is a one-line .mcp.json at
the plugin root; the packaging reference names it and goes no further.
Read what the repository already has before adding to it. An existing skill, agent or hook is a statement of team intent — extend it in place rather than adding a second one beside it. Where the repository has its own conventions for naming, layout or packaging, those win over this skill's defaults.
Claude Code's own documentation outranks this skill. These mechanics ship on Claude Code's release cadence, and every reference here is a snapshot with its sources and a verification date at the bottom. Where the two disagree, follow the docs and fix the reference.
This skill does not:
CLAUDE.md, .claude/rules/, or decision records — see
managing-claude-contextRoute on what just happened to you, not on the artifact you already have in mind.
| What just happened | Build this |
|---|---|
| Claude got a convention or command wrong twice | CLAUDE.md → managing-claude-context |
| You need guidance while creating a file that does not exist yet | A skill. A path-scoped rule fires on read, so it can never reach you here |
| You need guidance while editing files that already exist, and only some of them | A path-scoped rule → managing-claude-context |
| You pasted the same multi-step procedure into chat for the third time | A skill |
| You keep typing the same prompt to start a task | A skill, user-invocable |
| A side task floods the conversation with output you will not read again | A subagent |
| You need several independent opinions, or work that reads many files | A subagent |
| It must happen every time, the same way, without Claude deciding | A hook |
| Claude keeps ignoring an instruction that must always hold | A hook — not stronger wording |
| A second repository needs the same setup | A plugin |
Row two is the one people get wrong, and it is worth stating as its own rule: the
question is not only what the guidance is about, it is when it is needed.
Guidance about SKILL.md files that is needed while writing a new one is a skill,
even though a rule scoped to **/SKILL.md looks like a perfect fit.
Read ./references/choosing-the-primitive.md
before writing anything when the table gives more than one plausible answer.
| Severity | Rule |
|---|---|
| MUST | Decide the primitive before writing a line. Ask when the guidance is needed, not only what it is about. |
| MUST | Route creation-time guidance to a skill. A path-scoped rule fires only when Claude reads a matching file, so guidance for authoring a file that does not exist yet never loads. |
| MUST | Write description the way a person would phrase the request, not the way the artifact is filed. It is the only thing routing sees. |
| NEVER | Ship two extensions whose descriptions overlap. Routing between near-identical descriptions is a coin flip, and the loser is silently never invoked. |
| MUST | Use a hook, not an instruction, when something must hold regardless of what Claude decides. Instructions are context, not enforcement. |
| NEVER | Declare hooks, mcpServers or permissionMode in a plugin-shipped subagent. Claude Code ignores those fields there. |
| MUST | Keep SKILL.md under ~150 lines and move detail into references/, one concern per file, ≤300 lines each. |
| MUST | Give every Reference Loading table a Load when column, and repeat the trigger as an imperative at the point of use. |
| MUST | Verify the extension actually loaded and actually routes before calling the work done. Confirm with /context, and test the description with a request that does not name it. |
| NEVER | Set a status, enable a hook, or mark something enforced that the team has not agreed to. |
| Reference | Load when | Covers |
|---|---|---|
| Choosing the primitive | The routing table gives more than one plausible answer, every time | The full predicate: timing vs scope, trigger determinism, context cost, the read-not-write trap and its symptom, skill vs subagent, hook vs instruction |
| Authoring a skill | Writing or restructuring any SKILL.md | Frontmatter, writing a description that routes, disable-model-invocation and user-invocable, progressive disclosure, references, arguments |
| Authoring a subagent | Writing or changing a subagent | The frontmatter field set, tools and disallowedTools, what loads at startup, precedence across scopes, the plugin-shipped restrictions |
| Authoring a hook | Writing a hook, or deciding whether something needs enforcing | Events and which ones block, matchers, handler types, exit codes and JSON output, where hooks are registered |
| Packaging a plugin | Bundling extensions for another repository or a marketplace | Directory layout and the manifest trap, ${CLAUDE_PLUGIN_ROOT}, namespacing, marketplaces, versioning and distribution |
Step 1 — Read what exists. List the skills, agents and hooks already present at
project, user and plugin scope. Run /context to see what loads today. An extension
that duplicates one already installed makes both worse, because routing has to pick.
Step 2 — Choose the primitive. Apply the table above. When two rows both fit, read
choosing-the-primitive.md — the deciding
questions are when is this needed, must it be guaranteed, and whose context pays.
If the answer is a memory file, stop here and hand off to managing-claude-context.
Step 3 — Confirm the trigger exists. Name the moment the extension will fire, and check that moment is real. A hook needs an event that actually occurs; a path-scoped rule needs a file that will actually be read; a skill needs a request someone will actually phrase. An extension whose trigger never occurs is indistinguishable from one that was never written.
Step 4 — Write it. Read the reference for that primitive first. Write the routing
surface — description, when_to_use, matcher — before the body, because that is
what decides whether the body is ever reached.
Step 5 — Verify it loads and routes. Start a session and run /context. Then test
the routing with a request phrased the way a user would phrase it, without naming
the extension. If it does not route, the description is wrong; fix that before
anything else.
Step 6 — Report. Say which primitive you chose and which you rejected, and why. The rejected option is the part a reviewer needs in order to disagree.
- [ ] The primitive was chosen deliberately, and the rejected alternative is named
- [ ] Timing was considered, not just subject matter
- [ ] `description` is phrased the way a person would ask, and does not overlap an existing one
- [ ] The trigger has been shown to occur — a real event, a file that gets read, a request someone makes
- [ ] Nothing enforced that the team has not agreed to enforce
- [ ] No plugin-shipped subagent declares `hooks`, `mcpServers` or `permissionMode`
- [ ] `/context` confirms it loaded, and an un-named request routes to it
- [ ] Memory-file work was handed to `managing-claude-context`, not done here
What SKILL.md sets; muted values are Claude Code's defaults
Trigger on: creating or editing a skill, subagent or plugin; a hook that ships inside a plugin or has to reach a second repository; a procedure pasted into chat repeatedly; a side task flooding the conversation; packaging a setup for a second repository or a marketplace; or any question of the form "should this be a skill or a hook / a rule / an agent?". Not for adding one hook to this repository's settings.json — that is Claude Code configuration.
6 skills in this plugin
/initOne-shot setup of a project's Claude Code context. Audits what already loads, then creates or repairs root and nested `CLAUDE.md`, path-scoped rules, and the decision-record archive with its index by running the owning tsh-core skills in order, wires maintenance pointers into `CLAUDE.md` so future sessions keep it all current, and, where tsh-product-engineering is installed, has the project's verification and security-invariant skills captured. Run /tsh-core:init inside the repository to set up./managing-claude-contextSets up and maintains the project-context files Claude Code loads — root and nested `CLAUDE.md`, path-scoped rules in `.claude/rules/`, and a decision-record index — so a repository's conventions reach the model without bloating every session. Use when a repository has no `CLAUDE.md`, when Claude keeps ignoring a convention, or when the memory files have drifted from the code./managing-decision-recordsOwns the shape and lifecycle of architecture decision records — the four-section format, the status vocabulary, numbering, superseding, and keeping `docs/decisions/README.md` in step. Use when adding a decision record, changing one's status, superseding an old decision, or deciding whether something warrants a record at all./managing-git-worktreesManages Git worktree lifecycle requests: creating a worktree for a new branch from a freshly fetched base branch on origin — any branch, defaulting to origin's own default branch — adopting a branch that already exists on origin, such as a pull request's head branch, into its own worktree, listing registered worktrees, and removing a precisely identified worktree. Use when the user asks for worktree creation, adoption of an existing branch, listing, removal, or safe Git worktree lifecycle guidance./writing-technical-documentsApplies TSH's writing standard to any technical document — README, CHANGELOG, ADR, RFC, runbook, PR description, ticket, user story, bug report or test plan — so it leads with the conclusion, states only verified facts, and is short enough to be read. Use when writing or revising a document meant for other people, or when asked to tighten, shorten or clarify prose — load it before rewriting, even for one pasted paragraph, because the standard decides what to cut.npx claudepluginhub thesoftwarehouse/agentic-collections --plugin tsh-coreOther plugins' skills for the same job