Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
A support team has six jobs it repeats by hand. Four questions (trigger, same every time, scope, owner) send each one to its home in Claude Code: a skill, a hook, a rules file, a subagent, a slash command or a plugin. Plus where each file lives and which file wins when two disagree.
What you will learn
- Pick the right home for a repeated job with four questions: trigger, same every time, scope and owner
- Place each extension file where Claude Code looks for it, and spot the three common misplacements
- Say which file wins when settings, skills or subagents clash, and why hooks and CLAUDE.md files never compete
- Tell guidance (rules file, skill) apart from enforcement (hook)
Before you start
- Basic use of Claude Code in a terminal
- Reading JSON and Markdown files
A support team keeps doing the same jobs by hand. Someone says, "we repeat this every week", and the next question is always the same: where does this job belong?
Claude Code gives you six ways to extend it: a skill, a hook, a rules file, a subagent, a slash command and a plugin. They overlap just enough to be confusing. In this article we take six real jobs, ask four questions about each, and find each one its home. Then we look at where the files live and what happens when two files disagree.
Six jobs we repeat
Here is the team's list.
- Review a refund change against our policy checklist, item by item.
- Format the Python code after every single file edit, whoever made it.
- Follow our typing and test style whenever we work in the source folder.
- Scan a huge log and report only a short summary of what failed.
- Type one word and get a summary of yesterday's commits, grouped by feature.
- Share the refund check with every other support repo, without copying files.
Each job needs a different home. Choosing that home is the whole skill.
One kitchen, six ways to run it
Think of a busy kitchen.
- A recipe card: you read it when you cook that dish, then follow the steps. That is a skill.
- A door sensor: the light switches on every time, and nobody decides. That is a hook.
- A poster on the wall: everyone sees it and is asked to follow it. That is a rules file.
- A prep cook in the back room who brings back only the result. That is a subagent.
- A button on the till: one press sends a saved order. That is a slash command.
- A starter box packed for a new kitchen. That is a plugin.
Four questions pick the home
For any job, ask: what triggers it? Must it be the same every time? How far does it reach? Who maintains it?
| Mechanism | Trigger | Same every time? | Scope | Who maintains it |
|---|---|---|---|---|
| Skill | you type /name, or Claude matches the description | no, Claude follows it | project or personal | the workflow's owner |
| Hook | a lifecycle event | yes, it fires every time | project, user or plugin | the tooling owner |
| Rules file | session start, or when a matching file opens | no, it is guidance | whole project, or some paths | the whole team, by pull request |
| Subagent | Claude or you delegate a task | no, its own context | project or personal | the team that uses it |
| Slash command | you type /name | no, a saved prompt | project or personal | its author |
| Plugin | installed once, then enabled | its parts decide | many repositories | the plugin author, versioned |
The last column is a rule of thumb, not a rule from the docs. One more detail: plugin skills are namespaced, like /support-kit:refund-check, so two plugins never clash.
Each job finds its home
- Refund checklist: it needs judgment on each item, and you ask for it by name. A skill.
- Format after each edit: it must run every time, with no judgment. A hook.
- Typing and test style: guidance, for the source files only. A rules file.
- Huge log: it should stay out of the main chat and return only a summary. A subagent.
- Yesterday's commits: a saved prompt you type. A slash command.
- Share with other repos: one install for many repositories. A plugin.
Where each one lives
Claude Code reads set places, so a file anywhere else is never found. Here is the sample repo from the lecture.
CLAUDE.md rules file, always loads
.claude/settings.json hooks block (shared, committed)
.claude/settings.local.json your local overrides
.claude/rules/python-style.md rules file limited to some paths
.claude/skills/refund-check/SKILL.md skill (a folder with SKILL.md)
.claude/agents/log-scanner.md subagent
.claude/commands/standup.md slash command
support-kit/.claude-plugin/plugin.json plugin manifest
support-kit/skills/refund-check/SKILL.md plugin skill
The hook: settings.json
The hook lives in the shared settings file. It is committed, so the whole team gets it.
{
"model": "sonnet",
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{ "type": "command", "command": "ruff format ." }
]
}
]
}
}
PostToolUse means "after a tool has finished". The matcher Write|Edit limits it to file changes. And ruff format . runs every single time. Claude does not decide.
The skill: a folder with SKILL.md
---
name: refund-check
description: Checks refund code against
our policy checklist.
---
Walk the change through these items:
1. The amount is an integer in cents.
2. Big refunds need a human approval.
3. Every refund writes an audit line.
The subagent, the rules file and the command
---
name: log-scanner
description: Scans long support logs for failed refunds and returns only a
short summary. Use when a log is too big to read in the main chat.
tools: Read, Grep, Glob
---
You scan log files for failed refunds. Count the failures, group them by
error message, and return a summary of at most ten lines.
The rules file uses a paths list so it only applies to source files:
---
paths:
- "src/**/*.py"
---
Use type hints on every function.
Write tests with pytest fixtures, not setUp methods.
And the slash command is a saved prompt, named after its file (/standup):
---
description: Summarise yesterday's commits for standup
---
Summarise the commits made since yesterday in three bullet points,
grouped by feature. Skip merge commits.
Skills and slash commands share one mechanism, and the docs prefer a skill for new work.
Each home has its own deep dive: authoring a skill, CLAUDE.md, settings.json and plugins, hooks that block destructive actions and context isolation through subagents.
When two files disagree
Settings can come from three files. Skills and subagents can exist in your user folder and in the project. Who wins?
- A setting key: local file, then project file, then user file. The first one that sets the key wins.
- A skill with the same name: the user folder wins over the project folder.
- A subagent with the same name: the other way round, the project folder wins.
- Hooks do not compete. Every hook for the same event fires, from the project and from the user.
- CLAUDE.md files all load and add up. Claude weighs any conflict, so there is no winner.
The lecture's small Python checker, winner.py, encodes that order (highest priority first):
SETTINGS = {
"local": ".claude/settings.local.json",
"project": ".claude/settings.json",
"user": "home/.claude/settings.json",
}
HOME = {"user": "home/.claude", "project": ".claude"}
SKILL_ORDER = ["user", "project"]
AGENT_ORDER = ["project", "user"]
def setting_values(key):
found = [(s, load(s)) for s in SETTINGS]
return [(s, d[key]) for s, d in found if key in d]
def name_winner(order, subpath):
for scope in order:
if (ROOT / HOME[scope] / subpath).exists():
return scope
Running main.py over the sample repo checks the placement of every file, tries three misplaced paths, and prints the winners. This is plain Python reading files, no model involved:
PLACEMENT
ok .claude/skills/refund-check/SKILL.md = skill
ok .claude/settings.json = hook
ok .claude/rules/python-style.md = rules file
ok .claude/agents/log-scanner.md = subagent
ok .claude/commands/standup.md = slash command
ok support-kit/.claude-plugin/plugin.json = plugin
no .claude/skills/refund-check.md
fix: .claude/skills/refund-check/SKILL.md = skill
no .claude/agent/log-scanner.md
fix: .claude/agents/log-scanner.md = subagent
no support-kit/.claude-plugin/skills/refund-check/SKILL.md
fix: support-kit/skills/refund-check/SKILL.md = plugin skill
WINNERS
model: local opus, project sonnet, user haiku
-> the local settings file wins
skill refund-check in two places -> user wins
subagent log-scanner in two places -> project wins
PostToolUse hooks that fire: 2
project hook: ruff format .
user hook: echo file changed
Common mistakes
- A flat skill file.
.claude/skills/refund-check.mdis never found. A skill is a folder withSKILL.mdinside. - A singular folder.
.claude/agent/is wrong. Subagents live in.claude/agents/. - Skills inside the manifest folder. Only
plugin.jsongoes in.claude-plugin/. The plugin's skills sit at the plugin's root. - A rule that must always hold, written in CLAUDE.md. CLAUDE.md is guidance. If the format must run every time, it needs a hook.
- A checklist that needs judgment, written as a hook. A hook runs a command; it can't weigh items. That is a skill.
- Copying the files into every repo. To share properly, package a plugin with a version.
Quick recap
| Question | What it tells you |
|---|---|
| What triggers it? | You (skill, slash command), Claude (skill, subagent), or an event (hook) |
| Same every time? | If it must be, it's a hook, not a request |
| How far does it reach? | A path, a project, a user, or many repos (plugin) |
| Who maintains it? | Name the owner up front, so it stays alive |
Choose by the workflow, not by habit.
Try it yourself
Write down three jobs your own team repeats in a repository. For each one, answer the four questions and name its home. If you picked CLAUDE.md for something that must happen every time, look again.
Related course on Udemy
Claude Certified Developer - Foundations (CCDV-F) Exam Prep
Build and ship Claude apps: the API, agents, tools and MCP, prompts, evals, security and model choice.View on Udemy ↗: Claude Certified Developer - Foundations (CCDV-F) Exam Prep (paid course, opens in a new tab)Related posts
CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
Three needs in one repo: a test command, a rule that Claude must never read .env, and a shared deploy skill. See which file each belongs in, how the settings layers merge, and what a plugin manifest carries.
Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
Pack a support team's ticket-triage routine into one skill folder, then watch three requests load one, two or all three levels: the catalog, the SKILL.md body, and a script whose code never enters the context.
One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
Change one line in a repo and ask where it lands. A small resolver for bookshop-bot shows that a new model id in settings.json reaches only CI, a prompt bump reaches dev and CI, and a prod block edit reaches only prod.
Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
Follow one prompt edit from a branch to a merge: version prompts and the model pin like code, keep the API key in GitHub Secrets, gate changes by path, let Claude review the diff, and leave the merge to a person.