writing-slash-commands
Configures reusable slash commands to trigger automated tasks in Claude Code.
Install
mkdir -p .claude/skills/writing-slash-commands && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/5615" && unzip -o skill.zip -d .claude/skills/writing-slash-commands && rm skill.zipInstalls to .claude/skills/writing-slash-commands
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Create and use custom slash commands to automate Claude Code workflows. Learn argument passing, frontmatter configuration, bash integration, and file references for building reusable prompts.Key capabilities
- →Creates project-scoped command directories
- →Defines personal command templates for cross-project use
- →Captures all arguments via $ARGUMENTS placeholder
- →Maps individual arguments using positional parameters ($1, $2)
- →Namespaces commands using subdirectories
How it works
It parses markdown configuration files stored in predefined directories and substitutes placeholders with provided CLI arguments.
Inputs & outputs
When to use writing-slash-commands
- →Create a shortcut for code reviews
- →Automate performance optimization prompts
- →Namespace project-specific build tools
About this skill
Slash Commands Guide
Slash commands are reusable prompt templates that automate recurring tasks in Claude Code. Define them once, invoke them anytime with /command-name [args].
Quick Start
Create a Command
Project-scoped (shared with team):
mkdir -p .claude/commands
echo "Analyze this code for performance issues:" > .claude/commands/optimize.md
Personal (across all projects):
mkdir -p ~/.claude/commands
echo "Review this code for security vulnerabilities:" > ~/.claude/commands/security-review.md
Invoke with /optimize or /security-review.
Custom Commands Architecture
| Scope | Location | Scope | Shareable |
|---|---|---|---|
| Project | .claude/commands/ | Repository-specific | Yes (team) |
| Personal | ~/.claude/commands/ | All projects | No |
Namespacing
Organize commands in subdirectories (no effect on invocation):
.claude/commands/
├── frontend/
│ └── component.md # Invokes as `/component` (shows "project:frontend")
├── backend/
│ └── api.md # Invokes as `/api` (shows "project:backend")
└── security-review.md # Invokes as `/security-review`
Note: User-level and project-level commands with the same name conflict; only one is available.
Arguments & Placeholders
Capture All Arguments with $ARGUMENTS
Use $ARGUMENTS when you need all arguments as a single string:
---
description: Fix issue with optional priority
argument-hint: [issue-number] [optional-priority]
---
Fix issue #$ARGUMENTS following our coding standards.
Usage: /fix-issue 123 → $ARGUMENTS = "123"
Usage: /fix-issue 123 high-priority → $ARGUMENTS = "123 high-priority"
Access Individual Arguments with $1, $2, ...
Use positional parameters for structured commands:
---
description: Review pull request with priority and assignee
argument-hint: [pr-number] [priority] [assignee]
---
Review PR #$1 with priority $2 and assign to $3.
Focus on security, performance, and code style.
Usage: /review-pr 456 high alice → $1="456", $2="high", $3="alice"
When to use positional:
- Arguments have distinct roles (ID, priority, owner)
- Need defaults:
${3:-unassigned} - Reference arguments separately throughout command
Frontmatter Configuration
All options are optional; commands work without frontmatter.
| Field | Purpose | Example |
|---|---|---|
description | Shown in /help (required for SlashCommand tool) | "Fix security issues" |
argument-hint | Argument syntax hint for autocomplete | "[issue] [priority]" |
allowed-tools | Tools this command can invoke | Bash(git add:*), Bash(git status:*) |
model | Override default model for this command | "claude-3-5-haiku-20241022" |
disable-model-invocation | Prevent SlashCommand tool from triggering | true |
Example with Full Frontmatter
---
description: Create a git commit with staged changes
argument-hint: [message]
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
model: claude-3-5-haiku-20241022
---
Create a git commit with message: $ARGUMENTS
Bash Execution & File References
Run Bash Commands with !
Prefix inline commands with ! to execute before the command runs. Requires allowed-tools with Bash:
---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git log:*)
description: Create a git commit
---
## Context
- Current status: !`git status`
- Staged changes: !`git diff --cached`
- Recent commits: !`git log --oneline -5`
## Your Task
Create a single commit summarizing the changes.
Output from bash commands is included in the prompt context.
Reference Files with @
Include file contents in commands:
Review the implementation in @src/utils/helpers.js
Compare @src/old-version.js with @src/new-version.js
Use standard file references (e.g., @docs/, @src/).
Pattern Examples
Example 1: Priority-Based Issue Fix
---
description: Fix issue with priority level
argument-hint: [issue-number] [priority-level]
---
Fix GitHub issue #$1 with priority "$2".
Steps:
1. Understand the issue context
2. Write minimal, focused fix
3. Consider edge cases
4. Ensure tests pass
Usage: /fix-issue 42 high
Example 2: Bash-Powered Code Review
---
allowed-tools: Bash(git diff:*), Bash(git log:*)
description: Review recent commits for code quality
argument-hint: "[number-of-commits]"
---
## Context
Recent changes:
!`git log --oneline -${1:-5}`
Full diff:
!`git diff HEAD~${1:-5}...HEAD`
## Your Task
Provide a code quality review focusing on readability, performance, and best practices.
Usage: /review-commits 3 → Reviews last 3 commits
Example 3: Multi-Argument Configuration Command
---
description: Set up feature flags for testing
argument-hint: feature [enable|disable] [environment]
---
Configure feature "$1" to be $2 in the $3 environment.
Verify:
- Feature flag exists in @src/config/features.ts
- Environment is valid (dev, staging, production)
- Changes are tested before deployment
Usage: /feature dark-mode enable staging
SlashCommand Tool Integration
The SlashCommand tool allows Claude to invoke your custom commands programmatically.
Enable Auto-Invocation
Add to CLAUDE.md or project instructions:
When appropriate, use /optimize to analyze code performance.
When fixing bugs, use /fix-issue with the issue number.
Requirements for Tool Access
- Command must have
descriptionfrontmatter - Command must NOT have
disable-model-invocation: true - User must allow
SlashCommandtool in permissions
Disable Specific Commands
Prevent Claude from auto-invoking a command:
---
disable-model-invocation: true
description: Manual review only
---
Your command content...
Permission Rules
Fine-grained control via /permissions:
SlashCommand:/commit # Exact match: /commit only
SlashCommand:/review-pr:* # Prefix match: /review-pr with any args
Deny SlashCommand entirely to disable all auto-invocation.
Best Practices
✅ Do:
- Use descriptive names matching functionality (e.g.,
/optimize,/security-review) - Include
descriptionfor discoverability via/helpand SlashCommand tool - Add
argument-hintfor clear usage patterns - Keep commands focused on a single responsibility
- Use bash execution for context that changes (git status, timestamps)
❌ Don't:
- Embed static content that belongs in code (use file references instead)
- Create commands without descriptions (breaks tool integration)
- Overload with too many positional arguments (>3 becomes hard to remember)
- Assume tools are available without declaring
allowed-tools
Built-in Slash Commands (Reference)
Essential commands you get for free:
| Command | Purpose |
|---|---|
/help | List all commands (built-in + custom) |
/config | Open Settings interface |
/status | Show version, model, account |
/cost | Token usage statistics |
/model | Switch AI model |
/memory | Edit CLAUDE.md |
/rewind | Rewind conversation or code |
/clear | Clear history |
/agents | Manage custom AI subagents |
/mcp | Manage MCP server connections |
Workflow Integration
In CLAUDE.md or project instructions:
## Custom Commands
Use these commands to accelerate development:
- `/optimize [file]` — Analyze code performance
- `/security-review [file]` — Check for vulnerabilities
- `/commit [message]` — Create atomic commits
- `/test [suite]` — Run tests with focus
In conversations:
> I'll use /optimize to check this function for performance issues.
Claude recognizes the slash and may auto-invoke if SlashCommand tool is enabled.
See Also
- MCP Slash Commands: Commands exposed by MCP servers (pattern:
/mcp__server__prompt) - Plugin Commands: Commands from installed plugins (pattern:
/plugin-name:commandor just/command) - Interactive Mode: Keyboard shortcuts and input modes
- Permissions: Fine-grained tool and command access control
When not to use it
- →Simple one-off tasks not requiring reuse
- →Tasks that change too frequently to warrant a template
Limitations
- →Naming conflicts between project and user scopes
- →No support for complex logic branching inside commands
- →Requires filesystem access to configure
How it compares
It creates persistent, shareable shortcuts for complex prompts instead of repeatedly typing manual instructions.
Compared to similar skills
writing-slash-commands side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| writing-slash-commands (this skill) | 1 | 10mo | Review | Beginner |
| webapp-testing | 353 | 3mo | Review | Intermediate |
| resolve-conflicts | 81 | 8mo | Review | Intermediate |
| telegram-bot-builder | 106 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by CaptainCrouton89
View all by CaptainCrouton89 →You might also like
webapp-testing
anthropics
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
resolve-conflicts
antinomyhq
Use this skill immediately when the user mentions merge conflicts that need to be resolved. Do not attempt to resolve conflicts directly - invoke this skill first. This skill specializes in providing a structured framework for merging imports, tests, lock files (regeneration), configuration files, and handling deleted-but-modified files with backup and analysis.
telegram-bot-builder
davila7
Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.
dev-browser
SawyerHood
Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.
openspec-onboard
studyzy
Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
codex-cli-bridge
alirezarezvani
Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools