Intermediate 13 minAgents

Claude Code: skills, plugins, and hooks explained

An open laptop casts green light across a dark desk.
Direct response

In Claude Code, a skill is a SKILL.md file of instructions that Claude loads when the task calls for it or when you invoke it with /name; a hook is a command that Claude Code runs on a specific event, such as before a file edit; a plugin bundles skills, hooks, subagents, and MCP servers into a single shareable install. Simple rule: a skill to guide, a hook to enforce, a plugin to share.

Claude Code can be extended in four ways that look similar on paper: skills, plugins, hooks, and subagents. They don't load at the same time, don't cost the same, and don't offer the same guarantees. This guide explains them using Anthropic's official examples as of November 18, 2026, then helps you choose and install them safely.

By Mohamed Meguedmi·Update 2026-11-27·Tested on Windows, macOS, and Linux

#What are Claude Code skills?

A Claude Code skill is a SKILL.md file, stored in its own folder, that contains knowledge, a procedure, or instructions. Claude loads it on its own when the description matches the task, or you invoke it by typing a slash followed by its name, for example /deploy. The old custom commands have been merged into skills.

According to Anthropic's documentation, accessed November 18, 2026, the body of a skill loads only when it's used: only its description stays visible at all times, so long reference documentation costs almost nothing until it's needed.

A Claude Code skill has two parts. The header, in YAML between two lines of three dashes, provides at minimum a description that tells Claude when to use it. The body, in Markdown, contains the instructions. The folder can also contain scripts, templates, or reference files that the instructions call on.

#Where should you store a Claude Code skill?

The complete kit for building your own AI copilot.

Benefit from our experience and a guided path to build your local copilot and get comfortable with your coding assistant.

  • Lifetime online access
  • PDF + files
  • Refunded within 30 days

Where you place a Claude Code skill determines which sessions load it. When the same name exists in two locations, the documentation sets the priority: the organization skill takes precedence over the personal one, and the personal one over the project one. Plugin skills, prefixed with the plugin's name, never conflict.

Claude Code skill locations (Anthropic documentation, November 18, 2026)
LocationFile pathLoaded in
Personnel~/.claude/skills/nom-du-skill/SKILL.mdAll your projects on this machine
Project.claude/skills/nom-du-skill/SKILL.mdSessions opened in this repository; commit it for your team
Pluginplugin/skills/nom-du-skill/SKILL.mdAnywhere the plugin is enabled, as /plugin:skill
claude.ai accountSkills enabled in the accountCowork, cloud sessions, and terminals signed in to this account

#How do you create a skill in Claude Code?

To create a skill in Claude Code, create a folder named after it in ~/.claude/skills/ or in the project's .claude/skills/ folder, then write a SKILL.md file in it with a description and instructions. The folder name becomes the command you type.

  1. 01
    Create the skill folder
    In a macOS, Linux, or WSL terminal, run mkdir -p ~/.claude/skills/summarize-changes.
  2. 02
    Write the SKILL.md file
    Save the header and instructions to ~/.claude/skills/summarize-changes/SKILL.md. Claude Code runs the line that starts with an exclamation point before reading the file, so the actual diff ends up in the instructions.
  3. 03
    Run the skill manually
    In a git project with changes, start Claude Code with the claude command, then type /summarize-changes. Claude should reply with a short summary and a list of risks.
  4. 04
    Check automatic triggering
    Ask a question close to the description, for example "What did I change?". If Claude doesn't load the skill, put the main use case at the start of the description.
macOS, Linux, or WSL
mkdir -p ~/.claude/skills/summarize-changes
~/.claude/skills/summarize-changes/SKILL.md (official example)
---
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
---

## Current changes

!`git diff HEAD`

## Instructions

Summarize the changes above in two or three bullet points, then list any risks you notice such as missing error handling, hardcoded values, or tests that need updating. If the diff is empty, say there are no uncommitted changes.

#What settings does a skill's header accept?

All fields in a Claude Code skill's header are optional; only the description is recommended. The documentation warns that the description and the when_to_use field are truncated together at 1,536 characters in the skill list, so the main use case should come first.

disable-model-invocation
With true, Claude no longer runs the skill on its own: only the typed command triggers it. Useful for a deployment.
user-invocable
With false, the skill is removed from the command menu and is used only by Claude.
allowed-tools
Tools usable without confirmation during the turn that launches the skill.
context: fork
Runs the skill in an isolated subagent.

#What are Claude Code plugins, and how do you install them?

A Claude Code plugin is a folder that bundles skills, hooks, subagents, and MCP servers into a single installable unit. You install it from a marketplace, meaning a catalog, with the command /plugin install nom@place-de-marché; its skills then appear as /nom-du-plugin:skill.

A Claude Code plugin is built around a manifest, the .claude-plugin/plugin.json file, which gives it its name. Claude Code adds Anthropic's official marketplace, claude-plugins-official, the first time you launch it interactively in the terminal; you can add another with /plugin marketplace add followed by a GitHub repository, a git URL, or a local folder.

  1. 01
    Open the plugin listing
    In a Claude Code session, type /plugin install commit-commands@claude-plugins-official. The command first opens the plugin's details page, without installing anything.
  2. 02
    Review what the plugin adds
    The Will install section lists the commands, agents, skills, hooks, and servers that get added. For official plugins, the listing also estimates the context cost.
  3. 03
    Choose the scope
    User scope for all your projects, project scope for all collaborators on the repository, local scope for just you in this repository. Local settings override project settings, which override user settings.
  4. 04
    Check that the plugin responds
    Type a slash: /commit-commands:commit should appear. In the shell, claude plugin list displays Version, Scope, and Status. If the summary shows Run /reload-plugins to apply, Claude Code runs that reload itself.
Claude Code prompt (all systems)
/plugin install commit-commands@claude-plugins-official
Shell, outside the session (macOS, Linux, Windows)
claude plugin list
claude plugin disable formatter@your-org

#What are Claude Code hooks for?

A Claude Code hook is a command, most often a shell script, that Claude Code runs automatically at a specific point: before a tool, after a file edit, at the end of a response. Unlike a skill, a hook doesn't depend on a decision by Claude: it runs every time.

Claude Code hooks are for enforcing a rule, not suggesting it. Anthropic's overview puts it plainly: an instruction like "never modify .env" in CLAUDE.md or in a skill is a request, not a guarantee; a PreToolUse hook that blocks the modification is a constraint. A hook uses no context unless it returns output.

The events table in the official hooks guide has 33 rows as of November 18, 2026, based on a count of that table; the hooks reference keeps the list up to date. The most useful: SessionStart at the start of a session, PreToolUse before a tool call, which it can block, PostToolUse after a successful call, and Stop when Claude has finished responding.

Each Claude Code hook has a type: command runs a shell command, http sends the event to a web address, mcp_tool calls an MCP tool, prompt asks a Claude model for a judgment, and agent, still experimental, runs a multi-step check. You declare hooks in ~/.claude/settings.json for all your projects, or in .claude/settings.json for a shared project.

#Example: format every modified file

This official Claude Code hook runs Prettier after each use of the Edit or Write tools. It goes in .claude/settings.json at the project root and assumes jq is installed. When it succeeds, nothing is displayed: the proof is the reformatted file. The /hooks command lists the configured hooks, grouped by event.

Project .claude/settings.json (macOS, Linux)
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "f=$(jq -r '.tool_input.file_path') && npx prettier --write --ignore-unknown \"$f\""
          }
        ]
      }
    ]
  }
}

#Example: blocking edits to sensitive files

This second official example prevents Claude from modifying .env, package-lock.json, or the .git/ folder. The script compares the target path against the list of protected patterns and exits with code 2 to block the action; Claude receives the message and changes its approach. Make the script executable with chmod +x .claude/hooks/protect-files.sh on macOS and Linux.

.claude/hooks/protect-files.sh script (macOS, Linux)
#!/bin/bash
# protect-files.sh

INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')

# Normalize Windows backslash separators so the patterns below match
FILE_PATH="${FILE_PATH//\\//}"

PROTECTED_PATTERNS=(".env" "package-lock.json" ".git/")

for pattern in "${PROTECTED_PATTERNS[@]}"; do
  if [[ "$FILE_PATH" == *"$pattern"* ]]; then
    echo "Blocked: $FILE_PATH matches protected pattern '$pattern'" >&2
    exit 2
  fi
done

exit 0
Project .claude/settings.json: registering the PreToolUse hook
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-files.sh"
          }
        ]
      }
    ]
  }
}
!
Limitation noted in the documentation
This hook only watches the Edit and Write tools. According to the hooks guide, Claude can still modify protected files through shell commands, so add deny rules to your permissions. A PostToolUse hook can't undo an action that has already run.

#What are Claude Code agents (subagents)?

A Claude Code subagent is a specialized assistant that works in its own context window, with its own system prompt, allowed tools, and permissions. Claude hands it a side task, such as exploring dozens of files, and gets back only the summary, which keeps the main conversation readable.

A custom Claude Code subagent is a Markdown file with a header: a name, a description that says when to delegate, the list of tools, and, optionally, the model. If you put it in ~/.claude/agents/, it's available in all your projects. In the repository's .claude/agents/, it's available only to that project. Claude Code also ships with built-in subagents, including Explore, which is read-only.

~/.claude/agents/code-improver.md (official example)
---
name: code-improver
description: Scans files and suggests improvements for readability, performance, and best practices. Use after writing or modifying code.
tools: Read, Grep, Glob
model: sonnet
---

You are a code improvement specialist. For each issue you find, explain
the problem, show the current code, and provide an improved version.

A Claude Code subagent saves context, not usage: according to the documentation, its requests count toward the same limits as the main conversation. The model field lets you hand off a simple task to a cheaper model such as Haiku.

#Skill, plugin, hook, or subagent: which should you choose in Claude Code?

The right choice in Claude Code comes down to one question: "who decides?" A skill lets Claude judge when and how to apply a procedure; a hook runs on every event with no judgment involved; a subagent isolates a large chunk of work; a plugin is just packaging for sharing all three with other repositories or other people.

Which Claude Code extension fits which use case (based on Anthropic's overview, November 18, 2026)
Your situationExtensionWhy
You're pasting the same procedure for the third timeSkillLoaded only when needed; invoked with /name or by Claude
A rule must hold every time, without exceptionPreToolUse hookBlocks the action before it runs, independent of the model
Formatting or a test after every editPostToolUse hookDeterministic, no context cost without output
A search floods the conversation with resultsSous-agentWorks in a separate context and returns a summary
Claude needs to read a database or serviceMCP serverProvides the connection; a skill explains how to use it
A second repository needs the same configurationPluginBundles skills, hooks, agents, and MCP into a single install

#Claude Code skills and plugins: what are the risks and costs?

The main risk of a Claude Code plugin is that it runs code on your machine. Anthropic's security page puts it bluntly: an installed plugin can run arbitrary code with your user permissions. Its hooks and MCP servers run outside the sandbox, and an automatic update can change the files you previously reviewed.

Claude Code skills carry a subtler risk. A skill enters the context as an instruction, and its allowed-tools field can grant it broad tool access without confirmation. The documentation therefore recommends reviewing the allowed-tools of the skills in a cloned repository before running Claude Code in it.

A Claude Code skill or plugin costs you context and usage, not a separate price. The name and description of every skill or agent that Claude can launch on its own are included on every turn; according to the plugin documentation, those tokens count toward your usage, even when nothing from the plugin is used. Disable a plugin you don't need with claude plugin disable.

What stays on your machine
Command hooks, skill scripts, and local MCP servers.
What gets sent to the model provider
Everything that enters the context: the text of a loaded skill, hook output returned to Claude, subagent summaries.

#Do Claude Code skills work with other agents and local models?

Yes, as far as the format goes: Claude Code skills follow the open Agent Skills standard, created by Anthropic. According to the agentskills.io site, consulted on November 18, 2026, this format has been adopted by a growing number of agents, including OpenCode, Goose, Hermes Agent, OpenClaw, and Roo Code. The Ollama documentation has an integration page for each of these five agents, which can therefore use local models.

The portability of Claude Code skills has a limit: only the core of the format is shared. The folder, the SKILL.md file, the name, and the description are standard; Claude Code adds its own fields, such as disable-model-invocation or context: fork, which another agent ignores.

Claude Code itself can work with a local model: Ollama's documentation states that Ollama connects Claude Code to local and cloud models through its Anthropic-compatible API. However, no official source guarantees that a local model triggers skills as well as a Claude model does: test it on your own tasks.

→
Writing a skill you can reuse elsewhere
For a skill to also work in OpenCode or Goose, limit the frontmatter to the standard's fields: name in lowercase letters, digits, and hyphens, 64 characters at most, and description of 1,024 characters at most, according to the agentskills.io specification.
Frequently asked questions
Where can you find skills for Claude Code?+
The first place to find Claude Code skills is in plugins from Anthropic's official marketplace, claude-plugins-official, which you can browse with the /plugin command from the Discover tab, or at claude.com/marketplace, where the Claude Code button copies the install command. Claude Code also ships with built-in skills such as /code-review and /debug.
Should you say « un skill » or « une skill » in French?+
In French, both grammatical genders are used for Claude Code skills, and usage isn't settled. This guide writes « un skill », following « un plugin »; some prefer « une compétence ». The technical term to remember is SKILL.md, the file Claude Code looks for in each skill folder.
Are Claude Code skills, plugins, and hooks free?+
Claude Code skills, plugins, and hooks are files with no separate price in the documentation, but they do consume usage: descriptions on every turn, content loaded on demand, and subagent requests. According to Anthropic's pricing page, checked on November 18, 2026, Claude Code is included in all paid Claude plans.
Does a Claude Code skill work in Cowork or in the cloud?+
A skill stored in ~/.claude/skills/ on your computer isn't read by Cowork sessions or Claude Code cloud sessions. According to Anthropic's documentation, those sessions load the skills enabled in your claude.ai account; for a cloud session outside a project, you can also commit the skill to the repository's .claude/skills/.
How do you disable all Claude Code hooks?+
To disable all Claude Code hooks, add "disableAllHooks": true to your settings file, for example ~/.claude/settings.json. However, hooks defined in an organization's managed settings keep running unless that setting is also present there. The /hooks command then shows what remains configured.
Can a hook block Claude Code even in no-permissions mode?+
Yes. According to the Claude Code hooks guide, a hook that returns a deny decision blocks the tool even in bypassPermissions mode or with the --dangerously-skip-permissions option. Conversely, a hook that returns allow doesn't override deny rules defined in the settings.

#Sources and verification as of November 18, 2026

The definitions, locations, commands, and examples in this guide were collected on November 18, 2026, from the official Claude Code documentation (version 2.1.327 at the top of the changelog), agentskills.io, and the Ollama documentation. Claude Code changes almost daily, and event or field names may change.

Did this guide help you?

Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.