Skip to main content

How to Create Custom Slash Commands and Skills in Claude Code

Michael 7 min read
How to Create Custom Slash Commands and Skills in Claude Code

If slashes and dashes prevented code crashes, we'd never need to debug. - Ancient 6502 Proverb

If you've spent hands-on time in Claude Code, you've probably become familiar with commands that are prefixed with a slash. There's /init to create and populate your CLAUDE.md file. There's also /memory to show which configuration files are currently loaded into context. Oh and there's /stickers if you want to order some physical merch from Anthropic.

All of those are built-in commands, even though they start with a slash. And today, I'm going to take you through a Claude Code tutorial which will describe three different types of items in Claude Code that all start with a slash.

But I want to stop here and make a very important note: at the time of this writing, the Claude Certified Architect exam is based on the v0.1 documentation, last updated on February 10, 2025. As of March 2026, there have been some changes to Claude Code so that now custom skills and custom commands have been merged. I'm unsure which approach will be tested on the exam, so I'm going to mention both here so you're covered for either scenario.

Built-In Commands

Claude Code offers an array of built-in commands that execute pre-built code. They're deterministic, meaning they execute regardless of what Claude Code thinks and they do it the same way every time. As I mentioned above, some examples of built-in commands are /init, /memory, and /stickers. You can find an entire list of them on the official Anthropic Claude Code documentation on built-in commands. But the important takeaway here is they're not called slash commands, even though they are prefixed with a slash, and that they run pre-built code. There is no way to modify how these commands behave outside of input parameters, and they're not built on prompts.

The Legacy Approach

There's an important note here you should understand. At the time of this article (March, 2026), the official Anthropic study guide for the Claude Certified Architect separated slash commands from skills, which is based on their documentation from February, 2025. That is the legacy approach now based on the current documentation.

As of March 2026, Slash Commands have been deprecated and now you'd create them as Skills.

But for the sake of the exam, you need to know a few things:

  • Slash Command descriptions are loaded by Claude Code at startup, so they should be used when they universally apply, such as for coding conventions, testing requirements, architectural rules.

  • Custom Skills are only loaded when invoked or when Claude Code determines they're relevant. Use them for task-specific workflows, such as code review checklists, migration procedures, deployment scripts.

Slash Commands

Custom slash commands are reusable prompts stored as files, and can have project or user scope. When Claude Code starts, it scans both the user and project scope directories and loads all custom slash command descriptions. The actual content of the custom slash commands is only loaded into context when invoked.

  • Project Scope slash commands are stored in .claude/commands/.

    • They become part of the git repository.
    • The whole team gets it.
  • User Scope slash commands are stored in ~/.claude/commands/.

    • They do not become part of the git repository.
    • Only you use these commands.

Let's create a custom slash command that prints Claude Code is awesome! whenever you call it.

In Claude Code, make a prompt like the one below.

❯ Create a custom slash command called "/awesome" that will print "Claude Code is awesome!" whenever it's called.                                                       

● Write(.claude/commands/awesome.md)                                                                                                                                    

───────────────────────────────────────────────────────────────────────
 Create file                                                                                                                                                            
 .claude/commands/awesome.md                       

 Print "Claude Code is awesome!" to the user.   

 Do you want to create awesome.md?
 ❯ 1. Yes
   2. Yes, and allow Claude to edit its own settings for this session
   3. No

Claude Code asks if you would like to create awesome.md. Confirm.

● Done. The custom slash command /awesome is now available at .claude/commands/awesome.md. You can invoke it by typing /awesome in Claude Code.

You'll need to exit Claude Code and start it again (claude -c to continue your session) for it to take effect.

And now when you call /awesome, this happens:

❯ /awesome                                                                                                                                                              

● Claude Code is awesome!      
Modern Approach / Skills

Skills are called from Claude Code the same way as slash commands and built-in commands, through a name prefixed with a slash. Skills differ from slash commands in that they're more powerful because they have additional features.

  • Skills have frontmatter.
  • Skills can use supporting files.
  • Skills can use subagent isolation with the frontmatter context: fork directive.
  • A single skill can reside in .claude/skills/SKILL.md (project scope)
  • A single skill can reside in ~/.claude/skills/SKILL.md (user scope)
  • Multiple skills can reside in SKILL.md files in subfolders, such as ~/.claude/skills/awesome/SKILL.MD

This post discusses three major frontmatter options in skills. A complete list of frontmatter fields is contained in the official Anthropic documentation's Skills frontmatter reference section.

  • context:fork, which allows a skill to run in sub-agent isolation so that its output doesn't pollute your main agent window. When it finishes, a summarization of the sub-agents results are sent back to the calling agent's window.
  • allowed-tools, which determines which types of tools the skill can access, such as edit, write, grep, glob, read, bash, etc.
  • argument-hint, which is a developer-friendly way of notifying the user calling the skill that it requires some parameter input.

Let's set up a skill to see how they are configured.

Open your Claude Code project and ask it to create a new skill called /awesome-skill. Tell Claude Code that the skill should summarize

❯ In this project, create a comprehensive document of every Claude Code feature, dense, packed with information and details. Call it Claude-Code-Features.md.           

● 2 claude-code-guide agents finished (ctrl+o to expand)                                                                                                                
   ├─ Research Claude Code core features · 12 tool uses · 56.2k tokens                                                                                                
   │  ⎿  Done                                                                                                                                                           
   └─ Research Claude Code advanced features · 15 tool uses · 73.9k tokens
      ⎿  Done       

❯ Now create a new skill called /summarize-features. It should use the context:fork directive and should summarize the Claude-Code-Features.md file, returning that     
summarization to the calling agent.                                                                                                                                     

● Bash(mkdir -p /home/mp/Development/blog_post_projects/how-to-create-custom-slash-commands/.claude/skills/summarize-features)                                          
  ⎿  Done                                                                                                                                                               

● Write(.claude/skills/summarize-features/SKILL.md)  

───────────────────────────────────────────────────────────────────────
 Create file                                                                                                                                                            
 .claude/skills/summarize-features/SKILL.md
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
 ---                                                                                                                                                        
 name: summarize-features                                                                                                                                               
 description: Summarize the Claude-Code-Features.md file into a concise overview
 context: fork                                                                                                                                                          
 agent: Explore                                                                                                                                                         
 ---                                                                                                                                                                    

 Read the file `Claude-Code-Features.md` in the project root directory. Produce a concise summary of all the features it covers, organized by category. Keep the        
 summary dense but readable — aim for a high-level overview that captures every major feature area without repeating the full details.                                  
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
 Do you want to create SKILL.md?
 ❯ 1. Yes
   2. Yes, and allow Claude to edit its own settings for this session
   3. No

Once finished, close and restart Claude Code (claude -c), then run the /summarize-features skill.

It will take a document that looks like this:

Claude Code Features - Comprehensive Reference

A dense, exhaustive reference of every Claude Code feature, capability, and configuration option.


1. Installation & Platforms

Surfaces: Terminal CLI, VS Code extension, JetBrains plugin, Desktop app (macOS/Windows), Web (claude.ai/code), Chrome extension, Slack integration, iOS app.

Install methods: - Native (auto-updates): curl -fsSL https://claude.ai/install.sh | bash (macOS/Linux/WSL), PowerShell irm https://claude.ai/install.ps1 | iex (Windows), CMD curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd - Homebrew: brew install --cask claude-code (no auto-update, run brew upgrade claude-code) - WinGet: winget install Anthropic.ClaudeCode (no auto-update)

Platforms: macOS, Linux, WSL2, Windows (requires Git for Windows). WSL1 not supported for sandboxing.


2. CLI Commands

Command Description
claude Start interactive session
claude "query" Start session with initial prompt
claude -p "query" Print mode (non-interactive SDK mode), then exit
cat file | claude -p "query" Pipe content into print mode
claude -c Continue most recent conversation in current directory
claude -c -p "query" Continue most recent via SDK
claude -r "<session>" "query" Resume session by ID or name
claude update Update to latest version
claude auth login Sign in (flags: --email, --sso, --console)
claude auth logout Sign out
claude auth status Show auth status as JSON (--text for human-readable; exit 0=logged in, 1=not)
claude agents List all configured subagents grouped by source
claude mcp Configure MCP servers
claude remote-control Start Remote Control server (--name "My Project")

And make it appear as a summarized document that looks like this:

 Claude Code Features Summary                                                                                                                                     

 Installation & Platforms - Available on terminal, VS Code, JetBrains, Desktop (macOS/Windows), Web, Chrome extension, Slack, and iOS. Multiple installation methods
    (native, Homebrew, WinGet) across macOS, Linux, WSL2, and Windows.                                                                                                

 CLI & Commands - Core commands for session management (claude, -p print mode, -c continue, -r resume), authentication (login/logout/status), agent management, MCP 
 configuration, and remote control. Extensive flags for customization including model selection, system prompt modification, worktrees, and permission handling.

As you've read, there are a couple of different way to create your own commands in Claude Code that are prefixed with a forward slash. Claude Code makes a variety of its own built-in command available at the prompt, but you're able to create your own slash commands and skills, based on the need. Slash commands for universally-needed functions, and custom skills for as-needed functions. But as I mentioned above, the official Anthropic documentation has deprecated slash commands in lieu of custom skills. The exam content, however, leans toward the legacy methods.

Think about some of the ways you could take advantage of reusable commands in your projects. Which prompts are you typing over and over? Do those tools need to summarize data? Do they need to have their access restricted to grep or glob? Spend some time pondering that and see how you can apply them in your projects going forward.

Preparing for the CCA exam? Start with our overview: What Is Anthropic's Claude Certified Architect Exam?

Exam Prep

Preparing for the Claude Certified Architect Foundations exam? See what's covered and browse the full tutorial library mapped to all five exam domains.

Related Posts

The Best Way to Get Claude Code to Find and Fix Its Own Bugs

How to Use the Claude Message Batches API (And When Not To)

How to Integrate Claude Code into CI/CD Pipelines

← Back to all posts