CC-301c · Module 3
CI/CD Integration
4 min read
Local hooks and CI/CD pipelines are complementary layers of the same quality system. Local hooks catch errors before they leave the developer's machine — fast feedback, low cost, high iteration speed. CI/CD catches errors that local hooks missed or that only manifest in the full build environment — integration failures, cross-platform issues, dependency conflicts. The optimal setup runs both: local hooks as the first line of defense, CI/CD as the safety net.
The integration pattern connects them through git. Claude's auto-commit (triggered by the local stop hook passing all checks) pushes to a feature branch. The push triggers a CI/CD pipeline (GitHub Actions, GitLab CI, or equivalent). If CI fails, the developer gets a notification. The developer can then start a new Claude Code session, point it at the CI failure, and let it fix the issue — which triggers another auto-commit, another push, and another CI run.
The advanced integration uses Claude Code as a GitHub Action. When a PR is opened or updated, the Claude Code GitHub Action runs automatically — reviewing the diff, checking for issues that static analysis misses, and posting review comments. This is not a replacement for human review. It is a first pass that catches the obvious issues: unused imports, missing error handling, inconsistent naming, broken type contracts. The human reviewer then focuses on architecture, logic, and design — the things AI code review cannot yet evaluate reliably.
The deployment gate pattern extends CI further. After all tests pass and the code review is approved, the CI pipeline can trigger a deployment to staging, run integration tests against the staging environment, and — if everything passes — auto-merge the PR. This is the end-to-end loop: Claude writes code locally → hooks verify locally → auto-commit and push → CI verifies remotely → Claude reviews the PR → tests pass → auto-merge. Human involvement is limited to the architectural review step.