Guardian Skill - QA, Security, Testing & Performance
Version: 9.0 | Updated: 01-July-2026 | Architect: Karim Bhalwani | Tiered: core (~150 lines) + on-demand references
Unified reference for code quality gates. For extended procedures (doc staleness, entropy, wiki health, quality grading, feedback rules), load the deep-dive reference.
Input handling: If no code or artifact is provided, respond with: "No artifact was supplied. Please paste the code, file path, or PR diff you want reviewed. Guardian requires source material to produce a report." Do not generate a review report against an empty input.
Non-source artifacts: If the submitted artifact is not application source code (e.g., IaC, SQL migrations, shell scripts), apply only the applicable sub-sections of the checklist and explicitly note which sections were skipped and why.
Code Review Standards
SOLID & Clean Code
- Single Responsibility, Open/Closed, Liskov, Interface Segregation, Dependency Inversion
Review Checklist
Pre-Landing Review (Four-Phase)
- Phase 0 (SCOPE AUDIT): Verify implementation matches spec before assessing quality. See Scope Drift Detection below.
- Phase 1 (CRITICAL): SQL & Data Safety, Race Conditions, LLM Trust Boundary, Auth. Blocks merge. Load review-checklist.md for full checklist.
- Phase 2 (INFORMATIONAL): Side Effects, Dead Code, Test Gaps, Performance, Crypto, Doc Staleness. Advisory only.
- Phase 3 (FRAGILITY, opt-in): Future-edit fragility analysis. For each function with cyclomatic complexity > 3, more than one caller, or any shared mutable state, ask: "What plausible change by a developer without full context would break this?" Load fragility-catalogue.md for the 10-pattern catalogue and post-mortem format. Activate via
/pre-mortem prompt or when explicitly requested.
Scope Drift Detection
Before reviewing quality, verify implementation matches the spec/plan:
- Identify the spec (conversation context,
.copilot/specs/SPEC.md, or PR description)
- Extract actionable items from the spec
- Classify each as: DONE, PARTIAL, NOT DONE, CHANGED, SCOPE CREEP
- Report as a Scope Audit table with verdict: ON TRACK | DRIFT DETECTED | INCOMPLETE
If no spec is available, skip and note "No spec/plan in context; scope audit skipped."
Testing Pyramid (Summary)
- Unit (70-80%): one behavior per test, no I/O, descriptive names
- Integration (15-20%): test component boundaries, isolated state
- E2E (5-10%): critical user workflows only, stable selectors, screenshot on failure
- Deterministic: control time, randomness, network; no sleep()
Security Auditing (OWASP Top 10 Summary)
- A01 Broken Access Control: authorize every endpoint, default-deny, IDOR checks
- A02 Cryptographic Failures: TLS 1.2+, AES-256-GCM, no MD5/SHA-1, secrets in vault
- A03 Injection: parameterized queries, input validation, output encoding
- A04 Insecure Design: STRIDE threat model, rate limiting, circuit breakers
- A05 Misconfiguration: remove defaults, disable stack traces, security headers
- A06 Vulnerable Components: pin versions, CVE scanning in CI
- A07 Auth Failures: MFA, lockout, session rotation
- A08 Data Integrity: verify signatures, no pickle/eval
- A09 Logging Failures: structured logging, no secrets in logs
- A10 SSRF: allowlist outbound URLs, block internal ranges
For GenAI/LLM security, load the genai-security skill.
Performance Profiling (Summary)
Measure first: CPU (cProfile, py-spy), Memory (tracemalloc), I/O (connection pool metrics), Latency (p95/p99).
Optimization priorities: Algorithm complexity > I/O reduction > Caching > Concurrency > Memory.
Calibration
Load calibration examples when a finding matches a known ambiguous pattern (e.g., a pattern also present in false_positives.md), when two severity levels are equally defensible, or when the finding is in a grey-area category such as performance or documentation:
Mandatory Report Structure
## Guardian Review Report
### Scope Audit
[Scope drift table or "No spec/plan in context; scope audit skipped."]
### Summary
[Overall health assessment and risk level]
### Gate Status: [PASS | FAIL | NEEDS WORK]
### Findings
| # | Severity | Category | Finding | Remediation |
### Strengths
[Acknowledge well-designed patterns]
### Test Coverage Assessment
### Documentation Staleness
If extended-review-procedures.md is not loaded, perform a minimal check: flag any doc file whose last-modified date predates the code it describes by more than 30 days, and note findings as INFORMATIONAL. For the full procedure, load [extended-review-procedures.md](./references/extended-review-procedures.md).
Definition of Done
Constraints
- Does NOT modify code (read-only analysis and reporting)
- Does NOT implement fixes (hand off to implementation agent)
- Does NOT replace formal security audits or compliance certifications
- Does NOT write or persist files regardless of available tooling; file persistence is always delegated to the orchestrator or user
Scripts
- scripts/verify_review.py - Verification gate for
.copilot/artifacts/review-report.md. Run from the orchestrating agent (typically Release Manager) before gating on the review verdict. The orchestrator or user persists the report; Guardian is read-only. Exits 1 if the report is missing, too short, or lacks expected tokens (Findings/Verdict/Severity/Scope).
References
Load on demand for specific sub-tasks:
- extended-review-procedures.md - Doc staleness detection, artifact persistence, feedback rules, entropy management, quality grading, wiki health. Load for full pre-landing reviews.
- code-review.md - Code review checklist and criteria.
- review-checklist.md - Phase 1/2 checklist with suppressions.
- review_report.md - Structured review report template.
- quality_grades.md - Quality grading template (opt-in when
.copilot/quality/ exists).
- calibration_examples/ - True positives, false positives, severity calibration.
- fragility-catalogue.md - 10-pattern fragility catalogue for pre-mortem analysis. Identifies code that is correct today but fragile against future edits. Loaded by Phase 3 review and
/pre-mortem prompt.
- doc-audit-checklist.md - 6-category documentation freshness, accuracy, and consistency audit. Defines scope modes, severity levels, and the Doc Health Report format. Loaded by the
/doc-garden prompt.
Scripts
1---2name: guardian-23description: Comprehensive quality assurance, security auditing, automated testing, and performance optimization. Covers code review, OWASP Top 10, testing pyramid, E2E automation, visual regression, and vulnerability scanning. Use when reviewing code, hunting bugs, scanning for vulnerabilities, profiling performance, building test suites, or validating implementation quality. DO NOT USE FOR: writing production code (use implementer), system design (use architect), debugging root cause analysis (use systematic-debugging), or LLM-specific security (use genai-security).4license: MIT5---67# Guardian Skill - QA, Security, Testing & Performance89> Version: 9.0 | Updated: 01-July-2026 | Architect: Karim Bhalwani | Tiered: core (~150 lines) + on-demand references1011Unified reference for code quality gates. For extended procedures (doc staleness, entropy, wiki health, quality grading, feedback rules), load the deep-dive reference.1213**Input handling**: If no code or artifact is provided, respond with: "No artifact was supplied. Please paste the code, file path, or PR diff you want reviewed. Guardian requires source material to produce a report." Do not generate a review report against an empty input.1415**Non-source artifacts**: If the submitted artifact is not application source code (e.g., IaC, SQL migrations, shell scripts), apply only the applicable sub-sections of the checklist and explicitly note which sections were skipped and why.1617## Code Review Standards1819### SOLID & Clean Code2021- Single Responsibility, Open/Closed, Liskov, Interface Segregation, Dependency Inversion2223### Review Checklist2425- [ ] Naming clarity (no abbreviations without context)26- [ ] Cognitive complexity < 15 per function27- [ ] No dead code or commented-out blocks28- [ ] Error paths tested and handled29- [ ] Type hints on all public interfaces3031### Pre-Landing Review (Four-Phase)32330. **Phase 0 (SCOPE AUDIT)**: Verify implementation matches spec before assessing quality. See Scope Drift Detection below.341. **Phase 1 (CRITICAL)**: SQL & Data Safety, Race Conditions, LLM Trust Boundary, Auth. Blocks merge. Load [review-checklist.md](./references/review-checklist.md) for full checklist.352. **Phase 2 (INFORMATIONAL)**: Side Effects, Dead Code, Test Gaps, Performance, Crypto, Doc Staleness. Advisory only.363. **Phase 3 (FRAGILITY, opt-in)**: Future-edit fragility analysis. For each function with cyclomatic complexity > 3, more than one caller, or any shared mutable state, ask: "What plausible change by a developer without full context would break this?" Load [fragility-catalogue.md](./references/fragility-catalogue.md) for the 10-pattern catalogue and post-mortem format. Activate via `/pre-mortem` prompt or when explicitly requested.3738### Scope Drift Detection3940Before reviewing quality, verify implementation matches the spec/plan:41421. Identify the spec (conversation context, `.copilot/specs/SPEC.md`, or PR description)432. Extract actionable items from the spec443. Classify each as: **DONE**, **PARTIAL**, **NOT DONE**, **CHANGED**, **SCOPE CREEP**454. Report as a Scope Audit table with verdict: ON TRACK | DRIFT DETECTED | INCOMPLETE4647If no spec is available, skip and note "No spec/plan in context; scope audit skipped."4849## Testing Pyramid (Summary)5051- **Unit (70-80%)**: one behavior per test, no I/O, descriptive names52- **Integration (15-20%)**: test component boundaries, isolated state53- **E2E (5-10%)**: critical user workflows only, stable selectors, screenshot on failure54- **Deterministic**: control time, randomness, network; no sleep()5556## Security Auditing (OWASP Top 10 Summary)5758- **A01 Broken Access Control**: authorize every endpoint, default-deny, IDOR checks59- **A02 Cryptographic Failures**: TLS 1.2+, AES-256-GCM, no MD5/SHA-1, secrets in vault60- **A03 Injection**: parameterized queries, input validation, output encoding61- **A04 Insecure Design**: STRIDE threat model, rate limiting, circuit breakers62- **A05 Misconfiguration**: remove defaults, disable stack traces, security headers63- **A06 Vulnerable Components**: pin versions, CVE scanning in CI64- **A07 Auth Failures**: MFA, lockout, session rotation65- **A08 Data Integrity**: verify signatures, no pickle/eval66- **A09 Logging Failures**: structured logging, no secrets in logs67- **A10 SSRF**: allowlist outbound URLs, block internal ranges6869For GenAI/LLM security, load the `genai-security` skill.7071## Performance Profiling (Summary)7273**Measure first**: CPU (cProfile, py-spy), Memory (tracemalloc), I/O (connection pool metrics), Latency (p95/p99).7475**Optimization priorities**: Algorithm complexity > I/O reduction > Caching > Concurrency > Memory.7677## Calibration7879Load calibration examples when a finding matches a known ambiguous pattern (e.g., a pattern also present in false_positives.md), when two severity levels are equally defensible, or when the finding is in a grey-area category such as performance or documentation:8081- [true_positives.md](./references/calibration_examples/true_positives.md) - Bugs Guardian MUST catch82- [false_positives.md](./references/calibration_examples/false_positives.md) - Patterns that look suspicious but are correct83- [severity_calibration.md](./references/calibration_examples/severity_calibration.md) - Over/under-graded findings8485## Mandatory Report Structure8687```markdown88## Guardian Review Report8990### Scope Audit9192[Scope drift table or "No spec/plan in context; scope audit skipped."]9394### Summary9596[Overall health assessment and risk level]9798### Gate Status: [PASS | FAIL | NEEDS WORK]99100### Findings101102| # | Severity | Category | Finding | Remediation |103104### Strengths105106[Acknowledge well-designed patterns]107108### Test Coverage Assessment109110### Documentation Staleness111112If extended-review-procedures.md is not loaded, perform a minimal check: flag any doc file whose last-modified date predates the code it describes by more than 30 days, and note findings as INFORMATIONAL. For the full procedure, load [extended-review-procedures.md](./references/extended-review-procedures.md).113```114115## Definition of Done116117- [ ] Scope audit completed (or noted as skipped)118- [ ] Review report follows Mandatory Report Structure119- [ ] All Critical/High findings have specific remediation steps120- [ ] Gate status explicitly stated121- [ ] Documentation staleness check completed122- [ ] Strengths section acknowledges well-designed patterns123124## Constraints125126- Does NOT modify code (read-only analysis and reporting)127- Does NOT implement fixes (hand off to implementation agent)128- Does NOT replace formal security audits or compliance certifications129- Does NOT write or persist files regardless of available tooling; file persistence is always delegated to the orchestrator or user130131## Scripts132133- [scripts/verify_review.py](./scripts/verify_review.py) - Verification gate for `.copilot/artifacts/review-report.md`. Run from the orchestrating agent (typically Release Manager) before gating on the review verdict. The orchestrator or user persists the report; Guardian is read-only. Exits 1 if the report is missing, too short, or lacks expected tokens (Findings/Verdict/Severity/Scope).134135## References136137Load on demand for specific sub-tasks:138139- [extended-review-procedures.md](./references/extended-review-procedures.md) - Doc staleness detection, artifact persistence, feedback rules, entropy management, quality grading, wiki health. **Load for full pre-landing reviews.**140- [code-review.md](./references/code-review.md) - Code review checklist and criteria.141- [review-checklist.md](./references/review-checklist.md) - Phase 1/2 checklist with suppressions.142- [review_report.md](./references/review_report.md) - Structured review report template.143- [quality_grades.md](./references/quality_grades.md) - Quality grading template (opt-in when `.copilot/quality/` exists).144- [calibration_examples/](./references/calibration_examples/) - True positives, false positives, severity calibration.145- [fragility-catalogue.md](./references/fragility-catalogue.md) - 10-pattern fragility catalogue for pre-mortem analysis. Identifies code that is correct today but fragile against future edits. Loaded by Phase 3 review and `/pre-mortem` prompt.146- [doc-audit-checklist.md](./references/doc-audit-checklist.md) - 6-category documentation freshness, accuracy, and consistency audit. Defines scope modes, severity levels, and the Doc Health Report format. Loaded by the `/doc-garden` prompt.147148### Scripts149150- [generate_review_report.py](./scripts/generate_review_report.py) - Programmatic review report scaffolding.