Five Claude Code habits for spec-first development
Interview first, use subagents, set up hooks, rewind with checkpoints, and review with a fresh subagent.
Published here · 2 sources · Resume reading
Claude can build the wrong app from a vague prompt. The five habits below come from the official Claude Code best practices docs [1]. They turn a loose idea into a spec, keep context under control, enforce rules that matter, and catch mistakes before you merge.
The tea shop story in the reel is fictional. The habits are real.
Interview first, then write a spec
Before any code, ask Claude to interview you. It will ask about edge cases and constraints you haven't thought through yet [1].
I want to build [thing]. Interview me in detail using the AskUserQuestion tool, then write a complete spec to SPEC.md.Once SPEC.md exists, start a fresh session to build from it. The build begins with a clean context and a written definition of done.
Use subagents for research
When Claude needs to read many files to answer one question, delegate to a subagent. The subagent reads in its own context and sends back a summary [1].
Use subagents to investigate [question].You should see the subagent spawn, do its research, and return a summary without filling your main session's context.
Set up hooks for rules that must run
A note in CLAUDE.md is a request. Claude usually follows it, but there's no guarantee [1]. Claude Code runs a configured hook when its matching lifecycle event occurs; the command can still fail or time out.
Write a hook that runs eslint after every file edit.Hooks go in .claude/settings.json. Use them for linters, formatters, or any check that can't have exceptions.
Rewind with checkpoints
If Claude wrecks something, run /rewind, or press Esc twice with an empty prompt, to open the checkpoint menu [2].
/rewindYou should see a checkpoint picker. Choose the checkpoint and whether to restore code, conversation, or both. Checkpoints cover files Claude has edited in the session. Use git to recover other files and preserve commit history [2].
Review with a fresh subagent
A subagent that never saw your conversation makes a better reviewer. It isn't swayed by the reasoning that led to the code [1].
Use a subagent to review this diff against SPEC.md. Flag only real correctness gaps.Or run /code-review in the terminal to review the diff in a fresh context.
Your sessions now start with a spec, delegate research to subagents, enforce rules with hooks, recover with checkpoints, and end with a fresh review.
Keep this guide
Filed under Claude Code
Questions about this guide
What is the difference between a CLAUDE.md note and a hook?
CLAUDE.md is advisory. Claude reads it and usually follows it, but it can still skip steps. Claude Code runs a configured hook when its matching lifecycle event occurs. The command can still fail or time out.
Do checkpoints replace git?
No. Checkpoints cover files Claude has edited in the session. Changes to other files and Git commits need version control. Keep using git for everything else.
Sources
- Claude Code best practicescode.claude.com
- Claude Code checkpointingcode.claude.com
Next in this stack
Keyword HOOKLIGHT
Use Claude Code hooks for status notifications
Keyword SLIDES
Choose a slide tool for Claude Code
Keyword BRANDKIT
Give Claude Design an existing design system