Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Claude Code hooks, skills, and subagents extend the same agent in fundamentally different ways: hooks enforce events, skills provide reusable guidance, and subagents isolate work in another context window. Choose a hook when an action must happen (or must be blocked) every time, a skill when Claude should decide how to apply a procedure, and a subagent when a noisy or independent task should run away from your main conversation. The wrong choice creates skipped checks, bloated context, deadlocked sessions, or lossy summaries.
The practical rule is simple: “Always do X” is a hook; “decide whether to do X” is a skill; “do this somewhere else and bring back the result” is a subagent. This guide explains the boundaries, current Claude Code configuration, failure modes, and combinations that make the three primitives reliable.
As an Amazon Associate I earn from qualifying purchases.
At a glance
| Name | Best for | Key spec | Context cost | Checked |
|---|---|---|---|---|
| Hook | Guaranteed event actions and guardrails | Runs on lifecycle events; command, HTTP and MCP-tool handlers execute deterministically | Near zero unless output is returned | November 2026 |
| Skill | Reusable procedures, checklists and domain knowledge | SKILL.md; invoked with /name or matched from its description |
Description each session; body when used (or in a fork) | November 2026 |
| Subagent | Large searches, test runs and independent reviews | Separate context, tools, model and permissions; only final summary returns | Separate input/output token budget | November 2026 |
What is the difference between a hook, a skill and a subagent?
A hook is an event-triggered handler outside the model. A skill is an instruction package that Claude loads when relevant. A subagent is another Claude worker with its own context and tool policy. The official Claude Code extension overview describes the core distinction: hooks fire without Claude deciding, skills are interpreted by Claude, and subagents run separately.
| Question | Hook | Skill | Subagent |
|---|---|---|---|
| Who starts it? | Claude Code at a lifecycle event | You with /name, or Claude through description matching |
Claude through the Agent tool, or your request |
| Where does work happen? | Outside the model process | Main conversation unless context: fork is set |
Separate context window |
| Can it enforce a rule? | Yes, on blocking events such as PreToolUse |
No; it is advisory guidance | No; its prompt is still an instruction |
| What comes back? | Event result, errors or selected context | Instructions and any work performed in the current or forked context | Final message and metadata, not the whole transcript |
| Typical job | Format, deny, lint, notify, log | Release checklist, style guide, debugging playbook | Repository search, verbose tests, independent review |
Ken Imoto’s concise model is useful: hooks remove a decision from the model, skills add one, and subagents quarantine one. It also explains why these are complementary rather than competing plugins.
Popular on Amazon
- 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
- 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
- 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
- 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
- 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.
When should I use a Claude Code hook?
Use a hook when the same action must occur on an event without asking Claude to remember it. Formatting after every write, blocking edits to secrets, recording session events, and enforcing a pre-commit check are hook-shaped problems.
Claude Code registers hooks in ~/.claude/settings.json, project .claude/settings.json, managed policy settings, or skill and agent frontmatter. You can inspect configured hooks with /hooks. The hooks guide and hooks reference document the event contracts.
Which hook handlers are deterministic?
Current Claude Code supports command, http, mcp_tool, prompt, and agent handlers. All five are triggered deterministically when their event and matcher apply. The first three execute their configured operation deterministically; prompt and agent handlers ask Claude to use judgment for the output. Therefore a prompt hook is not a reliable substitute for a shell guard that must never allow an action.
How do blocking hook exit codes work?
For command hooks, exit code 0 means success but does not automatically approve a PreToolUse call; normal permission checks still run. Exit code 2 signals a blocking error on events that support blocking, with stderr used as the reason. Other non-zero codes are normally non-blocking unless an onFailure: "block" policy (available in newer 2.1.x builds) changes that behavior.
A minimal guard can reject sensitive paths before a tool runs:
#!/usr/bin/env bash
# Example PreToolUse command hook
path="$CLAUDE_TOOL_INPUT_FILE_PATH"
case "$path" in
.env|.env.*|.git/*|package-lock.json)
echo "Blocked: protected file" >&2
exit 2
;;
esac
exit 0
The exact input variable and matcher depend on the event and tool payload; follow the current hook reference when wiring a production guard. The important property is that the denial occurs before the edit, rather than relying on a sentence in project instructions.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesWhich events can cause trouble?
PreToolUse is the normal enforcement point. A blocking result there prevents the tool call. By contrast, exit code 2 on Stop prevents Claude from stopping and continues the conversation; on SubagentStop it prevents the child from stopping. A “make sure tests passed” Stop hook can therefore loop forever if the condition never changes. Put a check on the commit tool or return a stop decision that actually halts when the intent is to stop, and test the failure path before distributing the hook.
UserPromptSubmit can block a prompt before it reaches Claude. Session-start, notification, post-tool and many observational events cannot block; their exit-2 result is ignored or shown as a notice. When several hooks match, they run in parallel. A denial does not cancel sibling side effects, and the most restrictive PreToolUse decision wins in the order deny, defer, ask, allow.
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
What limits and timeouts should I plan for?
Default timeouts are 600 seconds for command, HTTP and MCP-tool hooks, 30 seconds for prompt hooks, and 60 seconds for agent hooks. Session-end hooks share roughly 1.5 seconds unless settings raise the per-hook timeout (up to 60 seconds). If more than 12 prompt or agent hooks match one event, 12 run concurrently and the rest wait.
Returned additionalContext, systemMessage, initialUserMessage, and plain stdout are each capped at 10,000 characters. Large output is replaced with a file path and preview, so a hook should summarize or write an artifact deliberately instead of dumping a log into the context. Command hooks also run with the user’s shell privileges, which is both their enforcement strength and their security risk. Managed-policy hooks cannot be disabled by a local setting.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWhen should I use a Claude Code skill?
Use a skill when Claude needs a reusable procedure or reference but must still decide how and when to apply it. Release checklists, API conventions, code-review criteria, incident playbooks and a team’s deployment sequence are typical skills.
A skill is a directory containing SKILL.md and optional scripts or reference files. Claude loads its name and description at session start, then loads the body when you invoke /skill-name or when the description matches the task. The skills documentation explains this progressive disclosure: long material costs little until it is needed.
How do I make a skill discoverable?
Place user skills in ~/.claude/skills/<name>/SKILL.md, project skills in .claude/skills/, or distribute them through a plugin. Legacy .claude/commands/name.md files still create slash commands, but new work generally belongs in a skill because it can carry supporting files and frontmatter.
Put YAML frontmatter first, with the opening --- on line one:
---
name: release-check
description: Review release notes, version changes, and required checks before publishing.
user-invocable: true
---
# Release check
1. Read the changed version and release notes.
2. Run the repository's documented verification commands.
3. Report missing checks; do not publish without approval.
Keep the description a routing key, not a mini-manual. The combined description and when_to_use text shown in the skill listing is truncated at 1,536 characters. If YAML is malformed, the skill can load with no fields set, a quiet failure that makes automatic matching appear broken. If a skill does not trigger, first check that its description contains the words a user would naturally say and that it appears in the available-skills list.
Which frontmatter controls invocation and isolation?
disable-model-invocation: truemakes the skill manual-only. It also prevents preloading into subagents and scheduled-task firing.user-invocable: falsehides it from the slash-command menu while allowing Claude to invoke it.context: forkruns the skill in a new context, useful when its procedure would otherwise flood the main transcript.allowed-toolsanddisallowed-toolsscope tools;modelandeffortcan select execution settings.- A skill can register hooks in frontmatter; those hooks remain active for the session after invocation unless configured with
once: true.
A skill is still a request. If “always run the linter” is a requirement, a skill that explains the lint command can be skipped when Claude judges it unnecessary. Pair it with a hook if the action must be automatic.
Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
When should I use a subagent?
Use a subagent when a side task would fill your main conversation with search results, logs, test output or file contents that you will not reread. It runs with its own context, tools, model and permissions, then returns a final summary and metadata. The custom subagents guide describes this as an isolated worker, not merely another prompt.
What belongs in a subagent?
- A repository-wide search for usages, references or dependency risks.
- A long test suite where you only need failures and their locations.
- An independent code review or security audit that should not bias the main plan.
- Parallel investigations of separate modules.
Built-in types include Explore (read-only search), Plan (planning research), and general-purpose (explore plus act), along with helper agents. A project or user agent named Explore overrides the built-in, so check naming collisions.
Free tools Windows power users keep installed
One-click scans. No signup required.
How do I define a custom subagent?
Create a Markdown file in .claude/agents/ or ~/.claude/agents/ with required name and description frontmatter. The body is the agent’s system prompt. Project agents discovered nearer the repository root take precedence over user agents; managed settings and the --agents CLI option can take precedence over both.
Give the worker a concrete brief and require evidence in its final response:
---
name: dependency-audit
description: Find risky or unused dependencies and return paths, versions, and evidence.
---
Search the repository without changing files. Return:
- each finding with an exact path and line or package name;
- commands or files checked;
- uncertainty and anything you could not inspect.
Do not report a conclusion without the supporting evidence.
A subagent starts without the parent conversation unless you explicitly pass the relevant brief or use a fork. It also does not automatically inherit every project instruction: Explore and Plan intentionally omit CLAUDE.md and git status in their default behavior. A directory change inside a child does not persist to the parent; use isolation: worktree when an isolated repository copy is needed.
Descriptions for custom agents collectively exceeding about 15,000 tokens produce a startup warning, so keep routing descriptions short and put detailed procedure in the body. Subagents can nest up to five levels, but every child request counts against the same usage limits as the parent.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Should a rule go in CLAUDE.md, a skill or a hook?
Use CLAUDE.md for short, always-relevant project facts; use a skill for a procedure needed sometimes; use a hook or permission rule for an invariant. Anthropic recommends keeping the effective CLAUDE.md under 200 lines because longer files consume context and can reduce adherence. Claude Code skips a file larger than 4 MiB, and imports organize content without reducing its context cost. Path-scoped .claude/rules/ files can load only when matching files are touched.
The distinction is enforcement: “never edit .env” in CLAUDE.md or a skill is a request, not a guarantee. A PreToolUse hook that blocks the path is enforcement. Prompt injection or a long, ambiguous session can cause a model to miss an instruction; deterministic hooks and managed settings are the appropriate control for actions that absolutely must not happen.
Also popular on Amazon
- Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
- Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
- 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
- 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
- Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.
How do hooks, skills and subagents work together?
Combining primitives is usually better than forcing one to do every job. A subagent can preload skills with a skills: field, while a skill can fork into an isolated context with context: fork. In the first pattern the subagent owns the system prompt and receives the full skill bodies at startup; a skill marked disable-model-invocation: true cannot be preloaded.
What is a reliable test-before-commit design?
- Keep the repository’s test flags, known flakes and interpretation rules in a skill.
- Ask a subagent to run the suite and return only failures, paths and evidence, keeping logs out of the main window.
- Use a
PreToolUsehook on the commit command to block a commit when the required result is absent. - Put one short line in
CLAUDE.mdstating the canonical test command so Claude always knows the baseline.
This separates explanation, isolation and enforcement instead of trusting one prompt to do all three.
Can a skill and a hook handle linting together?
Yes. A PostToolUse hook can run the formatter or linter after an edit and return concise diagnostics. A /fix-lint skill can then explain the project’s preferred fixes, exceptions and review checklist. The hook supplies the event guarantee; the skill supplies judgment.
When is MCP a better fit?
MCP is for giving Claude access to an external system; a skill is for explaining how your team should use that system. For example, an MCP server can expose a database or messaging service, while a skill documents schema, query patterns or message formatting. If the requirement is “connect to a system Claude cannot otherwise reach,” choose MCP and optionally pair it with a skill.
When should I package these as a plugin?
A plugin bundles skills, hooks, subagents and MCP servers into one installable unit. Use one when a second repository needs the same setup or when you distribute a standard extension through a marketplace. Plugin skills are namespaced, such as /my-plugin:review. For security, plugin subagents cannot set some fields, including hooks, MCP servers and permission mode; copy an agent into project or user scope when those controls are required.
What are the most common backfires?
Each primitive fails when it is asked to provide a property it does not have. Diagnose the symptom first, then move the behavior to the layer that owns it.
Recommended Free Tools
| Symptom | Likely mistake | Better fix |
|---|---|---|
| Linter runs only sometimes | A skill or instruction was used for an “always” requirement | Run it from a matching post-tool hook; keep the skill for remediation guidance |
| Session will not stop | A Stop hook exits 2 while its condition remains true | Move the check to the commit tool or return an intentional stop decision |
| Protected edit still occurred | A prompt/agent hook or CLAUDE.md sentence was treated as deterministic | Use a command PreToolUse guard, deny rule or managed setting |
| Skill never appears or triggers | Vague description or invalid frontmatter | Put --- on line one, add natural keywords and verify the skill listing |
| Main transcript is unusable | A verbose search or test run was placed in a normal skill | Use a subagent or context: fork and request a concise evidence-based summary |
| Subagent conclusion is wrong | Thin brief, wrong directory or lossy summary | Pass paths and constraints; require counts, file locations and uncertainty in the final report |
| Hook appears to allow a tool but it is denied | Exit 0 on PreToolUse was mistaken for approval |
Remember that normal permission flow still applies after exit 0 |
| Logger ran despite a denial | One matching hook was expected to cancel siblings | Design side effects assuming all matching hooks run in parallel |
Also avoid huge hook output, shell commands with excessive privileges, and a root CLAUDE.md that grows into a second manual. No published study currently establishes a universal token saving or skip rate for one primitive over another; choose based on context, authority and failure cost rather than an invented benchmark.
Which Claude Code extension should I choose?
Use this decision sequence:
- Must it happen every time, with no model judgment? Use a hook (and permissions or managed settings for stronger organizational enforcement).
- Should Claude always know a short fact? Put it in a concise
CLAUDE.mdor path-scoped rule. - Will the work produce output you will not reread? Use a subagent.
- Is it a procedure or reference needed only sometimes? Use a skill.
- Does Claude need a system or data source it cannot reach? Use MCP, usually paired with a skill that explains usage.
- Do you need two properties? Combine primitives instead of compromising: skill for guidance, subagent for isolation, hook for the guarantee.
Build over time rather than designing everything up front: a convention that was wrong twice belongs in project memory; a prompt you type repeatedly belongs in a user-invocable skill; a playbook pasted a third time belongs in a skill; a side task that floods the transcript belongs in a subagent; and an action that must occur without asking belongs in a hook.
Also popular on Amazon
- 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
- 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
- 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
- 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
- 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.
How should I maintain these extensions as Claude Code changes?
Claude Code is a rapidly versioned CLI, and lifecycle events, bundled skills and frontmatter fields can change across 2.1.x releases. Re-check the current documentation when upgrading, especially for version-gated features such as newer hook failure policies or agent controls. Keep examples small, log the event and exit behavior you rely on, and test both success and blocking paths in a disposable project.
Review extension scope as part of code review: who can edit a hook, which shell privileges it uses, whether a skill can invoke sensitive tools, what a subagent is allowed to change, and whether a managed policy is required for every repository. Treat summaries as evidence-bearing reports, not unquestionable truth, and preserve paths, counts and commands when a decision depends on them.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Bottom line: what is the safest mental model?
Hooks are enforcement, skills are reusable judgment, and subagents are isolation. Put “must” rules in deterministic hooks or permissions, “how” guidance in skills, and noisy or independent work in subagents. Once those boundaries are explicit, combining the three gives Claude Code predictable guardrails without turning every task into a giant prompt.
Frequently Asked Questions
Can a Claude Code skill guarantee that a command runs every time?
No. A skill is interpreted by the model, so Claude can decide that the procedure is unnecessary or overlook it during a long session. Put the command in a matching hook when execution is mandatory, and keep the skill for explaining how to handle the result.
Why did my PreToolUse hook not approve the tool call after exiting 0?
Exit code 0 only reports that the hook found no objection; Claude Code still applies its normal permission flow. To permit an action, configure permissions as well as the hook, and reserve exit code 2 for an explicit block.
Do subagents inherit my entire Claude Code conversation?
Not automatically. A subagent receives its own prompt and environment, so pass the relevant history or use a fork when the task depends on earlier discussion. Its final response is a summary, which is why you should request paths, counts and uncertainty when accuracy matters.
Can one hook stop other hooks that match the same event?
No. Matching hooks run in parallel, and a denial does not undo side effects such as logging that another hook already performed. Design each hook as though its siblings will still execute.
What should I do if a skill is missing from the slash-command menu?
Check whether it is intentionally marked user-invocable: false, confirm the folder and SKILL.md location, and verify that the YAML frontmatter starts on the first line. A malformed frontmatter block can load without the fields that make a skill visible or discoverable.

