add-new-command
Skill9 starsChanged 4 months agoMITView on GitHub
Add a new Claude Code slash command to the dotcontext toolkit — author the command markdown with frontmatter and wire it into the templates and docs. Use when adding a new interactive `/command` workflow that users invoke in Claude Code.
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Use this skill when you need to add a new interactive command that users can invoke with /command-name in Claude Code.
- Very specific: line 23
Create a new markdown file in .claude/commands/:
- Distinctive: line 33
Follow this template structure:
- Distinctive: line 90
Don't make commands too broad: - Keep focused on one task
- Distinctive: line 91
Don't skip AskUserQuestion: - Always clarify before significant work
- Distinctive: line 92
Don't hardcode paths: - Use relative paths from project root
- Distinctive: line 93
Don't ignore existing patterns: - Check skills/ and decisions/ first
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Add a New Claude Code Slash Command
When to Use
Use this skill when you need to add a new interactive command that users can invoke with /command-name in Claude Code.
Prerequisites
- Understanding of what the command should do
- Knowledge of Claude Code's tool system (AskUserQuestion, file tools, etc.)
Steps
1. Create the command file
Create a new markdown file in .claude/commands/:
touch .claude/commands/my-command.mdThe filename (without .md) becomes the slash command name.
2. Structure the command file
Follow this template structure:
# Command Name
Brief description of what this command does.
## Instructions
Detailed instructions for Claude on how to execute this command.
**Important guidelines:**
- List specific behaviors
- Reference which tools to use
- Mention any context files to check
## Tasks
### 1. First Step
Description of what to do first.
### 2. Second Step
Description of what to do next.
## Output
Describe what the command should produce when complete.3. Include AskUserQuestion usage
Per ADR-005, all commands should use AskUserQuestion for clarification:
**Important:** Use the AskUserQuestion tool to clarify:
- [Question 1]
- [Question 2]4. Reference context files
Commands should check relevant context:
Before proceeding:
- Check `.context/decisions/` for related ADRs
- Consult `.claude/skills/` for patterns to follow5. Test the command
In Claude Code, run /my-command to verify it works as expected.
Anti-Patterns
- Don't make commands too broad - Keep focused on one task
- Don't skip AskUserQuestion - Always clarify before significant work
- Don't hardcode paths - Use relative paths from project root
- Don't ignore existing patterns - Check skills/ and decisions/ first
Example
See .claude/commands/code-review.md for a well-structured command that:
- Has clear instructions
- Uses a checklist for thoroughness
- Provides specific output format
- References exact file locations
Related
- ADR-004: Claude Code integration
- ADR-005: AskUserQuestion requirement
In this repository7 other files it gives its agents.
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- add-cli-subcommandSkill
- batch-operationsSkill
- bug-reproductionSkill
- git-platformSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

