Finalize Branch
Answer the practical pre-merge question: what remains before this branch is
safe, coherent, maintainable, and ready to merge? This is a decision and
execution workflow, not a generic code review or a command that automatically
ships the branch.
Modes
- Report-only: inspect and return blockers, lane scores, required hard cuts,
validation, docs work, and decisions. Do not modify the checkout.
- Implementation: resolve confirmed findings, remove superseded paths, add
the narrow proof, align docs, and rerun applicable gates.
- PR closeout: include hosted checks, review threads, branch state, and
mergeability when the user authorizes those read operations.
State the mode. Do not commit, push, merge, deploy, or resolve hosted threads
unless the user explicitly requests that action and the owning workflow allows
it.
Source Order
- Dirty worktree, branch diff, tests, generated consumers, and live PR/CI state.
- Root and nested agent instructions, README, architecture docs, ADRs, specs,
package scripts, validation manifests, and release runbooks.
- Relevant companion skills and their references.
- Current official docs and dependency source when API behavior affects a
recommendation.
Preserve unrelated dirty changes. Never infer product status, compatibility
requirements, or validation commands from memory.
Decision Model
Use hard gates before numeric scoring.
Hard gates
A failure blocks merge regardless of score:
- security, authorization, tenant or account isolation, privacy, or secret
handling;
- data integrity, destructive behavior, migration safety, idempotency, or state
transition correctness;
- public API, schema, protocol, provider, platform, or release safety;
- a branch that does not close a coherent user/operator workflow;
- missing narrow proof for a material changed behavior;
- a required repository gate that fails;
- an unjustified compatibility layer, fallback, alias, dual shape, stale path,
obsolete test, or dead generated consumer left behind.
Lane scoring
Select the narrowest applicable profiles in
references/review-framework.md. Mixed branches receive separate lane scores
and a blocker summary; never average away a weak security, backend, native,
integration, or UX lane.
Score criteria from 0.0 to 10.0, apply the profile weights, and use these action
tiers:
- 9.0-10.0: preferred; execute or recommend confidently.
- 8.0-8.9: acceptable with explicit tradeoffs and verification.
- 7.0-7.9: narrow, research, ask, or defer before implementation.
- Below 7.0: reject, redesign, or hard-cut more aggressively.
Scores support decisions; hard gates remain authoritative.
Core Posture
- Keep one canonical schema, API, path, function, export, fixture, document,
and test lane per concept.
- Delete compatibility wrappers, fallback paths, aliases, dual shapes, stale
exports, orphaned tests, obsolete docs, unused migrations, and dead generated
references unless a proven external boundary requires them.
- Name that external boundary, its owner, and removal condition. "Safer" is not
proof that a compatibility path must remain.
- Prefer maintained dependency-native capabilities over local wrappers when
they reduce ownership without weakening contracts.
- Preserve server-side authorization and isolation. Finalization must not move
trust into clients or weaken denied-path tests.
- Keep tests deterministic and proportional to changed risk.
- Update docs only when behavior, architecture, ownership, setup, operations,
or public contracts changed.
- Separate report-only advice from implementation. Never imply fixes were made
or gates passed when they were only recommended.
Companion Routing
Load only relevant skills that exist in this repository:
autoreview, codex-review, or multi-model-review for independent review.
review-remediation for verified local review-note fixes.
repo-modernizer for dependency upgrades and dependency-native cleanup.
repo-docs-align or docs-align for changed documentation contracts.
vitest-dev or pytest-dev for runner-specific test work.
qa-router for repository gate selection and validation routing.
grill-me for an unresolved user-owned product or architecture tradeoff.
pre-mortem before an irreversible, high-risk decision.
commit, ship-branch, or gh-pr-review-fix only when the user explicitly
requests their mutation/hosting workflow.
Companion skills do not override repository instructions or this skill's hard
gates.
Workflow
- Establish branch scope. Read instructions and authority docs. Inspect
status, merge-base diff, commits, generated consumers, and, when authorized,
live PR checks/reviews. Separate task changes from unrelated dirt.
- Build the system map. Trace each changed producer to consumers, public
boundaries, data shapes, authorization, UI/native surfaces, tests, docs,
operations, and generated artifacts.
- Run architect lanes. Cover hard-cut shape, product completeness,
performance/cost, QA, and docs. Add backend, auth/security, web, native,
UI/UX, or integration profiles only when touched.
- Apply hard gates. Report blockers before scores. Stop risky mutation when
a product, security, data-loss, public-contract, or provider decision needs
user approval.
- Score and resolve. Show each active profile, criterion scores, weighted
result, tradeoffs, and required action tier. Answer evidence-resolvable
questions directly.
- Ask only when necessary. If two viable options depend on user intent,
use
grill-me: one to three independent questions, recommended option first,
mutually exclusive choices, and profile scores.
- Execute or report. In implementation mode, make the smallest complete
end-state change, delete the old path, update tests/docs, and avoid unrelated
cleanup. In report-only mode, return an ordered, self-contained plan.
- Verify. Rerun the narrow changed lane, then every wider repository gate
selected by touched files. A gate not run is
UNVERIFIED.
- Close out. Reinspect diff and status, confirm no unresolved blocker or
stale path remains, and report merge readiness without performing unasked
Git or provider mutations.
Severity
- HIGH: hard-gate failure or defect that can compromise security, data,
contracts, release safety, core workflow completion, or merge confidence.
- MEDIUM: maintainability, performance, test, docs, or product-completeness
gap that should be resolved before merge but is not itself a hard gate.
- LOW: bounded cleanup or clarity improvement with low operational risk.
Review Output Format
For report-only mode:
## Finalization Review
- Scope and evidence:
- Hard-gate blockers:
- Lane scores and profiles:
- Required hard cuts:
- Product completeness:
- Performance and cost:
- QA and validation:
- Docs and operations:
- Decisions needed:
- Merge readiness: Ready | Needs changes | Blocked | Inconclusive
- UNVERIFIED:
For implementation mode:
## Finalization Implemented
- What changed and why:
- Canonical path retained:
- Compatibility/dead paths deleted:
- Files touched:
- Tests/docs aligned:
- Verification commands and results:
- Residual risks and UNVERIFIED gaps:
- Merge readiness: Ready | Needs changes | Blocked | Inconclusive
Read references/review-framework.md for lane checklists, weighted profiles,
and scoring discipline on broad or mixed branches.
1---2name: finalize-branch3description: Pre-merge branch and PR closeout. Use to identify and implement follow-up work, hard cuts, dependency-native simplification, validation coverage, docs alignment, and merge-readiness fixes.4license: MIT5---67# Finalize Branch89Answer the practical pre-merge question: what remains before this branch is10safe, coherent, maintainable, and ready to merge? This is a decision and11execution workflow, not a generic code review or a command that automatically12ships the branch.1314## Modes1516- **Report-only:** inspect and return blockers, lane scores, required hard cuts,17 validation, docs work, and decisions. Do not modify the checkout.18- **Implementation:** resolve confirmed findings, remove superseded paths, add19 the narrow proof, align docs, and rerun applicable gates.20- **PR closeout:** include hosted checks, review threads, branch state, and21 mergeability when the user authorizes those read operations.2223State the mode. Do not commit, push, merge, deploy, or resolve hosted threads24unless the user explicitly requests that action and the owning workflow allows25it.2627## Source Order28291. Dirty worktree, branch diff, tests, generated consumers, and live PR/CI state.302. Root and nested agent instructions, README, architecture docs, ADRs, specs,31 package scripts, validation manifests, and release runbooks.323. Relevant companion skills and their references.334. Current official docs and dependency source when API behavior affects a34 recommendation.3536Preserve unrelated dirty changes. Never infer product status, compatibility37requirements, or validation commands from memory.3839## Decision Model4041Use hard gates before numeric scoring.4243### Hard gates4445A failure blocks merge regardless of score:4647- security, authorization, tenant or account isolation, privacy, or secret48 handling;49- data integrity, destructive behavior, migration safety, idempotency, or state50 transition correctness;51- public API, schema, protocol, provider, platform, or release safety;52- a branch that does not close a coherent user/operator workflow;53- missing narrow proof for a material changed behavior;54- a required repository gate that fails;55- an unjustified compatibility layer, fallback, alias, dual shape, stale path,56 obsolete test, or dead generated consumer left behind.5758### Lane scoring5960Select the narrowest applicable profiles in61`references/review-framework.md`. Mixed branches receive separate lane scores62and a blocker summary; never average away a weak security, backend, native,63integration, or UX lane.6465Score criteria from 0.0 to 10.0, apply the profile weights, and use these action66tiers:6768- **9.0-10.0:** preferred; execute or recommend confidently.69- **8.0-8.9:** acceptable with explicit tradeoffs and verification.70- **7.0-7.9:** narrow, research, ask, or defer before implementation.71- **Below 7.0:** reject, redesign, or hard-cut more aggressively.7273Scores support decisions; hard gates remain authoritative.7475## Core Posture7677- Keep one canonical schema, API, path, function, export, fixture, document,78 and test lane per concept.79- Delete compatibility wrappers, fallback paths, aliases, dual shapes, stale80 exports, orphaned tests, obsolete docs, unused migrations, and dead generated81 references unless a proven external boundary requires them.82- Name that external boundary, its owner, and removal condition. "Safer" is not83 proof that a compatibility path must remain.84- Prefer maintained dependency-native capabilities over local wrappers when85 they reduce ownership without weakening contracts.86- Preserve server-side authorization and isolation. Finalization must not move87 trust into clients or weaken denied-path tests.88- Keep tests deterministic and proportional to changed risk.89- Update docs only when behavior, architecture, ownership, setup, operations,90 or public contracts changed.91- Separate report-only advice from implementation. Never imply fixes were made92 or gates passed when they were only recommended.9394## Companion Routing9596Load only relevant skills that exist in this repository:9798- `autoreview`, `codex-review`, or `multi-model-review` for independent review.99- `review-remediation` for verified local review-note fixes.100- `repo-modernizer` for dependency upgrades and dependency-native cleanup.101- `repo-docs-align` or `docs-align` for changed documentation contracts.102- `vitest-dev` or `pytest-dev` for runner-specific test work.103- `qa-router` for repository gate selection and validation routing.104- `grill-me` for an unresolved user-owned product or architecture tradeoff.105- `pre-mortem` before an irreversible, high-risk decision.106- `commit`, `ship-branch`, or `gh-pr-review-fix` only when the user explicitly107 requests their mutation/hosting workflow.108109Companion skills do not override repository instructions or this skill's hard110gates.111112## Workflow1131141. **Establish branch scope.** Read instructions and authority docs. Inspect115 status, merge-base diff, commits, generated consumers, and, when authorized,116 live PR checks/reviews. Separate task changes from unrelated dirt.1172. **Build the system map.** Trace each changed producer to consumers, public118 boundaries, data shapes, authorization, UI/native surfaces, tests, docs,119 operations, and generated artifacts.1203. **Run architect lanes.** Cover hard-cut shape, product completeness,121 performance/cost, QA, and docs. Add backend, auth/security, web, native,122 UI/UX, or integration profiles only when touched.1234. **Apply hard gates.** Report blockers before scores. Stop risky mutation when124 a product, security, data-loss, public-contract, or provider decision needs125 user approval.1265. **Score and resolve.** Show each active profile, criterion scores, weighted127 result, tradeoffs, and required action tier. Answer evidence-resolvable128 questions directly.1296. **Ask only when necessary.** If two viable options depend on user intent,130 use `grill-me`: one to three independent questions, recommended option first,131 mutually exclusive choices, and profile scores.1327. **Execute or report.** In implementation mode, make the smallest complete133 end-state change, delete the old path, update tests/docs, and avoid unrelated134 cleanup. In report-only mode, return an ordered, self-contained plan.1358. **Verify.** Rerun the narrow changed lane, then every wider repository gate136 selected by touched files. A gate not run is `UNVERIFIED`.1379. **Close out.** Reinspect diff and status, confirm no unresolved blocker or138 stale path remains, and report merge readiness without performing unasked139 Git or provider mutations.140141## Severity142143- **HIGH:** hard-gate failure or defect that can compromise security, data,144 contracts, release safety, core workflow completion, or merge confidence.145- **MEDIUM:** maintainability, performance, test, docs, or product-completeness146 gap that should be resolved before merge but is not itself a hard gate.147- **LOW:** bounded cleanup or clarity improvement with low operational risk.148149## Review Output Format150151For report-only mode:152153```markdown154## Finalization Review155- Scope and evidence:156- Hard-gate blockers:157- Lane scores and profiles:158- Required hard cuts:159- Product completeness:160- Performance and cost:161- QA and validation:162- Docs and operations:163- Decisions needed:164- Merge readiness: Ready | Needs changes | Blocked | Inconclusive165- UNVERIFIED:166```167168For implementation mode:169170```markdown171## Finalization Implemented172- What changed and why:173- Canonical path retained:174- Compatibility/dead paths deleted:175- Files touched:176- Tests/docs aligned:177- Verification commands and results:178- Residual risks and UNVERIFIED gaps:179- Merge readiness: Ready | Needs changes | Blocked | Inconclusive180```181182Read `references/review-framework.md` for lane checklists, weighted profiles,183and scoring discipline on broad or mixed branches.