Copy as MarkdownCtrl+⇧+C
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.
📚 Teaching Aid
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, andargument-hintfrontmatter - 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 - Configure advanced hook types (prompt, http, agent) and leverage the full set of 20+ hook events
Chapter Structure
- The CLAUDE.md Configuration Hierarchy: three levels, user vs project scope, @import syntax, .claude/rules/ directory, /memory command
- Path-Specific Rules with Glob Patterns: YAML frontmatter path scoping, glob syntax (**/*.test.tsx), token efficiency, decision framework
- Custom Skills with Frontmatter: context: fork, allowed-tools, argument-hint; skills vs CLAUDE.md decision framework
- Plan Mode vs Direct Execution: when to use each, the Explore subagent, combining modes, the exam's decision tree
- Iterative Refinement Techniques: concrete I/O examples, test-driven iteration, interview pattern, single message vs sequential
- Advanced Hook Types and Events: prompt hooks (LLM evaluation), http hooks (POST to endpoints), agent hooks (subagent verification), the full 20+ event catalog beyond Chapter 14's five core events
- Claude Code in CI/CD Pipelines: the
-pflag,--output-format json+--json-schema, CLAUDE.md as CI context, avoiding duplicate comments - Multi-Pass Review Architecture: self-review limitations, per-file + cross-file passes, session context isolation, confidence self-reporting
- Session Management. Resume, Fork, and Recovery: named sessions, fork_session, /compact, informing resumed sessions about changes
Prerequisites
- Chapter 14: General Agents (CLAUDE.md basics from Lesson 5, Skills from Lessons 8-9, Settings hierarchy from Lesson 14, command hooks from Lesson 15)
- 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, advanced hooks, 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)