Skip to content

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.

Ընտրեք տեքստը՝ հայերեն թարգմանությունը տեսնելու համար։Highlight text to see Armenian. Machine-assisted translation; English is the source of truth.

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 description matters most. Claude uses it to decide when the skill is relevant. name defaults to the directory name.
  • Arguments: $ARGUMENTS is everything after the command. $0, $1… are the individual arguments, and they start at 0, so $0 is the first one. A skill with no placeholder gets the arguments appended as ARGUMENTS: ….
  • Live context: !`command` runs a shell command before the prompt is sent and pastes in its output. Here that’s the current git 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.md and .claude/skills/x/SKILL.md both give you /x.
  • Frontmatter is optional. description drives automatic use, and disable-model-invocation makes 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

running a /deploy-check skill · illustrative session
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

  1. Create .claude/skills/deploy-check/SKILL.md from the example in this lesson.
  2. Run /deploy-check prod and confirm that $0 became prod and the live git status output was included.
  3. Add disable-model-invocation: true and check that Claude no longer starts the skill on its own.
  4. Move a one-file command from .claude/commands/ into a skill directory and confirm that the /name stays the same.

Check yourself

3 questions. Original practice questions, not taken from the real exam.

  1. A repo has both .claude/commands/release.md and .claude/skills/release/SKILL.md.

    1. What does typing /release run?

  2. Your /deploy-check skill body says "Check workspace $0 in region $1". You type /deploy-check prod eu-west-1.

    2. What do $0 and $1 become?

  3. You publish a /rollback-prod skill. You want people to run it on purpose, but Claude must never start it on its own because the description happens to match a conversation.

    3. Which two settings or practices help? (Choose two.)

    Choose 2.

Answer every question to check.