Claude Code Commands

Six built-in commands that transform Claude Code into a task execution engine

The 6 Commands

These commands eliminate the inefficient Q&A pattern where users ask one question at a time. Instead, they enable persistent goals, scheduled tasks, parallel work, and automatic diagnostics.

CommandPurposeDurationToken Level
/goalPersistent goal across turnsMulti-roundMedium
/loopScheduled recurring tasksPer intervalMedium
/batchParallel subagent work1-3 hoursVery High (1M+)
/simplifyAuto code cleanupSeconds-minutesLow-Medium
/doctorInstallation diagnosticsSecondsVery Low
/debugBehavioral debuggingMinutesMedium

Command Details

/goal — Persistent Goals

Sets a continuing condition that Claude works toward across multiple turns. Survives session timeouts. Use for large refactoring, migrations, and test coverage goals.

Example:
/goal migrate all React components in src/ to TypeScript with 100% type coverage

/loop — Scheduled Tasks

Runs tasks on a schedule (e.g., every 5 minutes). Different from /goal — /goal is one-time completion, /loop is recurring.

Examples:
/loop 5m check if the deploy finished
/loop 30m run tests, analyze failures, and auto-fix

/batch — Parallel Subagents

Decomposes large changes into 5-30 independent units. Spawns subagents in isolated git worktrees, each implementing one unit and opening a PR.

Warning: Extremely high token consumption (1M+ in 1 hour). Only use when truly needed.
/batch migrate src/ from Solid to React

/simplify — Code Cleanup

Four parallel review agents check: reuse of helpers, complexity, efficiency, and abstraction level. Automatically applies fixes.

Best practice: Run before submitting PRs.

/doctor — Diagnostics

Diagnoses installation and configuration issues. Output shows green checkmarks, yellow warnings, and red X marks. Press 'f' to auto-fix.

/debug — Behavioral Debugging

Enables session debug logs to trace Claude's reasoning. Use when Claude's answer is wrong but you can't see why.

Workflow Pattern

The sample project - Python 2→Python 3 migration using these commands:

  1. /goal — Run main migration
  2. /debug — Find failure root cause
  3. /loop — Iterate tests until passing
  4. /simplify — Cleanup code
  5. /batch — Parallel test coverage improvement
  6. /doctor — Verify environment

Why Use Commands?

Commands transform Claude Code from a simple chat interface into a powerful task execution engine. Instead of repeatedly asking questions or managing state yourself, you can delegate these responsibilities to built-in commands:

  • Efficiency — Eliminate repetitive Q&A patterns
  • Persistence — Goals survive session timeouts
  • Automation — Schedule recurring tasks without manual triggers
  • Scale — Parallelize work across multiple subagents
  • Reliability — Diagnose and fix issues automatically