Primary Domains Tested
- ▸Domain 3 — Claude Code Mastery: Headless mode, CLI flags, and CI/CD integration patterns
- ▸Domain 4 — API and Optimization: Batch API vs. standard API, structured output, and cost management
Build a CI/CD pipeline that uses Claude Code for automated code review, test generation, and deployment validation. Covers headless mode, Batch API selection, multi-file review strategies, and structured output.
Quick Reference
You are integrating Claude Code into your team's CI/CD pipeline. The pipeline runs on GitHub Actions and handles two workflows: (1) pre-merge code review — triggered on every pull request, must complete within 5 minutes, and posts review comments directly on the PR; and (2) overnight code quality reports — runs at 2 AM on the main branch, produces a comprehensive report covering code quality trends, test coverage gaps, and architectural drift. The pre-merge review must be fast, actionable, and have a low false-positive rate. The overnight report can take longer but must be thorough.
Your implementation uses Claude Code in headless mode (non-interactive) within Docker containers. Key challenges include: running Claude Code without a terminal (stdin), choosing the right API mode for each workflow (standard vs. Batch API), handling large pull requests with many files, producing structured output that integrates with existing review tools, and ensuring reviews are idempotent when the pipeline re-runs on the same PR.