// 46 tips tagged "ci-cd"
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Instead of piecing together a CI pipeline from Stack Overflow snippets, tell Claude to read your project and generate a GitHub Actions workflow that actually matches your stack — the right language version, your real test commands, proper caching, and the services your tests depend on.
Unlike --system-prompt which replaces everything, --append-system-prompt layers additional instructions on top of your existing CLAUDE.md and default system prompt. Keep all your project context and just add a temporary constraint or focus area for one session.
When running Claude Code in automation or headless mode, pass --max-turns to cap the number of agentic steps it takes before stopping. This prevents runaway operations, controls costs, and ensures Claude finishes within a predictable budget of actions.
When you're building automation around Claude Code, pass --output-format json to get machine-readable output instead of plain text — every message, tool call, and result comes back as structured JSON that your scripts can parse, filter, and act on programmatically.
Restrict which tools Claude has access to with --allowedTools and --disallowedTools — make Claude read-only by blocking Edit and Write, prevent command execution by blocking Bash, or whitelist only the specific tools a CI job needs. Fine-grained control for safety-conscious workflows.
In CI pipelines and trusted automation environments where no human is available to approve tool calls, pass --dangerously-skip-permissions so Claude Code runs fully autonomously — reading, writing, and executing without permission prompts. Only use this in environments you control.
Tell Claude to read your project's test runner, linter, build tools, and deployment target, then generate a GitHub Actions workflow that actually matches your stack — not a generic template, but a pipeline built from what your project uses.
Set --max-turns to cap how many tool-use steps Claude takes before stopping and waiting for your input — useful when you want autonomous work within a boundary, not an unbounded run that changes 50 files before you can review.
Limit which tools Claude Code can use by setting allowedTools in your project settings or passing --allowedTools on the CLI — restrict to read-only for code reviews, block file writes in CI, or limit to specific MCP tools for safety.
Use separate CLAUDE.md files or conditional sections so Claude follows different rules depending on the context — strict and non-destructive in CI, verbose in development, focused on code quality during reviews — all from the same project.
dontAsk mode auto-denies every tool that isn't on your allow list, making Claude fully non-interactive and safe for locked-down CI environments.