7. Workflow, subagents, worktree

9 cards

Review this deck
All cards in this deck

5-step workflow

Explore → plan → implement → test → review; go back when you find a wrong assumption.

When to start with a plan

When you cannot describe the expected diff in one sentence.

Entering plan mode

Shift+Tab, `/plan <description>`, or `claude --permission-mode plan`; Ctrl+G opens the plan in an editor to edit.

TDD with Claude

Write tests, confirm they fail for the right reason, review and commit the tests, then implement with the constraint "do not edit test files".

Subagent

A side session with its own context, system prompt, tools and model; only a summary returns to the main session.

Subagent location and required fields

`.claude/agents/` or `~/.claude/agents/`; required frontmatter `name` and `description`; `tools` to limit permissions.

Built-in subagents

Explore (read-only search), Plan (gathers context in plan mode), general-purpose.

`claude --worktree <name>`

Creates a git worktree at `.claude/worktrees/<name>/` on branch `worktree-<name>`, branched from the remote default branch, to run parallel sessions without stepping on each other.

Worktree caveats

Dependencies must be reinstalled; gitignored files like `.env` are not present (declare them in `.worktreeinclude`); only parallelize file-independent work.

7. Workflow, subagents, worktree – Flashcards – Claude | Học Dev