All study guides

CCA-F · Study guide

Claude Code workflows and automation

Mind map

Mind map — Claude Code

🗺 Claude Code

  • Memory
    • CLAUDE.md
  • Automation
    • Headless mode
    • CI/CD
    • GitHub Actions
  • Control
    • Hooks
    • Permissions
  • Extend
    • MCP servers
    • Subagents
  • Use cases
    • Code review
    • Refactor
    • Tests
Summary

Claude Code — TL;DR

Claude Code is Anthropic's agentic coding tool for the terminal and CI. It reads a `CLAUDE.md` file for project memory — conventions, commands, and context it should always know. It can run non‑interactively (headless) for automation and CI/CD (e.g. GitHub Actions). Hooks run *your* commands at lifecycle points (before/after a tool runs) to enforce policy or capture logs. It connects to external systems via MCP, and permissions control what it may do without asking. Use it for code review, refactors, test generation, and pipeline automation — with scoped permissions and human approval for risky operations.

Summary

Headless & CI patterns

In CI, Claude Code runs non‑interactively: a prompt in, structured output out, wired into pipelines like GitHub Actions. The discipline that makes it safe: scoped permissions (allowlist exactly what it may run), no broad shell or filesystem access, secrets kept out of context, and hooks or exit codes to enforce policy (fail the build on violations). High‑value jobs: automated review comments, test generation, refactor/migration checks, changelog updates — always landing behind human review.

Cheat sheet

Claude Code — cheat sheet

  • CLAUDE.md: project memory — conventions, build/test commands, do's & don'ts. Keep it current.
  • Headless / non‑interactive: run in scripts and CI/CD (e.g. GitHub Actions).
  • Hooks: run your commands at lifecycle events (PreToolUse / PostToolUse) to enforce rules or log.
  • MCP in Claude Code: add external tools/data via MCP servers.
  • Permissions: allow/deny tool actions; require approval for destructive ones.
  • Great for: code review · refactoring · test generation · migrations · pipeline automation.
  • Subagents: delegate focused sub‑tasks to keep the main context clean.
  • Safety: scope file/exec access to the project; never grant broad shell access blindly.
Cheat sheet

CLAUDE.md best practices

  • Keep it short and current — it loads every session, so every line costs tokens.
  • Include: build/test/lint commands, code conventions, architecture pointers, explicit do's & don'ts.
  • Update it when conventions change — stale memory is worse than none.
  • Check it into git so the whole team (and CI) shares the same project memory.
  • Don't paste whole documents — point to paths instead; Claude Code can read files on demand.
  • Separate project memory (repo) from personal preferences (user-level memory).
Mnemonic

Mnemonic — “MHPC”

“MHPC” — the four levers of Claude Code: Memory (CLAUDE.md), Hooks (lifecycle commands), Permissions (what it may do), Connectors (MCP). Automate confidently when all four are set — automate blindly when none are.

Mnemonic

Mnemonic — “SCAR”

Before you automate with Claude Code, check “SCAR”Scope permissions, CLAUDE.md current, Approve destructive actions, Review outputs. Automation without SCAR leaves one.

Practise this domain with original, exam-style questions.

Start practising free