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: MIT5metadata:6 version: "1.0.0"7 companion-skills:8 - autoreview9 - repo-modernizer10 - repo-docs-align11 - qa-router12---1314# Finalize Branch1516Answer the practical pre-merge question: what remains before this branch is17safe, coherent, maintainable, and ready to merge? This is a decision and18execution workflow, not a generic code review or a command that automatically19ships the branch.2021## Modes2223- **Report-only:** inspect and return blockers, lane scores, required hard cuts,24 validation, docs work, and decisions. Do not modify the checkout.25- **Implementation:** resolve confirmed findings, remove superseded paths, add26 the narrow proof, align docs, and rerun applicable gates.27- **PR closeout:** include hosted checks, review threads, branch state, and28 mergeability when the user authorizes those read operations.2930State the mode. Do not commit, push, merge, deploy, or resolve hosted threads31unless the user explicitly requests that action and the owning workflow allows32it.3334## Source Order35361. Dirty worktree, branch diff, tests, generated consumers, and live PR/CI state.372. Root and nested agent instructions, README, architecture docs, ADRs, specs,38 package scripts, validation manifests, and release runbooks.393. Relevant companion skills and their references.404. Current official docs and dependency source when API behavior affects a41 recommendation.4243Preserve unrelated dirty changes. Never infer product status, compatibility44requirements, or validation commands from memory.4546## Decision Model4748Use hard gates before numeric scoring.4950### Hard gates5152A failure blocks merge regardless of score:5354- security, authorization, tenant or account isolation, privacy, or secret55 handling;56- data integrity, destructive behavior, migration safety, idempotency, or state57 transition correctness;58- public API, schema, protocol, provider, platform, or release safety;59- a branch that does not close a coherent user/operator workflow;60- missing narrow proof for a material changed behavior;61- a required repository gate that fails;62- an unjustified compatibility layer, fallback, alias, dual shape, stale path,63 obsolete test, or dead generated consumer left behind.6465### Lane scoring6667Select the narrowest applicable profiles in68`references/review-framework.md`. Mixed branches receive separate lane scores69and a blocker summary; never average away a weak security, backend, native,70integration, or UX lane.7172Score criteria from 0.0 to 10.0, apply the profile weights, and use these action73tiers:7475- **9.0-10.0:** preferred; execute or recommend confidently.76- **8.0-8.9:** acceptable with explicit tradeoffs and verification.77- **7.0-7.9:** narrow, research, ask, or defer before implementation.78- **Below 7.0:** reject, redesign, or hard-cut more aggressively.7980Scores support decisions; hard gates remain authoritative.8182## Core Posture8384- Keep one canonical schema, API, path, function, export, fixture, document,85 and test lane per concept.86- Delete compatibility wrappers, fallback paths, aliases, dual shapes, stale87 exports, orphaned tests, obsolete docs, unused migrations, and dead generated88 references unless a proven external boundary requires them.89- Name that external boundary, its owner, and removal condition. "Safer" is not90 proof that a compatibility path must remain.91- Prefer maintained dependency-native capabilities over local wrappers when92 they reduce ownership without weakening contracts.93- Preserve server-side authorization and isolation. Finalization must not move94 trust into clients or weaken denied-path tests.95- Keep tests deterministic and proportional to changed risk.96- Update docs only when behavior, architecture, ownership, setup, operations,97 or public contracts changed.98- Separate report-only advice from implementation. Never imply fixes were made99 or gates passed when they were only recommended.100101## Companion Routing102103Load only relevant skills that exist in this repository:104105- `autoreview`, `codex-review`, or `multi-model-review` for independent review.106- `review-remediation` for verified local review-note fixes.107- `repo-modernizer` for dependency upgrades and dependency-native cleanup.108- `repo-docs-align` or `docs-align` for changed documentation contracts.109- `vitest-dev` or `pytest-dev` for runner-specific test work.110- `qa-router` for repository gate selection and validation routing.111- `grill-me` for an unresolved user-owned product or architecture tradeoff.112- `pre-mortem` before an irreversible, high-risk decision.113- `commit`, `ship-branch`, or `gh-pr-review-fix` only when the user explicitly114 requests their mutation/hosting workflow.115116Companion skills do not override repository instructions or this skill's hard117gates.118119## Workflow1201211. **Establish branch scope.** Read instructions and authority docs. Inspect122 status, merge-base diff, commits, generated consumers, and, when authorized,123 live PR checks/reviews. Separate task changes from unrelated dirt.1242. **Build the system map.** Trace each changed producer to consumers, public125 boundaries, data shapes, authorization, UI/native surfaces, tests, docs,126 operations, and generated artifacts.1273. **Run architect lanes.** Cover hard-cut shape, product completeness,128 performance/cost, QA, and docs. Add backend, auth/security, web, native,129 UI/UX, or integration profiles only when touched.1304. **Apply hard gates.** Report blockers before scores. Stop risky mutation when131 a product, security, data-loss, public-contract, or provider decision needs132 user approval.1335. **Score and resolve.** Show each active profile, criterion scores, weighted134 result, tradeoffs, and required action tier. Answer evidence-resolvable135 questions directly.1366. **Ask only when necessary.** If two viable options depend on user intent,137 use `grill-me`: one to three independent questions, recommended option first,138 mutually exclusive choices, and profile scores.1397. **Execute or report.** In implementation mode, make the smallest complete140 end-state change, delete the old path, update tests/docs, and avoid unrelated141 cleanup. In report-only mode, return an ordered, self-contained plan.1428. **Verify.** Rerun the narrow changed lane, then every wider repository gate143 selected by touched files. A gate not run is `UNVERIFIED`.1449. **Close out.** Reinspect diff and status, confirm no unresolved blocker or145 stale path remains, and report merge readiness without performing unasked146 Git or provider mutations.147148## Severity149150- **HIGH:** hard-gate failure or defect that can compromise security, data,151 contracts, release safety, core workflow completion, or merge confidence.152- **MEDIUM:** maintainability, performance, test, docs, or product-completeness153 gap that should be resolved before merge but is not itself a hard gate.154- **LOW:** bounded cleanup or clarity improvement with low operational risk.155156## Review Output Format157158For report-only mode:159160```markdown161## Finalization Review162- Scope and evidence:163- Hard-gate blockers:164- Lane scores and profiles:165- Required hard cuts:166- Product completeness:167- Performance and cost:168- QA and validation:169- Docs and operations:170- Decisions needed:171- Merge readiness: Ready | Needs changes | Blocked | Inconclusive172- UNVERIFIED:173```174175For implementation mode:176177```markdown178## Finalization Implemented179- What changed and why:180- Canonical path retained:181- Compatibility/dead paths deleted:182- Files touched:183- Tests/docs aligned:184- Verification commands and results:185- Residual risks and UNVERIFIED gaps:186- Merge readiness: Ready | Needs changes | Blocked | Inconclusive187```188189Read `references/review-framework.md` for lane checklists, weighted profiles,190and scoring discipline on broad or mixed branches.