C2 · lesson 5 · 8 min read
Slash commands and skills
Package a repeatable workflow, such as a pre-deploy check, as a skill that you or Claude can invoke.
Հայերեն
Official video by Anthropic on YouTube. Pressing play loads it from youtube-nocookie.com. ·open on YouTube
Every team has prompts it types over and over: “check this branch is ready to
deploy”, “write the release notes”. Claude Code lets you save them as skills
that run with /name.
Commands and skills are one system
Custom slash commands have been merged into skills. Both of these create
/deploy:
.claude/commands/deploy.md # single-file command (still works)
.claude/skills/deploy/SKILL.md # skill directory: can hold scripts and references
If both exist with the same name, the skill wins. Use a skill directory when the workflow needs supporting files such as scripts, templates or checklists.
| Location | Scope |
|---|---|
.claude/skills/<name>/SKILL.md |
This project (commit it) |
~/.claude/skills/<name>/SKILL.md |
You, every project |
<plugin>/skills/<name>/SKILL.md |
A plugin, invoked as /plugin:name |
Anatomy of a skill
---
description: Check that the current branch is safe to deploy to an environment. Use before any release.
argument-hint: <environment>
allowed-tools: Bash(git *) Bash(terraform plan *)
---
Deploy check for **$0**.
Working tree right now:
!`git status --short`
1. Confirm the branch is up to date with origin/main.
2. Run `terraform plan` for workspace `$0` and summarise adds/changes/destroys.
3. Refuse to continue if anything would be destroyed in prod.
- Frontmatter: every field is optional, but
descriptionmatters most. Claude uses it to decide when the skill is relevant.namedefaults to the directory name. - Arguments:
$ARGUMENTSis everything after the command.$0,$1… are the individual arguments, and they start at 0, so$0is the first one. A skill with no placeholder gets the arguments appended asARGUMENTS: …. - Live context:
!`command`runs a shell command before the prompt is sent and pastes in its output. Here that’s the currentgit status. allowed-tools: tools the skill may use without asking while it runs.
Why skills stay cheap
Only each skill’s name and description sit in context all the time, and the listing has a small budget. The body loads only when the skill runs. So you can install many skills without crowding the context window, as long as each description is short and specific.
Recap
- Commands and skills are the same system:
.claude/commands/x.mdand.claude/skills/x/SKILL.mdboth give you/x. - Frontmatter is optional.
descriptiondrives automatic use, anddisable-model-invocationmakes a skill human-only. $ARGUMENTS,$0,$1… (starting at 0) and!`cmd`add input and live context.- Only descriptions are always loaded; bodies load when the skill runs.
See it in action
transcript
> /deploy-check prod # $0 = prod; !`git status --short` ran before the prompt was sent Branch is up to date with origin/main. Bash(terraform plan -no-color) workspace: prod Plan: 2 to add, 1 to change, 0 to destroy. Safe to deploy: nothing is destroyed in prod.
$ ./try-it.sh
Try it: a /deploy-check skill
- Create
.claude/skills/deploy-check/SKILL.mdfrom the example in this lesson. - Run
/deploy-check prodand confirm that$0becameprodand the livegit statusoutput was included. - Add
disable-model-invocation: trueand check that Claude no longer starts the skill on its own. - Move a one-file command from
.claude/commands/into a skill directory and confirm that the/namestays the same.
Check yourself
3 questions. Original practice questions, not taken from the real exam.