Notre avis
Cette compétence explique comment créer des commandes slash personnalisées pour Claude Code en utilisant des fichiers Markdown avec du frontmatter.
Points forts
- Approche structurée avec des emplacements de fichiers clairs
- Support des arguments et du contenu dynamique
- Possibilité de regrouper des commandes avec des sous-répertoires
- Restriction des outils autorisés pour la sécurité
Limites
- Nécessite un respect strict des noms et emplacements de fichiers
- Le contenu dynamique peut avoir des bugs (caractères spéciaux dans les backticks)
- La gestion de la portée entre commandes projet et personnelles peut prêter à confusion
Utilisez cette compétence lorsque vous souhaitez ajouter des commandes réutilisables et personnalisées à Claude Code pour des tâches répétitives ou des workflows.
Évitez cette compétence si la fonctionnalité peut être obtenue avec une simple invite ponctuelle ou si vous avez besoin d'interactions complexes avec état au-delà de ce qu'une seule commande peut fournir.
Analyse de sécurité
SûrThe 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.
Aucun point d'attention détecté
Exemples
Create a slash command for Claude Code that reviews the current file for bugs and style issues, storing it in .claude/commands/review.md.Create a personal slash command `/summarize` that takes a file path as an argument and provides a summary of the file's contents.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:
- Official Documentation - Anthropic's slash command guide
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→/testshows(project:frontend).claude/commands/backend/test.md→/testshows(project:backend)
Checklist
- [ ] Description filled in frontmatter
- [ ]
argument-hintif command takes arguments - [ ]
allowed-toolsif using Bash or specific tools - [ ] Test with
/command-name --helpstyle invocation
Expert Next.js App Router
Developpement
Un skill qui transforme Claude en expert Next.js App Router.
Générateur de README
Developpement
Crée des README.md professionnels et complets pour vos projets.
Rédacteur de Documentation API
Developpement
Génère de la documentation API complète au format OpenAPI/Swagger.