Skip to main content

Chapter 18: Claude Code for Teams, CI/CD & Advanced Configuration

Claude Code becomes exponentially more valuable when it is configured for a team, embedded in automated pipelines, and equipped with path-aware conventions. This chapter transforms Claude Code from a solo developer tool into shared engineering infrastructure.

What You'll Learn

By the end of this chapter, you'll be able to:

  • Configure the three-level CLAUDE.md hierarchy (user, project, directory) and diagnose team configuration issues
  • Create path-specific rules with glob patterns in .claude/rules/ YAML frontmatter
  • Build custom skills with context: fork, allowed-tools, and argument-hint frontmatter
  • Choose between plan mode and direct execution based on task characteristics
  • Apply iterative refinement techniques (concrete examples, test-driven iteration, interview pattern)
  • Integrate Claude Code into CI/CD pipelines with -p, --output-format json, and --json-schema
  • Design multi-pass review architectures that overcome single-session attention limitations
  • Manage sessions with --resume, fork_session, and /compact

Chapter Structure

  1. The CLAUDE.md Configuration Hierarchy — three levels, user vs project scope, @import syntax, .claude/rules/ directory, /memory command
  2. Path-Specific Rules with Glob Patterns — YAML frontmatter path scoping, glob syntax (**/*.test.tsx), token efficiency, decision framework
  3. Custom Skills with Frontmatter — context: fork, allowed-tools, argument-hint; skills vs CLAUDE.md decision framework
  4. Plan Mode vs Direct Execution — when to use each, the Explore subagent, combining modes, the exam's decision tree
  5. Iterative Refinement Techniques — concrete I/O examples, test-driven iteration, interview pattern, single message vs sequential
  6. Claude Code in CI/CD Pipelines — the -p flag, --output-format json + --json-schema, CLAUDE.md as CI context, avoiding duplicate comments
  7. Multi-Pass Review Architecture — self-review limitations, per-file + cross-file passes, session context isolation, confidence self-reporting
  8. Session Management — Resume, Fork, and Recovery — named sessions, fork_session, /compact, informing resumed sessions about changes

Prerequisites

  • Chapter 14: General Agents (Claude Code fundamentals)
  • Chapter 16: Spec-Driven Development with Claude Code

Chapter Deliverables

  • A complete CLAUDE.md hierarchy for a team monorepo
  • Four path-specific rule files with glob patterns
  • Three custom skills with context: fork, allowed-tools, and argument-hint
  • A working CI/CD pipeline with Claude Code integration (-p, --output-format json)
  • A multi-pass review workflow script

Certification Exam Coverage

This chapter covers Claude Certified Architect — Foundations exam domains:

  • Domain 3 (20%): Task Statements 3.1-3.6 — CLAUDE.md hierarchy, custom skills, path rules, plan mode, iterative refinement, CI/CD
  • Domain 4 (20%): Task Statement 4.6 — Multi-pass review architecture
  • Directly covers Sample Questions 6, 10, 11, 12
  • Covers exam Scenarios 2 (Code Generation) and 5 (Claude Code for CI)