commands-authoring
Guide to writing slash commands for Claude Code. Use when creating commands that set mode, constraints, or workflows invoked via /command-name.
What this skill does
# Writing Slash Commands
Commands specify **constraints and mode**, not instructions. Claude already knows how to do most things — commands tell it what to do differently.
**Commands and skills are the same thing now.** `.claude/commands/deploy.md` and `.claude/skills/deploy/SKILL.md` both produce `/deploy` and use the same frontmatter. Existing `commands/` files keep working. Prefer skills when you need bundled scripts, reference files, or per-skill hooks — see the skills-authoring skill for the full feature set.
## Structure
```markdown
---
description: One-line description (shows in /help)
allowed-tools: Tool(pattern:*), Tool(pattern:*)
argument-hint: [arg1] [arg2]
---
Prompt content. Set role, constraints, then get out of the way.
```
## Features
- `$ARGUMENTS` — all args as a single string
- `$ARGUMENTS[N]` or `$N` — positional arg by 0-based index (`$0` is first)
- `${CLAUDE_SESSION_ID}`, `${CLAUDE_SKILL_DIR}` — runtime substitutions
- Inline bash: a `!` immediately followed by a backtick-wrapped command (e.g. the bang-prefix form around `git status`). Output is included in context. The literal pattern is intentionally not shown verbatim here because the preprocessor evaluates it on raw text **including inside fenced code blocks**, which would run the example at command-load time.
- Multi-line bash: open a fenced code block whose opener is three backticks immediately followed by `!`, and close it with a normal triple-backtick fence. Each line runs as a separate shell command; Claude sees the combined output.
- `@path/to/file.ts` — file reference (contents included inline)
Inline bash runs at **template expansion time** — it does not require `allowed-tools`. The `allowed-tools` field only governs tools the model can call at runtime.
## Key Rules
1. **Minimal tokens** — every line costs context
2. **Constraints > procedures** — say what to do differently, not how
3. **Don't restate knowledge** — skip things Claude already knows
4. **Limit allowed-tools** — only enable what's needed
5. **One concern** — focused commands, not kitchen sinks
## Invocation Control
Most commands should be **user-only** or **agent-only** — rarely both.
| Field | Who can invoke | Description in context | Use when |
|-------|---------------|----------------------|----------|
| *(default)* | User + Agent | Yes | Rare — general-purpose commands |
| `disable-model-invocation: true` | User only | **No** | Actions with side effects (commit, deploy, send) |
| `user-invocable: false` | Agent only | Yes | Background knowledge, auto-applied patterns |
**Default to `disable-model-invocation: true`** for most commands. Agent auto-invocation is a footgun — commands that modify state, run tools, or trigger workflows should require explicit user intent. Reserve agent-invocable commands for read-only reference or context-injection where autonomous discovery is the point.
## Other Frontmatter
| Field | Purpose |
|-------|---------|
| `model` | Override model (haiku for cheap, opus for capability) |
| `effort` | Override effort level: `low`, `medium`, `high`, `max` |
| `argument-hint` | Document expected args for autocomplete |
| `paths` | Glob patterns — only activate when working with matching files |
| `context: fork` | Run in an isolated subagent context |
| `agent` | Subagent type when `context: fork` is set (`Explore`, `Plan`, etc.) |
| `hooks` | Command-scoped hooks (same format as `hooks.json`, nested in frontmatter) |
| `shell` | `bash` (default) or `powershell` for inline shell execution |
## Commands vs Skills
Functionally identical — same frontmatter, same invocation. Choose the file layout:
| Single `.md` in `commands/` | Directory in `skills/` |
|-----------------------------|------------------------|
| Quick prompts, single file | Needs bundled scripts or reference files |
| Existing muscle memory | Per-skill hooks via `hooks:` frontmatter |
| <200 lines | Progressive disclosure across multiple `.md` files |
If a command needs to grow supporting files or bundled scripts, convert it to a skill directory.
## Anti-Patterns
- Missing `description` (won't appear in `/help` or Skill tool)
- `allowed-tools: Bash(*)` (overly permissive)
- Absolute file paths (use `@` references instead)
- No `argument-hint` when args are expected
- Long procedural instructions (use constraints instead)
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.