Automated Code Review and Security Linting Agent Specification
Author an exhaustive system prompt specification for an autonomous agent reviewing pull requests, checking static security, and grading diffs.
Deploy this template when deploying autonomous code review bots across continuous integration pipelines. It establishes precise comment syntax, severity grading rubrics, and automated approval guardrails.
Role: Staff Developer Tools Architect & Application Security Engineer
Context
- Codebase Tech Stack: {{primary_programming_languages}}
- Compliance & Hardening Standards: {{security_compliance_standards}}
- Integrated Static Analysis Tooling: {{linters_and_ast_tools}}
- Critical Path Repository Rules: {{repository_tiering_rules}}
- Prohibited Code Patterns: {{forbidden_api_patterns}}
- Developer Interaction Voice: {{reviewer_personality_tone}}
Task
Design a multi-stage system prompt specification for an autonomous pull request review agent that validates patch diffs, enforces security postures, detects anti-patterns, and delivers actionable, non-pedantic feedback to software engineers.
Method
- Establish the agent's diff parsing methodology across {{primary_programming_languages}}, isolating context lines from modified blocks.
- Ingest diagnostic outputs from {{linters_and_ast_tools}} to avoid duplicating baseline syntax warnings.
- Formulate deep vulnerability scanning heuristics aligned with {{security_compliance_standards}}.
- Cross-reference imported dependencies and method calls against {{forbidden_api_patterns}}.
- Calibrate review depth and approval permissions based on repository classification in {{repository_tiering_rules}}.
- Specify the feedback generation schema ensuring tone adheres strictly to {{reviewer_personality_tone}}.
- Define deterministic criteria for when the agent may post an approving review versus applying a blocking change request.
- Establish thread-resolution tracking logic to re-evaluate updated commits efficiently.
Constraints
- MUST NEVER post blocking reviews on stylistic preferences that are not defined in {{linters_and_ast_tools}}.
- MUST flag any detected secret, token, or insecure pattern matching {{forbidden_api_patterns}} with a critical security block.
- Feedback comments must always provide a concrete before-and-after code suggestion.
- Review execution latency must not exceed defined CI/CD budget constraints.
Output format
Deliver an engineering specification organized into:
- Agent System Identity & Review Philosophy (Markdown prose)
- Diff Parsing & Context Ingestion Pipeline (Step-by-step pipeline definition)
- Severity Rubric: Blocking vs. Non-blocking Criteria (Structured matrix)
- Pull Request Review Comment Templates (Markdown examples with diff blocks)
- Autonomous Approval & Merge Guardrail Rules (Numbered logic statements) Limit output to 1000-1500 words.
Self-review
- Ensure all rule definitions account for every language in {{primary_programming_languages}}.
- Verify that the feedback templates match {{reviewer_personality_tone}} without being condescending.
- Confirm clear separation between automated warnings and critical blockers.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.