Open · free

Claude Code: a practical guide

Using a command-line coding agent without losing control

Intermedio10 chapters2 hours of readingcertificate includedupdated on

A complete written course on Claude Code, the terminal coding agent: what it sees of your project, how to install it, how to write instructions it actually follows, how to set up permissions and safety, how to plan a large task, how to extend it with commands, hooks and MCP servers, how to work in parallel, and how to bring it into CI and into a team. One thread runs through all of it: getting code you would approve in review, knowing where the agent goes wrong in predictable ways. Pass the final test and you get a certificate of attendance with a verifiable Open Badge.

What you will learn7 outcomes
  • Explain how a coding agent differs from autocomplete and from a chat assistant
  • Understand what goes into Claude Code's context, and manage it with /context, /clear and /compact
  • Install Claude Code, start it on a project, and write a short, specific, checkable CLAUDE.md
  • Configure permission modes and rules, starting from the line between reversible and irreversible operations
  • Use plan mode to break a large task into verifiable steps
  • Extend the agent with skills, hooks, MCP servers and subagents, choosing between instructions and enforced mechanisms
  • Set up headless and CI use with minimal permissions, explicit limits and human review

Prerequisites

  • Everyday use of the terminal and of git: clone, branch, commit, diff
  • Development experience in at least one language: the examples use JavaScript tooling, but the concepts apply to any stack
  • Nothing else is needed to read the course and take the test; to put it into practice you need a Claude account with access to Claude Code, which is paid

Chapter 01

What a coding agent is

If you have used a programming assistant before, you probably know it in one of two forms. The first is autocomplete: as you type, the editor suggests the next lines in the file you have open, and you accept or reject one suggestion at a time. The second is the chat assistant: you paste some code into a chat, get a text answer back, and it's up to you to carry it into the project, run it and find out whether it works. In both cases the real work — deciding which files to touch, running the commands, checking the result — stays entirely in your hands.

A coding agent like Claude Code changes how the work is split. You don't ask it for a line or an answer: you hand it a goal, and it works in a loop that the official documentation describes as three intertwined phases — gather context, take action, verify results. To do that it uses tools: it reads and searches files, edits them, runs commands in the terminal, looks things up on the web. Every tool result is new information that shapes the next step. Ask it to fix the failing tests and it will typically run the suite, read the error, search for the files involved, edit them and run the tests again to check. It doesn't just see the file open in your editor, but the whole project you started it in.

It helps to separate the two pieces the agent is made of. The model is the part that reasons: it understands the code, decides what to do, writes the changes. Claude Code is the layer around the model — the documentation calls it the harness — that provides the tools, manages what goes into the context and applies the rules you configure, such as permissions. The distinction comes back throughout the course: some things the model decides, and they can vary from one run to the next; others the harness enforces, and they happen every time.

It's also worth saying what it is not. It is not an oracle: it produces plausible code with the same confidence whether it's right or wrong. It doesn't remember previous sessions: every new session starts with an empty context, apart from the persistent instructions covered in the CLAUDE.md chapter and the notes Claude Code can save on its own (what it calls auto memory). It is not deterministic: the same request, repeated, can take different paths. And it doesn't replace review: it moves your work from writing every line to defining the goal well and checking the result.

Two more things before you start. First, you are part of the loop: you can interrupt the agent at any moment with Esc, or type a correction while it works, and it will take it into account before its next step. Second, Claude Code doesn't only live in the terminal: it ships as an extension for VS Code and JetBrains IDEs, as a desktop app and on the web, and it can run in CI pipelines. The loop and the tools are the same everywhere; this course uses the terminal because that's where every mechanism is most visible.

Chapter 02

What the agent sees of your project

A coding agent does not have the whole repository in front of it the way you do. When a session starts, Claude Code loads a few things on its own — its system instructions, the CLAUDE.md files, the git state (current branch, uncommitted changes, recent commits), the names of the available tools — and from then on it reads the files it decides to read, when it decides to read them. Everything it reads, every command output and every message in the conversation goes into the context window, which has a limit. The quality of the result starts here: if the agent has not read the right file, it will produce code that looks plausible and is wrong.

This explains something that catches beginners off guard: the agent reinvents a function that already exists, or pulls in a library when the project already uses a different one for the same job. It is not the model being ignorant, it is missing context. The distinction matters because it points straight at the fix: give the agent the right references instead of hoping it guesses. In practice that means naming the file or folder to start from, describing the symptom rather than your guess at the fix, and saying what “fixed” means. If you already have what it needs, hand it over: @ followed by a path includes a file in your message, you can paste a screenshot of an error, and you can pipe a command's output in from your shell, for example with cat error.log | claude -p 'what is going on here?'.

Projects that work well with agents share one trait: they are navigable. Consistent file names, a predictable structure, conventions written down somewhere instead of living in the heads of the team. These are the same properties that make a project understandable to a new colleague — the agent only amplifies a problem that was already there. Claude reads code very well on its own, and works out the structure, the conventions and the test framework; what it can't find is whatever never made it into the repository: a decision taken in a meeting, a deploy process that lives in one person's head, the environment variable the integration tests need.

The context window fills up as the session goes on. As it approaches the limit, Claude Code compacts the conversation into a summary: your requests and the important code snippets survive, but detailed instructions given early on can get lost. That is why rules that must always hold belong in CLAUDE.md, which is reloaded from disk, rather than in the conversation's memory. Current models have large windows and running out of room is less common than it used to be, but a context full of old work still has two costs: it dilutes attention on what matters now, and it is sent again — and paid for — with every new message.

The three context-management commands, typed inside a session.text
/context
/compact focus on the API changes and the test commands
/clear

/context shows what is taking up space and confirms which instruction files were loaded. /compact summarises the conversation right away and takes a hint about what to keep, which is useful before starting a long task. /clear starts over, and it's the right call when you move on to unrelated work: the next task doesn't drag the previous one's history along. Finally, remember that sessions are independent: a new session knows nothing about earlier ones, unless you pick one up again with claude --continue, which reopens the most recent conversation in the current folder, or with claude --resume, which lets you choose.

Chapter 03

Installation, first launch and first commands

To use Claude Code you need three things: a terminal, a project to work on, and an account that gives access to the models. The last point needs clearing up straight away, because it causes confusion: this course is free, the tool is not. Claude Code requires a paid Claude subscription, a Claude Console account with API credit, or access through one of the supported cloud providers. Plans and prices change: check the official pages before choosing.

The method the documentation recommends is the native installer. On macOS, Linux and WSL it's a single line; on Windows there's an equivalent for PowerShell. Alternatives include Homebrew, WinGet, the package managers of the main Linux distributions, and npm. The practical difference is updates: the native install updates itself in the background, while Homebrew and WinGet installs have to be upgraded by hand. With npm, the documentation explicitly recommends against using sudo.

Native install and check. The exact commands for each system are in the official quickstart.bash
# macOS, Linux, WSL
curl -fsSL https://claude.ai/install.sh | bash

# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

# check the installation (open a new terminal first)
claude --version

A practitioner's note: the first line downloads a script and runs it. It is the official procedure, but the right habit is still to check the exact address in the documentation rather than copy it from some tutorial — this one included. If after installing your shell can't find the claude command, the install folder isn't on your PATH yet: open a new terminal, and if that's not enough, claude doctor and the installation troubleshooting page will help you work out why.

You launch it for the first time from the project folder: cd into it and run claude. On first use you're asked to sign in through the browser. If you open Claude Code in a folder you've never used, the workspace trust dialog also appears: read it, because whether part of the repository's configuration — permission rules, hooks — comes into play depends on that choice, and the project's MCP servers have an approval step of their own. On a project cloned from a source you don't know, this is the moment to look at what's inside the .claude folder before accepting.

To find your bearings, start with questions that change nothing: what does this project do, where is the entry point, how is the folder structure organised. Then the commands you'll use every day. Inside a session, the ones starting with / control Claude Code itself: /help lists them, /init generates a first CLAUDE.md, /clear and /compact manage the context, /permissions shows the active rules, /usage reports consumption and limits, /rewind goes back to an earlier point. A message starting with ! runs a shell command directly and adds its output to the conversation. Shift+Tab changes the permission mode, Esc interrupts. From the shell, claude followed by a quoted request opens a session with that task, while claude -p runs a single request and exits. Pick your first real task small and reversible, in a git repository with a clean status: that way every change the agent makes is visible with git diff and can be undone with one command. It isn't excessive caution: it's the fastest way to learn how the agent reasons about your code, before you trust it with something that matters.

Chapter 04

CLAUDE.md: project instructions that work

At the start of every session Claude Code reads the CLAUDE.md files and puts them in the context. It's where you write what a new colleague would need to know before touching the code and couldn't work out by reading it. The files can live in several places, with different scopes: CLAUDE.md (or .claude/CLAUDE.md) at the project root is shared with the team through git; ~/.claude/CLAUDE.md holds your personal preferences for every project; CLAUDE.local.md at the project root is for your personal notes on that project, and should be kept out of version control. An organisation can also deploy a centrally managed file. The files don't override one another: they are concatenated, from the most general to the most specific. If the repository already has an AGENTS.md written for other agents, Claude Code can read that.

You don't have to start from a blank page: /init analyses the code and generates a first version with the build and test commands and the conventions it can discover. From there the work is mostly removing lines. The most common mistake is filling the file with generic good intentions along the lines of “write clean, well-tested code”: they have no measurable effect. The second, subtler mistake is describing what the agent finds out on its own — the architecture, the folder structure — which costs context in every session without adding information.

Useful instructions are specific and checkable. The official documentation offers a simple test before you write a line: could the agent find this by reading the code? And would it actually go and look? If the answer to both is yes, the line isn't needed. What's left is the exact commands to verify work — tests, typecheck, lint, how to run a single test file —, the places where the code is misleading, such as an old module still in use that new code must not imitate, decisions made outside the repository, and anything you've had to correct twice.

A short CLAUDE.md: commands, non-obvious conventions, gotchas. Nothing the code already says.markdown
# Commands
- Install: pnpm install
- Run one test file: pnpm vitest run path/to/file.test.ts
- Typecheck: pnpm tsc --noEmit

# Conventions
- Use the error helpers in src/lib/errors.ts, never throw raw strings
- src/legacy/ is still live: do not copy its patterns into new code

# Gotchas
- Integration tests need DATABASE_URL, see .env.example

The rule here is the opposite of the one for traditional documentation: a few lines about non-obvious decisions beat pages of redundancy. The documentation suggests staying under 200 lines per file, because every line costs context in every session and a long file lowers adherence to the instructions. When part of it only concerns one area of the code, it can move to a file in the .claude/rules/ folder, scoped to certain paths, which loads only when the agent works on those files; when it grows into a multi-step procedure, it's better off as a skill, as chapter 7 shows. Imports with the @path syntax help organise things, but they don't lower the cost: imported files load together with the file that imports them.

Two last things not to forget. CLAUDE.md is context, not enforced configuration: the agent follows it almost always, but it remains its own call. If a rule allows no exceptions — never read .env, never touch the migrations folder — writing it in capitals or adding “IMPORTANT” won't fix it: it needs to become a permission rule or a hook, covered in chapters 5 and 7. And treat the instructions as code: they live in git, they get reviewed, they get updated when the conventions change. An out-of-date file is worse than no file at all, because the agent follows it just as diligently.

Chapter 05

Permissions and operational safety

A terminal agent runs commands: it installs packages, edits files, runs tests, can commit. That is what makes it useful and it is also what makes it risky. The right question is not “can I trust it?” but “how much damage can I afford if it gets this wrong?”. The practical line runs between reversible and irreversible operations. Editing a file tracked by git is reversible: you can always go back. Deleting untracked files, rewriting history, pushing to a shared branch, touching a database or a production environment are not. The first category can go ahead without asking; the second needs explicit confirmation, every time. Claude Code helps on the reversible side. Before it edits a file with its own tools it takes a snapshot, a checkpoint: press Esc twice, or use /rewind, and you can roll the code, the conversation or both back to an earlier point. But checkpoints have clear limits: they don't cover files changed by shell commands, and they can't undo anything that has left the machine — a database query, an API call, a deployment. They don't replace git: they sit alongside it.

The second mechanism is permission modes, which set what the agent can do without asking. In Manual mode (its configuration value is default) reads are free and almost every edit or command asks for confirmation. acceptEdits approves file edits and some common filesystem commands inside the working folder on its own. plan allows exploring but not editing the code (chapter 6). auto hands the judgement of actions to a second model, a classifier, which blocks the ones it considers risky. dontAsk denies anything that hasn't been pre-approved, and is meant for CI and scripts. bypassPermissions skips the checks, and the documentation reserves it for isolated containers and virtual machines. Shift+Tab cycles through the modes; which one a session starts in depends on version and configuration, and it has changed over time: check the documentation.

On top of the modes come the rules: allow (go ahead without asking), ask (always ask), deny (forbidden). You write them in settings files — .claude/settings.json for the team, .claude/settings.local.json for yourself — and manage them with /permissions. They are evaluated in the order deny, then ask, then allow: a deny can't be overridden by a more specific allow, and it holds in every mode, bypassPermissions included. The difference from CLAUDE.md is fundamental: rules are applied by Claude Code, not by the model. That is why your “nevers” belong here and not in the instructions; even auto mode, being one model's judgement, can be wrong.

Rules in .claude/settings.json: tests and lint without asking, push always asks, secrets never.json
{
  "permissions": {
    "allow": [
      "Bash(npm run test *)",
      "Bash(npm run lint)"
    ],
    "ask": [
      "Bash(git push *)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./secrets/**)"
    ]
  }
}

Rules have edges worth knowing: they match tool calls, not intent. The deny on Read(./.env) also stops cat .env, because Claude Code recognises the common file-reading commands, but not a script that opens the file by itself. For a limit enforced by the operating system there is the sandbox for shell commands, which you turn on with /sandbox on macOS, Linux and WSL2.

Then there is the risk that doesn't depend on you. The agent reads content you did not write — issues, comments, web pages, dependency documentation, responses from external servers — and a malicious piece of text can carry instructions written to steer it: that is prompt injection. Claude Code has defences — for instance it doesn't auto-approve commands that fetch content from the network such as curl, and it asks for explicit trust before using an unknown repository's configuration. But no defence is complete, which is why destructive operations should never be automatic, however reliable the agent looks in day-to-day use.

Chapter 06

Plan before you write: plan mode

Faced with a large task — a migration, a feature that cuts across several modules, a refactoring — the agent tends to do what it always does: start. The trouble is that a wrong assumption discovered after twenty edited files costs far more than the same assumption discussed before a line was written. Planning before writing isn't bureaucracy: it moves error correction to the point where it's cheapest.

Plan mode exists for exactly this. In this mode Claude reads files, runs commands to explore and writes a plan, but doesn't edit your source code until you approve it. You enter it with Shift+Tab, by prefixing a single request with /plan, or by starting the session directly in this mode. When the plan is ready, Claude presents it and asks how to proceed: you can approve it and let it work with fewer prompts, approve it but confirm each edit yourself, or stay in planning and say what to change. Ctrl+G opens the plan in your editor so you can fix it directly.

Starting a session in plan mode, or entering it for a single request.bash
# start the whole session in plan mode
claude --permission-mode plan

# inside a session: plan mode for one request
/plan migrate the session store to the new cache API

Read a plan the way you'd read a colleague's proposal, looking for three things. Assumptions: does the plan take something false for granted, such as a function being used in only one place? Boundaries: which files does it touch, and are there any it shouldn't? And above all, verification: for each step, how will you know it worked? A step without an objective check — a passing test, a clean typecheck, a build that completes — is a step whose outcome you only discover at the end, together with all the others.

Breaking the work into verifiable steps has an immediate practical effect: each step becomes a unit the agent can close on its own, running the check and fixing things until it passes, and that you can review and commit separately. A good step leaves the project in a working state; a bad one leaves it halfway between two versions. If the plan says “update all the modules, then fix the tests”, ask for it the other way round: first the tests that describe the expected behaviour, then one module at a time, with the tests green at the end of each.

When you don't yet know exactly what you want, you can put an interview before the plan: ask Claude to question you until it has enough to write a spec, and to save it to a file. The documentation then suggests opening a fresh session to build it, so the work starts from a clean context and a written definition of “done”, which also comes in handy at review time. For small, obvious changes, on the other hand, explicit planning is a cost with no return: a one-line fix doesn't need a plan. One useful detail for long sessions: the plan written in plan mode is reloaded from disk even after the context is compacted, so it stays a stable reference while the rest of the conversation gets summarised.

Chapter 07

Extending the agent: commands, hooks and MCP servers

Everything you've seen so far falls into two families, and it pays to keep them apart. There are instructions the model reads and decides whether to follow: your request, CLAUDE.md, skills. And there are mechanisms Claude Code always applies, whatever the model decided: permission rules, hooks. The extensions in this chapter belong to one family or the other, and picking the wrong one is the most common mistake: a preference turned into a hook becomes an obstacle, a rule with no exceptions left in a text file becomes a hope.

Custom commands save you from rewriting the same procedure every time. A Markdown file in .claude/commands/, say deploy.md, creates the /deploy command: the content is the prompt that runs, and the $ARGUMENTS placeholder picks up whatever you type after the name. In recent versions commands have been merged into skills: a .claude/skills/deploy/ folder containing a SKILL.md file produces the same command, and also lets you add supporting files and let the agent load the skill itself when its description matches the request. Existing files in .claude/commands/ keep working. A skill's body only enters the context when it's used, which makes it the right home for long procedures that would weigh down CLAUDE.md. For a skill that must run only when you ask, like a deploy, the disable-model-invocation: true frontmatter option stops the agent from starting it on its own.

Hooks are shell commands Claude Code runs at specific points in its lifecycle: before a tool is used (PreToolUse, which can block it), after it's used (PostToolUse), when the agent is about to finish its response (Stop), when a session starts (SessionStart), when it needs your attention (Notification), and at several other moments. You configure them in settings files under the hooks key, with a matcher that picks the tools to react to, and /hooks shows the active ones. A PreToolUse hook that exits with code 2 blocks the action and sends its error message back to the agent, so it can correct course; a PostToolUse hook, by contrast, runs after the action has happened and can't undo it. The textbook case is formatting, as in the example below: instead of writing “always format after editing a file” in CLAUDE.md, a hook does it every time, and whether the agent remembers stops mattering. Two cautions. Hooks run with your user's permissions, so the ones in a cloned repository should be read before you trust the folder. And keep them few: every hook will sooner or later fire when it shouldn't, and someone has to maintain it.

A PostToolUse hook: after every file edit or write, Prettier formats the file that was touched.json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
          }
        ]
      }
    ]
  }
}

The third mechanism connects the agent to external systems — issue trackers, databases, internal services — through the Model Context Protocol. How the protocol works is the subject of our dedicated MCP course; what matters here is how you use it in Claude Code. You add a server with claude mcp add, manage it with /mcp inside a session, and it can have one of three scopes: local, the default (just you, just that project); project, in a .mcp.json file you commit for the team; user (you, across all your projects). Servers from .mcp.json need explicit approval in interactive sessions.

Adding a remote server and a local one shared with the team. The addresses are examples.bash
# remote server over HTTP, local scope (the default)
claude mcp add --transport http tracker https://mcp.example.com/mcp

# local stdio server, shared with the team through .mcp.json
claude mcp add --scope project --transport stdio db -- npx -y @example/mcp-server

claude mcp list

The security rule is the one from chapter 5: a server that brings external content into the conversation is a door for prompt injection, so only connect servers you trust. Finally, skills, hooks, subagents and MCP servers can be bundled into a plugin, to distribute them across repositories or to the whole team.

Chapter 08

Working in parallel: subagents and worktrees

A subagent is a separate instance working in its own context window, with its own system prompt and, if you choose, a reduced set of tools. It receives a task, carries it out on its own and returns only a summary to the main conversation. Claude Code includes a few built-in ones, among them Explore, read-only, for searching and analysing the code, and Plan, used in plan mode to gather information before proposing a plan. Claude delegates to a subagent when the task matches its description; you can also ask for one explicitly, by naming it in your request or @-mentioning it.

A custom subagent is a Markdown file with frontmatter: name and description are required, tools restricts the tools, model picks the model. The body of the file becomes its system prompt. In the project's .claude/agents/ folder it's shared with the team through git; in ~/.claude/agents/ it's personal and available in all your projects. The description matters more than it looks, because it's what Claude reads to decide when to delegate.

A reviewer that can read but not edit: the limit is enforced by Claude Code, not by the prompt.markdown
---
name: reviewer
description: Reviews changed files against the spec they were built from. Use after implementing a feature, before opening the PR.
tools: Read, Grep, Glob
---
You are reviewing code you did not write. Compare the changed files
with the spec you are given, check that every requirement is
implemented and tested, and report only gaps that affect correctness.

Subagents earn their keep in four situations: independent pieces of work to run in parallel; long output — a full test run, a search across the whole repository — that would otherwise stay in the main context for the rest of the session; a review by someone who hasn't seen the reasoning that produced the code; a task with fewer permissions than the main session. What they don't give you is a smarter answer: the same model on the same task gives an equivalent result. And they have a cost: every subagent sends its own requests, which count against the same usage limits, and it often has to rebuild context the main conversation already had, which can make it slower.

Subagents work inside one session. For longer parallel work — a feature on one side, a fix on the other — the files need separating too, or two sessions edit the same copy and trip over each other. The tool for this is the git worktree: a separate working directory with its own branch, sharing the repository's history. claude --worktree name (or -w) creates one under .claude/worktrees/, on a new branch, and starts the session there; the same command with another name, in a second terminal, opens a second isolated session. A subagent can also work in a worktree of its own, with the isolation: worktree frontmatter option.

Two parallel sessions, each in its own worktree and on its own branch.bash
# keep worktree contents out of the main checkout
echo ".claude/worktrees/" >> .gitignore

# terminal 1
claude --worktree feature-auth

# terminal 2
claude --worktree fix-login

A worktree is a fresh checkout: dependencies aren't installed and gitignored files such as .env aren't there. A .worktreeinclude file at the repository root lists the ones to copy in automatically. The real limit on parallelism, though, isn't technical: every parallel session produces work to review, and your attention is the resource that runs out first. Two well-verified sessions are worth more than five you can't keep track of. The use that almost always pays off is the simplest one: one session writes, another — which never saw how the code came about — reviews it.

Chapter 09

The daily workflow: tests, small commits, review

What actually makes you productive is not asking the agent to write a function, but handing it a complete, checkable job: “add the tests for this module and make sure they pass”. A goal with an objective success criterion lets the agent iterate on its own: it makes a change, runs the check, reads the output, fixes, until the check passes. Without a check, the agent stops when the work looks done — and you become the test suite.

One practical consequence follows: projects with a good test suite get far more out of agents. The test is the contract that lets you verify without rereading every line; where tests are missing, human review goes back to being the bottleneck. The check can be anything that returns a readable result, though: a build's exit code, a linter, the typecheck, a script that diffs output against a reference. For a bug fix, the most solid sequence is to ask first for a test that reproduces the problem and fails, then for the fix that makes it pass. And when the agent says it's done, ask for evidence: the command it ran and its output. “All tests pass”, on its own, tells you very little.

The request matters as much as the check. A useful request says where to start, describes the symptom and says what “fixed” means: not “fix the login bug”, but “login fails after the session expires; look at token refresh in src/auth/, write a test that reproduces it, then fix it”. If the agent heads the wrong way, stop it straight away with Esc. If after two corrections it's still off track, the documentation advises against pushing on: /clear and a new request that folds in what you've learned work better than a third correction in a conversation already full of failed attempts.

On version control, work on a dedicated branch and in small commits. Not for the sake of formality, but because it makes every change undoable in isolation: if one part is not convincing, you drop that part without losing the rest. The agent knows git and can commit if you ask it to, but the decision about what goes into the history — and above all what goes onto the shared branch — stays yours. Claude Code's checkpoints are handy for going back within a session, but they don't replace git history.

One branch per task, one commit per verified step: read before you stage.bash
git switch -c fix/session-timeout

# after each verified step
git diff
git add -p
git commit -m "Add failing test for token refresh after timeout"

Then there is review. Read generated code with the same attention you would give a colleague — no more, or you hand back the gain, but no less either. The specific risk is code that is syntactically flawless and conceptually wrong: exactly the class of error a distracted read fails to catch. A second, independent look helps: the /code-review command reviews the changes with a subagent that hasn't seen the conversation, and you can also ask for a targeted review against the spec written during planning. Either way, ask it to focus on correctness and leave style alone: a reviewer asked to find problems always finds some, and chasing them all produces needless abstractions and tests.

Chapter 10

In automation and in a team: CI, shared settings, limits and costs

Outside the interactive session, you use Claude Code through claude -p: it runs one request, prints the result and exits, with a non-zero exit code if the run fails. That's the form that slots into scripts, git hooks and CI pipelines. In automated use a few options become almost mandatory: --allowedTools pre-approves the tools the job needs, --permission-mode dontAsk refuses everything else instead of waiting for a confirmation nobody will give, --max-turns caps the iterations, --output-format json returns an object you can parse. With --bare the run skips loading hooks, skills, MCP servers and CLAUDE.md, and behaves the same on every machine; in this mode authentication goes through an API key or your cloud provider's credentials, not your subscription login.

A non-interactive run with pre-approved tools, everything else denied, and a cap on iterations.bash
claude -p "Run the test suite and fix failing tests. Reply OK or FAIL." \
  --allowedTools "Read,Edit,Bash(npm test *)" \
  --permission-mode dontAsk \
  --max-turns 20 \
  --output-format json

A security detail not to overlook: without --bare, a -p run loads the hooks in the project's .claude/settings.json and connects the servers in .mcp.json without showing either the trust dialog or the approvals. On a repository whose content you don't control, that means running configuration someone else wrote. More generally, before you leave a run unattended, the documentation suggests five questions: does it know what “done” means? Can it check its own work? What is it allowed to touch? What stops it? Where does the result go, and who signs it off? The last answer must always include a person, for anything that can't be undone.

For GitHub there's an official integration, the anthropics/claude-code-action GitHub Action. The quickest way to set it up is the /install-github-app command inside Claude Code, which walks you through installing the GitHub app and the credential as a repository secret, and opens a pull request with the workflow file for you to review before merging. It works in two ways: interactive, where the agent responds when someone mentions @claude in an issue or pull request, and automated, where it runs a fixed prompt on an event, including on a schedule. Keys always go in secrets, never in the repository; the workflow gets only the permissions it needs; and proposed changes are reviewed before merging. An integration with GitLab CI/CD is documented as well.

In team work, configuration splits by scope. In the repository, under version control, go CLAUDE.md, .claude/settings.json with shared permissions and hooks, .mcp.json, and project skills and subagents. Personal exceptions go in .claude/settings.local.json and CLAUDE.local.md, which stay out of git. Above everything, managed settings deployed by the organisation take precedence and can't be overridden: they're the place for security policy. When the same key appears in several files the highest level wins, while lists such as permission rules are combined.

That leaves costs. Usage is measured in tokens and varies a lot with the model you choose, the size of the codebase and your habits: long sessions that pile up different tasks, subagents, automated runs. /usage shows the session's consumption and, for subscribers, the plan's limits; the dollar figure it reports is an estimate, not the bill. The habits that cut spending are the same ones that improve results: /clear between unrelated tasks, a short CLAUDE.md, precise requests, explicit caps on automated runs. Prices, plans, models and even the defaults change often: for anything numeric or configuration-related, the reference is the official documentation, not a course — this one included.

Final testpass mark 80%

Get your certificate

Pass the final test by answering at least 80% of the questions correctly. The certificate is issued automatically and stays verifiable online through a permanent link: it is an Open Badge compliant with the 2.0 standard, ready to be added to LinkedIn and to digital skills wallets.

No sign-up needed. Your name will appear on the certificate; the email is only used to identify the credential and avoid issuing duplicates.

Your name and the course title will be publicly visible on the credential verification page, which anyone holding the link can open.

FAQ

Certificate, badge and course access

Is the course free? Do I get a certificate?

Yes to both. The course is free in full: the content, the final test and the certificate, with no paid modules and no payment method ever requested. When you pass the final test with at least 80% correct answers you receive a Certificate of Attendance in your name, with a verification code, a public page anyone can consult to confirm it's genuine, a downloadable PDF and an Open Badge you can add to your LinkedIn profile. Your name and email are requested only at the end, if you decide to take the test.

Do I need a paid subscription to follow the course?

Not to read it and pass the test. To put what it teaches into practice, yes, because Claude Code isn't free: it requires a paid Claude subscription, a Claude Console account with API credit, or access through a supported cloud provider. The course is written so that every concept makes sense even if you haven't tried it, but trying it on a project of your own is the best way to make it stick. Plans and prices change: check Anthropic's official pages.

Is this an official Anthropic course?

No. It's an independent course by Rinoova Academy, not affiliated with or endorsed by Anthropic, and the certificate is issued by Rinoova. Claude and Claude Code are Anthropic products. Every technical detail in the course has been checked against the official Claude Code documentation, which remains the reference for anything to do with the tool's commands, configuration and behaviour.

How long is the course, and how are the hours calculated?

About two hours. Ten chapters and roughly 5,300 words of technical text, which take a little under an hour of careful reading, plus eleven command and configuration blocks to try on your own project, and the final test. It's not a video course: you can read it at your own pace, stop and pick it up again whenever you like.

What are the prerequisites?

The course is intermediate level: it assumes you use the terminal and git in your daily work and have development experience in at least one language. You don't need to have used a coding agent before, or to know the Model Context Protocol: where it's needed, the course introduces it and points to the dedicated course.

What happens if I don't pass the final test?

You can retake it. The threshold is 80% and the questions cover every chapter, so if part of it isn't clear it's worth going back to that chapter and reading it again before trying once more. The certificate is issued only on a pass, and it is never issued twice for the same course to the same person.

Is the course up to date? Claude Code changes often.

Yes, and that's exactly why it's written the way it is. The concepts — context, instructions, permissions, planning, verification — are stable, and they're what the test focuses on. The details that change fastest, such as versions, prices, models and defaults, are deliberately left out, and where a behaviour may evolve the text says so and points to the official documentation. The date of the last revision is shown at the top of the page.

Where to go next

More Open courses