Create a Verification Loop Script for AI Coding Agents
Generate a lightweight bash verification pipeline that validates linters, scoped test suites, and git diff budgets before an agent declares a task complete.
Agent prompt for Claude Code and Cursor
You get: Script File, agent Instruction and risk Note
Prompt
mkdir -p .agents/skills/create-a-verification-loop-script-for-ai-coding-agents && curl -sL "https://prompts-gpt.com/prompts/create-a-verification-loop-script-for-ai-coding-agents/raw" -o .agents/skills/create-a-verification-loop-script-for-ai-coding-agents/SKILL.mdAct as a principal DevOps automation engineer. Your job is to draft a single, deterministic POSIX bash verification loop script that an AI coding agent like Claude Code or Cursor must run and pass before submitting changes.
First, ask me 3 brief questions and wait for my response:
1. What is your repository language runtime and package manager?
2. What exact commands run your linter and your scoped unit test suite?
3. What is your maximum allowed line-diff budget (additions plus deletions) for a single agent session?
Rules for the script once I answer:
- Fail immediately on the first non-zero exit code using strict bash error handling.
- Enforce the diff budget using git diff to prevent hallucinated refactors.
- Provide clear standard error messages pointing directly to the failed verification step.
- Return an overall exit code 0 only when lint, tests, and diff boundaries all pass.
Output format:
- Script File: Complete bash script in a single code block.
- Agent Instruction: A two-line system directive instructing the agent how to run and interpret this script.
- Risk Note: One sentence identifying what this loop cannot catch.Example output
Tips and common edits
Why this works
- Uses strict bash error settings (set -euo pipefail) to block cascading silent failures.
- Calculates total diff changes through git to stop agents from rewriting unrelated codebase files.
- Provides exit codes mapped to specific failures so the agent knows whether to fix linting or scope.
Use this prompt in Claude Code, Cursor, or Codex when setting up guardrails for autonomous background runs. Have your build commands and diff limits ready.
Common edits
- Change the diff check to compare against origin/main instead of HEAD for multi-commit branches.
- Add a typecheck step like tsc --noEmit or pyright before running unit tests.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Audit AI Code Diffs for Performance Regressions
This prompt scans code changes for silent performance killers like N+1 queries, unindexed filters, and memory leaks before you merge them.
Convert User Stories into Strict Acceptance Test Assertions
This prompt transforms vague business requirements into precise Given-When-Then test assertions with exact HTTP status codes and JSON payload structures for AI coding agents.
Create Automated Verification Loops for Long-Running Coding Agents
Generate a deterministic shell pipeline that combines linting, isolated unit testing, and diff-budget monitoring to validate AI agent code changes.
Design a Sandbox Security Policy for Autonomous Coding Agents
Generate a rigorous security policy for autonomous agents to define allowed shell commands, file access boundaries, and network restrictions.
Generate Database Migration and Rollback Specs for Coding Agents
Get a structured migration and rollback plan that ensures data integrity and zero-downtime execution for your database schema changes.
Generate Reproducible Bug Fix Specs for Coding Agents
Get a standalone reproduction test script and a precise technical plan to fix a bug, ensuring your AI agent stays focused and avoids unnecessary file changes.
- Audit PR Git Diffs for Scope Creep and Churn
- Create a Legacy Module Reference Sheet for Coding Agents
- Evaluate Coding Agent Test Suites for False Positive Traps
- Review AI Pull Requests for Phantom Imports and Bloat
- Structure a Multi-Repo Dependency Update Brief for Coding Agents
- Turn Bug Reports into Agent Reproduction Scripts and Fix Briefs