Search⌘ K
AI Features

Custom Commands and Skills

Explore how to create and use custom commands and skills within Claude Code to automate coding tasks efficiently. Understand command file setup, argument use, skill configuration, and control options to streamline workflows and support collaborative projects.

Claude Code comes with built-in slash commands, but the real power comes from the automation you define yourself. This lesson covers two related systems:

  • Custom Commands (the original, simpler approach)

  • Skills (the newer, more capable evolution).

Both let you save long or repetitive prompts as slash commands. So instead of typing “Perform a code review following our team standards…” every time, you just run /review. Skills add more on top of that: supporting files, automatic invocation by Claude, subagent execution, and invocation control.

Custom commands and skills are unified in Claude Code. A file at .claude/commands/review.md and a skill at .claude/skills/review/SKILL.md both create the same /review command. Your existing command files keep working as before. For new automation, skills are the better choice since they give you all the extra capabilities covered below. If a skill and a command share the same name, the skill wins.

Claude Code skills follow the Agent Skills open standard, so skills you write can work across multiple AI tools. Claude Code adds its own features on top: invocation control, subagent execution, and dynamic context injection.

How are custom commands created?

Setting up a custom command is simple. Custom command files live in your project and are Markdown files that contain the instructions you want Claude to execute. Here's how:

  1. Locate (or create) the hidden .claude folder at the root of your project/current directory.

  2. Inside .claude, create a subfolder named commands.

  3. Add a new Markdown file in the commands folder for your custom command. The file name (without extension) becomes the command name. For example, a file named docs.md creates a /docs command.

For instance, to quickly generate a documentation file for your project, create docs.md with the following content:

Create a new Markdown file named **docs.md** at the repository root. If it already exists, overwrite its contents.
Write **short, generic project documentation**. Keep it skimmable (roughly 150–250 words).
Only use facts you can clearly see in the repo; leave `<placeholders>` if unsure. Do **not** invent details or include secrets.
--- docs.md (begin) ---
## Overview
<One or two sentences on what the project does and who it’s for.>
## Quick Start
- Requirements: <e.g., runtime/tools>
- Install: <command>
- Run: <command>
- Test: <command>
## Structure
- <folder-or-file> — <purpose>
- <folder-or-file> — <purpose>
## Configuration
- <ENV_VAR_NAME> — <what it controls>
## Scripts / Tasks
- <script-or-task> — <one-line purpose>
## Notes
<anything notable, limitations, or TODOs>
--- docs.md (end) ---
After writing, print: Created/updated docs.md
Create project docs with /docs command

This Markdown file defines what the /docs command should do. It tells Claude to create (or update) docs.md with a documentation template. The template includes sections like overview, quick start, and structure, with placeholders (<...>) for anything not visible in the repository.

...