The prompt
Score 10 of 10, Excellent
Use it when Your tests only run when someone remembers to run them, and you want a coding agent to add CI that runs them on every pull request.
- {{default_branch}}
- {{ci_file}}
- {{check_commands}}
- {{version_files}}
- {{package_manager}}
- {{services}}
- {{env_vars}}
- {{off_limits}}
- {{pr_permission}}
Full prompt and why it works
Prompt
Goal: Add a CI workflow that runs our checks on every pull request to {{default_branch}} and on every push to it, so that no change merges without the tests having run. Context: - CI system and the file to create: {{ci_file}} (for example .github/workflows/ci.yml for GitHub Actions, or .gitlab-ci.yml) - Checks to run, in order: {{check_commands}} - Runtime version: read it from {{version_files}}; do not choose one yourself. - Package manager and lockfile: {{package_manager}} - Services the tests need, with versions: {{services}} - Environment variables the tests need (names and non-secret values only): {{env_vars}} Constraints: - Add or change only CI configuration files. Do not touch application code, tests, dependency versions or {{off_limits}}. If a check fails in CI because of the code, report it; do not fix it in this task. - Install from the lockfile with the clean-install command (for example npm ci), and cache dependencies keyed on the lockfile, using the setup action's built-in cache where there is one. - Trigger on pull_request, not pull_request_target, so code from forks never runs with write access. Give the workflow read-only permissions (permissions: contents: read) unless a step needs more, and explain why if it does. - Pin third-party actions to a release tag or a commit SHA. Set a timeout on each job, and cancel superseded runs on the same branch with a concurrency group. - Run services as service containers with health checks, not with sleeps. - Do not add deploy, release or publish steps, and do not create or print secrets. If a check needs a secret, stop and tell me its name. Done when: - {{ci_file}} exists and passes a workflow linter if one is available (for example actionlint). - The same commands pass locally in a clean checkout with the versions the workflow uses. - On a pull request, the checks run and show green. You may push a branch and open a draft pull request only if I say so here: {{pr_permission}}. Otherwise stop after the local run and give me the exact steps to open one. Verify: run the checks locally, read the output and iterate on the workflow until it is right. Then report in this format: Workflow (the file in full), Jobs (one line each), Cache key, Run time, Commands run with the last 20 lines of their output, and For you to do, such as making the check required in the branch protection settings. If the project files disagree about the runtime version, stop and ask which one is right.
Variables
- {{default_branch}}
- The branch pull requests target, for example main.
- {{ci_file}}
- The workflow file to create, for example .github/workflows/ci.yml.
- {{check_commands}}
- The commands to run, in order, for example "npm run lint, npm test, npm run build".
- {{version_files}}
- Where the project declares its runtime version, for example .nvmrc, .python-version, pyproject.toml or go.mod.
- {{package_manager}}
- For example "npm with package-lock.json" or "uv with uv.lock".
- {{services}}
- For example "Postgres 16 and Redis 7", or "none".
- {{env_vars}}
- Variable names and safe test values, for example "DATABASE_URL pointing at the CI Postgres", or "none".
- {{off_limits}}
- Files or settings that must not change, for example the existing deploy workflow.
- {{pr_permission}}
- "yes, push branch ci-setup and open a draft pull request" or "no, stop after the local run".
Why it works
- What to avoid. Only CI files change, so a failing check is reported rather than fixed by editing the code the CI is meant to test.
- What good looks like. Done means the workflow passes a linter, the same commands pass in a clean checkout, and a pull request shows green, each a check the agent can run.
- If unsure. A needed secret or conflicting runtime versions stop the agent with a question instead of a guess.