agentleFS
goca-segoca-se/dotcontext/.claude/skills/add-new-command/SKILL.md

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
  1. Very specific:

    Use this skill when you need to add a new interactive command that users can invoke with /command-name in Claude Code.

    line 12
  2. Very specific:

    Create a new markdown file in .claude/commands/:

    line 23
  3. Distinctive:

    Follow this template structure:

    line 33
  4. Distinctive:

    Don't make commands too broad: - Keep focused on one task

    line 90
  5. Distinctive:

    Don't skip AskUserQuestion: - Always clarify before significant work

    line 91
  6. Distinctive:

    Don't hardcode paths: - Use relative paths from project root

    line 92
  7. Distinctive:

    Don't ignore existing patterns: - Check skills/ and decisions/ first

    line 93

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.md

The 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 follow

5. 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.