AnthropicClaude Certified Architect – Foundations2026-100 Prerequisites
Make command runs reproducible in CI
Completed by the knowledge check
Learning objective
Apply essential CLI, Git, and CI/CD concepts: flags, exit codes, shared versus personal configuration, and environment variables
Core idea
A reproducible automated run depends on more than its prompt. The command line selects a mode and options, Git decides which content is recorded, configuration files and environment variables reach the process, and the exit status tells the caller whether the process succeeded. In CI/CD, a successful agent invocation is one step, not proof that the code passes tests or that a release ran.
How it works
Flags and task text
A flag changes how a command runs. In claude -p "Review the authentication module", claude is the program, -p (long form --print) selects non-interactive execution, and the quoted text is the task. Long flags can take values: --output-format json selects machine-readable output. --tools and --allowedTools look alike but differ; 0.6 separates them. The flags and GitHub Actions inputs for unattended jobs are taught in 3.6.1, the JSON envelope and --json-schema in 3.6.2, and --bare context loading in 3.6.3.
Exit status
Claude Code exits with code 0 on success and a non-zero code when the run fails, so scripts can branch on it. An invalid flag is reported to stderr before the run starts; a failure inside the run, such as missing authentication, is printed as the result on stdout. GitHub Actions sets a check-run status from an action’s exit code: 0 is success, anything else failure.
Working tree, index, commit
Git separates the working tree, the index (staging area) and commits. Editing changes the working file; git add snapshots it into the index; git commit records the staged snapshot. Edit the file again after git add and the two differ. git status shows pending state and git diff --cached compares staged changes with the last commit. CI evaluates recorded content, so a local run that passed against an unstaged file says nothing about the revision CI checks.
Shared and personal configuration
| File | Audience |
|---|---|
~/.claude/settings.json | You, across projects |
.claude/settings.json | Everyone on the project; committed |
.claude/settings.local.json | You, in this project only |
Claude Code keeps .claude/settings.local.json out of Git when it creates the file; create it by hand and you add it to .gitignore yourself. The same shared-versus-personal split for MCP servers — .mcp.json against ~/.claude.json — is taught in 2.4.1.
Environment variables
Environment variables are values the execution environment gives a process, separate from the prompt and from the repository. In GitHub Actions, env can be set at workflow, job or step scope, and secrets are stored apart from ordinary configuration variables, so a credential reaches the step that needs it without being committed. Referencing credentials as ${VAR} in shared MCP configuration is taught in 2.4.2.
Key distinctions and trade-offs
- Flag versus prompt: asking for JSON in prose is not
--output-format json. - Exit status versus output: output carries data; the exit status carries success.
- Working tree versus commit: a check covers only the content it inspects.
Architecture / decision scenario
A CI job runs claude -p "Summarize the authentication change" --output-format json on a pull request after passing locally. In CI it fails: the developer’s terminal credentials do not exist there. The wrapper preserves the non-zero exit code although a result was printed, and the team supplies the API key to that step from GitHub Actions secrets instead of committing it to .claude/settings.json. Then git status shows a supporting file was edited but never staged, so the local success described different content.
Common exam traps
- Treating non-empty stdout as success.
- Assuming a successful agent run proves the code passes CI.
- Confusing
--allowedToolswith tool availability. - Assuming edits after
git addupdate the staged snapshot. - Relying on personal settings or terminal credentials in CI.
- Committing a secret because the job needs it.
What to remember
Read flags apart from the task, preserve the exit status, and know which Git content is being evaluated. Commit shared configuration deliberately, keep personal overrides local, and supply environment values to the step that needs them.
Knowledge check
A CI wrapper runs claude -p "Summarize the authentication change" --output-format json and must decide whether the run succeeded. In one run without credentials, a result was still printed. What should the wrapper check?
A developer runs git add auth.py, edits auth.py again, runs the tests locally, and then runs git commit without staging again. The local tests passed; CI fails. Which content of auth.py did the commit record?
git addgit add snapshots the file into the index, and git commit records the index. The later edit stays in the working tree only, so the local tests checked content the commit does not contain; git status would have shown the unstaged change.A team wants every member to share a pre-approval for Bash(npm test *) in their project. One developer also wants an extra rule that applies only to them, only in this project. Where does each rule belong?
~/.claude/settings.json , personal in .claude/settings.local.json.claude/settings.json , personal in .claude/settings.local.json.claude/settings.json , personal in ~/.claude/settings.json.claude/settings.local.json , personal in .claude/settings.json.claude/settings.json is committed and applies to everyone on the project; .claude/settings.local.json applies to one person in one project and stays out of Git. ~/.claude/settings.json belongs to one person but applies across all of their projects, which is broader than asked.A Claude Code step works on a developer’s laptop through their terminal login, but fails in GitHub Actions because no credentials exist there. The step needs an API key without exposing it in the repository. How should it receive the key?
.claude/settings.json , committed with the project.claude/settings.local.json on the developer’s machineenvenv at step scope hands the value to the one step that needs it. A committed settings file exposes the key, a local settings file never reaches the runner, and a configuration variable is ordinary configuration, stored apart from secrets.References
- Anthropic, CLI reference
- Anthropic, Run Claude Code programmatically
- Anthropic, Claude Code settings
- Git, gittutorial
- GitHub, Store information in variables
- GitHub, Setting exit codes for actions
- GitHub, Using secrets in GitHub Actions