Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
Follow one prompt edit from a branch to a merge: version prompts and the model pin like code, keep the API key in GitHub Secrets, gate changes by path, let Claude review the diff, and leave the merge to a person.
What you will learn
- Decide what belongs in git for a Claude app (prompts, tool schemas, model pin, evals, CLAUDE.md) and what stays out (the API key)
- Map changed files to the checks they need, so a prompt edit triggers evals
- Ask Claude to review a diff and treat the reply as advice, not an approval
- Add the Claude Code GitHub Action to pull requests with the key in GitHub Secrets
Before you start
- Git and GitHub fundamentals
- The Claude Messages API: your first call
Every change to a Claude app starts in git. A teammate edits the system prompt of a returns helper, opens a pull request, and the change has to pass checks and a review before it ships. This article follows that one change, and shows where Claude fits into the road without taking the final decision.
A change travels three steps
- A teammate edits the system prompt, on a branch in git.
- A pull request opens. Checks run, and Claude reviews the change.
- A person looks at everything and approves. Then the change merges.
Every change to a Claude app takes the same road.
What goes in git
The code, of course. But also everything else that decides how the app behaves:
- the prompts (here
prompts/returns.txt), - the tool schemas,
- the model pin,
- the evals,
- and the CLAUDE.md file with the team's standards.
A prompt change is a code change, and git keeps its whole history. One thing stays out: the API key. It lives in GitHub Secrets, and the .env file that holds it locally is listed in .gitignore, so it never gets committed:
.env
__pycache__/
The road itself is the usual one: branch, commit, pull request, review, merge. Keep commits small, one idea each, so a reviewer can follow the change. If git itself is new to you, start with Git and GitHub fundamentals.
Who decides the merge
Checks come first. A change that needs evals can't merge until the evals pass. Claude's review points at risks, but it isn't an approval. So merging needs passing checks and a person's approval.
change_gate.py: which checks does a change need?
"""Decide which checks a change needs before it can merge."""
# which part of the repo needs which check
RULES = [
("prompts/", "evals"),
("tools/", "evals"),
("src/", "tests"),
]
def required_checks(changed_files):
checks = []
for path in changed_files:
for prefix, check in RULES:
if path.startswith(prefix) and check not in checks:
checks.append(check)
return checks
- A table maps each path prefix to the check it needs. Prompts and tools need evals; source code needs tests.
- Every changed file is matched against the prefixes, and each check is collected once.
- So a prompt edit comes back as
evals.
claude_review.py: advice, then a merge status
"""Ask Claude to review a diff. A person decides."""
from stand_in import MODEL
SYSTEM = "You are a code reviewer. Name the main risk."
def review(client, diff):
msgs = [{"role": "user", "content": diff}]
r = client.messages.create(
model=MODEL, max_tokens=200,
system=SYSTEM, messages=msgs,
)
return r.content[0].text
def merge_status(checks_passed, human_approved):
if not checks_passed:
return "blocked, checks failed"
if not human_approved:
return "waiting for a human approval"
return "ready to merge"
- The system prompt gives Claude the role of a reviewer.
- The diff goes to Claude in a normal
messages.createcall, and the reply comes back as text. It's advice and nothing more. merge_statusnever looks at Claude's reply. Failed checks block; passing checks without a person's approval wait.
Gate and review: what the run printed
run_all.py sends two changes through the gate and the review. Change 1 deletes the shipping line from prompts/returns.txt; change 2 is a one-line fix in src/handler.py. The project runs against a stand-in (the real Anthropic SDK on an httpx mock transport), so the review replies and the check results are scripted for the demo.
show("change 1, a prompt edit", ["prompts/returns.txt"], PROMPT_DIFF, False, False)
show("change 2, a code fix", ["src/handler.py"], CODE_DIFF, True, False)
print("change 2, after approval")
print(" merge:", claude_review.merge_status(True, True))
change 1, a prompt edit
needs: evals
claude: test model reply: This diff removes the shipping line.
merge: blocked, checks failed
change 2, a code fix
needs: tests
claude: test model reply: No risks found in this diff.
merge: waiting for a human approval
change 2, after approval
merge: ready to merge
- The prompt edit needs evals. Claude's review flags the removed shipping line. The checks failed, so the merge is blocked.
- The code fix needs tests. Claude finds no risks, but the merge still waits for a person.
- After the approval, it's ready to merge.
Three ways to bring Claude Code in
| Where | How it runs |
|---|---|
| A script or CI step | claude -p runs without a person, prints the reply and exits. --allowedTools lists the tools it may use without asking. |
| GitHub | The Claude Code GitHub Action. Mention @claude in a pull request or issue to ask for help, or give it a prompt and it runs on the workflow's events. The key comes from GitHub Secrets. |
| Automatic review | Anthropic also offers a Code Review feature that reviews pull requests with no workflow file to write; check the Claude Code docs for which plans include it. |
In GitHub, the CLAUDE.md file in the repo holds the standards Claude follows, so Claude reads the same rules your team does. For a full headless review bot with JSON findings, see a Claude Code review bot in CI.
claude-review.yml: the Action on every pull request
The workflow file lives in .github/workflows/. The project follows the Claude Code docs page "Claude Code GitHub Actions":
name: Claude review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: "Review this pull request for risks."
claude_args: "--max-turns 5"
- It runs when a pull request is opened or gets new commits (
synchronize). - The first step checks out the repository; the second runs the Claude Code GitHub Action, version 1.
- The key comes from
secrets.ANTHROPIC_API_KEY, never from the file itself. - Because there's a
prompt, the action runs on its own without waiting for an@claudemention. By default the result appears in the workflow run log.
Notice the permissions: the job can read the code and the pull request. It can't merge anything. The merge stays with a person, exactly as in merge_status. For the GitHub Actions basics behind this file, see CI with GitHub Actions.
Common mistakes
- Letting Claude's review replace a human. Merging needs passing checks and a person.
- Keeping prompts out of git because "they aren't code". Prompts change behaviour as much as code does. Version and gate them like code.
- Putting the API key in the workflow file. Never. Keep it in GitHub Secrets and keep
.envin.gitignore. - Running only unit tests on a prompt edit. Map
prompts/andtools/to evals, so a harmless-looking edit can't skip them.
Quick recap
| Rule | In the project |
|---|---|
| Everything but secrets goes in git | prompts/returns.txt in the repo, .env in .gitignore |
| Every change passes its checks | change_gate.py maps paths to tests or evals |
| Claude's review is advice | claude_review.review returns text only |
| A person approves the merge | merge_status waits for a human approval |
Try it yourself
Add a rule for an evals/ folder to RULES (an edit to the eval cases should need a person's review of the cases themselves, say "eval review"). Then pass a change that touches both prompts/ and src/ and check that required_checks returns both checks, each once.
Related course on Udemy
Claude Certified Developer - Foundations (CCDV-F) Exam Prep
Build and ship Claude apps: the API, agents, tools and MCP, prompts, evals, security and model choice.View on Udemy ↗: Claude Certified Developer - Foundations (CCDV-F) Exam Prep (paid course, opens in a new tab)Related posts
CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
Three needs in one repo: a test command, a rule that Claude must never read .env, and a shared deploy skill. See which file each belongs in, how the settings layers merge, and what a plugin manifest carries.
Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
Pack a support team's ticket-triage routine into one skill folder, then watch three requests load one, two or all three levels: the catalog, the SKILL.md body, and a script whose code never enters the context.
One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
Change one line in a repo and ask where it lands. A small resolver for bookshop-bot shows that a new model id in settings.json reaches only CI, a prompt bump reaches dev and CI, and a prod block edit reaches only prod.
Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
A coding agent is told to clean up the data folder and picks rm -rf data/. A PreToolUse hook sees the call before the tool runs: tests and single-file deletes pass, a force push asks a person, and rm -rf, DROP TABLE and a write to .env are denied with a reason.