How to Use Claude Code Skills and Custom Commands

Claude Code skills now include custom commands. Create a SKILL.md file, run it with /skill-name, and pass arguments. Step by step, with fixes.

By Archit Tamrakar · LinkedIn · · 9 min read

Quick answer: Create a folder with a SKILL.md file in ~/.claude/skills/, then run it by typing /skill-name in Claude Code. Free? The files are plain text, so creating them costs nothing.

Anthropic's Claude Code docs say that 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. This guide shows both formats as of 16 October 2026.

What do you need before you start?

You need Claude Code installed and working, and a folder where you want to try the skill. If you have not installed it yet, follow How to Install Claude Code on Mac and Windows. If you are new to the tool, What Is Claude Code? explains the basics.

The docs' first example also uses a git project, because it reads your uncommitted changes. You do not need git for your own skills. Any text-based task works.

You also need to know one term. A skill is a folder of instructions that Claude reads when it needs them. The Claude Code docs say you should create one when you keep pasting the same instructions or checklist into chat.

How do you create a Claude Code skill? (Method 1: a SKILL.md folder)

Make a folder named after your skill, put a SKILL.md file inside it, then type / and the skill name. The steps below follow the official walkthrough, which builds a skill called summarize-changes.

  1. Open a terminal and create the skill folder: mkdir -p ~/.claude/skills/summarize-changes. The docs call this your personal skills folder, which is available in all your projects.
  2. Create a file named SKILL.md inside that folder.
  3. Paste the following into the file and save it:
---
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.
  1. Open a git project and make a small edit to any file.
  2. Start Claude Code by running claude.
  3. Test it one of two ways. Ask "What did I change?" and Claude can load the skill itself. Or type /summarize-changes to run it directly.

The line that starts with ! is called dynamic context injection. The docs explain that Claude Code runs the command first and replaces the line with its output, so Claude sees your real diff.

The SKILL.md file has two parts. The top section between --- markers is the frontmatter, which tells Claude when to use the skill. The Markdown below it holds the instructions. The folder name becomes the command you type, unless you set a name in the frontmatter.

Claude Code watches skill folders. According to the docs, you can add or edit a skill during a session without restarting. If the top-level skills folder did not exist when the session began, run /reload-skills.

How do you make a custom slash command with arguments? (Method 2: a commands file)

Save a Markdown file in .claude/commands/ and put $ARGUMENTS where the extra text should go. The docs say this older format still works and accepts the same frontmatter except name and paths. The file name becomes the command.

Here is an example you could save as .claude/commands/summarize-file.md:

---
description: Summarize a text file in three bullet points
disable-model-invocation: true
argument-hint: "[file-name]"
---

Read the file $ARGUMENTS and summarize it in three bullet points.
List any action items separately. Do not invent names or dates.

Then type /summarize-file notes.txt. The docs say $ARGUMENTS is replaced by whatever follows the command name. Their example is /fix-issue 123, where Claude receives "Fix GitHub issue 123 following our coding standards."

To use several values, the docs describe $ARGUMENTS[0], or the shorter $0, for the first one, and $1 for the second. If you pass arguments but your file has no placeholder, Claude Code appends ARGUMENTS: <your input> to the end so Claude still sees them.

New work should use a skill folder instead. The docs say skills add a directory for supporting files, frontmatter that controls who can invoke the skill, and automatic loading.

Which frontmatter fields matter most?

Only description is recommended. The docs say all fields are optional, and Claude Code ignores any field name it does not recognise, without an error. Spell each one exactly, hyphens included.

FieldWhat it doesUse it when
descriptionTells Claude what the skill does and when to use itAlways
disable-model-invocation: trueClaude cannot load the skill on its ownThe skill commits, deploys or sends something
user-invocable: falseHides the skill from the / menu; only Claude can use itIt is background knowledge, not an action
allowed-toolsPre-approves listed tools for the turn that runs the skillYou want fewer permission prompts
argument-hintShows a hint while you type the commandThe skill takes arguments
context: forkRuns the skill in a forked subagentThe task is self-contained

Two limits are worth knowing. The combined description and when_to_use text is truncated at 1,536 characters in the skill listing, so put the main use case first. And allowed-tools does not restrict anything: the docs say every tool stays callable, and your normal permission settings still apply to tools you did not list.

Frontmatter is read only if the opening --- is the very first line of the file.

Where should you save a skill?

Save it in your home folder for personal use, or in a repository for a team. The docs list these main locations.

LocationPathLoads in
Personal~/.claude/skills/<skill-name>/SKILL.mdAll your projects on this machine
Project.claude/skills/<skill-name>/SKILL.mdSessions in that repository; commit it to share
Plugin<plugin>/skills/<skill-name>/SKILL.mdWherever the plugin is enabled, as /plugin-name:skill-name
Enterprise.claude/skills/<skill-name>/SKILL.md in the managed settings directoryAll users where the organization deploys it

If two skills share a name, the docs say enterprise beats personal, and personal beats project. A skill also beats a .claude/commands/ file with the same name. Plugin skills never clash because they carry the plugin name as a prefix.

A project folder works like a shared team template. Anyone who opens that project in Claude Code gets the same /command.

Which method should you choose?

Use a skill folder unless you already have command files. The table compares the two formats and the bundled option.

MethodCostDifficultyLimitsBest for
Skill folder (SKILL.md)Free to createLowFrontmatter must parse; keep SKILL.md under 500 lines (docs tip)Anything you will reuse, or that needs extra files
Commands file (.claude/commands/)Free to createLowestNo name or paths field; the older formatCommands you already have
Bundled skills (/doctor, /debug, /loop)Included with Claude CodeNoneYour own skill with the same name replaces the bundled command, not its aliasesChecking your setup or common jobs
Plugin or marketplace skillsVaries by publisherMediumThird-party code; review before installingSharing skills across many projects

What's free and what costs money?

The skill files are plain text, and the docs do not describe any separate fee for skills. What you spend is normal Claude Code usage under your own plan. The docs say a skill's body loads only when it is used, so long reference material costs almost nothing until needed. Pricing for Claude Code plans is not covered in the skills docs, so check Anthropic's pricing page for current plan limits.

Anthropic's skills repository on GitHub says its example skills are available to paid plans in Claude.ai. Many are Apache 2.0 licensed. The document skills for docx, pdf, pptx and xlsx are described as source-available, not open source.

What can go wrong, and how do you fix it?

Most problems come from the description or the YAML. The docs' troubleshooting section covers these cases.

  • Claude never uses the skill. Check the description includes words you would naturally say. Ask "What skills are available?" to confirm it is listed. Try typing /skill-name directly.
  • The slash command works but Claude never picks it up. If the YAML is malformed, the skill body still loads but with no metadata, so Claude cannot match your description. Run with --debug to see the parse error, or run claude plugin validate .claude/skills (v2.1.233 or later).
  • The skill triggers too often. Make the description more specific, or add disable-model-invocation: true.
  • Claude stops following the skill mid-session. The docs say the file is not re-read on later turns. Write guidance as standing instructions, such as "run the tests after every edit".
  • It stopped working after a long chat. After compaction, Claude Code keeps only the first 5,000 tokens of each recently used skill, within a combined 25,000-token budget. Put key instructions at the top and invoke the skill again.
  • A subfolder skill is missing. Skills in a .claude/skills/ folder below where you started load only after Claude reads or edits a file in that subfolder. Run /add-dir with the path to load it sooner.

Is it safe to use skills from other people?

Only if you read them first. A skill can run shell commands and pre-approve tools, so it is closer to a small program than a note.

The Claude Code docs say a skill can grant itself broad tool access, and they tell you to review the allowed-tools of skills checked into a repository before running Claude Code there. Even in a headless run in a folder you have never trusted, a project skill's allowed-tools still applies, according to the docs.

According to Datadog Security Labs, malicious skills can abuse dynamic context commands to run before model-level prompt injection defenses can step in. Administrators can set "disableSkillShellExecution": true in settings. The docs say each injected command is then replaced with a "disabled by policy" message instead of running.

Anthropic's own repository also carries a disclaimer: its example skills are for demonstration and education, and you should test them in your own environment before relying on them.

Two habits help. Read every SKILL.md and any script in the folder before installing it. And use disable-model-invocation: true on anything that sends, deletes or publishes.

What's still unclear?

  • Plans and prices. The skills docs do not list what each Claude plan allows for skills, so check Anthropic's pricing page before relying on a specific limit.
  • Spec versus Claude Code. The Agent Skills specification requires name and description and says the name must match the folder. Claude Code treats every field as optional and lets name differ from the folder. A skill that works in Claude Code may therefore fail strict validation elsewhere.
  • Portability. If you add Claude Code-only fields such as argument-hint, the docs say packaging for claude.ai or the Skills API fails with a hard error. Dynamic context injection also does not work in claude.ai chat or the API.
  • Reliability. Automatic loading depends on Claude judging that your description matches the request. The docs list "triggers too often" and "stops following" as known problems, with no guaranteed fix.
  • Security evidence. The Datadog finding is one vendor's research, and Anthropic's built-in controls (disableSkillShellExecution, managed permission settings) address part of it.

For connecting skills to outside apps, see How to Connect Claude Code to Google Sheets, Slack and Gmail With MCP. To see how Claude Code compares with other coding assistants, read Claude Code vs Codex vs Cursor.

Last checked: 16 October 2026, against Anthropic's Claude Code documentation and the Agent Skills specification.

Frequently asked questions

Are Claude Code custom commands still supported?

Yes. Anthropic's Claude Code docs say custom commands have been merged into skills, and existing files in .claude/commands/ keep working. A command file and a skill folder with the same name both create the same slash command. If both exist, the skill runs. The docs recommend skills for new work because they support extra files and more frontmatter options.

Where do I save a Claude Code skill so it works in every project?

Save it at ~/.claude/skills/<skill-name>/SKILL.md. The docs describe this personal location as loading in all your projects on that machine. To share a skill with a team, save it at .claude/skills/<skill-name>/SKILL.md inside a repository and commit it, so everyone who works in that repository gets it.

How do I stop Claude from running a skill on its own?

Add disable-model-invocation: true to the skill's frontmatter. Claude can then no longer load the skill automatically, and you run it only by typing /skill-name. The docs recommend this for workflows with side effects, such as deploying code, committing changes or sending messages, where you want to control the timing.

Why is Claude Code ignoring my skill?

Most often the description does not contain words you naturally say, or the YAML at the top of the file is malformed. The docs suggest checking the description keywords, asking 'What skills are available?', rephrasing your request, and typing /skill-name directly. Run Claude Code with --debug to see a frontmatter parse error.

Do Claude Code skills work in other AI tools?

Partly. Claude Code skills follow the open Agent Skills standard, which Anthropic's docs say works across multiple AI tools. But Claude Code adds extra frontmatter fields and features, such as dynamic context injection, that other products may not support. Keep to the standard's six fields if you want a skill to be portable.

Is it safe to install skills written by other people?

Treat them like any software you download. A skill can run shell commands and pre-approve tools. Anthropic's docs tell you to review the allowed-tools of repository skills before running Claude Code there. Read the SKILL.md file and any scripts first, and avoid skills from sources you do not trust.

Sources

  1. Extend Claude with skills - Claude Code Docs, Anthropic (2026-10-16)
  2. Specification - Agent Skills, Agent Skills (agentskills.io) (2026-10-16)
  3. anthropics/skills: Public repository for Agent Skills, GitHub (Anthropic) (2026-10-10)
  4. Malicious Coding Agent Skills and the Risk of Dynamic Context, Datadog Security Labs (2026-05-11)