Claude Code — practice exercise
Claude Code — practice exercise
Difficulty: intermediate · Estimated duration: 45–60 minutes
You will write the commands, files and choices a developer makes to run Claude Code well on a small project, and check them against the reference solution. Everything is written down, so no API or subscription spend is needed. If you have Claude Code installed and want to see a step working, running it is optional and uses your own account.
The project: an invented order-tracking service in a git repository, with a test suite, a weekly release procedure and a CI pipeline.
| Stage | What you practise | Minutes |
|---|---|---|
| 1 | Steering the loop, managing context, resuming or forking | 12 |
| 2 | Memory, a skill and a read-only subagent | 14 |
| 3 | A headless CI step and its permission mode | 12 |
| 4 | Settings scopes and two workflows | 12 |
Stage 1 — Context and sessions
Skills: CCDVF-U3.T1.LO1.S1 Minutes: 12
For each situation, write the command or action you would take and one sentence saying why.
- Claude has started rewriting the whole order parser, but you only wanted the currency rounding fixed.
- You are deep into renaming the order statuses. The window is nearly full, and you want the summary to keep the list of files still to rename.
- An edit Claude made to the order model broke three tests, and you want the code and the conversation back to how they were before it.
- You want to see what is taking up the context window.
- Yesterday's session has a working fix. You want to try a riskier approach today without disturbing it.
Stage 2 — Memory, skills and subagents
Skills: CCDVF-U3.T1.LO1.S2 Minutes: 14
- The team pastes the same 60-line release checklist into chat every Friday. Write the path of a skill that holds it (skills live at
.claude/skills/<name>/SKILL.md) and its first lines: frontmatter with adescription, then the start of the body. - Write the frontmatter for a project subagent, saved under
.claude/agents/, that audits the repository for hard-coded secrets. It must be able to read and search files (Read,Grep,Glob) but never edit or write them. - In two sentences, explain to a teammate why the checklist should not live in CLAUDE.md, and what auto memory is for instead.
Stage 3 — A headless CI step
Skills: CCDVF-U3.T1.LO1.S3 Minutes: 12
- Write a shell step for CI that asks Claude Code to run the test suite (
npm test) and explain any failures. The step must:- stream its progress as newline-delimited events, so the CI log shows it live;
- never wait for an approval (set the mode with
--permission-mode); - pre-approve only the test command;
- fail the pipeline if the run fails.
- Name the permission mode you would use in each place, with one reason:
- (a) your laptop, while you review every change;
- (b) the CI runner;
- (c) a throwaway container with no network access, for an experiment.
Stage 4 — Settings and workflows
Skills: CCDVF-U3.T1.LO1.S4 Minutes: 12
- Put each setting in the right file:
- (a) the team's shared permission rules;
- (b) your preferred theme, in every project;
- (c) a model override you want only in this project.
- Before a risky schema change, you want Claude to read the code and propose a plan without touching disk. Write the command that starts the session that way.
- You need to learn how orders are archived, but you do not want dozens of file reads in your main context. Write the one-line request you would send.
Acceptance checks
- Every Stage 1 answer names a command or action and says why.
- The skill sits under
.claude/skills/with a cleardescription(frontmatter fields are optional;descriptionis the one that matters most), and the subagent restricts its tools with an allowlist. - The CI step uses
-p, requests streamed output (stream-jsonwith--verbose), uses a mode that refuses prompts, pre-approves only the test command, and fails on a non-zero exit. - Each setting is in a file whose scope matches who it should apply to.
- The plan-mode command and the delegation request each match the workflow the stage asks for.
Reference solution
Stage 1
| Situation | Action |
|---|---|
| 1 | Interrupt and redirect to the rounding fix only |
| 2 | /compact with a focus on the files still to rename |
| 3 | /rewind to the checkpoint before the edit |
| 4 | /context |
| 5 | Fork yesterday's session, which leaves the original unchanged |
You can interrupt at any point to steer. Compaction keeps requests and key snippets but can lose early detail, so focus it. /rewind rolls code and conversation back to a checkpoint; checkpoints cover file changes only, not remote systems. Resuming would append to the original session; forking copies it into a new session ID.
Stage 2
Path: .claude/skills/release-checklist/SKILL.md
---
name: release-checklist
description: >-
Friday release steps for
the order service
---
1. Confirm main is green...---
name: secrets-audit
description: >-
Finds hard-coded secrets
in the repository
tools: Read, Grep, Glob
---A skill's body loads only when it is used, while CLAUDE.md loads in every session. Auto memory is what Claude writes itself from your corrections, not a place for procedures. The tools field is an allowlist, so this subagent cannot edit or write files.
Stage 3
claude -p "Run npm test and \
explain failures" \
--output-format \
stream-json --verbose \
--permission-mode \
dontAsk --allowedTools \
"Bash(npm test)" || exit 1- (a) acceptEdits: reads and edits go through while you review the changes.
- (b) dontAsk: anything that would prompt is denied, which suits locked-down CI.
- (c) bypassPermissions: only in an isolated container or VM like this one.
Stage 4
- (a)
.claude/settings.json, committed so everyone gets the same permission rules. - (b)
~/.claude/settings.json, which applies to you in every project. - (c)
.claude/settings.local.jsoninside the project, which changes nothing for your teammates.
Start the session with claude --permission-mode plan: Claude reads files and proposes a plan, but makes no edits until you approve.
A good request: "Use a subagent to investigate how orders are archived and report a summary." The subagent reads files in its own context window and returns only the findings; its requests still count toward your usage limits.
Sources
Claude Code documentation: how Claude Code works, commands, memory, skills, subagents, headless mode, permission modes, settings and common workflows.