Choose Auto, TokenLab Verified, or Official for each request, with prices shown up front. See what's new

Claude Code Skills: Build Custom Workflows for Your AI Coding Assistant

·September 19, 2026·10 min read·Updated November 11, 2026·3477 views
#Claude Code#Skills#AI Coding#Developer Tools
Claude Code Skills: Build Custom Workflows for Your AI Coding Assistant

A Claude Code skill is a folder with a SKILL.md file. The file holds instructions that Claude Code follows for one kind of task, such as writing a commit message, reviewing a pull request, or following your team's coding conventions. This guide shows the file format, where skills live, how to install and share them, and how to back a skill with a hook when a rule must hold every time.

The details come from three pages of the Claude Code documentation, read on 2026-11-11: Skills, Hooks reference and Install and manage plugins.

Skills and custom commands

Custom commands have been merged into skills. A file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy and work the same way. Existing command files keep working. Skills add a folder for supporting files, frontmatter that controls who can invoke them, and automatic loading by Claude when the task matches. Use a skill for new work. If a skill and a command file have the same name, the skill runs.

Claude Code keeps the name and description of every skill in context, so Claude knows what exists. The full text loads only when the skill is invoked. You invoke one by typing /skill-name. Claude invokes one when your request matches its description.

Where skills live

Location Path Available in
Personal ~/.claude/skills/<skill-name>/SKILL.md All your projects on this machine
Project .claude/skills/<skill-name>/SKILL.md Sessions in this repository. Commit it to share it with your team
Nested project <subdir>/.claude/skills/<skill-name>/SKILL.md Sessions in or below that subdirectory, which suits monorepos
Plugin <plugin>/skills/<skill-name>/SKILL.md Wherever the plugin is enabled, as /plugin-name:skill-name
Enterprise .claude/skills/<skill-name>/SKILL.md in the managed settings directory All users on machines where the organization deploys it
Legacy command .claude/commands/<name>.md Still works and creates the same /name

If a personal skill and a project skill share a name, the personal skill runs. An enterprise skill beats a personal one. Plugin skills never collide, because they carry the plugin name as a prefix.

Write your first skill

This example is a project skill for commit messages. Create .claude/skills/commit/SKILL.md:

---
name: commit
description: Write a conventional commit message for the staged changes and commit them.
disable-model-invocation: true
allowed-tools: Bash(git commit *) Bash(git status *)
---

## Staged changes

!`git diff --staged`

## Steps

1. Read the staged changes above. If nothing is staged, stop and say so.
2. Pick a type: feat, fix, refactor, docs, test or chore.
3. Write the message as `type(scope): description`.
   - The scope is the package or module name.
   - The description is in imperative mood, lowercase, with no period.
   - The body explains why the change was made, not what changed.
4. If the changes touch more than one scope, say so and suggest separate commits.
5. Run `git commit -m "<message>"`.

## Rules

- Never use `--no-verify`.
- Never amend a commit that was already pushed.
- If a check fails, fix the cause and commit again.

## Examples

- `feat(billing): add stripe webhook handler`
- `fix(auth): handle expired refresh tokens`
- `refactor(api): extract rate limiter to shared package`

Type /commit and Claude Code runs the workflow. The line that starts with ! runs git diff --staged before Claude reads the skill, so the staged diff is already in the prompt.

The frontmatter sits between two --- lines, and the opening line must be the first line of the file. These are the fields used above and a few more you will meet often:

Field What it does
name The command name in the / menu. It defaults to the folder name.
description What the skill does and when to use it. Claude uses it to decide when to load the skill. Put the main use case first.
disable-model-invocation With true, only you can invoke the skill. Use it for actions with side effects, such as commits and deploys.
user-invocable With false, only Claude can invoke the skill. Use it for background knowledge.
allowed-tools Tools Claude can use without a permission prompt during the turn that invokes the skill. It does not restrict other tools.
paths Glob patterns that limit automatic loading to matching files.
hooks Hooks that Claude Code registers when the skill is invoked. See the hooks section below.

All fields are optional, and description is the one the docs recommend. Claude Code ignores a field name it does not recognize and reports no error, so check your spelling. Run claude plugin validate .claude/skills to find a SKILL.md whose frontmatter does not parse. The full list is in the frontmatter reference.

Skill design patterns

The docs advise keeping SKILL.md under 500 lines and moving detail into separate files. Three shapes cover most skills.

The checklist pattern

Use it for tasks with several verification steps.

# Pre-Deploy Checklist

Before deploying, verify each item:

- [ ] `pnpm typecheck` passes
- [ ] `pnpm test` passes
- [ ] No console.log statements in production code
- [ ] Environment variables are documented in .env.example
- [ ] Database migrations are reversible

If any check fails, stop and report the issue. Do not deploy.

The decision tree pattern

Use it when the approach depends on the cause.

# Bug Fix Workflow

1. Reproduce the bug. Find or write a failing test.
2. Identify the root cause:
   - Type error: fix the type definition at the source.
   - Race condition: add locking or sequencing.
   - Missing validation: add schema validation at the boundary.
   - Logic error: fix it and add a regression test.
3. Check that the fix does not break existing tests.

The template pattern

Use it to get consistent output. The paths below are examples. Use your own.

# New API Endpoint

## File structure
- Route handler: `src/routes/{resource}/{action}.ts`
- Schema: `src/schemas/{resource}.ts`
- Test: `src/routes/{resource}/__tests__/{action}.test.ts`

## Required elements
- A request validation schema
- Authentication middleware
- Structured error responses

Install and share skills

There are three ways to put a skill on a machine:

  • Personal: copy the skill folder into ~/.claude/skills/.
  • Project: commit the folder to .claude/skills/ in the repository. Teammates get it when they pull.
  • Plugin: install a plugin that ships skills in its skills/ folder.

To install a plugin, run /plugin install inside Claude Code. This example installs commit-commands from Anthropic's official marketplace:

/plugin install commit-commands@claude-plugins-official

The command opens the plugin details so you can review what it adds and pick a scope: user, project or local. When it finishes, the plugin's skills appear in the / menu as /<plugin>:<skill>, here /commit-commands:commit. Because of the prefix, it does not replace your own /commit skill. Anthropic's official marketplace is added the first time you start an interactive session. Other marketplaces need one extra step, using a GitHub owner/repo or a git URL:

/plugin marketplace add your-org/plugins
/plugin install deploy-helper@your-org

The name after @ is the name the marketplace registered under. In your shell, claude plugin install <plugin>@<marketplace> --scope project does the same without a session, and claude plugin list shows what is installed. Read the plugin install guide for scopes, updates and removal.

Treat third-party skills and plugins like code. A plugin runs with your user privileges, and a skill can pre-approve tools through allowed-tools. Read both before you install them. To share skills across a whole organization, deploy them through managed settings.

Enforce a skill with hooks

A skill is guidance, and Claude can skip a step. If a rule must hold every time, put it in a hook. Claude Code runs a hook every time its event occurs, whether or not Claude follows the skill.

Hooks attach to Claude Code events, not to git events. Claude Code has no pre-commit or post-commit event. To act on a commit, hook the Bash tool and filter on the command. These are the events you will use most:

Event When it fires
SessionStart When a session begins or resumes
UserPromptSubmit When you submit a prompt, before Claude processes it
PreToolUse Before a tool call runs. It can block the call
PostToolUse After a tool call succeeds
Stop When Claude finishes responding
SessionEnd When a session ends

The hooks reference lists every event. Git's own pre-commit hook is a separate thing. Git runs it when Claude runs git commit, and --no-verify skips it, as the githooks manual says.

Run checks before every commit

This hook runs before any git commit that Claude issues and blocks the commit if the checks fail. Add it to .claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "if": "Bash(git commit *)",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check-before-commit.sh"
          }
        ]
      }
    ]
  }
}

Save the script as .claude/hooks/check-before-commit.sh and run chmod +x on it. Replace the two commands with your own checks.

#!/bin/bash
# Runs before "git commit". Exit code 2 blocks the commit
# and sends stderr to Claude as feedback.

if ! pnpm typecheck >&2; then
  echo "Blocked: typecheck failed. Fix the errors, then commit again." >&2
  exit 2
fi

if ! pnpm lint >&2; then
  echo "Blocked: lint failed. Fix the errors, then commit again." >&2
  exit 2
fi

exit 0

Three details matter. The matcher selects the Bash tool. The if field uses permission-rule syntax, so the script runs only for git commit commands. Exit code 2 blocks the tool call. Exit code 0 lets it continue through the normal permission flow, and any other non-zero code does not block. The if filter is best effort. For a rule that must never be broken, use permission rules or a CI check as well.

Format files after every edit

A PostToolUse hook with an Edit|Write matcher runs after Claude changes a file. This one, from the hooks guide, runs Prettier on the edited file:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
          }
        ]
      }
    ]
  }
}

This example needs jq to be installed.

Keep the hook with the skill

A skill can carry its own hooks in its frontmatter, in the same format as in settings. Claude Code registers them when the skill is invoked and keeps them for the rest of the session:

---
name: secure-operations
description: Perform operations with security checks
hooks:
  PreToolUse:
    - matcher: "Bash"
      hooks:
        - type: command
          command: "./scripts/security-check.sh"
---

If your organization's managed settings list hooks under strictPluginOnlyCustomization, skills outside a plugin lose their frontmatter hooks. Ship such a skill as a plugin instead.

A good team setup has three parts: a skill that tells Claude the workflow, a hook that enforces the rule that must hold, and repo docs that explain both to people. A skill without a hook is advice. A hook enforces a rule, and the skill explains the workflow around it.

Supporting files

A skill is a folder, so it can hold more than one file. Keep SKILL.md short and link the other files from it, so Claude loads them only when needed:

my-skill/
├── SKILL.md        (required: overview and navigation)
├── reference.md    (detailed notes, loaded when needed)
├── examples.md     (examples, loaded when needed)
└── scripts/
    └── helper.py   (a script that runs, not loaded as text)

This suits deployment workflows, schema migration checklists, multi-step code review and product-specific playbooks. A command file is a single Markdown file, so it has no folder for these.

Tips for effective skills

  1. Be specific about paths and names. "Create a component" is vague. "Create a component in src/components/ui/ in PascalCase" is something Claude can follow.

  2. Include examples of correct output.

  3. Say what not to do. "Never use the any type" is easier to follow than "use proper types."

  4. Keep each skill to one workflow. Five short skills work better than one long skill that covers everything.

  5. Write the description for matching. Put the main use case first, and use words people say in requests. The description and when_to_use text together are cut at 1,536 characters in the skill list.

  6. Decide who invokes the skill. Set disable-model-invocation: true on anything with side effects, so Claude does not run a deploy because the code looks ready.

  7. Update skills when your conventions change. An outdated skill teaches old patterns.

If you write only one skill, write it for the repeated step where a mistake costs the most.


TokenLab gives you one API key for chat models from several providers. To run Claude Code on it, follow the Claude Code integration guide. To compare models for coding work, read TokenLab's guide to the best AI models for coding.

Prepared by TokenLab's AI agents. Facts are checked against the linked primary sources on the date shown.

Recent model releases

Try the models from this article

Chat, create images, or make video with the same TokenLab balance.

Your first API call

Get your API key
curl https://api.tokenlab.sh/v1/chat/completions \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"gemini-3.8-flash","messages":[{"role":"user","content":"Hello!"}]}'