liveBook · Manning

Slash command

As explained in Vibe Engineering

A slash command is an explicitly invoked command entered with a slash-prefixed name in an interactive tool interface.

A slash command is an explicitly invoked, slash-prefixed entry point for an interactive agent workflow. It turns a recurring task into a reusable prompt with constraints instead of relying on an open-ended session. section 9.5.2 section 3.3.6

The engineering value is control. Agent sessions can read files, run commands, iterate, and consume substantially more tokens than standard completions. A command narrows exploration, limits output, caps retries, and states a token target. It does not make an agent correct; tests and unresolved-failure reporting remain necessary. section 9.5.2

A production-oriented slash command should:

  • Restrict reading to files directly relevant to the requested change. section 9.5.2
  • Prefer changed code or diff output over explanations when the task permits. section 9.5.2
  • Run existing tests, define a maximum retry count, and stop with an explicit report when failures persist. section 9.5.2
  • Pair with file-reading and command-output rules that exclude irrelevant directories and filter unbounded output. section 9.5.2
  • Treat distributed command bundles as governed dependencies when plugins package commands with skills, subagents, hooks, or MCP configurations. section 3.3.6

Bounded focused refactor

A focused-refactor command can require reading only relevant files, generating only a diff, running existing tests without writing new ones, fixing failures for at most two iterations, and stopping near a 50,000-token budget. section 9.5.2

Listing 9.6 Custom slash commands for cost-controlled agent workflows
markdown
<!-- .claude/commands/focused-refactor.md -->
# Focused Refactor
Refactor the specified function or module with these constraints:
- Read ONLY the files directly relevant to the change
- Do NOT explore the broader codebase unless explicitly needed
- Generate ONLY the changed code (diff format preferred)
- Do NOT explain changes unless asked
- Run existing tests after changes; do NOT write new tests
- If tests fail, fix the issue in max 2 iterations, then stop and report what's unresolved
- Budget: aim to complete in under 50,000 tokens total
$ARGUMENTS

Inspect the complete Markdown template for a cost-controlled focused-refactor command, including its constraints and argument placeholder. section 9.5.2

How Vibe Engineering covers it

How deep it goes
Defines reusable Markdown prompts with file, output, testing, iteration, and token constraints, but does not guarantee correctness.
Examples
Uses focused-refactor, write-tests, fix-bug, add-feature, and review-pr commands, including a two-retry refactoring template.
What it assumes
Assumes an agentic development tool and a recurring workflow, while making constraints explicit rather than relying on ad hoc prompts.
What you can do after
Operate/configure it through reusable Markdown commands that limit reading, output, retries, and token use.
How it connects
Connects agent mode, prompt templates, token budgets, CLAUDE.md, skills, plugins, and MCP server configurations.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vibe Engineering. The section links point to the parts of the book it draws on.