How to Let Claude Code Finish Your Work While You Sleep: 6 Essential Commands
Claude Code offers a suite of six built‑in slash commands—/goal, /loop, /batch, /simplify, /doctor, and /debug—that let you define autonomous goals, schedule status checks, run parallel refactors, clean up code, diagnose configuration issues, and debug runtime problems without constant supervision.
Claude Code (v2.1.154+) provides a complete set of built‑in slash commands that turn a conversational programming assistant into an autonomous worker. By mastering these six core commands you can shift from a "half‑human, half‑Claude" workflow to one where you set the direction and Claude completes the tasks.
/goal — Define a verifiable end condition
Function: Set a goal with a concrete success condition; Claude keeps working until the condition is met, eliminating the need for step‑by‑step prompts.
Problem solved: Without /goal Claude stops after each sub‑task, requiring you to repeatedly say "continue" for multi‑step jobs such as API migration or bulk issue handling.
Mechanism: After each round Claude runs a lightweight model to check the condition; if unmet it proceeds, if met it clears the goal and returns control.
When to use:
Module migration: rewrite all calls from an old API until compilation and tests pass.
Batch fixes: process an issue list until it is empty.
Any multi‑step work with a clear pass/fail criterion.
Best practices: Write verifiable conditions (e.g., "test pass rate 100%"), request evidence (test output, screenshots), monitor progress with /goal (no args), and abort early by re‑issuing /goal if the direction changes.
/loop — Scheduled polling so you can sleep
Function: Re‑run a prompt at a configured interval within the CLI session, useful for status polling or timed reminders.
Problem solved: Long‑running deployments, CI builds, or PR reviews often require you to stare at the terminal; /loop automates periodic checks.
Official description: "Scheduled tasks let Claude re‑run a prompt automatically on an interval. Use them to poll a deployment, babysit a PR, check back on a long‑running build, or remind yourself to do something later in the session."
When to use:
Deployment polling every N minutes.
Monitoring long‑running builds or tests.
Timed personal reminders.
Combine with /goal: set a goal first, then use /loop to monitor progress.
Best practices: Place a loop.md file in the project root to supply a default prompt, choose a sensible interval (5–15 minutes) to avoid token waste or stale information, and switch to cloud‑based Routines for cross‑session persistence.
/batch — Split a large change into parallel tasks
Function: Break a massive codebase change into independent units, each executed in its own Git worktree.
Problem solved: Large‑scale migrations (framework upgrades, dependency version bumps) can overflow Claude's context window or cause conflicts if attempted in one go.
When to use:
Framework migration, e.g., /batch migrate src/ from Solid to React.
Bulk rename or refactor across files.
Standardising code style or dependency versions across modules.
Best practices: Ensure tasks are independent; if task B depends on A's output, prefer /goal. Explicitly specify the directory or file range to avoid accidental changes, and finish with /simplify to clean up.
/simplify — Clean up code after changes
Function: Detect cleanup opportunities in changed code and apply fixes automatically via four parallel review agents (reuse tools, simplify code, optimise efficiency, validate abstraction levels).
Problem solved: Developers often forget to tidy up after a change, leading to technical debt.
Best practices: Run after a feature or fix, before PR submission; target specific paths with /simplify [path]; note that from v2.1.154 onward /simplify no longer performs bug detection—use /code-review for that. Prior to v2.1.154 it behaved like /code-review --fix.
/doctor — Configuration health check
Function: Diagnose core configuration files (CLAUDE.md, settings, hooks, MCP servers, skills) for missing keys, schema errors, or loading failures.
Problem solved: When Claude ignores commands or fails to load skills, the cause is often a mis‑configured file or permission issue.
When to use:
Claude ignores your CLAUDE.md directives.
MCP server connection problems.
Skills not taking effect.
Post‑install configuration verification.
After changing config, confirm correct loading.
Best practices: Run /doctor first, then /context to view what actually made it into the session; this combo quickly pinpoints issues.
/debug — Runtime diagnostics
Function: Enable debug logging so Claude can use logs and configuration paths to diagnose runtime anomalies.
Problem solved: Issues where commands produce wrong results, toolchains are broken, or path resolution fails.
When to use:
Unexpected command behavior.
Toolchain path problems (missing Node, wrong Python version).
Claude Code itself behaving incorrectly.
Before filing a bug report ( /feedback).
Best practices: Run /doctor first to ensure configuration health, then /debug [issue] with a detailed description (e.g., "npm test fails because jest command not found"); after confirming a Claude bug, use /feedback which automatically attaches the debug log.
Workflow composition suggestions
These commands shine when combined. Example snippets:
/goal: Migrate all components from Vue2 to Vue3, compile successfully and achieve test coverage >90%
→ Claude executes autonomously, checking the condition each round
/batch migrate src/components/ from Vue2 to Vue3
→ Parallel large‑scale migration
/simplify src/components/
→ Automatic post‑migration code cleanupAnother pattern:
/goal: Deploy to staging and pass health checks
→ Define the end state
/loop: Check deployment status every 5 minutes, notify when complete
→ Scheduled polling lets you work on other tasksDiagnostic flow:
Step 1: /doctor → Config health check (CLAUDE.md, MCP, settings)
Step 2: /context → Inspect loaded context (system prompt, skills, tools)
Step 3: /debug [issue] → Enable detailed logs to locate runtime problems
Step 4: /feedback → Submit bug report if the issue is a Claude bugReferences
Claude Code official command docs: https://code.claude.com/docs/en/commands /goal details: https://code.claude.com/docs/en/goal
Scheduled tasks ( /loop) docs: https://code.claude.com/docs/en/scheduled-tasks
Configuration debugging ( /doctor) docs: https://code.claude.com/docs/en/debug-your-config
Claude Code best practices: https://code.claude.com/docs/en/best-practices
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Code Ape Tech Column
Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
