Claude Code Slash Command Development

VerifiedSafe

Builds custom slash commands for Claude Code by authoring Markdown files with specific frontmatter. Helps add reusable prompt shortcuts, restrict tool access, or run isolated sub-agent tasks via the fork context.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#slash-commands#custom-commands#claude-code#command-development

Recommended for

Automated summary

This skill guides users in creating custom slash commands for Claude Code using Markdown files with frontmatter configuration.

Strengths

  • Structured approach with clear file locations
  • Supports arguments and dynamic content
  • Allows namespacing for organizing commands
  • Can restrict tool access for security

Limitations

  • Requires precise adherence to file naming and location
  • Dynamic content has bugs (e.g., special characters in backticks)
  • Scope management between project and personal commands can be confusing
When to use it

Use this skill when you need to add reusable, custom commands to Claude Code for repetitive tasks or workflows.

When not to use it

Avoid this skill if the functionality can be achieved with a simple one-time prompt or if you need complex, stateful interactions beyond what a single command can provide.

Security analysis

Safe
Quality score88/100

The skill is purely instructional for creating slash commands; it contains no executable code, no bash snippets, no exfiltration instructions, and no destructive operations. The only dynamic content mentions a ! prefix for bash execution but does not itself execute anything. The bug workaround is benign.

No concerns found

How this analysis is made

Examples

Create a project-level slash command for code review
Create a slash command for Claude Code that reviews the current file for bugs and style issues, storing it in .claude/commands/review.md.
Add a personal slash command with arguments
Create a personal slash command `/summarize` that takes a file path as an argument and provides a summary of the file's contents.
Build a namespaced command with dynamic content
Add a command under .claude/commands/git/ that shows the current branch and recent commits using dynamic bash execution.

name: claude-code-slash-commands description: This skill should be used when the user asks to "create a command", "write a slash command", "build a plugin command", or wants to add custom commands to Claude Code. allowed-tools: Read, Grep

Slash Command Development

Create custom slash commands for Claude Code.

Quick Reference

You MUST read these references for detailed guidance:

Command Structure

Commands are Markdown files in specific locations:

| Scope | Location | Description suffix | |-------|----------|-------------------| | Project | .claude/commands/ | (project) | | Personal | ~/.claude/commands/ | (user) | | Plugin | commands/ in plugin root | (plugin) |

Basic Command

---
description: Brief description of what this command does
---

Your prompt instructions here.

Frontmatter Options

---
allowed-tools: Bash(git:*), Read
argument-hint: [filename] [options]
description: What this command does
model: claude-3-5-haiku-20241022
disable-model-invocation: false
context: fork
---

| Field | Purpose | |-------|---------| | allowed-tools | Tools the command can use | | argument-hint | Shows in autocomplete (e.g., [message]) | | description | Brief description (required for SlashCommand tool) | | model | Specific model to use | | disable-model-invocation | Prevent programmatic invocation | | context: fork | Run in isolated sub-agent context, preventing side effects on main agent state |

Arguments

All arguments:

Fix issue #$ARGUMENTS following our coding standards

Positional arguments:

Review PR #$1 with priority $2 and assign to $3

Dynamic Content

<!-- NOTE: Avoid isolated special chars in backticks due to bug #12762 --> <!-- See: https://github.com/anthropics/claude-code/issues/12762 -->

Bash execution (prefix with exclamation mark):

Current branch: EXCLAMATION`git branch --show-current`
Recent commits: EXCLAMATION`git log --oneline -5`

Replace EXCLAMATION with the exclamation mark character - workaround for bug #12762.

File references (prefix with at-sign):

Review the implementation in @src/utils/helpers.js

Namespacing

Subdirectories group related commands:

  • .claude/commands/frontend/test.md → /test shows (project:frontend)
  • .claude/commands/backend/test.md → /test shows (project:backend)

Checklist

  • [ ] Description filled in frontmatter
  • [ ] argument-hint if command takes arguments
  • [ ] allowed-tools if using Bash or specific tools
  • [ ] Test with /command-name --help style invocation

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/claude-code-slash-command-development-mm8o5215/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/claude-code-slash-command-development-mm8o5215' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/claude-code-slash-command-development-mm8o5215/download' --output '.skill-downloads/claude-code-slash-command-development-mm8o5215/SKILL.md.part' && mv '.skill-downloads/claude-code-slash-command-development-mm8o5215/SKILL.md.part' '.skill-downloads/claude-code-slash-command-development-mm8o5215/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Grep

Original excerpt: Quick Reference

You MUST read these references for detailed guidance:

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/claude-code-slash-command-development-mm8o5215/SKILL.md' && test -s '.skill-downloads/claude-code-slash-command-development-mm8o5215/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/claude-code-slash-commands' && cp -R '.skill-downloads/claude-code-slash-command-development-mm8o5215' '.claude/skills/claude-code-slash-commands'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/claude-code-slash-command-development-mm8o5215'

openskills read 'claude-code-slash-command-development-mm8o5215'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/claude-code-slash-command-development-mm8o5215/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills