Skip to main content
Free courses · 13 lessons

Claude Code Tips: A Short Course From a Real Repo

Thirteen Claude Code lessons from a real repo: CLAUDE.md, permissions, skills, hooks, subagents, tokens, MCP, headless runs and settings, doc-checked.

By Matthews WongReviewed on Checked against Claude Code v2.1.301

Key takeaway

Claude Code is Anthropic's agentic coding tool for the terminal. These thirteen lessons show how one real repository steers it: a CLAUDE.md that sets the rules, permissions that remove friction, skills that teach house style, hooks that check every edit, subagents that work in parallel without collisions, habits that keep context small, MCP servers, headless runs, parallel worktrees and safe rewinds.

Free, no sign-up, no certificate. Built from the setup that runs this website.

Start the course

What you will be able to do

  • Write a CLAUDE.md and settings that steer Claude Code without slowing you down.
  • Teach project rules once with skills, and enforce them automatically with hooks.
  • Run subagents in parallel safely, and keep context and token use under control.

Who it is for

Developers who already use Claude Code for small tasks and want it to follow their project's rules on bigger ones.

Before you start

  • Claude Code installed and signed in, and a git repository to practise in.
  • Basic terminal and JSON familiarity.
Where should I start?

Five questions to find your starting lesson

Already know some of this? Answer five questions from across the course and get a lesson to start at. It is only a suggestion: every lesson stays open.

  1. 1.You add src/api/CLAUDE.md, start Claude in the repo root and ask it to summarise the README. /context does not list the new file. Why?
  2. 2.Your skill's description says "Helps with blog posts". You ask Claude to add a figure to a post, and the skill never loads. What fixes it?
  3. 3.You just fixed an auth bug and want to start a README for an unrelated tool. What is the cheapest next move?
  4. 4.A claude -p run under --permission-mode dontAsk tries a Bash command that is not in --allowedTools. What happens?
  5. 5.The team commits a model choice in .claude/settings.json, and you want a different one only for your own sessions. Where do you set it?
Lessons

Claude Code tips

  1. CLAUDE.md File Example: Global, Project and Local LayersA real CLAUDE.md file example: the managed, user, project and local layers, how they load, @imports, and what belongs in a skill or a hook instead.10 min
  2. Claude Code settings.json Example: Allow, Ask and Deny RulesA real Claude Code settings.json example: which settings file wins, how allow, ask and deny rules match, why deny wins, and how to keep .env out of reach.12 min
  3. Claude Code Skills Examples: Write One That Actually TriggersClaude Code skills examples from a real repo: SKILL.md frontmatter, why the description decides triggering, what loads when, and skills vs CLAUDE.md.10 min
  4. Claude Code Hooks Examples: Guardrails That Always RunClaude Code hooks examples from a real repo: events, matchers, the JSON on stdin, exit codes and JSON output, and when a hook should block or only advise.12 min
  5. Claude Code Subagents Examples: When to Delegate a TaskClaude Code subagents examples from a real repo: what a subagent sees, the name, description and tools fields, when to delegate, and safe parallel fan-out.12 min
  6. Claude Code Tips to Save Tokens: Context, Compaction, ScopeClaude Code tips to save tokens: read /context, compact or clear at the right time, scope reads, load skills on demand and keep exploration in subagents.11 min
  7. Add an MCP Server to Claude Code: Scopes and PermissionsAdd an MCP server to Claude Code with claude mcp add: http vs stdio, local, project and user scope, .mcp.json, MCP permission rules, and the risks.12 min
  8. Claude Code Headless Mode: claude -p With a Pass/Fail GateRun Claude Code headless with claude -p: output formats, permission modes, allowedTools and dontAsk, plus a verification gate script that closes the loop.13 min
  9. Claude Code Worktrees: Run Parallel Sessions Without CollisionsRun parallel Claude Code sessions with git worktrees: what claude --worktree creates, what it isolates, what stays shared, cleanup, and subagent isolation.11 min
  10. Claude Code Rewind and Plan Mode: Undo Risky ChangesHow to undo Claude Code changes: what /rewind restores and what it cannot, how plan mode holds edits for review, and why git stays your real safety net.11 min
  11. Claude Code Settings Scopes: Which File Wins, What Is SharedClaude Code settings scopes explained from a real repo: user, project, local and managed files, which one wins, what git shares, and how lists merge.10 min
  12. Where to Put Instructions in Claude Code: A Decision GuideWhere to put instructions in Claude Code: CLAUDE.md, rules, skills, custom commands, hooks or auto memory. A decision table built on a real repo.11 min
  13. Claude Code Git Workflow: Safe Commits, PRs and Push RulesA Claude Code git workflow that keeps main clean: commit and PR attribution, feature branches, and a deny rule or hook that stops git push and force-push.12 min
Course check

10 questions from across the course

One question from each part of the course, in order. Get 8 of 10 right and you have its core. Every answer links to the lesson that teaches it, and nothing is locked either way.

  1. 1.You add src/api/CLAUDE.md, start Claude in the repo root and ask it to summarise the README. /context does not list the new file. Why?
  2. 2.The team's .claude/settings.json denies Bash(rm *). Your settings.local.json, a higher level, allows Bash(rm -rf dist). Claude runs rm -rf dist. What happens?
  3. 3.A long skill keeps its most important rule at the very end. After compaction, Claude stops following that rule. Why?
  4. 4.Your PreToolUse hook should stop edits to .env. It spots one, prints a reason to stderr and exits 1. What happens to the edit?
  5. 5.Early in a session you typed: always run the linter before committing. After auto-compaction, Claude stops doing it. What is the fix?
  6. 6.Which rule pre-approves every tool from a server named puppeteer?
  7. 7.A claude -p run under --permission-mode dontAsk tries a Bash command that is not in --allowedTools. What happens?
  8. 8.You press Esc twice, but the prompt box holds half-typed text. What happens?
  9. 9.Your local settings file sets a key that your organization also sets in managed settings. Which value does Claude Code use?
  10. 10.A 40-step release procedure matters only on release day. Where does it belong?