AGENT0S
HomeLibraryAgentic
FeedbackLearn AI
LIVE
Agent0s · AI Intelligence Library
Share FeedbackUpdated daily · 7am PST
Library/prompt
promptbeginnerClaude Code

Create Custom Slash Commands for Repetitive Tasks

This guide demonstrates how to create custom slash commands in Claude Code, which function as reusable prompt templates to automate repetitive tasks. By saving a simple Markdown file in a specific project directory, developers can invoke complex instructions with a short command, saving time and ensuring consistent outputs for tasks like code reviews or style checks.

AI SETUP PROMPT

Paste into Claude Code — it will scan your project and set everything up

# Set Up: Create Custom Slash Commands for Repetitive Tasks

## What This Is
This guide demonstrates how to create custom slash commands in Claude Code, which function as reusable prompt templates to automate repetitive tasks. By saving a simple Markdown file in a specific project directory, developers can invoke complex instructions with a short command, saving time and ensuring consistent outputs for tasks like code reviews or style checks.

Source: https://platform.claude.com/docs/en/agent-sdk/slash-commands

## Before You Start

Scan my workspace and analyze:
- The project language, framework, and directory structure
- Existing agent configuration (check for .claude/, .codex/, CLAUDE.md, settings.json, commands/, skills/ directories)

Then ask me before proceeding:
1. Should this be a slash command (.claude/commands/*.md) or added to CLAUDE.md as persistent context?
2. Any project-specific values I should customize in the prompt?

## Source Access Note

The source URL (https://platform.claude.com/docs/en/agent-sdk/slash-commands) may not be directly accessible from the terminal. Use the Reference Implementation and Additional Context sections below instead. If you need more details, ask me to paste relevant content from the source.

## What to Implement

This is a **Command Template** — a reusable slash command or system prompt.

- Create the command file based on my answer above (either `.claude/commands/[name].md` or add to `CLAUDE.md`)
- Adapt any placeholder values to my project specifics
- If the command references specific tools or APIs, wire it to what I already have configured

## Additional Context

- Create the directory structure for custom commands within the user's project by running `mkdir -p .claude/commands` in the project root.
- Create an example command file at `.claude/commands/review-colors.md` with the provided code snippet to allow users to audit color consistency in source files by typing `/review-colors <filename>`.
- Scan the user's project for their `CLAUDE.md` file. Instruct the user to test the new command and then prompt them to create a new custom command that references a standard defined in their `CLAUDE.md` to automate one of their own repetitive tasks.

## Reference Implementation

```
---
description: Check visualization colors
allowedTools: ["Read"]
---
Analyze $ARGUMENTS for color consistency with CLAUDE.md palettes. Suggest fixes without editing.
```

## Guidelines

- Adapt everything to my existing project — do not assume a specific stack or directory layout
- Review any fetched code for safety before installing or executing it
- After setup, run a quick verification and show me a summary of exactly what was installed, where, and how to use it
2,735 charactersCompatible with Claude Code & Codex CLI
MANUAL SETUP STEPS
  1. 01Create the directory structure for custom commands within the user's project by running `mkdir -p .claude/commands` in the project root.
  2. 02Create an example command file at `.claude/commands/review-colors.md` with the provided code snippet to allow users to audit color consistency in source files by typing `/review-colors <filename>`.
  3. 03Scan the user's project for their `CLAUDE.md` file. Instruct the user to test the new command and then prompt them to create a new custom command that references a standard defined in their `CLAUDE.md` to automate one of their own repetitive tasks.

CODE INTELLIGENCE

bash
---
description: Check visualization colors
allowedTools: ["Read"]
---
Analyze $ARGUMENTS for color consistency with CLAUDE.md palettes. Suggest fixes without editing.

FIELD OPERATIONS

Automated Docstring Generator Command

Create a `/docstring` command that accepts a Python or TypeScript file as an argument, analyzes its functions or methods, and generates properly formatted docstrings for each one based on standards defined in CLAUDE.md.

Boilerplate Test File Scaffolder Command

Develop a `/scaffold-test` command that takes a source file (e.g., `component.jsx`) and generates a corresponding test file (`component.test.jsx`) with necessary imports, a describe block, and placeholder `it(...)` blocks for common test cases.

STRATEGIC APPLICATIONS

  • →Enforce company-wide coding standards by creating a `/lint-style` command that analyzes a code file against the specific formatting rules and best practices documented in the project's central `CLAUDE.md` file.
  • →Streamline pull request preparation by implementing a `/generate-pr-summary` command that takes git diff output as input and automatically generates a structured description covering the changes, potential risks, and testing steps.

TAGS

#slash command#automation#prompt engineering#claude.md#workflow#customization
Source: WEB · Quality score: 9/10
VIEW SOURCE