Back to blog

April 15, 2026

Skills & Customization

Claude Code Skills Tutorial: Build Custom Skills From Scratch (2026)

Claude Code skills are reusable instruction packages that extend what Claude can do -- custom slash commands, automated workflows, and specialized knowledge that loads only when needed. This tutorial covers everything from your first SKILL.md to production patterns with subagents and dynamic context injection.

What Are Claude Code Skills?

A Claude Code skill is a folder containing a SKILL.md file with YAML frontmatter and markdown instructions. When Claude detects a relevant conversation topic, it loads the skill automatically. You can also invoke any skill directly by typing /skill-name in the CLI. Skills follow the open Agent Skills standard at agentskills.io, which means they work across multiple AI coding tools -- not just Claude Code.

According to Anthropic's documentation, the official frontend-design skill alone has over 277,000 installs as of March 2026. The skill ecosystem includes bundled skills like /simplify, /debug, and /batch, plus thousands of community-contributed skills.

When to create a skill

  • You keep pasting the same multi-step instructions into chat
  • A section of CLAUDE.md has grown into a procedure, not a fact
  • You want to share a workflow with your team via version control
  • You need Claude to follow a strict, repeatable process (deploys, reviews, commits)

Skills vs CLAUDE.md vs Slash Commands

Claude Code has three customization layers that serve different purposes. Choosing wrong means either wasted context tokens or instructions Claude never sees. Here is exactly when to use each.

FeatureCLAUDE.mdSkillsBuilt-in Commands
Loads whenEvery conversationOn demand / auto-matchWhen you type it
Best forShort facts, coding standardsMulti-step procedures, workflowsFixed logic (compact, help)
Context costAlways loaded (high)Only when invoked (low)None
CustomizableYes (edit the file)Yes (create your own)No (hardcoded)
Supports filesNoYes (templates, scripts, examples)No

The rule of thumb: if it is a fact or a one-line convention, put it in CLAUDE.md. If it is a procedure with steps, make it a skill. If CLAUDE.md is over 500 lines, you almost certainly have procedures that should be skills.

Where Claude Code Skills Live

Skills can be stored at four levels, each with different scope and priority. When two skills share the same name, the higher-priority location wins. Understanding this hierarchy prevents naming conflicts and makes team distribution straightforward.

HIGHEST

Enterprise (managed settings)

Deployed organization-wide. All users get these skills. Managed through enterprise admin tools.

HIGH

Personal (~/.claude/skills/)

Available across all your projects. Store skills you use everywhere -- commit conventions, code review checklists, personal workflows.

MEDIUM

Project (.claude/skills/)

Scoped to one repo. Commit to version control so your whole team gets them. Best for project-specific deploy, test, and review workflows.

PLUGIN

Plugin (plugin-name/skills/)

Namespaced as plugin-name:skill-name, so they never conflict with other levels. Distributed via the plugin ecosystem.

Create Your First Claude Code Skill (Step by Step)

This walkthrough creates a real, useful skill -- a code review checklist that Claude applies whenever you ask for a review. The entire process takes under 2 minutes.

Step 1: Create the directory

mkdir -p ~/.claude/skills/review-checklist

Step 2: Write the SKILL.md

Every skill needs exactly one file: SKILL.md. It has two parts -- YAML frontmatter between --- markers, then markdown instructions.

---
name: review-checklist
description: >
  Code review checklist for PRs. Use when reviewing
  code, checking pull requests, or when the user asks
  for a review.
---

When reviewing code, check every item:

## Security
- No hardcoded secrets or API keys
- Input validation on all user-facing endpoints
- SQL queries use parameterized statements

## Performance
- No N+1 queries in database calls
- Large lists use pagination or virtualization
- Expensive computations are memoized where appropriate

## Code Quality
- Functions do one thing and are under 50 lines
- Error handling is explicit, not swallowed
- Tests cover the happy path and at least one edge case

Step 3: Test it

No restart required -- Claude Code detects new skills in watched directories immediately. Test both invocation methods:

Manual invocation

/review-checklist src/auth.ts

Auto invocation

"Review the changes in this PR"

SKILL.md Frontmatter: Every Field Explained

The YAML frontmatter controls how Claude discovers, loads, and executes your skill. All fields are optional, but description is strongly recommended. Without it, Claude guesses from the first paragraph -- and guesses poorly.

FieldTypeWhat It Does
namestringSlash command name. Defaults to directory name. Lowercase, hyphens, max 64 chars.
descriptionstringWhat the skill does. Claude uses this for auto-match. Truncated at 1,536 chars.
disable-model-invocationbooleanSet true to block auto-invoke. Manual /name only. Use for deploys and destructive actions.
user-invocablebooleanSet false to hide from / menu. Claude-only background knowledge.
allowed-toolsstring | listPre-approve tools while skill is active. Example: Bash(git *) Bash(npm *)
contextstringSet to "fork" to run in an isolated subagent. No access to conversation history.
agentstringSubagent type for context: fork. Options: Explore, Plan, general-purpose, or custom agent name.
modelstringOverride the model while skill is active. Useful for Opus-only skills on complex tasks.
pathsstring | listGlob patterns to limit when skill activates. Example: "src/api/**/*.ts" only triggers on API files.
effortstringThinking effort: low, medium, high, or max (Opus 4.6 only). Overrides session default.

5 Production-Ready Skill Examples

These are skills we use daily at KaiShips. Each one solves a real problem -- not a toy demo. Copy the SKILL.md content into the right directory and they work immediately.

DEPLOY

1. Safe Deploy Skill

---
name: deploy
description: Deploy to production safely
disable-model-invocation: true
allowed-tools: Bash(git *) Bash(npm *)
---

Deploy to production:
1. Run npm run build -- fail = stop
2. Run npm test -- fail = stop
3. git push origin main
4. Verify deploy at $ARGUMENTS or production URL

Manual-only (disable-model-invocation). Pass the URL to verify: /deploy https://kaiships.com

COMMIT

2. Conventional Commit Skill

---
name: cc
description: >
  Create a conventional commit. Use when committing
  changes, staging files, or creating git commits.
allowed-tools: Bash(git *)
---

Create a conventional commit:
1. Run git diff --staged (if empty, stage relevant files)
2. Analyze changes and pick type: feat|fix|docs|refactor|test|chore
3. Write message: type(scope): description
4. Keep subject under 72 characters
5. Add body only if the "why" is non-obvious
RESEARCH

3. Deep Research Skill (Subagent)

---
name: deep-research
description: >
  Research a codebase topic thoroughly. Use when asked
  to explain how something works or investigate a system.
context: fork
agent: Explore
---

Research $ARGUMENTS thoroughly:
1. Find relevant files using Glob and Grep
2. Read and analyze the code
3. Map dependencies and data flow
4. Summarize findings with specific file references

Runs in an isolated Explore subagent -- does not pollute your main conversation context.

PR

4. PR Summary with Dynamic Context

---
name: pr-summary
description: Summarize the current PR with live data
context: fork
agent: Explore
allowed-tools: Bash(gh *)
---

## Live PR context
- Diff: !`gh pr diff`
- Comments: !`gh pr view --comments`
- Changed files: !`gh pr diff --name-only`

Summarize this PR: what changed, why, and
what reviewers should focus on.

The !`command` syntax runs shell commands before Claude sees the prompt. Claude receives actual PR data, not the command.

CONTEXT

5. API Conventions (Background Knowledge)

---
name: api-conventions
description: >
  REST API patterns for this codebase. Use when writing
  or modifying API endpoints.
user-invocable: false
paths: "src/api/**/*.ts"
---

When writing API endpoints:
- Use RESTful naming: GET /users, POST /users, etc.
- Return { data, error, meta } envelope
- Validate with zod schemas at the handler level
- Errors: { error: { code: string, message: string } }
- Pagination: cursor-based, not offset-based

Hidden from the / menu (user-invocable: false). Claude loads this automatically only when editing files matching src/api/**/*.ts.

Advanced Skill Patterns

Once you have basic skills working, these patterns unlock the real power. Dynamic context injection, argument parsing, and supporting files turn simple instruction sets into complete automation workflows.

$ARGUMENTS substitution

Use $ARGUMENTS for the full string or $0, $1 for positional args. Multi-word values need quotes.

Dynamic context (!`cmd`)

Shell commands run before Claude sees the prompt. Output replaces the placeholder. Use for live data like git status, API responses, or environment info.

Supporting files

Add templates, examples, and scripts alongside SKILL.md. Keep SKILL.md under 500 lines -- move reference material to separate files and link them.

Subagent execution

Set context: fork to run in isolation. Pair with agent: Explore for read-only research or a custom agent for specialized tasks.

Directory structure for complex skills

my-skill/
  SKILL.md              # Main instructions (required)
  template.md           # Template for Claude to fill in
  examples/
    sample.md           # Example output format
  scripts/
    validate.sh         # Script Claude can execute
    visualize.py        # Generate HTML reports

Reference supporting files from SKILL.md so Claude knows what each one contains. Example: "For API details, see reference.md. For usage examples, see examples/sample.md." Claude loads them on demand, not upfront.

How Skills Load and Persist in Context

Understanding the skill lifecycle prevents a common frustration: skills that seem to stop working after 10-15 messages. Here is exactly what happens from invocation through auto-compaction.

STEP 1

Discovery

Skill descriptions (not full content) are loaded into context at session start. This uses 1% of your context window -- roughly 8,000 characters shared across all skills.

STEP 2

Invocation

When invoked (manually or automatically), the full SKILL.md content enters the conversation as a single message. Claude does not re-read the file on later turns.

STEP 3

Compaction

When context fills up, auto-compaction keeps the first 5,000 tokens of each recently invoked skill. All skills share a 25,000-token budget. Most recent skills get priority -- older ones may be dropped entirely.

Troubleshooting Claude Code Skills

Most skill issues come down to three causes: description mismatch, context budget overflow, or directory placement. Here are the fixes.

Skill not triggering automatically

  • Check that description includes words users naturally say
  • Ask Claude "What skills are available?" to verify it sees yours
  • If you have 20+ skills, descriptions may be truncated. Set SLASH_COMMAND_TOOL_CHAR_BUDGET higher

Skill triggers when it should not

  • Make the description more specific and narrow
  • Add disable-model-invocation: true for manual-only
  • Use paths to restrict to specific file patterns

Skill stops working mid-conversation

  • Auto-compaction likely dropped it. Re-invoke with /skill-name
  • Keep SKILL.md under 500 lines -- large skills get trimmed first
  • Move reference material to supporting files, not the main SKILL.md

The complete playbook

Every skill pattern, every config, and the reasoning behind each decision -- in the full KaiShips Guide to Claude Code.

This post covers skills. The guide covers memory architecture, hooks, subagents, worktrees, cron automation, and 5 more chapters of production-tested configs.

Get the KaiShips Guide to Claude Code -- $29

Frequently Asked Questions

What is a Claude Code skill?

A Claude Code skill is a reusable instruction package stored as a SKILL.md file inside a .claude/skills/ directory. Skills extend Claude's capabilities by giving it specific workflows, conventions, or task playbooks. Claude loads them automatically when relevant or you invoke them manually with /skill-name. Skills follow the open Agent Skills standard at agentskills.io.

How many skills can I have in Claude Code?

There is no hard limit on the number of skills you can install. However, skill descriptions share a context budget (1% of the context window, roughly 8,000 characters by default). If you have dozens of skills, descriptions get truncated and Claude may miss matches. Keep descriptions concise and front-load the key use case within the first 100 characters.

What is the difference between skills and CLAUDE.md?

CLAUDE.md loads into every conversation automatically and should contain short, always-true project facts like coding standards and environment notes. Skills load on demand -- only when invoked or when Claude detects relevance. Use skills for multi-step procedures, task-specific workflows, and detailed reference material that would bloat CLAUDE.md.

Can I share Claude Code skills with my team?

Yes. Commit your .claude/skills/ directory to version control and every team member gets the same skills. For cross-project sharing, create a plugin with a skills/ directory. Enterprise teams can deploy skills organization-wide through managed settings. Skills follow the Agent Skills open standard, so they also work with other compatible AI tools.

How do I stop Claude from triggering a skill automatically?

Add disable-model-invocation: true to the YAML frontmatter in your SKILL.md file. This removes the skill from Claude's automatic context entirely. You can still invoke it manually with /skill-name. This is recommended for skills with side effects like deployments, commits, or sending messages.

Keep Learning

Skills are one piece of the Claude Code customization stack. These guides cover the rest.