Claude Code setup: make it ask less and do more
Claude Code works out of the box, but the defaults are conservative — it checks with you before every move. The model is smart enough to earn a longer leash. This page is organised by what you want; every field name and flag was verified against a live install.
Quick reference
| You want | Where | How |
|---|---|---|
| Trusted commands, no prompts | permissions.allow | allowlist in settings.json |
| File edits without confirmations | acceptEdits mode | Shift+Tab in session |
| No prompts at all (isolated env) | bypassPermissions | risk boundary below |
| It remembers your rules | CLAUDE.md | global + project layers |
| Pin a model | model setting | /model or settings |
| Pick up yesterday's session | session recovery | claude -c |
| Call it from scripts | headless mode | claude -p |
First thing: make it ask less
"Stop asking and just do it" is the number-one configuration request. There are three tiers, in increasing order of trust — start at tier one; most people never need to go past tier two.
Tier 1 · Allowlist trusted commands#
- How
-
List operations you trust under
permissions.allow; anything matching runs without a prompt:~/.claude/settings.json{ "permissions": { "allow": [ "Bash(npm run *)", "Bash(git status)", "Bash(git diff *)", "Read(*)" ] } }The
*inBash(npm run *)is a prefix wildcard:npm run buildandnpm run test -- --watchboth match. Only allow prefixes you know are harmless — allowgit diff *, not all ofgit *(which would includegit push --force). - Why start here
- Precise, auditable, reversible. Every grant is a visible line in a file; delete the line and it is revoked.
Tier 2 · acceptEdits: auto-accept file changes#
- How
-
Press Shift+Tab in a session to cycle permission modes and land on acceptEdits — file creation and edits stop prompting, while everything else (like Bash) still asks. To make it the default:
.claude/settings.json{ "permissions": { "defaultMode": "acceptEdits" } } - Who it suits
- Anyone whose code lives in git. A bad edit is one
git diffaway from visible and one command from reverted — version control is the safety net. The plan mode goes the other way: read-only analysis, plan first, touch nothing — useful when you want the approach before the changes.
Tier 3 · bypassPermissions: no prompts at all#
- How
- Launch with
claude --dangerously-skip-permissions, or set"defaultMode": "bypassPermissions". Every permission check is skipped; any command runs immediately. - Risk boundary
-
The flag says dangerously, and it means it. Deleting files, changing the system, calling the network — all waved through alike. It is built for isolated environments: Docker containers, dedicated VMs, CI sandboxes — places you can rebuild if they break. Running it bare on the machine that holds your real data hands over the whole keyring. Teams can disable the mode entirely via
disableBypassPermissionsModein settings.
Make it remember your rules: CLAUDE.md
The other half of "ask less" is teach less — repeating your conventions every session is worse than any confirmation prompt. CLAUDE.md is read automatically at session start, in two layers:
| Location | Scope | Put here |
|---|---|---|
~/.claude/CLAUDE.md | All your projects | Language preference, working style ("conclusion first, no preamble") |
CLAUDE.md at repo root | This repository (commit it — whole team benefits) | Build/test commands, code conventions, no-go directories |
The one rule that matters most: keep it a terse rule list, not an essay. It occupies context every session; length is noise. Three kinds of content pay off: fixed conventions ("comments in English"), common commands ("tests run with npm test, never yarn"), and no-go zones ("migrations/ is read-only").
Pin a model
| Method | How | Best for |
|---|---|---|
| In-session | /model, pick from the list | Switching as you go |
| Lasting default | "model": "..." in settings.json | Long-term preference |
| Environment | ANTHROPIC_MODEL (beats settings) | Scripts / CI overrides |
| One session | claude --model <name> | One-off runs |
Model ids are easy to mistype — pick from the /model list or copy the exact id from the models page.
Sessions: resume, compact, clear
| Command | What it does |
|---|---|
claude -c | Continue the most recent session (use it — stop starting from zero) |
claude --resume / /resume | Pick a past session from a list |
/compact | Condense a long session's history to free context (also triggers automatically near the limit) |
/clear | Wipe clean and start fresh — better than dragging an old session into a new task |
| Esc | Interrupt the current response — no need to wait out a wrong turn |
Calling it from scripts: headless mode
# run one prompt, print, exit
claude -p "summarise the TODOs in this directory"
# structured output for downstream tools
claude -p "..." --output-format json
--output-format takes text / json / stream-json (only with -p). CI, cron jobs and batch pipelines all go through this.
Three settings.json files — which wins?
Three layers, highest to lowest. Permission rules merge across layers; single-value fields (like model) resolve to the highest layer:
| Priority | File | Role |
|---|---|---|
| High | .claude/settings.local.json | Personal, this machine (not committed) |
| Mid | .claude/settings.json | Team-shared, committed |
| Low | ~/.claude/settings.json | Your global defaults |
Rule of thumb: personal preferences user-level, team conventions project-level, machine-specific exceptions local.
Advanced, one line each
- MCP servers:
claude mcp add -s user|project|local ...connects external tools (databases, browsers, internal systems);-schooses which config layer stores it. - Hooks: the
"hooks"block in settings.json runs automation around tool calls (e.g. lint on PostToolUse) — "auto-format after every edit" lives here. - Status line: the
statusLinesetting customises what the bottom status bar shows.
claude --help and the official docs. Configuration evolves with versions — where your install differs, trust its --help output. This page is kept up to date.
Related
- Claude Code with 9Coding — two environment variables; get connected first, then tune
- Troubleshooting handbook — 401 / 429 / 529 by error code
- Usage and balance — console and billing API