# How to Use Claude Code on a First Real Project: Git, Permissions, Plans, and Commits

A git baseline before the session, a deny list for secrets, a plan you read before any edit, and a review that ends in one commit — the four habits that make a terminal agent safe enough to use on work you care about.

> coding-agents · ai-assisted development · git-workflow · About 8 min · Nov 29

## Key points

1. Claude Code writes straight to disk, so the working method is built on git: commit a clean baseline before the session, and every later change becomes attributable to the agent or to you.
2. Its actions run with your account's permissions, so set a deny list for secrets and production credentials before it asks, and approve shell commands one kind at a time instead of approving everything.
3. A CLAUDE.md file at the project root is read at every session start, making it the right place for the run command, the test command, and any correction you have had to repeat.
4. Plan mode lets the agent read and search while changing nothing, and reading that plan first catches unrequested additions while they are still text rather than code.
5. The agent's "it works" is a claim: have it run the check and show the output, then run the app yourself, because tests it wrote prove only what it thought to check.
6. Review with git status and git diff --stat before reading any code, commit behaviour by behaviour, and keep one session to one commit so a later break traces back to a single change.
7. A good first project is one folder deep with one command that proves it works, which is why a QA automation suite fits Claude Code better than a page only your eyes can judge.

---

You already have a project folder, either code you exported from an app builder or a small tool someone handed you, and you have been told Claude Code is the tool to graduate to. This walkthrough covers one real session on that project and the four habits that decide whether the agent helps you or quietly ruins a week of work: start from a clean git commit, decide what it may touch before it starts, make it plan before it edits, and review the result one commit at a time.

What you need first: a terminal you can open, git installed so that `git --version` prints a version, a Claude account (a paid Claude plan or Anthropic Console credits, because Claude Code bills separately from chatting), and a project small enough to describe in one sentence. You do not need to read code for any of this, but you do need to be willing to look at file names and diffs.

## 1. Put the folder under git before the agent touches anything

Claude Code writes directly to your files, and there is no accept-or-reject diff window between you and the disk. Git is the only undo that survives. Open a terminal in the project folder and make a baseline commit:

```bash
cd path/to/your-project
git init
git add -A
git commit -m "baseline before using Claude Code"
git status
```

You should see `nothing to commit, working tree clean`. If `git status` lists modified files, commit or stash them before you continue. A dirty tree breaks the whole method, because from then on you cannot tell your edits from the agent's.

If the folder contains a `.env` file, a database file, or anything holding a password, add those names to `.gitignore` and commit again. You are about to give an agent read access to every file in this directory, and you do not want credentials sitting in a diff you might push somewhere later.

## 2. Install it, start it in the project root, and write down how the project runs

Install Claude Code with npm (`npm install -g @anthropic-ai/claude-code`, which needs Node.js 18 or newer) or with the native installer from the docs. Install routes and flags change often, so if a line here fails, check the current install page before assuming you did something wrong.

Then, from inside the project folder rather than your home directory, run:

```bash
claude
```

The first run walks you through login. You should land in an interactive prompt inside your project, with a line under the box telling you which model and which permission mode you are in.

Now teach it this project once so you do not repeat yourself every session. Type `/init`. Claude reads the folder and writes a `CLAUDE.md` file summarising what it found. Open that file and correct it: add the command that runs the app, the command that runs the tests, and one line saying what the project is. That file is read at the start of every session, which makes it the cheapest place to record a fact you would otherwise repeat, such as "the dev server is `npm run dev` on port 3000" or "do not touch `legacy/`". If you correct the agent on the same point twice, the correction belongs in `CLAUDE.md`, not in a third prompt.

## 3. Decide what it is allowed to touch, before it asks

Every action Claude Code takes runs with your user account's power: the same files, the same credentials, the same ability to push to git, call your cloud provider, or delete a database row. The boundary question is therefore not whether the tool is trustworthy, but what on this machine you would not want an AI to touch.

At first it asks roughly one question per action. Edits prompt you ("Do you want to create `src/App.tsx`?"), and shell commands prompt you ("Do you want to run `npm test`?"), each with options to allow once, allow that kind of command from now on, or refuse and say what to do instead. File reads go through silently. The beginner mistake is approving everything for an hour, because the prompts are tedious and nothing has gone wrong yet.

Type `/permissions` to see and edit the rules, and put a deny list there first, so that some things are refused no matter how the question is phrased. Rules are a tool plus a pattern:

```json
{
  "permissions": {
    "deny": ["Read(./.env)", "Read(./.env.*)", "Bash(git push:*)"],
    "allow": ["Bash(npm run test:*)", "Bash(npm run lint)"]
  }
}
```

Denying `.env` means the agent cannot read your secrets even if a prompt would have persuaded you. Allowing your test command removes the interruption you would otherwise meet every few minutes. The pattern syntax is the part of this workflow that most often changes shape between versions, so check it against the permissions docs.

The other lever is the mode. Press Shift+Tab to cycle it and read the label that appears under the prompt box rather than trusting a fixed order. One mode asks before every edit, one accepts file edits automatically but still asks before commands, and plan mode lets the agent read and search while changing nothing. Never use the mode that skips all checks on a project you care about. It is for throwaway sandboxes, and it removes exactly the switch that lets you say no.

## 4. Get a plan before any edits

With the boundary set, state what you want together with one instruction: propose a plan first. Either switch to plan mode and ask, or simply write it:

> Read the project. I want the quote form to save to the database instead of console.log. Propose a plan: which files you would change, and how you would prove it works. Don't edit yet.

Claude searches the folder and answers with a list of steps. This is the most valuable minute of the session, because the plan is a scope check you can read without reading code. Look for three things. Does the file list match your mental picture of the project? Does it name a command or test that will show the change worked? And has it quietly added something you never asked for, such as a new library, a login screen, or a migration that rewrites existing rows? That third one is the AI's default guess, not your requirement, and it is far cheaper to delete from a plan than from a working project.

Press Escape to stop an action mid-stream when you see it heading the wrong way. Nothing already written to disk is undone, which is what step 1 is for. Then say in plain words what was wrong. You can also type `/clear` before a genuinely unrelated task, since a long session accumulates stale instructions and a fresh one with a clear sentence beats a crowded one.

## 5. Review the diff, run the thing, then commit

When the agent says it is done, it will also tell you what it verified. Treat that as a claim. Ask it to run the check and show the output, then run the app yourself, because a test the agent wrote can only prove what the agent thought to check.

The review is where most of the value of this workflow sits:

```bash
git status
git diff --stat
git diff
```

`--stat` gives you the file list, and every file you do not recognise is a question worth asking. Then ask the agent to explain the change in words: one sentence per file, no code. You are not auditing the implementation. You are checking that the shape of the change matches the plan you approved.

If it matches, commit it, and write the message about behaviour rather than files:

```bash
git add -A
git commit -m "quote form saves to the database"
```

If it does not, `git checkout -- .` discards the edits to tracked files and returns you to the baseline, while `git stash` parks them if you want to look later. `git clean -fd` is what removes new files the agent created. None of this restores data: a migration it already ran against your local database is not in git.

The rule that holds it together is one session, one commit. If a session produced four separable changes and they all work, commit them separately, with `git add src/form.tsx` followed by its own commit. Months from now, a series of small commits tells you which change broke something; one enormous commit tells you only that the agent was involved.

```mermaid
flowchart LR
  A["Clean commit<br/>before the session"] --> B["Deny rules<br/>for secrets"]
  B --> C["Plan mode:<br/>read the proposal"]
  C --> D["Approve edits<br/>and commands"]
  D --> E["Run the app<br/>yourself"]
  E --> F{"Diff matches<br/>the plan?"}
  F -->|yes| G["Commit the change"]
  F -->|no| H["git checkout -- .<br/>back to baseline"]
  G --> A
  H --> C
```

## Where this leaves you

You now have a workflow rather than a magic tool: a baseline commit, a deny list, a plan you read first, and a review that ends in a commit. Choose the first project with that workflow in mind. It works best when the project is one folder deep and one command proves it works, which is why QA automation is a genuinely good first job for Claude Code. Teaching it to drive a browser test suite against an app you already have gives it a check it can run itself, and you can verify the suite by breaking the app on purpose and watching it go red. Visual work is the harder case: a frontend-design plugin can add taste to what it builds, but nothing in it tells you the page looks right, so your own eyes do all the work.

One honest caveat. Command names, mode cycling and permission syntax in Claude Code move fast, and the details above were written without live access to the current documentation. If a flag or menu label disagrees with what you see, type `/help` and trust the tool over this article.

## Mind map

```mermaid
flowchart LR
  Q["Using Claude Code<br/>on a first real project"] --> G["Git baseline<br/>clean tree before starting"]
  Q --> P["Permissions:<br/>deny list, modes, approve per kind"]
  Q --> M["CLAUDE.md<br/>run and test commands"]
  Q --> PL["Plan before edits<br/>read the proposal"]
  Q --> RV["Review<br/>diff, run it, commit"]
  G --> O["Undo that survives"]
  P --> O
  PL --> S["Scope check<br/>catch unrequested additions"]
  RV --> C["One session,<br/>one commit"]
  C --> T["A break traces<br/>to one change"]
```

## Glossary

- Baseline commit：the clean git commit taken before an agent starts, so everything after it can be reviewed or thrown away with one command.
- Deny rule：a permission rule that refuses an action outright instead of asking, used for secrets and irreversible commands.
- Permission mode：the setting that decides how often the agent stops to ask before editing files or running commands.
- CLAUDE.md：a file of standing instructions at the project root that the agent reads at the start of every session.
- One session, one commit：committing each verified change separately, so a later failure traces back to one change instead of a whole day's work.

## Sources

1. [Claude Code documentation — install routes, permission modes and rule syntax; command names and menu labels change between releases, so check the current page for exact flags.](https://docs.claude.com/en/docs/claude-code/overview)
2. [Anthropic engineering: Claude Code best practices — on CLAUDE.md, planning before executing, and giving the agent a check it can run.](https://www.anthropic.com/engineering/claude-code-best-practices)

---

Original article: https://eulore.ai/articles/how-to-use-claude-code-d63031a3

> **Eulore** · Start small. Go deep.
>
> Eulore is an AI learning tool built around connected articles, each a 5–10 minute read. Ask questions as you go and help shape what comes next. That’s how this article was created.
>
> Start your own series → https://eulore.ai
