Claude Code: A Safe First Week for Someone Who Isn't an Engineer Yet

· 7 min read ·
vibe-coding claude-code safety workflow

A man in a green sweater smiling at his desk while a small robot in a yellow safety helmet places a traffic cone beside a laptop, with a seven-day calendar showing four checked days and a red stop button on the desk

A safe first week with Claude Code means five things in order: commit your project to git, write down what it must never read or delete, make your first change with a test that can fail, learn what /rewind cannot undo, and only then give it more freedom. Claude Code is good at routine work out of the box. The setup below is for the few things where “almost always” is not good enough.

Why does a first week need a plan?

In September 2026 a user posted on Reddit that Claude Code wiped their WSL home directory, including files that were never backed up, after they had told it that area was off limits. That account is unverified, and the comments argue about who approved what. The useful part is one commenter’s point: an instruction in a chat or a memory file is a request, not a lock.

Claude Code’s own docs draw the same line. Instructions you write, in a prompt or CLAUDE.md, are “non-deterministic”: the model decides what to do with them. Hooks and deny rules are “deterministic”: Claude Code enforces them every time. The week below uses both kinds, on purpose.

Day 1: Put the project in git before anything else

Claude Code keeps its own restore points, but Anthropic’s checkpointing docs list what they miss. A file changed only by a shell command is not tracked. Edits made by most subagents are not restored either. The docs tell you to use version control for those. So git is your real undo.

Terminal window
git init
git add -A
git commit -m "before Claude Code"
git switch -c claude-week-one

Check that .env is in your .gitignore first (git check-ignore .env prints .env if it is). If you committed a secret already, see leaked API keys.

Day 2: Look around without letting it change anything

Install with the command on the quickstart page (claude --version should print a version number), open your project folder and start claude. Start in Plan mode with claude --permission-mode plan, where Claude reads and explores but does not edit your source files. Ask: “Explain how login works in this app and list the files involved.”

Know what mode you are in. According to the docs, new terminal and VS Code sessions start in auto mode: Claude works without routine prompts, and a second AI model (the classifier) reviews actions before they run. The docs also warn that the classifier is a judgment call and can be wrong. Manual mode, where you approve each edit and command, is claude --permission-mode manual.

Day 3: Write the rules that cannot have exceptions

Inside Claude Code, type /init and then cut what it wrote. The docs recommend a CLAUDE.md under 200 lines and say to keep only what Claude cannot find by reading your code (for ideas, see what belongs in a rules file, which applies here too).

Then add the deterministic part. Create .claude/settings.json:

{
"permissions": {
"ask": ["Bash(git push *)"],
"deny": ["Read(./.env)", "Read(./.env.local)", "Read(./secrets/**)"]
}
}

Per the docs, deny rules hold in every permission mode, auto and bypassPermissions included. To test it, ask Claude to open .env with the Read tool. It should be blocked.

Know the edges. The docs say a Read deny rule is applied to some Bash commands such as cat .env, but not to a script that opens the file itself, and grep -r from inside the folder can still read it. For OS-level limits, turn on /sandbox. Best of all, keep real secrets out of the project folder.

Day 4: Block the commands you would never approve

A hook is a small script Claude Code runs before or after each action it takes, such as running a shell command. Anthropic’s hooks guide has an example that denies rm -rf. Tested against five spellings of the same delete in a scratch folder, it caught rm -rf and let rm -fr, rm -r -f, rm --recursive --force and find . -delete through. Save this wider version, which also watches git clean -f, as .claude/hooks/block-rm.sh and run chmod +x on it:

#!/bin/bash
COMMAND=$(jq -r '.tool_input.command')
if echo "$COMMAND" | grep -Eq '(^|[^[:alnum:]_-])rm([[:space:]].*)?[[:space:]](-[a-zA-Z]*[rR][a-zA-Z]*|--recursive)([[:space:]]|$)|find .* -delete|git clean +-[a-zA-Z]*f'; then
jq -n '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"Recursive delete blocked. Ask the user."}}'
fi
exit 0

Install jq first (brew install jq on a Mac, sudo apt install jq on Ubuntu), then register it by adding this to .claude/settings.json (merge it with the permissions block from Day 3). Leave out the guide’s if filter, because it only matches rm and this script also watches find and git clean:

{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/block-rm.sh" }
]
}
]
}
}

You can test the script without Claude. Save these as cases.txt, one BLOCK|command or ALLOW|command per line:

BLOCK|rm -rf ./build
BLOCK|rm -f -r ./build
BLOCK|/bin/rm -rf ./build
BLOCK|echo $(rm -rf ./build)
BLOCK|xargs rm -rf
BLOCK|find . -delete
BLOCK|git clean -fdx
ALLOW|rm notes.txt
ALLOW|ls -la
ALLOW|docker run --rm -it node

Then run each through the hook:

Terminal window
while IFS='|' read -r want cmd; do
out=$(jq -n --arg c "$cmd" '{tool_input:{command:$c}}' | .claude/hooks/block-rm.sh)
got=ALLOW; [ -n "$out" ] && got=BLOCK
[ "$got" = "$want" ] && echo "ok $cmd" || echo "MISMATCH $cmd (wanted $want)"
done < cases.txt

In the scratch run, the guide-style version let rm -f -r, /bin/rm -rf, echo $(rm -rf ...) and git clean -fdx through. The version above blocked all 11 cases and allowed the safe ones. It also blocks git rm -r --cached x, so expect an occasional false alarm.

Know what it still misses. It reads command text, so a command that builds the delete another way gets through: python -c "import shutil; shutil.rmtree('x')", a script that deletes files itself, or a variable that holds the command. Hooks match command text, not intent, so treat this as a seatbelt and not a wall. For everything else, rely on /sandbox and on git: commit before each session so a deleted folder is one git restore away.

Using Cursor instead? Cursor: rules and habits that keep your codebase clean covers the same ground for that tool. The deny rules and hook above are specific to Claude Code.

Day 5: Make your first change with a test that can fail

Pick one small behavior. Before asking for the fix, ask Claude for a test that describes what the user sees, and run it to watch it fail. Say you have a cart where the coupon code does nothing:

// cart.test.js (run with: node --test)
import { test } from "node:test";
import assert from "node:assert/strict";
import { total } from "./cart.js";
test("a 10% coupon takes 10% off what the customer pays", () => {
const items = [{ cents: 2000, qty: 2 }, { cents: 1000, qty: 1 }];
assert.equal(total(items, "SAVE10"), 4500);
});
test("no coupon means full price", () => {
assert.equal(total([{ cents: 2000, qty: 2 }]), 4000);
});

Run against the buggy cart.js, one test fails (the coupon one) and one passes. Money is in whole cents, so the check compares exact numbers. After adding return coupon === "SAVE10" ? Math.round(sum * 0.9) : sum; both passed. The second test matters as much as the first: it checks a behavior the fix could break. Test what the customer experiences, not how the function is built inside, so a later fix that changes the internals still has to keep the behavior. Then commit.

Day 6 and 7: Review, then earn more freedom

Run git status --short and git diff --stat and read what changed against what you asked for. Open /permissions to see what you approved. Only after a quiet week consider loosening anything, and keep bypassPermissions for a disposable container or VM, as the docs say.

A prompt to start with

Read this project and do not change anything. Tell me which files hold secrets or credentials, whether .env is in .gitignore, and which commands in package.json delete or overwrite data. Then suggest deny rules for .claude/settings.json. Wait for my approval.

What an engineer checks by hand: after any session, git log --oneline and git status --short. If you see commits or files you do not recognize, stop and read them before going on. Before launch, use the launch checklist, and when a fix breaks something else, read why that happens.

The Get AI Native ebook goes deeper on this. It is free, and the expected launch is around Christmas. Join the waitlist on the homepage.

Comments