Claude Code Best Practices: Skills, Hooks, Subagents and Pricing
Claude Code best practices for building Bookly
Updated
Claude Code best practices come down to three habits: tell it what it cannot see, give it a check to run, and enforce the rules that cannot bend. This is Step 10 of 12 in the Vibe Coding guide, the first of three agent deep dives. You leave with a CLAUDE.md for Bookly, one skill, one hook, one read-only reviewer subagent, and a plan and cost check.
The three habits map to features with different levels of control. CLAUDE.md, skills and prompts are instructions that Claude weighs on each turn. Hooks, deny rules, the sandbox and managed settings run every time, whatever the model decides. This page covers how Claude Code applies those layers. The method behind them, from planning to security, is on the earlier pages.
The running example is Bookly, a booking app for a small hair salon. The CLAUDE.md, skill, hook and subagent shown here illustrate how Bookly would use Claude Code. They are not results from a real build.
Related guides: vibe coding legal, Claude Cowork deep dive, vibe coding workflow, vibe coding security.
Best Practices
Claude Code best practices: tell it what it cannot see, give it a check, enforce the rules that cannot bend
The three habits behind most of the official guidance
Write only what Claude cannot find by reading the repo. Ask of each line: could Claude find this by reading the code, and would it go and look? If both answers are yes, cut the line.
Use a test, a build, a linter, or a screenshot next to the mockup. Ask for the command and its output, not for a claim that all tests pass.
A rule that must always hold goes in a hook or a deny rule. If you keep adding emphasis to a CLAUDE.md line and Claude still misses it, move the line to a hook.
| Layer | Who enforces it | Use for |
|---|---|---|
| Prompts, CLAUDE.md, skills | Claude decides on each turn | Preferences, conventions and how to work. Advice, not a guarantee |
| Hooks (command and http), deny rules, sandbox, managed settings | Claude Code enforces them | Rules that must hold every time, whatever the model decides |
- Aggressive context management. Current models have large windows and compact on their own.
- Emphasis such as IMPORTANT or ALL CAPS. It makes Claude over-apply the rule.
- Subagents "to protect context" or "for a better answer". They cost tokens and do not make answers smarter.
- "Think hard" phrasing. Set the effort level instead.
- "Keep going, don't be lazy" lines.
- Architecture and file layout written into CLAUDE.md. Claude can read the repo.
- Run /clear between unrelated tasks. A focused context is cheaper and gives better answers.
- Correct a drift early. Press Esc when Claude goes off course.
- After two failed corrections, run /clear and write a better prompt instead of a third correction.
- Keep Claude's rules in one place: CLAUDE.md for advice, hooks and deny rules for limits.
Part 1: What It Is & Setup
Cost figures are Anthropic's reported averages across enterprise deployments. Your own cost depends on the tasks you run.
Why Non-Coders Should Use Claude Code
Despite its name, Claude Code isn't just for programmers. It works directly with your filesystem, remembers preferences across sessions, and can help you automate repetitive workflows.
Three Places It Can Run
The same agent runs in three execution environments; pick one per task. Cloud sessions keep running after you close your laptop. They count against your plan limits and need a claude.ai login, not an API key. Remote Control steers a local session from a browser or phone.
| Environment | Where it runs | Use for |
|---|---|---|
| Local (default) | Your machine | Everyday work in your own repo, with your files, tools and environment |
| Cloud | Anthropic-managed VMs | Long tasks that keep running after you close your laptop. Start with claude --cloud, pull back with claude --teleport |
| Remote Control | Your machine, driven from a browser or phone | Steer a local session from another device. It is not a cloud run |
Getting Started Tutorial
Install and configure Claude Code in under 5 minutes
1Install Claude Code
Open your terminal (Terminal on Mac, PowerShell on Windows) and paste the command for your OS. It installs in seconds; the native installer auto-updates itself. Homebrew and WinGet installs do not: update them with brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode.
Homebrew has two casks: claude-code (stable, about a week behind) and claude-code@latest. On native Windows, Git for Windows is recommended. Packages are also available for apt, dnf and apk. A Windows CMD installer exists as well.
Also available as a VS Code extension (search "Claude Code" in the Extensions panel) and in JetBrains IDEs. The Claude Desktop app runs on macOS, Windows and a Linux beta, with the Code tab. The web version at claude.ai/code also runs in the Claude iOS and Android apps. Slack, Chrome, GitHub Actions, GitLab CI/CD and the Agent SDK complete the list.
2Log In
Type claude in your terminal and hit Enter. It will open a browser window to log in. That's it. Credentials are saved for future sessions.
Claude Pro / Max
Pro is $20 per month, or $17 per month billed annually. Max starts at $100 per month. Log in with your claude.ai account. The Free plan does not include Claude Code. Every paid plan defaults to Opus 5.5.
API Credits
Pay per token through the Claude Console at platform.claude.com. Track spending on platform.claude.com/usage. Good if you want granular cost control.
Teams / Enterprise
Team seats run from 2 to 150 seats, at $20 per seat per month billed annually or $25 billed monthly. Enterprise is US$20 per seat per month billed annually, with a 20-seat minimum. Cloud providers can also sign in: Amazon Bedrock, Claude Platform on AWS, Google Cloud's Agent Platform and Microsoft Foundry.
3Start Your First Session
Navigate to any project folder and type claude. You'll see a welcome screen. Just start typing what you want. Plain English works.
Claude reads your files automatically, so you don't need to copy-paste code. New terminal and VS Code sessions start in auto mode, where a classifier approves routine actions without asking. Press Shift+Tab to change the mode, or start with claude --permission-mode default to get a prompt before each edit.
4Commands You'll Use Daily
5Tips for Non-Developers
Be specific
Instead of "fix the bug," say "the login page shows a blank screen after entering a wrong password. Fix it."
Ask before building
Start with "what does this project do?" or "explain how authentication works" before asking for changes.
Break it down
Instead of "build me an app," try step-by-step: "1. create a form, 2. add validation, 3. connect to the database."
Use /init
Running /init creates a CLAUDE.md with project context. This saves you from re-explaining your project every session.
Part 2: Interface & Control
Essential Slash Commands
The commands you will use most, with what each one does.
| Command | Purpose |
|---|---|
| /init | Create a CLAUDE.md for the project. CLAUDE_CODE_NEW_INIT=1 adds an interactive setup for skills, hooks and memory |
| /clear [name] | Start a fresh context between unrelated tasks. A name labels the old session for /resume |
| /compact [focus] | Summarize the conversation and keep the focus you name |
| /model | Switch models. Use /model fable for the hardest, longest tasks |
| /effort | Set effort: low, medium, high, xhigh, max, or auto. ultracode is a separate toggle |
| /goal [condition] | Keep Claude working across turns until the condition is met |
| /mcp | Manage MCP connections |
| /context | View context window usage |
| /usage | Show plan usage and what it went to. /cost is an alias |
| /memory | Edit CLAUDE.md files and turn auto memory on or off |
| /rewind | Restore code, conversation or both to a checkpoint |
| /permissions | Manage tool allowlist and URL domains |
Keyboard Shortcuts
From the interactive-mode reference.
| Shortcut | Action |
|---|---|
| Shift+Tab | Cycle permission modes: default, acceptEdits and plan, then any optional modes you enabled. Alt+M on Windows if Shift+Tab does not reach the terminal |
| Alt+P | Switch model without clearing the prompt |
| Alt+O | Toggle fast mode |
| Esc | Interrupt (preserves context) |
| Esc Esc | Rewind menu (empty input) / clear draft (with text) |
| Ctrl+V | Paste images directly (Alt+V on Windows/WSL) |
| Ctrl+G | Open the prompt or the plan in your editor |
| Ctrl+R | Search prompt history across all projects |
| \ + Enter | Multi-line input. Shift+Enter also works in several terminals, including Windows Terminal |
| Ctrl+B | Move the current task to the background |
| !command | Run shell command directly |
| Tab | Accept AI prompt suggestion |
Use /memory to edit CLAUDE.md files and to turn auto memory on or off.
Permission Modes
Six modes control what Claude may do without asking. Shift+Tab cycles the first three and any optional modes you enable. Set dontAsk with --permission-mode or in settings. The Bash sandbox is a separate layer. Turn it on with /sandbox on macOS, Linux or WSL2. Deny rules hold in every mode.
| Mode | Behavior |
|---|---|
| Manual | Asks before each edit and command. It was the old default; new terminal and VS Code sessions now start in Auto. |
| Accept edits | Auto-accepts file edits and common filesystem commands; still asks for other terminal commands. |
| Plan mode | Read-only. Claude explores and proposes a plan you approve before any edits. |
| Auto | The starting mode for new terminal and VS Code sessions since v2.1.283. A classifier model reviews each action first. Pauses after 3 blocks in a row or 20 in total. |
| dontAsk | Allows only pre-approved tools and refuses the rest. Meant for locked-down CI and scripts. Set with --permission-mode dontAsk. |
| Bypass permissions | Skips nearly all prompts (--dangerously-skip-permissions). Deny rules still block. Use only in a container or VM without internet access. |
- Allowlist: Use
/permissionsto always allow specific tools (e.g.,Edit,Bash). - Bypass mode:
--dangerously-skip-permissionsskips nearly all prompts. Use it only in a container or VM without internet access.
A deny rule holds in every mode, including auto and bypass. A Read deny rule catches cat .env but not a script that opens the file, so pair deny rules with /sandbox for security rules. Trusted infrastructure goes in autoMode.environment and autoMode.allow in ~/.claude/settings.json. Or run /permissions and add rules in its interface.
Effort Levels
Effort is the main control for cost and quality. Set it with /effort, --effort or CLAUDE_CODE_EFFORT_LEVEL
| Effort | Use for |
|---|---|
| low | Quick brainstorming and simple questions |
| medium | Default on Opus 5.5, Sonnet 5.5 and Haiku 5.5 |
| high | Bugs in code you did not write, flaky tests, schema changes |
| xhigh | The same cases as high, when high is not enough. Writing ultrathink in one prompt runs that turn at this level |
| max | Hard problems you leave running unattended. It tends to overthink ordinary tasks |
Custom Commands and Skills
Commands and skills are one mechanism. Each one creates a slash command you can run
The older .claude/commands/fix-issue.md path still works and creates the same command. Skills from a plugin are namespaced, for example /plugin-name:skill.
Course Correction Tools
Redirect Claude mid-task without losing context
Tell Claude to plan before coding, and confirm the plan before implementation starts.
Interrupt Claude during any phase. Context is preserved for redirection.
On an empty prompt, opens the rewind menu to restore code, conversation or both. Files changed only by a Bash command are not restored.
Ask a side question without adding it to the conversation history.
Have Claude undo changes and take a different approach.
Claude Code tips: shortcuts and commands that save the most time
Features in the terminal that save the most time each day
| Feature | Shortcut | Description |
|---|---|---|
| Checkpointing | Esc Esc or /rewind | Restores code, conversation or both. Covers files Claude edits with its own tools, not files changed only by a Bash command. |
| Side question | /btw | Asks a quick question without adding it to the conversation history. |
| Named sessions | /rename, then claude --resume <name> | Name a multi-day task, then resume it by that name. |
| Prompt suggestions | Auto-appears | Next-step suggestions based on context. Press Tab to accept. |
| Prompt history search | Ctrl + R | Search prompts across all project conversations. Press Ctrl+R again to cycle results. |
| Editor prompt | Ctrl + G | Write a long prompt, or edit a plan, in your editor. |
| Model switch | Alt + P | Change the model without clearing the prompt. |
| Fewer prompts | /fewer-permission-prompts | Builds a permission allowlist from your past transcripts. |
| Config check | /doctor prompt-audit | /doctor suggests cuts to CLAUDE.md. prompt-audit flags stale or contradictory instructions. |
| File mention | @path | Mention a file to add it to the prompt. |
Data Input Methods
Four ways to get data into Claude for processing
How: Directly into prompt (most common)
Use for: Quick data snippets, error messages, short text
How: cat foo.txt | claude or cat logs.txt | claude -p "Analyze errors"
Use for: Logs, CSVs, large data files that would be tedious to paste
How: Ask Claude to use bash commands, MCP tools, or custom slash commands
Use for: Data from APIs, databases, or external services Claude can access
How: Mention file paths or paste URLs for Claude to read directly
Use for: Images, PDFs, documentation pages, design mocks
Part 3: Inner Workings
CLAUDE.md Configuration Files
Claude Code's memory, automatically loaded at session start.
| Location | Scope | Purpose |
|---|---|---|
| Managed policy CLAUDE.md | Organization | Set by an admin for everyone. On Windows: C:\Program Files\ClaudeCode\CLAUDE.md |
| ~/.claude/CLAUDE.md | Global | Your rules for every project on this machine |
| ./CLAUDE.md or ./.claude/CLAUDE.md | Project | Shared with the team through git |
| ./CLAUDE.local.md | Local | Gitignored. Your personal notes for this project |
| .claude/rules/*.md | Path-scoped | Loads only when Claude works on files that match its paths: filter |
| Subdirectory CLAUDE.md | On-demand | Loads when Claude works on files in that folder |
- Imports:
@path/to/filepulls a file into context. It does not reduce what the file costs. - AGENTS.md: with no CLAUDE.md, Claude Code reads AGENTS.md. With both, it reads CLAUDE.md only, unless CLAUDE.md imports AGENTS.md with
@AGENTS.md. - Auto memory: Claude writes its own notes to a MEMORY.md index on your machine. The first 200 lines or 25KB of that index load each session. Turn it off with
/memoryor CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
Each line passes the test above: Claude cannot get it from the code alone. The migration rule matters for Bookly because a change to an applied migration breaks every environment that already ran it. The hook below enforces that rule.
Context Engineering
Managing the context window for maximum performance
Token management
Every request re-sends the whole conversation, so a long session costs more on each turn.
Context window
Models with a native 1M-token window compact automatically at about 967K tokens by default.
Prompt cache
The cache lasts about 1 hour on a subscription and 5 minutes on an API key. A session over about 200K tokens that sits idle is compacted before the cache expires.
Pro Workflow
Recommended loop for complex features
1. Explore
Ask questions first. Use the Explore subagent to map the code before you change it.
Sonnet 5.5 or Haiku 5.52. Plan
Enter plan mode with Shift+Tab or /plan when the first direction is costly to redo. Ctrl+G edits the plan in your editor.
Opus 5.53. Execute
Implement in small steps, and give each step a check to run.
Sonnet 5.54. Review
Run /code-review, which reviews in a fresh subagent, or hand the diff to a read-only reviewer subagent.
Fresh contextClaude Code subagents: built-ins, custom agents, cost and when they help
Built-in and custom subagents, how they are configured, and what they cost
| Agent | Role | Tools | Description |
|---|---|---|---|
| Explore | Read-only search | Write and Edit denied | Finds and reads code fast. Runs on the main conversation's model. Skips CLAUDE.md and the git status snapshot. |
| Plan | Research in plan mode | Write and Edit denied | Reads the codebase before you approve a plan. Skips CLAUDE.md and the git status snapshot. |
| General-purpose | Task executor | Default tool set | Handles multi-step work. A subagent starts with a fresh context window and does not see your conversation. Only a fork carries it. |
| Custom subagent | Your specialist | Set in its frontmatter | A Markdown file in .claude/agents/ (project) or ~/.claude/agents/ (personal). The name and description fields are required. |
| Agent tool | Spawns subagents | Built in | Replaces the older Task tool. Built-ins: Explore, Plan, general-purpose, claude, statusline-setup (Sonnet) and claude-code-guide (Haiku). |
- Model order: the model set per call, then the model in the agent file, then CLAUDE_CODE_SUBAGENT_MODEL, then the main model.
- Nesting goes three layers deep. Up to 20 subagents can run at once by default.
- Subagents cost tokens too. By default they use the same model or a smaller one, so they give parallel work or a fresh review, not a smarter answer.
- A reviewer that cannot edit: set tools to Read, Grep and Glob. Tell it to report only gaps that affect correctness and to skip style, or it always finds something.
- Dynamic workflows (/workflows, or /effort ultracode) have Claude write a script that runs many subagents in the background and returns one result. By default up to 16 run at once and 1,000 per run. On Pro, turn the feature on in /config.
- Agent teams are experimental and off by default. Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 to try them. They suit research, review and parallel modules, and they are a poor fit for edits to the same file.
The reviewer above is a file at .claude/agents/reviewer.md. Its tool list, not a request in the prompt, keeps it from editing.
Claude Code skills: SKILL.md, frontmatter and when a skill beats CLAUDE.md
A skill's body loads only when the skill runs. Its description stays in context on every request
Skills live in .claude/skills/<name>/SKILL.md for the project, in ~/.claude/skills/<name>/SKILL.md for you, or inside a plugin. Skills follow the Agent Skills open standard.
Each skill's description and when_to_use text is cut at 1,536 characters in the listing. Keep SKILL.md under 500 lines.
| Frontmatter field | What it does |
|---|---|
| description | What the skill does and when to use it. Always in context |
| disable-model-invocation | Set to true for skills with side effects, such as deploy or send. The description leaves context |
| user-invocable | Whether you can run the skill directly as a slash command |
| allowed-tools | Tools the skill may use without asking |
| context: fork | Runs the skill in a forked subagent with its own context |
| paths | Limits when the skill is offered, by file path |
Set disable-model-invocation: true on any skill with side effects, such as a release that bumps a version and pushes a tag. You then run it yourself with /new-migration.
| When this happens | Use |
|---|---|
| Claude gets a convention wrong twice | Add it to CLAUDE.md |
| You paste the same procedure a third time | Make a skill |
| You copy data from a tool Claude cannot see | Add an MCP server |
| A side task floods your conversation | Use a subagent |
| Something must happen every time | Write a hook |
| A second repo needs the same setup | Make a plugin |
Skills & Plugins
Plugins install skills, agents, hooks and MCP servers as one unit
How skills work
A skill is a folder with a SKILL.md file. Its description stays in context on every request. Its body loads only when the skill runs.
How plugins package them
A plugin bundles skills, agents, hooks and MCP servers into one unit that you install with /plugin. Plugins run code with your user privileges, so review one before you install it.
Popular Plugin Example: frontend-design
It is in Anthropic's official plugin marketplace as a frontend design skill for UI and UX implementation.
Claude Code hooks: events, exit codes and three recipes you can paste
A hook runs a command at a fixed point in the session. Command and http hooks are deterministic
| Event | When it runs | Example |
|---|---|---|
| PreToolUse | Before a tool call runs | Block a path or a command. Exit code 2 stops the call and sends stderr to Claude |
| PostToolUse | After a tool call finishes | Run a formatter after every Edit or Write |
| Stop | When Claude finishes a turn | Exit code 2 keeps Claude working. Claude Code overrides a Stop hook after 8 blocks in a row |
| UserPromptSubmit | When you submit a prompt, before Claude reads it | Add context or check the prompt format |
| SessionStart | When a session starts | Load setup that every session needs |
| PreCompact | Before compaction | Keep notes that the summary must not lose |
| SubagentStop | When a subagent finishes | Check the subagent's result before the main session uses it |
Claude Code has 33 hook events. The table shows the main ones.
- Exit code 2 blocks the action and sends stderr to Claude. On PreToolUse it blocks the tool call. On Stop it keeps Claude working.
- Exit code 1 is a non-blocking error. A policy hook must exit 2, or set
onFailure: "block"(v2.1.295 and later). - PostToolUse runs after the tool. Exit code 2 there cannot undo the edit. It only shows stderr to Claude.
- Five handler types: command, http, mcp_tool, prompt and agent. Only command and http hooks are deterministic. Prompt and agent hooks ask a model.
- Matchers made of letters, digits, underscores and | match exactly. Any other text is a JavaScript regex, and matchers are not anchored: Edit.* also matches NotebookEdit.
- Settings live in ~/.claude/settings.json, .claude/settings.json (shared), .claude/settings.local.json, managed policy, a plugin's hooks/hooks.json, or a skill or subagent's frontmatter.
Claude Code sends the tool input as JSON on stdin. The script needs jq on the PATH. On Windows the file path arrives with backslashes, so the script converts them first. A new migration file passes. An edit to an existing one exits with code 2.
The PreToolUse entry runs the Bookly script. The PostToolUse entry runs Prettier after each edit. The Stop entry runs the typecheck and keeps Claude working until it passes. Claude Code overrides a Stop hook after 8 blocks in a row with no tool call between them. In a real project, move the command into a script that exits 0 when stop_hook_active is true, as Step 5 shows, so a check the agent cannot fix does not loop.
Rule of thumb: a rule that must always hold goes in a hook. Advice goes in CLAUDE.md. A hook that enforces a mere preference is a hook to delete.
MCP (Model Context Protocol) Servers
Connect Claude Code to data it cannot read on its own, such as a database or a hosted API
| Scope | Stored in | Use for |
|---|---|---|
| Local (default) | ~/.claude.json | Your own server setup on this machine |
| Project | .mcp.json in the repo | Shared with the team through git |
| User | ~/.claude.json | Personal servers you want outside any one repo |
Use the HTTP transport. The SSE transport is deprecated.
- Tool search is on by default. Idle MCP tools add only their names and server instructions to context.
- Disable servers you do not use. Prefer a CLI where one exists, such as gh, aws or gcloud.
- A tool result past 10,000 tokens triggers a warning. Output is capped at 25,000 tokens by default. MAX_MCP_OUTPUT_TOKENS changes the cap.
Headless Mode & Automation
Run Claude non-interactively for CI/CD and scripts (claude -p "prompt")
Issue Triage
Run on GitHub Actions to auto-label new issues or summarize bug reports.
Subjective Linter
"Review this PR for tone, variable naming clarity, and missing comments."
Fan-out Migration
Generate a list of 100 files, then script claude -p to migrate each one in parallel.
Pipelining
cat logs.txt | claude -p "Find errors" --output-format json | process_errors.py
--bare skips hooks, skills, plugins, MCP servers and CLAUDE.md, so every machine runs the same way. --max-turns and --max-budget-usd cap the run, and --output-format json returns structured output. Try the script on three files before you run it on the full list.
Bypass only in a container: the docs say to use --dangerously-skip-permissions only in a container, VM or dev container without internet access. See the reference devcontainer.
Multi-Claude Workflows
Scale your intelligence by running parallel instances
1. Claude A writes code.
2. /code-review, or a read-only reviewer subagent, reviews it in a fresh context.
3. Claude A fixes what the review found.
(A fresh context avoids tunnel vision. The review loop is on Step 4.)
claude -w feature-auth starts a session in a new worktree. .worktreeinclude copies gitignored files such as .env into each worktree. Two sessions that edit the same file still conflict. /batch with an instruction splits a mechanical change into 5 to 30 units, runs each in its own worktree, and opens a pull request per unit. When parallel agents are worth it is on Step 4.
The opusplan alias uses Opus in plan mode and Sonnet while it executes. Use opusplan[1m] for the 1M window in both.
Hidden Power User Features
Commands, environment variables and files that change how Claude Code behaves.
- !command - Run a shell command directly from the Claude Code prompt
- /clear - Start a fresh context between unrelated tasks
- /compact - Condense the conversation to reduce token usage
- /usage - Show plan usage and what it went to. /cost is an alias
- /help - Show available slash commands and usage info
- ANTHROPIC_MODEL - Override the default model for a session
- CLAUDE_CODE_EFFORT_LEVEL - Set the effort level
- CLAUDE_CODE_SUBAGENT_MODEL - Set the model that subagents use
- CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 - Turn off automatic memory
- CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING=1 - Turn off file checkpointing (/rewind then restores conversation only)
- .claude/settings.json - Project settings: permissions, hooks, env vars
- .mcp.json in project root - Shared MCP server config, committed for the whole team
Part 4: Workflows, Marketing & ROI
Claude Code workflow: one Bookly feature from plan to pull request
Booking a slot in Bookly, step by step. Each step gives Claude a check or a stop condition
1. Scope it in plan mode
Describe the book-a-slot feature for Bookly. Ask Claude to read the booking code and propose a plan. Approve the plan before any edit.
2. Write the failing test first
Ask for the no double booking test. Run it and confirm it fails for the right reason. The test method is on the TDD page.
3. Build on a branch
Create a branch for the task, then let Claude implement in small steps. Branch and commit habits are on the workflow page.
4. Set a completion condition
Use /goal with a condition that a command proves, such as the test suite passing. Add a Stop hook that runs the typecheck.
5. Review in a fresh context
Run /code-review, or hand the diff to a read-only reviewer subagent. Fix what it finds.
6. Open the pull request
Ask for the pull request with the test output and the open risks in the description.
- Does it know what done looks like?
- Can it check its own work?
- What may it touch?
- What stops it: --max-turns, --max-budget-usd or a spend limit?
- Where does the result go, and who signs off?
Planning and the PRD are on the planning page. Git, branches and rollback are on the workflow page. Test-first prompts are on the TDD page. Secrets and row-level security are on the security page.
Core Development Loops
Patterns for agentic coding, from exploring the code to committing the change
AExplore, Plan, Code, Commit
Versatile workflow for most features. Prevents "jumping to code" too early. The plan comes from the PRD on Step 3.
BTDD Loop (Test-Driven)
Claude works best with a clear failing target. The full method is on the TDD page.
Codebase Q&A (Onboarding)
Treat Claude as a pair programmer who knows the whole repo.
- "How does the logging system work?"
- "Where is the API endpoint for user creation?"
- "Why are we using `useEffect` here?"
- "What changes made it into v1.2.3?" (Git history search)
Git and GitHub Integration
Claude can handle routine git operations. Install the gh CLI for GitHub access. Branch, commit and rollback habits are on the workflow page.
| Smart Commit | "Commit these changes" (Generates context-aware message) |
| History Search | "Who changed this file last week and why?" |
| Create PRs | "Create a PR" (understands "pr" shorthand) |
| Fix Review Comments | "Fix the comments on my PR and push" |
| Fix Failing Builds | "Fix the failing CI checks" |
| Watch a PR | /autofix-pr watches the PR for CI failures and review comments |
| Triage Issues | "Loop over open issues and categorize by priority" |
Workflow Optimization Tips
"Implement this design." → Copy/Paste screenshot of result → "Fix padding."
(Use a browser tool or a manual screenshot. /verify builds and runs the app, then checks the result)
For migrations: "1. List all errors in file. 2. Fix one by one. 3. Verify each."
Bad: "Fix it."
Good: "Look at `foo.py` history to understand why the API is weird, then fix the type error."
Prompt Specificity Examples
Specific instructions dramatically improve first-attempt success
| Poor Prompt | Better Prompt |
|---|---|
| add tests for foo.py | Write a new test case for foo.py covering the edge case where the user is logged out. Avoid mocks. |
| why does ExecutionFactory have such a weird api? | Look through ExecutionFactory's git history and summarize how its API came to be. |
| add a calendar widget | Look at how existing widgets are implemented on the home page to understand patterns. HotDogWidget.php is a good example. Then implement a calendar widget with month selection and year pagination. |
Use Cases Beyond Code
Know before you script: these task categories are also what Claude Cowork (page 11 of this guide) is built for. Cowork uses the same agentic approach as Claude Code, for non-coding knowledge work. Keep the work here when you want scripts, git history and hooks around it. Choose Cowork when you or a teammate only need the finished deliverable.
File Management & Organization
Tame digital chaos by renaming, sorting, and organizing files with natural language commands.
- Rename invoices to YYYY-MM-DD Vendor - Invoice - Product.pdf format
- Organize 5 years of project folders with searchable indexes
- Transform messy Obsidian vaults into structured knowledge bases
- Sort photos by EXIF date into year/month folders
Writing & Content Creation
Native skills for creating Word docs, PowerPoints, Excel spreadsheets, and PDFs.
- End-to-end content creation from idea to publication
- Technical writing with Hugo integration
- Presentation slides with multi-AI feedback via MCP
- Documentation management with CLAUDE.md context
Research & Information Synthesis
Custom slash commands unlock powerful research workflows across platforms.
- /youtube @channel for full channel analysis
- Competitor analysis with pricing page summaries
- Literature reviews and hypothesis generation
- YouTube transcript analysis with note-taking MCPs
Personal Assistant & Automation
Transform Claude Code into a persistent personal assistant that maintains context.
- Daily briefings with personalized priority summaries
- Automated journaling with /daily-journal command
- Weekly dashboards monitoring personal and career metrics
- Disk space cleanup, screenshot enhancement, raffle picking
Jupyter Notebooks & Data Science
Read and write Jupyter notebooks with Claude interpreting outputs including images.
- Open .ipynb file side-by-side with Claude Code in VS Code
- Explore and interact with data through notebook cells
- Clean up notebooks before sharing with colleagues
- Make data visualizations aesthetically pleasing
Business & Productivity Workflows
SEO & Content Strategy
Export your Search Console and GA4 reports to CSV, then ask Claude Code which pages convert and which topics need a new content pillar.
Lead Generation
"Look at what I'm building and identify the top 5 companies in my area that would be good for a pilot."
Meeting Analysis
Download recordings, ask Claude to identify patterns like "all the times I subtly avoided conflict."
Product Management
Keep each PRD as a Markdown file in the repo, then ask Claude Code to split it into tasks. The PRD method is on the planning page.
Claude Code pricing: Pro, Max, Team, Enterprise and API compared
Plan prices, billing periods and limits, as Anthropic publishes them.
| Plan | Price | Limits | Notes |
|---|---|---|---|
| Pro | $20 per month, or $17 per month billed annually | 5-hour limit and a weekly limit, shared with Claude chat | Claude Code is included. Fable is available only through usage credits |
| Max 5x | From $100 per month | 5x the Pro usage, with a separate weekly limit for Fable | Fable at 50% of weekly limits. Includes $100 of monthly API credits |
| Max 20x | $200 per month | 20x the Pro usage | Includes $200 of monthly API credits |
| Team Standard | $20 per seat per month billed annually, or $25 billed monthly | 2 to 150 seats; usage from a per-seat allowance | Fable not included on Standard seats |
| Team Premium | $100 per seat per month billed annually, or $125 billed monthly | 5x the Standard usage | Fable included at 50% of weekly limits |
| Enterprise | US$20 per seat per month billed annually | 20-seat minimum, plus usage at API rates | Usage is billed on top of the seat fee |
| API | Pay per token | Rate limits set per organization | Prompt cache lasts 5 minutes, not 1 hour |
- Anthropic publishes relative limits, such as 5x and 20x Pro usage. It does not publish message counts per window.
- Pro and Max can turn on usage credits to keep working past a limit. Use /usage-credits to set them up.
- On May 6, 2026, Anthropic doubled the five-hour limits for Pro, Max, Team and seat-based Enterprise, and removed the peak-hours reduction for Pro and Max. Weekly limits were not part of that change.
- Anthropic reports about $13 per developer per active day, and $150 to $250 per developer per month across enterprise deployments.
- Check /usage, use /clear between tasks, set effort per task, and give simple subagents a smaller model with model: haiku.
- The prompt cache lasts about 1 hour on a subscription and 5 minutes on an API key. The first message after a break re-reads the whole context.
- An agent team uses about 7x more tokens than a standard session when its teammates run in plan mode.
- API organizations get per-user rate-limit starting points. 1 to 5 users: 200k to 300k tokens per minute and 5 to 7 requests per minute. 50 to 100 users: 25k to 35k tokens per minute and 0.62 to 0.87 requests per minute. 500 or more users: 10k to 15k tokens per minute and 0.25 to 0.35 requests per minute.
Cost Optimization Strategies
API prices per million tokens, and how to match the model to the task
| Model | Best For | API price per million tokens |
|---|---|---|
| Fable 5.1 (fable) | Hardest, longest tasks. Never the default; pick it with /model fable | $10 input / $50 output |
| Opus 5.5 (opus) | Planning, architecture, final review. Default on every plan | $4 input / $20 output |
| Sonnet 5.5 (sonnet) | Routine implementation and standard tasks | $2 input / $10 output |
| Haiku 5.5 (haiku) | Quick status checks, data parsing, simple subagent jobs | $0.10 / $0.50 up to 100K prompt tokens; $0.50 / $2.50 above |
Input and output prices are listed separately. Batch processing saves 50%. US-only inference costs 1.1x. Opus 5.5 fast mode costs 2x. Switch models with /model, and check spending with /usage (alias /cost). The opusplan alias plans with Opus and executes with Sonnet.
Common Mistakes to Avoid
Measure your own return
Measure your own tasks. Outside figures, including vendor case studies, will not match your work
Time per task
Time one real task before you start using Claude Code, then time the same kind of task after. Use the same scope each time.
Cost per task
Run /usage at the end of a task. It shows the share taken by skills, subagents, plugins and MCP servers.
Rework
Count how many corrections a task needed. Repeated corrections are a sign to /clear and write a better prompt.
Checks passed
Count the tasks that passed your test or build check on the first run, and note which prompts got them there.
PPC Workflow Automation
A two-subagent pattern for ad copy: one subagent for headlines, one for descriptions
Key insight: Use two specialized subagents, one for headlines and one for descriptions, rather than one prompt for both. Each subagent gets one task and one output format, so its result is easier to check.
RSA Generation Prompt Pattern
SEO Automation Workflows
Bulk Meta Generation
Process a URL list in batches. Draft a title and a description for each page with its primary keyword, within the length limits your platform applies.
Schema Markup at Scale
Generate JSON-LD FAQ and Product schema ready for HTML insertion. Validate the output before you publish it.
Keyword Cannibalization
Cluster by semantic similarity, identify cannibalization, recommend primary URLs.
Internal Linking Plans
Analyze content, identify linking opportunities, suggest anchor text variations.
Shopify Integration
Export the products to CSV or JSON. Then run one orchestrator and three specialist subagents:
- 1.Orchestrator Agent manages workflow
- 2.Product Description Agent (Sonnet) for SEO
- 3.Meta Fields Agent for structured data
- 4.SEO Fields Agent optimizes descriptions
Klaviyo Automation
Export the campaign data from Klaviyo to CSV, then ask Claude Code to:
- Analyze 30-day campaign performance
- Identify top-performing subject lines
- Draft subject line variations (urgency, curiosity, personalization)
- Generate SMS variants that fit the SMS length limit you set
Scheduled Automation Patterns
Add --bare, --permission-mode dontAsk and --max-turns to each line, as in the headless example above. For a schedule that must run while your laptop is closed, use /schedule cloud tasks. They need a claude.ai login.
Content Production Workflows
End-to-end automation for high-volume content generation
Ad Copy Variants
Generate headline and description variants for underperforming responsive search ads
Blog Content Briefs with SEO
Turn a keyword into a content brief with a structure to follow
Product Description Generation
Write product copy that follows one brand voice
Video Ad Script Generation
Write video ad scripts with a hook, body and call to action
Essential Resources
Next step: Claude Cowork
Next, read the Claude Cowork deep dive. It applies the same agentic approach to non-coding knowledge work, so you can decide which tasks belong in Cowork and which stay in Claude Code.
Common Questions
Is Claude Code free?
No. Claude Code needs a paid Claude plan or an Anthropic Console account billed at API rates; the free Claude plan does not include it. Pro costs $20 a month, or $17 a month billed annually, with a 5-hour limit and a weekly limit shared with chat. Pro and Max can turn on usage credits to keep working past a limit.
How much is Claude Code?
Pro is $20 a month ($200 a year billed annually), and Max starts at $100 a month for 5x or 20x the Pro usage. Team Standard seats are $25 a month or $20 billed annually, and Premium seats are $125 or $100. On the API, Anthropic puts the average at about $13 per developer per active day, or $150 to $250 a month.
How do I install Claude Code on Windows?
Open PowerShell and run irm https://claude.ai/install.ps1 | iex, or install it with winget install Anthropic.ClaudeCode. Anthropic recommends Git for Windows on native Windows. The native installer updates itself; WinGet installs do not, so update those with winget upgrade Anthropic.ClaudeCode. Then run claude in your project folder and sign in with your plan.
How do I update Claude Code?
The native installer updates Claude Code automatically. You can also run claude update to update now. Homebrew and WinGet installs do not auto-update: run brew upgrade claude-code on a Mac or winget upgrade Anthropic.ClaudeCode on Windows. The Homebrew claude-code cask is the stable channel and runs about a week behind claude-code@latest.
How do I use Claude Code in VS Code?
Install the Claude Code extension from the VS Code marketplace; it also works in Cursor. It uses the same Claude plan, CLAUDE.md file and settings as the terminal version, and new VS Code sessions start in auto mode. You can also run claude in VS Code's integrated terminal if you prefer the command line.
Claude Code hooks vs CLAUDE.md: when do I need a hook?
CLAUDE.md is advice. Claude reads it and decides on each turn whether it applies, so a rule that must always hold does not belong there alone. Put 'never read .env', 'always run the formatter' and 'never edit applied migrations' in a deny rule or a hook, because Claude Code enforces those whatever the model decides. If you keep adding emphasis to a CLAUDE.md line and Claude still misses it, move the line to a hook.