Slash commands and skills

Working with Claude on Projects

Chapter 6  ·  Slash Commands and Skills

Claude Code ships with a set of built-in slash commands for actions you perform often — code review, help, configuration, memory consolidation. On top of those, you can write your own skills: custom slash commands that live inside a project and trigger any workflow you can express in a prompt. This chapter covers both layers.

Built-in Slash Commands

Built-in commands are typed directly into the Claude Code chat input. They open panels, trigger operations, or configure behaviour — they are not sent to the model as chat messages.

/help

Lists all available slash commands for the current session, including any custom skills loaded from the project. Your first stop when you forget a command name.

/code-review

Triggers a code review of the current branch. Can be scoped to a PR number or run locally against uncommitted changes.

/code-review
/code-review ultra
/code-review ultra 42
/ultrareview

Deprecated alias for /code-review ultra. Does the same thing — launches a multi-agent cloud review of the branch. Prefer the newer form.

/clear

Clears the current conversation context without closing the session. Useful when you want to start a fresh exchange without losing your project setup.

/compact

Manually triggers context compaction — summarises older turns to free space. Normally happens automatically; useful if you want to compact before the automatic threshold.

/memory

Opens the memory management panel. Lets you view, add, edit, or delete memory files interactively without switching to a file editor.

/status

Shows the current project status — loaded CLAUDE.md files, active memory files, token usage, and the current model.

/fast

Toggles Fast mode on/off. Fast mode uses Claude Opus with optimised output — it does not downgrade to a smaller model. Useful for rapid iteration when response time matters more than maximum depth.

Desktop app vs terminal
Some slash commands open interactive panels — /permissions, /config, /agents, /hooks, /doctor. These are available in an interactive claude terminal session. In the desktop app, use the app's own UI for model selection and settings instead.

The /code-review Command in Depth

/code-review is the most powerful built-in. It comes in two flavours:

Standard review

/code-review with no arguments reviews the uncommitted changes in the current working tree — staged and unstaged. Good for a quick review before committing.

Ultra review

/code-review ultra (or /code-review ultra <PR number>) launches a multi-agent cloud review. Multiple Claude instances work in parallel across different review angles — correctness, security, style, architecture — and produce a consolidated report.

  • Requires a git repository. No GitHub remote needed for the no-arg form (bundles the local branch).
  • With a PR number: /code-review ultra 42 — reads the PR from GitHub directly.
  • This is billed separately (multi-agent runs consume more tokens than a single-model review).
  • You cannot launch ultra review via Bash or the API — it must be triggered from the Claude Code UI.
When to use ultra vs standard
Use standard review for routine commits and quick sanity checks. Reserve ultra for pull requests that touch security-sensitive code, a large surface area, or anything going to production. The additional cost is justified when catching an issue in review is cheaper than a production incident.

Skills — Custom Slash Commands

A skill is a markdown file that defines a custom slash command. When Claude loads your project, it reads any skills registered in your project settings and makes them available as /skill-name commands. Invoking a skill sends its prompt (with any arguments substituted) to Claude as a message — the skill is executed by the model, not the CLI.

How a skill file is structured

.claude/skills/session-diary.md  — example skill file
---
name: session-diary
description: Generate an end-of-session diary entry
---

Generate a session diary for this conversation.

Format: a structured markdown file at
claude-generated-files/claude_session_diary_{{date}}.md

Include sections:
1. Date and session summary (2–3 sentences)
2. Full session transcript (USER / ASSISTANT pairs)
3. Files generated this session
4. Decisions and preferences saved to memory

Write the file then confirm the path.

The name field becomes the command trigger: /session-diary. The body is the prompt sent to Claude when the command is invoked. You can include argument placeholders like {{date}} or $ARGUMENTS — Claude substitutes them from what you type after the command name.

Creating a Skill — Step by Step

Create the skills directory — skills live in .claude/skills/ inside your project. If the directory doesn't exist, create it. Each skill is its own .md file.
Write the skill file — frontmatter block with name and description, then the prompt body. The name must be lowercase with hyphens (no spaces). The description appears in /help.
Register the skill — add an entry to .claude/settings.json under "skills". Or, if using the desktop app, skills in .claude/skills/ may be picked up automatically — check /help to confirm the skill appears.
Test it — invoke with /skill-name in the chat. If the skill takes arguments, test with /skill-name some argument. Iterate on the prompt body until the output matches your expectation.
Save a memory note — add the skill to your shorthand prompt map memory file so future sessions know it exists. A skill that isn't documented is easy to forget.

Example Skills for This Project

Progress report
/progress
Produces a three-section status report: completed courses, started-but-incomplete, and proposed-but-not-started. Equivalent to the "progress" shorthand in this project. The skill body reads the course memory files and formats the output to a consistent structure.
Session diary
/session-diary
Generates an end-of-session diary file. Loops over the conversation, producing USER/ASSISTANT pairs, a file list, and a decisions log. Saves to claude-generated-files/claude_session_diary_YYYY-MM-DD.md.
Course chapter
/chapter $ARGUMENTS
A parameterised skill. /chapter vpn6 looks up the shorthand in the VPN course memory file and generates the corresponding chapter HTML. Encapsulates the entire chapter-generation workflow — styling lookup, content generation, file write, and status update — into a single command.
Memory consolidation
/consolidate-memory
Reviews all memory files for staleness, duplicates, and accuracy. Merges redundant files, updates MEMORY.md hooks, removes entries that reference files or facts that no longer exist. Run periodically on long-running projects.

Skills vs Shorthand Prompts

Both skills and shorthand prompts are ways to trigger a workflow with minimal typing. The difference is where the spec lives and how Claude receives it:

Shorthand promptSkill
How triggered Type a keyword (e.g. vpn6) in chat Type /skill-name in chat
Spec location Memory file (read by Claude on relevance) Skill .md file (always loaded as a command)
Prompt delivery Claude reads the memory, constructs the action Skill body is sent directly as the prompt
Arguments Embedded in the keyword (e.g. vpn6 = chapter 6) Passed after the command name; substituted via $ARGUMENTS
Reliability Depends on Claude loading the right memory file Prompt is always the same — deterministic trigger
Best for Flexible workflows where context varies per invocation Repeatable workflows with a fixed structure every time

In practice, shorthand prompts and skills are complementary. Use shorthand for course-chapter generation (where the chapter number and course vary) and skills for project-wide recurring actions (progress report, session diary, memory consolidation) that don't vary by invocation.

When to Build a Skill

A skill is worth creating when a workflow meets most of these criteria:

  • You perform it more than a handful of times across sessions
  • The prompt is long or complex enough that retyping it is error-prone
  • The steps are consistent — same structure every time, possibly with a parameter
  • Getting it slightly wrong has a meaningful cost (e.g. writing to the wrong file path, forgetting a SQL step)

Don't create skills for one-off tasks, tasks that vary too much to have a fixed prompt, or tasks where typing a short note to Claude is just as fast. Premature skill creation produces a .claude/skills/ directory full of files you never use.

Prototype in chat first
Before writing a skill file, prove the prompt works by typing it manually in two or three sessions. Once you've confirmed the output is reliably what you want, extract the prompt into a skill file. Skill design after testing is much faster than skill design upfront.
Next — Chapter 7: MCP Servers
What the Model Context Protocol is, how MCP servers extend what Claude can see and do, built-in servers (filesystem, browser, computer use), and how to connect third-party servers to your project. Practical examples from this project's own toolchain.