The project starts protecting itself
Local tests only help when someone remembers to run them. Continuous Integration runs the test suite automatically on push and pull request, so broken code is harder to merge unnoticed. The module asks for a simple test workflow, not deployment automation. Claude Code generates the file; you inspect the YAML line by line.
Key ideaA green check only matters if failure turns it red. CI is not proved by one passing run; it is proved when a deliberate test failure makes the workflow fail.
The expected workflow shape
The notes describe what the generated workflow should look like, area by area.
| Workflow area | Expected behavior |
|---|---|
| Location | .github/workflows/ci.yml at the repository root. |
| Triggers | Run on push to branches and pull request to main. |
| Job | One job named test running on ubuntu-latest. |
| Python setup | Use the exact project Python version from CLAUDE.md or the repo configuration. In the demo context, this is Python 3.11. |
| Dependencies | Install the project requirements, including test dependencies such as pytest and httpx when the test suite needs them. |
| Test command | Run pytest in a way that returns a non-zero exit code when tests fail. |
Reject these immediately
Each of these patterns can make a workflow look healthy while it hides the one thing CI exists to show. The prompt library adds one more: piping pytest output in a way that swallows its exit code.
| Red flag | Why it is dangerous |
|---|---|
| continue-on-error | Allows a failing test step to appear acceptable. |
| || true | Turns a failing command into a successful shell command. |
| --exit-zero or similar flags | Can force a tool to exit successfully even when problems exist. |
| latest Python or vague version | May test on a different version than students run locally. |
| Missing push or PR trigger | The workflow may not run when it actually matters. |
| Deployment steps | This module is not deploying the app; deployment adds risk and scope that the lecture did not ask for. |
Generate with the shortcuts already ruled out
Prompt C1 names the exact artifact and blocks every false-green shortcut in advance. C2 then reviews the file against a nine-point checklist and returns Pass or Concern with evidence for each, which you compare against your own manual search of the file.
Prompt C1 from the libraryCreate .github/workflows/ci.yml for the Module 4 Task Tracker. Project context: - Python 3.11 FastAPI backend. - Tests run with pytest -v. - Dependencies are installed from requirements.txt. - This module is not deploying the app. Requirements: - Run on push and pull_request. - Use actions/checkout and actions/setup-python. - Use Python 3.11, not latest or an unspecified version. - Install dependencies with python -m pip install --upgrade pip and pip install -r requirements.txt. - Run pytest -v. - Do not include deployment steps. - Do not use continue-on-error. - Do not use || true. - Do not use --exit-zero. - Do not hide pytest failures behind pipes or summary steps. Constraints: - Show me the diff before applying. - If .github/workflows does not exist, create it at the repository root, not inside app/ or another subfolder. Output format: First summarize the workflow. Then show the YAML diff.
The green-red-green proof
One passing run proves only that the workflow can pass. To prove it catches failures, break one test on purpose, watch CI turn red for the reason you intended, then revert and watch it return to green without touching the workflow.
- 1Greennormal suite passes
- 2Redbreak one test on a branch; CI fails for that reason
- 3Green againrevert; workflow unchanged
| Step | What to do | What proves it worked |
|---|---|---|
| Green | Push the workflow and confirm the normal test suite passes. | GitHub Actions shows a successful run. |
| Red | Deliberately break one test on a branch and push. | The CI run fails and the log shows the same kind of test failure you would expect locally. |
| Green again | Revert the deliberate break and push again. | CI returns to green without changing the workflow to hide the failure. |
Read with careBreak only a test or a test expectation, never production code, and keep the red run intentional and reversible. Save links or screenshots of all three runs as your evidence.
When the demo goes wrong
The notes say the recording shows realistic friction. The workflow can land in the wrong folder, or CI can fail because test dependencies such as pytest or httpx are missing from requirements. Both are real problems in the repository. Fix the repo truthfully, by moving the file or adding the dependency, and do not hide the failure with one of the red-flag patterns.
Key ideaA red run you did not plan is information. Fix its cause; never silence it.
Key takeaways
- CI should run on push and pull request, on the project’s exact Python version, and fail when pytest fails.
- continue-on-error, || true, --exit-zero and vague versions are reasons to reject the file.
- Prove CI with green, an intentional red, and a restored green.
- When CI fails for a real reason, fix the repo; do not hide the failure.