Step 4: Let AI Self-Review Before the PR#
What Usually Goes Wrong#
Committing to a feature branch is harmless, and you do not want to sit in an
editor manually reviewing code before every branch commit. What wastes everyone's
time is having the AI open a pull request the instant go test turns green:
- Self-review blindness: If the same AI chat that just wrote the code checks its own work, its conversation history is already primed to defend the choices it just made.
- Forgotten supporting files: Tests pass on the Go code, and then GitHub
Copilot (or you, during PR review) has to point out that
expires_inandGET /links/{code}/statswere never documented inexamples/go-app/README.md, costing an avoidable CI and review round.
What to Do Instead#
Validating everything it possibly can before asking for your final review is an AI job, not yours.
Your standing workflow-policy.md instructs your harness to automatically run
the finish-issue pre-PR gate whenever it wraps up an issue to open a pull
request (and you can also trigger it anytime in plain English or via
/finish-issue). It runs static security checks (gosec), then dispatches two
fresh, read-only subagents in parallel
over the branch diff:
go test -race, golangci-lint, and gosec on your laptop ($0 CPU).REVIEW.md rules.--help flags, examples, and README.md updates.Because neither subagent wrote the code and both are read-only (edit: deny),
the AI catches its own blind spots before pushing. You still have not opened a
code editor or read a line of Go locally; the AI only interrupts you here if one
of its reviewers surfaces a genuine design or API decision that belongs to a
human.
Walk Through It#
Watch the AI audit its own work (
finish-issue)On your own repo or fork, telling your harness "wrap this up on a feature branch and open a PR" runs
finish-issueautomatically before pushing. Because this walkthrough practices locally onshortywithout opening a PR yet, trigger that pre-PR self-review directly:Run the pre-PR finish-issue check on the shorty changes and fix anything mechanical.What you should see: The AI runs Go build/test/
gosecchecks, dispatchescode-reviewerandartifact-auditorin parallel, and merges their findings into one list:artifact-auditorflagsexamples/go-app/README.mdas Missing update becausePOST /linksnow acceptsexpires_inandGET /links/{code}/statsis undocumented.code-reviewerchecks edge cases againstREVIEW.md(such as rejecting negativeexpires_invalues or large integer overflows, and returning404on/statsfor unknown codes).
Let the AI fix confirmed gaps & verify full CI
The AI fixes the mechanical findings and missing
README.mddocs in one pass (pausing only if something requires a real product or API decision from you) and re-runs the repository verification suite:scafctl run action ciWhat you should see: Go CI,
scafctlsolution tests, and the docs build all finish green, with both implementation and docs ready for a clean pull request.
Branch commits stay frictionless; publishing stays gated: Committing on a feature branch cannot hurt
main, soopencode.jsonclets the AI stage and commit on feature branches freely (while blockinggit commit --amend), prompts before pushing or opening a PR (git push,gh pr create), and strictly blocks merging (gh pr merge:deny).
Next, Step 5 opens the pull request, pairs with GitHub Copilot Code Review without burning quota, and brings you in once at the end for final architectural and code sign-off.