From claude-resources
Guides creation and management of custom slash commands in Claude Code, covering project/personal locations, frontmatter, arguments, bash execution, file references, namespacing, and command vs skill comparison.
npx claudepluginhub takazudo/claude-resourcesThis skill uses the workspace's default tool permissions.
Guide for creating effective custom slash commands in Claude Code.
Guides Next.js Cache Components and Partial Prerendering (PPR): 'use cache' directives, cacheLife(), cacheTag(), revalidateTag() for caching, invalidation, static/dynamic optimization. Auto-activates on cacheComponents: true.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Share bugs, ideas, or general feedback.
Guide for creating effective custom slash commands in Claude Code.
Custom slash commands are Markdown files that define reusable prompts. They're simpler than skills - single files for quick, frequently-used prompts.
Use commands when:
Use skills instead when:
| Location | Path | Scope |
|---|---|---|
| Project | .claude/commands/<name>.md | This project only (shows as "project") |
| Personal | $HOME/.claude/commands/<name>.md | All your projects (shows as "user") |
Priority: Project commands override personal commands with same name.
Every command is a single Markdown file with optional frontmatter:
---
description: Brief description of what the command does
allowed-tools: Bash(git:*), Read
argument-hint: [filename] [options]
---
# Command Instructions
Your prompt content here with $ARGUMENTS placeholder.
See frontmatter.md for all available fields.
Pass dynamic values to commands using placeholders:
All arguments - $ARGUMENTS:
Fix issue #$ARGUMENTS following our coding standards
Usage: /fix-issue 123 high-priority → $ARGUMENTS = "123 high-priority"
Positional arguments - $1, $2, etc.:
Review PR #$1 with priority $2 and assign to $3
Usage: /review-pr 456 high alice → $1="456", $2="high", $3="alice"
Run shell commands before the prompt is sent using !command`` syntax:
---
allowed-tools: Bash(git:*)
---
## Context
- Git status: !`git status`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -5`
## Task
Create a commit based on the above changes.
Important: Must include Bash in allowed-tools for this to work.
Include file contents using @ prefix:
Review the implementation in @src/utils/helpers.js
Compare @src/old.js with @src/new.js
Include thinking keywords to trigger extended thinking mode:
Think deeply about the architecture of this codebase.
Use subdirectories to organize related commands:
.claude/commands/
├── frontend/
│ └── component.md → /component (project:frontend)
├── backend/
│ └── api.md → /api (project:backend)
└── deploy.md → /deploy (project)
Same-named commands in different subdirectories are distinguished by their namespace label.
When the user asks to create a command, follow this workflow.
If the user provides a name, use it. If they describe what they want, derive an appropriate kebab-case name.
Choose location based on context:
$HOME/.claude/commands/<name>.md): User says "global", or wants it available across all projects.claude/commands/<name>.md): User says "local" or "project", or wants it scoped to current repoFor local commands, find the project root first:
git rev-parse --show-toplevel # Use repo root, or cwd if not a git repo
Ensure the target directory exists before writing.
Ask the user if needed:
!command``) for dynamic context?Create the command file with proper structure:
Required best practices:
description fieldargument-hint if the command accepts arguments (e.g., [filename], [pr-number])$ARGUMENTS for all args or $1, $2 for positional argsallowed-tools in frontmatterdisable-model-invocation: trueTemplate:
---
description: Brief description of what the command does
argument-hint: [expected-args]
allowed-tools: Bash(git:*), Read
---
# Command Title
Clear instructions for what Claude should do.
## Context (if using bash execution)
- Dynamic info: !`git status --short`
## Task
What to accomplish with $ARGUMENTS.
Format the created command file using the mdx-formatter to ensure consistent markdown formatting:
pnpm dlx @takazudo/mdx-formatter --write <path-to-command-file.md>
After creating the file:
/<command-name>my-command.mddescription in frontmatter - commands without it are harder to discover$ARGUMENTS / $1 / $2 for dynamic values, not hardcoded values$HOME instead of ~: When command instructions reference home directory paths (e.g., log directories, config files), always write $HOME/cclogs/... or $HOME/.claude/..., NEVER $HOME/cclogs/... or $HOME/.claude/.... The ~ character is only expanded by interactive shell login contexts. In Node.js fs operations, non-login shells, and many tool contexts, ~ is treated as a literal character, which creates an actual directory named $HOME/ inside the working directory. This applies to paths in the command body text, bash execution snippets, and any instructions that an agent will follow---
description: Quick code review
---
Review this code for:
- Security vulnerabilities
- Performance issues
- Code style violations
---
description: Create a git commit with context
allowed-tools: Bash(git:*)
---
## Context
- Status: !`git status`
- Diff: !`git diff HEAD`
- Branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -5`
## Task
Create a single git commit for the staged changes.
Message should be concise and follow conventional commits.
---
description: Review a pull request
argument-hint: [pr-number]
allowed-tools: Bash(gh:*)
---
## PR Context
- PR info: !`gh pr view $1`
- PR diff: !`gh pr diff $1`
- PR comments: !`gh pr view $1 --comments`
## Task
Review PR #$1 for:
1. Code quality and best practices
2. Potential bugs or edge cases
3. Security concerns
4. Test coverage
---
description: Complex analysis with specific model
model: claude-sonnet-4-20250514
---
Perform detailed analysis of $ARGUMENTS.
To prevent Claude from invoking a command automatically via the Skill tool:
---
description: Deploy to production (manual only)
disable-model-invocation: true
---
Deploy the application to production.
Define hooks that run only during command execution:
---
description: Deploy with validation
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "./scripts/validate.sh"
once: true
---
Deploy to staging environment.
The once: true option runs the hook only once per session.
.claude/commands/ or $HOME/.claude/commands/).md extension/help to see available commands$ARGUMENTS for all args or $1, $2 for positionalallowed-tools: Bash(...) is in frontmatter