Writing Slash Commands

Create custom slash commands with arguments, frontmatter, and Bash integration.

497|68|Updated Sep 7, 2025
One-click install
npx skills add https://github.com/CaptainCrouton89/.claude --skill writing-slash-commands
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Writing Slash Commands
Source: https://github.com/CaptainCrouton89/.claude/tree/main/.claude/skills/slash-commands-guide
Command: npx skills add https://github.com/CaptainCrouton89/.claude --skill writing-slash-commands

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill empowers you to create custom slash commands, transforming repetitive Claude Code interactions into single, reusable prompts. It streamlines your workflow by automating common tasks, reducing manual input, and integrating bash execution and file references directly into your AI assistant.

Core Features & Use Cases

  • Custom Command Creation: Define project-scoped or personal commands with arguments and frontmatter.
  • Bash Integration: Execute shell commands directly within your prompts to fetch context or perform actions.
  • Use Case: Instead of repeatedly typing "Review this code for security vulnerabilities in src/file.js", create a /security-review [file] command that automatically loads the file and applies your review prompt, saving time and ensuring consistency.

Quick Start

Create a project-scoped command

mkdir -p .claude/commands echo "Analyze this code for performance issues:" > .claude/commands/optimize.md

Invoke the command

/optimize

Frequently Asked Questions about Writing Slash Commands

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate repetitive Claude Code workflows with custom commands?

Create custom slash commands in `.claude/commands` directories to automate recurring tasks. Define commands with frontmatter configuration, argument handling, and bash integration to transform manual prompts into single, reusable invocations that apply consistent logic across projects.

What's the difference between project-scoped and personal slash commands?

Project-scoped commands live in `.claude/commands` within your project and apply only to that codebase, while personal commands reside in a user-level directory for access across all projects. Use project-scoped for team consistency and personal for individual workflows.

Can I pass arguments and file references to custom slash commands?

Yes. Use `$ARGUMENTS`, `$1`, `$2`, and numbered parameters to pass dynamic inputs, and reference files with `@` syntax to load content directly into your command prompt. This enables flexible, parameterized command templates.

How do I integrate bash execution into slash commands?

Embed bash commands directly in your command files to fetch context, execute shell operations, or perform actions within your prompt. Bash integration runs automatically when the command is invoked, allowing dynamic context generation.

Can I use slash commands for code review and security analysis workflows?

Yes. Create specialized commands like `/security-review [file]` or `/code-optimize` that combine file references, argument substitution, and your review prompts. This standardizes analysis and eliminates repetitive typing for common development tasks.

Do I need prior command-line experience to write slash commands?

Basic familiarity with directory structure and frontmatter syntax helps, but the Skill supports straightforward markdown files with simple bash integration. Start with basic argument substitution before advancing to complex bash operations.