Layer 2

Skills: Custom Slash Commands

Markdown files that become slash commands. Codify your team's best practices into reusable workflows anyone can invoke by typing /skill-name.

You type /deploy staging

Claude Code looks for a matching SKILL.md file

SKILL.md loaded into context

The markdown instructions are injected into Claude's conversation, with $ARGUMENTS replaced by "staging"

Claude follows the instructions

Step by step — running tests, building, deploying — exactly as the skill specifies

Result reported

If using context: fork, the result returns to your main conversation cleanly

.claude/skills/deploy/SKILL.md
--- name: deploy description: Deploy the app to staging or production allowed-tools: Bash(npm *), Bash(git *) --- # Deploy $ARGUMENTS 1. Run the test suite: `npm test` 2. Build for production: `npm run build` 3. Deploy to $ARGUMENTS environment 4. Verify the deployment is healthy 5. Report the deployment URL

Type /deploy staging and this entire workflow runs. $ARGUMENTS becomes "staging".

What Are Skills?

Skills extend Claude's capabilities with instructions, templates, and step-by-step workflows, all written in markdown. They come in two flavors:

Reference Skills

Guidelines and conventions that Claude applies contextually. Think coding standards, API patterns, or project-specific rules that Claude should always know.

Task Skills

Step-by-step workflows you invoke with /skill-name. Deploy scripts, review checklists, research workflows — type the command and it runs.

How Skills Actually Work (Under the Hood)

When you type /deploy staging, here's what actually happens inside Claude Code:

  1. File lookup: Claude Code searches for SKILL.md in .claude/skills/deploy/ (project), then ~/.claude/skills/deploy/ (personal), then installed plugins.
  2. Frontmatter parsed: YAML frontmatter is read for name, description, allowed-tools, and context settings.
  3. String substitution: $ARGUMENTS is replaced with everything after the slash command. ${CLAUDE_SKILL_DIR} becomes the absolute path to the skill's directory.
  4. Context injection: The processed markdown is injected into Claude's conversation as instructions. If context: fork is set, it runs in an isolated subagent.
  5. Execution: Claude follows the instructions, restricted to the tools listed in allowed-tools (if specified).
Skills don't use extra API calls.

A skill is just markdown injected into the existing conversation. The "cost" is context window tokens, not additional API calls — unless you use context: fork, which spawns a subagent (consuming tokens for that separate conversation).

Anatomy of a SKILL.md

Full SKILL.md structure
---
name: my-skill              # Slash command name (/my-skill)
description: What it does    # Shown in skill list
disable-model-invocation: true  # Only runs when YOU type /my-skill
context: fork                # Run in isolated subagent (optional)
allowed-tools: Bash(*), Read # Restrict which tools the skill can use
---

# Instructions for Claude

Use $ARGUMENTS for user input.
Use ${CLAUDE_SESSION_ID} for the current session.
Use ${CLAUDE_SKILL_DIR} for the skill's directory path.

## Steps

1. Do this first
2. Then do this
3. Finally, report the result

Frontmatter Options

FieldWhat It Does
nameThe slash command name (e.g., /deploy)
descriptionShown when listing available skills
disable-model-invocationIf true, Claude won't auto-trigger this — only manual /skill
context: forkRuns in an isolated subagent, keeping your main conversation clean
allowed-toolsRestrict which tools the skill can access (security + focus)

Built-in Skills

Claude Code ships with several powerful skills out of the box:

/batch

Parallel changes across 5-30 git worktrees. Refactor 1,000 files with 20 agents working simultaneously.

Included

/simplify

Code quality review with 3 parallel agents checking for reuse, quality, and efficiency.

Included

/loop

Run a prompt on a recurring interval. /loop 5m check deploy status polls every 5 minutes. Underrated.

Included

/debug

Enable debug logging and troubleshoot issues with Claude Code itself.

Included

Notable Community Skills

The community has built some incredible skills. These are the standouts:

Superpowers
by Jesse Vincent (obra) — 94K+ stars

Core competencies covering the full SDLC — TDD, debugging, brainstorming, subagent-driven development with code review. Officially listed in the Anthropic marketplace. This is the most popular community skill set by a wide margin.

Trail of Bits Security Skills
by Trail of Bits — Professional security auditing

Professional-grade security skills: code auditing, vulnerability detection, CodeQL integration, Semgrep analysis, variant analysis, and fix verification. Built by one of the most respected security firms in the industry.

Claude Code PM (CCPM)
by Ran Aroussi (automazeio)

Comprehensive project management workflow with specialized agents and slash commands. Turns Claude Code into a project manager that can break down tasks, track progress, and coordinate work.

Context Engineering Kit
by NeoLabHQ

Advanced context engineering techniques with minimal token footprint. Helps you get more out of Claude's context window by structuring information efficiently.

Creating Your Own Skill

Step 1: Create the file

Terminal
# Personal skill (all your projects) $ mkdir -p ~/.claude/skills/review # Project skill (shared in git) $ mkdir -p .claude/skills/review

Step 2: Write the SKILL.md

Example: Code review skill
---
name: review
description: Run a thorough code review on staged changes
context: fork
---

# Code Review

Review the staged git changes (`git diff --cached`) for:

## Checklist
1. **Security** — SQL injection, XSS, command injection, secrets in code
2. **Performance** — N+1 queries, unnecessary loops, missing indexes
3. **Correctness** — Edge cases, null checks, off-by-one errors
4. **Style** — Consistent naming, no dead code, clear variable names
5. **Tests** — Are changes covered? Any missing edge case tests?

## Output Format
- List each issue with file, line number, and severity (critical/warning/info)
- End with a summary: "Ready to merge" or "Needs changes"
Example: Research skill
---
name: research
description: Deep research on a topic with web search
allowed-tools: WebSearch, WebFetch, Read, Write
---

# Research: $ARGUMENTS

1. Search the web for recent, authoritative sources on "$ARGUMENTS"
2. Find at least 5 distinct sources (prefer: official docs, peer-reviewed, reputable outlets)
3. For each source, extract:
   - Key findings or claims
   - Supporting data or statistics
   - Source URL and publication date
4. Write a research summary to `research-$ARGUMENTS.md` with:
   - Executive summary (3-5 sentences)
   - Detailed findings organized by theme
   - All source URLs as inline citations
   - Gaps in current knowledge / areas needing more research

Step 3: Use it

Claude Code
> /review Running code review on staged changes... > /research "MCP server best practices" Researching "MCP server best practices"...

Skill Scopes

ScopeLocationVisibility
Personal~/.claude/skills/name/SKILL.mdAll your projects
Project.claude/skills/name/SKILL.mdEveryone on this repo
Pluginplugin/skills/name/SKILL.mdAnyone with the plugin
EnterpriseManaged settingsOrg-wide
Skills can include supporting files.

Put templates, example configs, or reference data alongside your SKILL.md. Use ${CLAUDE_SKILL_DIR} in your instructions to reference them. Claude will have access to everything in the skill directory.

Advanced Features

Forked Context

Adding context: fork runs the skill in an isolated subagent. This keeps heavy operations (like /batch) from cluttering your main conversation. The result is returned when done. Note: forked skills consume additional tokens for the subagent conversation.

Tool Restrictions

allowed-tools limits what the skill can do. Use glob patterns:

  • Bash(npm *) — only npm commands
  • Read, Glob, Grep — read-only access
  • Bash(git *), Edit, Write — full dev access

String Substitution

VariableReplaced With
$ARGUMENTSEverything typed after /skill-name
${CLAUDE_SESSION_ID}Current session identifier
${CLAUDE_SKILL_DIR}Absolute path to the skill's directory

What Does It Cost?

UsageCostDetails
Creating skills Free Markdown files. Nothing to install, nothing to pay for.
Using skills (inline) Included Injected into existing conversation. Uses context window space, not extra API calls.
Using skills (forked) Tokens context: fork spawns a subagent — a separate conversation that consumes tokens.
Community skills Free All community skills listed above are open source and free.