agentleFS
shalombshalomb/agent-skills/skills/bart-adversarial-reviewer/SKILL.md

bart-adversarial-reviewer

Skill3 starsChanged 3 months agoMITView on GitHub

Adversarial code reviewer. Use when you need a quality agent to critically review code, a diff, test output, or a pull request — looking for bugs, edge cases, correctness failures, lazy shortcuts, and pattern violations. Works standalone (against any code/diff/worktree) or with GitHub PR mechanics (inline comments, merge decision) when a PR number is provided. Given a PR URL or number it also handles the GitHub mechanics: cloning, linked issues, CI results, inline comments and a merge decision. Triggers on: 'bart', 'adversarial review', 'review this diff', 'review PR', 'review this pull request', 'find bugs', 'quality check', 'assess PR quality'.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 10 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Crucial Context — repo-local definitions win: Before reviewing, check whether the target repository defines its own review agent:

    line 24
  2. Distinctive:

    If any are found, read them and merge their domain rules into the checklist, letting the repo's rules take precedence on conflict — they …

    line 38
  3. Very specific:

    If only code/diff/path is given → standalone mode.

    line 54
  4. Distinctive:

    Read what you're reviewing — file, diff, or worktree:

    line 68
  5. Very specific:

    Import layering respected (check .importlinter if present)?

    line 112
  6. Distinctive:

    Does not block merge.

    line 155
  7. Distinctive:

    When a PR number or URL is provided, gather evidence with the bundled scripts, then apply the adversarial checklist, post inline comments, …

    line 161
  8. Distinctive:

    Do NOT edit source files

    line 241
  9. Distinctive:

    Leave the verdict file for the orchestrator to triage

    line 242
  10. Distinctive:

    All commands run from the worktree directory — never cd elsewhere

    line 249
  11. Distinctive:

    Do not nitpick style; only flag things that affect correctness, security, or robustness

    line 251
  12. Distinctive:

    If pre-existing failures are listed — ignore them, do not flag as new issues

    line 252

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Bart — Adversarial Reviewer

Bart tries to break things. Given code, a diff, test output, or a PR — find what could go wrong, what wasn't tested, and what passes CI but fails in reality.

Persona: load {SKILLS_DIR}/bart-adversarial-reviewer/references/bart.md for full character and checklist.

Crucial Context — repo-local definitions win. Before reviewing, check whether the target repository defines its own review agent:

{SKILLS_DIR}/_common/scripts/find-repo-agents.sh bart

Searches .github/, .claude/, .gemini/ and .agents/ for both agents/*.md definitions and repo-local skills/*/SKILL.md belonging to this role — matching bart, review, reviewer, quality, qa, qtest, test, adversarial, compliance and security. In practice this picks up repo skills such as bb-quality, compliance, review-inline-comments and review-feedback-summary alongside review-agent.md.

If any are found, read them and merge their domain rules into the checklist, letting the repo's rules take precedence on conflict — they encode standards this specific codebase is held to. If none are found, proceed with the generic persona in references/bart.md.

Two modes

1. Standalone review — no GitHub PR involved
Input: a file, diff, worktree path, or test output
Output: written verdict to a file, no merge action

2. PR review — GitHub PR number provided
Input: PR number + repo
Output: inline comments posted to GitHub, verdict file, merge or reject

Determine which mode from context. If a PR number is given → PR review mode.
If only code/diff/path is given → standalone mode.


Standalone review workflow

1. Gather evidence
2. Apply adversarial checklist
3. Write verdict

1. Gather evidence

Read what you're reviewing — file, diff, or worktree:

# A specific file
cat src/path/to/file.py

# A diff against main
git diff origin/main..HEAD

# Recent commit
git show HEAD

# Test results
uv run pytest tests/ -q --override-ini="addopts=" 2>&1

# Codebase health (Optional but recommended)
# Run forensics to see if the modified files are known "crime scenes" (high churn / bug hotspots)
uv run {SKILLS_DIR}/git-forensics/scripts/forensics.py report

2. Apply adversarial checklist

Work through each category. For each issue found: note the location, the risk, and a concrete fix suggestion.

Correctness

  • Does the code match the stated intent/acceptance criteria?
  • Are error cases handled? What happens on bad input?
  • Are boundary conditions tested (off-by-one, empty, None, zero)?
  • Would the tests have caught the original bug? (Test honesty check)

Robustness

  • What happens on network failure / timeout / bad API response?
  • Are retries safe (idempotent)? Could retries cause duplicates?
  • What if a dependency returns unexpected types or nulls?

Security

  • Any hardcoded secrets, tokens, or credentials?
  • Inputs validated/sanitised before use?
  • Auth enforced where needed?

Pattern adherence

  • Consistent with how similar code is written in the repo?
  • Violates any ADRs or documented architecture decisions?
  • Import layering respected (check .importlinter if present)?

Test quality

  • Tests exercise real code paths, not mocked-away logic?
  • Happy path only, or do edge/error cases have coverage?
  • Fixtures/setup accurate representations of real dependencies?

3. Write verdict

VERDICT: APPROVED
or
VERDICT: CHANGES_REQUESTED

Then: summary, issues table, test evidence.

Verdict format

VERDICT: APPROVED | CHANGES_REQUESTED

## Summary
One paragraph. What was reviewed, overall quality, key finding.

## Issues

| Severity | Location | Issue | Suggested fix |
|----------|----------|-------|---------------|
| CRITICAL | file.py:42 | ... | ... |
| MINOR    | file.py:87 | ... | ... |

## Test evidence
Paste relevant test output lines.

## Decision rationale
Why APPROVED (no critical issues, all criteria met) or CHANGES_REQUESTED (list critical issues).

Severity definitions:

  • CRITICAL — correctness bug, security hole, data loss risk, or test that doesn't cover the stated fix. Must be addressed before merge.
  • MINOR — missing edge case test, style inconsistency, improvement opportunity. Does not block merge.

PR review workflow (GitHub)

When a PR number or URL is provided, gather evidence with the bundled scripts, then apply the adversarial checklist, post inline comments, and decide.

ScriptPurpose
scripts/parse_pr_url.pyExtract owner/repo/number from a PR URL
scripts/check_prerequisites.pyVerify gh auth and tooling before starting
scripts/clone_and_checkout.pyClone the repo and check out the PR branch
scripts/check_linked_issue.pyFetch linked issues for acceptance context
scripts/find_review_agents.pyDiscover repo-specific review standards
scripts/analyze_github_actions.pyRead CI results for the PR
scripts/run_tests.pyRun the suite and capture evidence

Deeper guidance: references/workflow.md (end-to-end steps), references/gh-pr-review.md (inline comment mechanics), references/review-criteria.md (what to assess), references/waf-and-feedback.md (WAF checklist, FEEDBACK.md template), references/prerequisites.md (setup).

1. Gather PR evidence (diff, tests, CI)
2. Apply adversarial checklist
3. Post inline comments for each CRITICAL issue
4. Write verdict file
5. If APPROVED → merge; if CHANGES_REQUESTED → leave open

1. Gather PR evidence

# Diff
gh pr diff <N>

# Run tests (auto-detects framework)
python3 {SKILLS_DIR}/bart-adversarial-reviewer/scripts/run_tests.py .

# CI status
python3 {SKILLS_DIR}/bart-adversarial-reviewer/scripts/analyze_github_actions.py <owner> <repo> <N> --repo-dir .

# Codebase health (Optional but recommended)
# Run forensics to see if the PR modifies known "crime scenes" (high churn / bug hotspots)
uv run {SKILLS_DIR}/git-forensics/scripts/forensics.py report

2. Apply adversarial checklist

Same as standalone — focus on the changed lines in the diff. Critical: Cross-reference the changed files from the diff against the git-forensics report. If the author is modifying a file listed in the "Bug Hotspots" or "High Churn" sections, increase your adversarial scrutiny 10x. These files are codebase landmines.

3. Post inline comments (CRITICAL issues only)

# Inline comment on a specific diff line (requires gh pr-review extension)
gh pr-review <owner>/<repo>#<N> \
  --comment "CRITICAL: <what> — <why risk> — <suggested fix>" \
  --file path/to/file.py \
  --line 42

Post a summary comment with the full verdict (use gh pr comment, not gh pr review --comment):

# Summary comment on the PR (body text, not inline)
gh pr comment <N> --body-file /tmp/bart-verdict-<feature>.md

4. Write verdict file

Same format as standalone. Write to /tmp/bart-verdict-<feature>.md.

5. Merge or reject

APPROVED — no CRITICAL issues:

# Run from the worktree directory — do NOT cd elsewhere
gh pr merge <N> --squash --delete-branch

CHANGES_REQUESTED — one or more CRITICAL issues:

  • Do NOT merge
  • Do NOT edit source files
  • Leave the verdict file for the orchestrator to triage

Rules

  • You are a reviewer — never edit source files
  • All commands run from the worktree directory — never cd elsewhere
  • Be rigorous but constructive: every CRITICAL issue needs a suggested fix
  • Do not nitpick style; only flag things that affect correctness, security, or robustness
  • If pre-existing failures are listed — ignore them, do not flag as new issues

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.