agentleFS
MicrosoftKnown publishermicrosoft/amplifier-app-actions/skills/pre-push-review/SKILL.md

pre-push-review

Skill2 starsChanged 3 months agoMITView on GitHub

Pre-PR self-review using the same criteria as the automated review-pr-opened GitHub Action. Catches stale mock patch targets, dead imports with noqa suppressors, fixture env-var leaks, and silent ineffective patches BEFORE they are flagged by CI. Run before pushing any branch to a PR on microsoft/amplifier-resolve. Triggers on: "review before push", "pre-PR check", "self-review before pushing", "catch issues before CI", "is this ready to push".

8 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run the same review the automated review-pr-opened GitHub Action will run — catch issues before CI does.

    line 22
  2. Very specific:

    Success criteria: Every stale patch target identified with exact file:line references.

    line 67
  3. Distinctive:

    If not, it is silencing a real lint warning — flag it.

    line 78
  4. Very specific:

    Success criteria: Every # noqa: F401 is justified or flagged.

    line 80
  5. Very specific:

    Success criteria: No unguarded os.environ mutations in test fixtures.

    line 94
  6. Very specific:

    Success criteria: All findings returned with file:line references.

    line 119

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “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

Pre-Push Review

Run the same review the automated review-pr-opened GitHub Action will run — catch issues before CI does. The #1 recurring pattern on amplifier-resolve: stale mock patch targets after module splits. When a monolithic module is split into a package, tests that patch("old.module._X") or from old.module import _X must become patch("new.module.submodule._X"). Patching a re-export is silently ineffective — the call inside the real module uses its own local binding, not the re-export.

Success artifact: A list of Required / Advisory findings that match what CI would flag, returned before the branch is pushed.

Inputs

  • ``: Branch name to review (defaults to current branch). Optionally include the repo path.

Steps

1. Orient on the diff

git diff origin/main...HEAD --name-only  # files changed
git diff origin/main...HEAD              # full diff for orientation

Identify which source modules changed and whether any module splits occurred (a .py file deleted and a same-name / directory created).

Success criteria: You know which files changed and whether module splits happened.


2. Check stale patch targets (the #1 issue)

For every split module, grep ALL test files for references to the old path:

# Replace <old_module> with the split module name (e.g. cli, routes.instances)
grep -rn "patch.*amplifier_resolve\.<old_module>\." tests/
grep -rn "from amplifier_resolve\.<old_module> import _" tests/

Rules:

  • patch("a.b.symbol") is correct ONLY if symbol ACTUALLY LIVES in a.b — not just re-exported there
  • Patching a re-export binds the mock in the wrong namespace; the production code path is untouched
  • Correct target: patch("the.module.that.calls.symbol") — where it is IMPORTED, not defined

Success criteria: Every stale patch target identified with exact file:line references.


3. Check dead imports with noqa suppressors

grep -rn "# noqa: F401" src/

For each hit: is the import legitimately kept (backward-compat re-export, TYPE_CHECKING guard)? If not, it is silencing a real lint warning — flag it.

Success criteria: Every # noqa: F401 is justified or flagged.


4. Check fixture env-var safety

grep -rn "os\.environ\[" tests/
grep -rn "os\.environ\.pop" tests/

Manual os.environ[key] = value in fixtures leaks the env var if the test raises before teardown. The correct pattern is monkeypatch.setenv(key, value) — pytest handles cleanup.

Success criteria: No unguarded os.environ mutations in test fixtures.


5. Full review using pr-review.md criteria

Fetch the review criteria, then delegate a full review.

Fetch: https://raw.githubusercontent.com/microsoft/amplifier-app-actions/main/context/pr-review.md

Delegate to superpowers:code-reviewer with:

  • The pr-review.md content as the review instructions
  • The branch name and what the PR is supposed to do
  • Explicit instruction to read FULL files, not just the diff
  • Explicit instruction to grep for all callers/tests of any changed interface

Key pr-review.md criteria:

  • Read full files, not just diffs — the diff orients; the full file is the review
  • Verify through code, not proxies — PR descriptions and agent summaries are hypotheses
  • Five checks: Necessity, Layer fit, Pattern, Correctness, Calibration
  • Patch target correctness: for every unittest.mock.patch() in changed test files, verify the target is the module where the symbol actually lives after any rename/split

Execution: Delegate to superpowers:code-reviewer, model_role=critique

Success criteria: All findings returned with file:line references.


6. Report

Group findings by severity:

## Pre-Push Review: <branch>

### Required (will trigger CI CHANGES_REQUESTED)
1. `file:line` — description + exact fix

### Advisory (should fix, won't block merge)
1. `file:line` — description

### Verdict: READY TO PUSH  /  NEEDS FIXES FIRST

Success criteria: User receives actionable list; verdict is explicit.

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.