Claude Code

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

1

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.

2

Implement next

Implement the plan. Do not perform unrelated refactoring.
If the scope changes, stop and explain it first.
3

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.

.claude/agents/test-runner.md
---
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, and claude agents.

#Background and parallel work

CommandPurpose
/backgroundMove the current session to the background and free the terminal
/tasksInspect background tasks in the current session
/forkDispatch the current context to a background subtask
/batchSplit a large migration across parallel worktrees
claude agentsManage 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

ToolUse
Press Esc twiceReturn to an earlier message for editing
/rewindRewind the conversation and file checkpoints
GitRevert actual code changes
/compactKeep a summary and continue the same task
/clearChange 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/:

.claude/commands/release-check.md
---
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

ChangeMinimum check
DocumentationBuild the page and open its route
TypeScriptnpm run typecheck
Lint-related changesnpm run lint
UIDesktop, 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.