Advanced workflows
Practical Claude Code workflows with plan mode, subagents, background tasks, worktrees, headless execution, custom commands, and verification.
This page connects the workflows that make Claude Code practical rather than repeating configuration. For individual capabilities, see Memory and rules, MCP, Hooks, Permissions, and Caching.
#Structure a large task
Plan first
Read the relevant files first. List the smallest proposed change, risks, and validation commands.
Do not modify files yet.Use /plan or Shift+Tab to enter plan mode.
Implement next
Implement the plan. Do not perform unrelated refactoring.
If the scope changes, stop and explain it first.Verify last
Run lint, type checking, and relevant tests after the change.
For UI changes, check light mode, dark mode, and mobile layouts.#Subagents
Subagents divide work between focused roles, isolate context, and reduce noise in the main conversation.
---
name: test-runner
description: Run tests and identify the cause of failures
tools: Read, Bash, Grep
---
You are a testing specialist. Run the project tests and identify the cause of failures.
Do not make broad changes without authorization; suggest the smallest fix.Usage:
- Ask Claude to create or update
.claude/agents/. - Store project agents in
.claude/agents/. - Store personal agents in
~/.claude/agents/. - Combine background tasks with
/tasks,/background, andclaude agents.
#Background and parallel work
| Command | Purpose |
|---|---|
/background | Move the current session to the background and free the terminal |
/tasks | Inspect background tasks in the current session |
/fork | Dispatch the current context to a background subtask |
/batch | Split a large migration across parallel worktrees |
claude agents | Manage all background sessions |
claude attach <id> | Return to a background session |
Start parallel work with a clean repository and clear task ownership. Large changes across files are better suited to --worktree or /batch, avoiding agents editing the same workspace.
#Checkpoints and rollback
| Tool | Use |
|---|---|
Press Esc twice | Return to an earlier message for editing |
/rewind | Rewind the conversation and file checkpoints |
| Git | Revert actual code changes |
/compact | Keep a summary and continue the same task |
/clear | Change tasks or reset context |
When the direction is wrong, try /rewind first. When the task is on track but the conversation is long, use /compact.
#Headless mode
claude -p works well in scripts and CI:
git diff --staged | claude -p "Summarize these changes in one sentence for a commit message"
claude -p "List repository TODOs grouped by file" --output-format json
claude -p "Fix lint failures" --allowedTools "Read,Edit,Bash"Do not rely only on --allowedTools for unattended runs. It pre-approves tools; it does not restrict the available set. Use --tools to restrict built-in tools and --disallowedTools or permission deny rules to prohibit tools.
#Custom commands
Store recurring prompts in .claude/commands/:
---
description: Pre-release review
argument-hint: [version or module]
---
Review release risks for $ARGUMENTS.
Read the Git diff first, then check tests, documentation, configuration, and security risks.
Report blockers and non-blocking recommendations.Invoke it with:
/release-check billing#Verification habits
| Change | Minimum check |
|---|---|
| Documentation | Build the page and open its route |
| TypeScript | npm run typecheck |
| Lint-related changes | npm run lint |
| UI | Desktop, mobile, light, and dark modes |
| MCP / hook | /mcp, /hooks, and one real trigger |
| Permissions | /permissions and positive/negative tool-call examples |
#Continue reading
Support
Need help?
For setup, billing, or model issues, email us. Check the status page for uptime.
WeChat / QQ support is available at the bottom right.

