en un clic
pr
Create a pull request with cleanup, fmt, and test gates
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Create a pull request with cleanup, fmt, and test gates
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle SOC
Start a new feature in an isolated git worktree with proportional verification
Diagnose and fix a bug in an isolated git worktree with reproduce-first, test-first methodology
Create a pull request with cleanup, fmt, and test gates
Safely restructure code in an isolated git worktree with test-preserved, incremental transformations
Start a new feature in an isolated git worktree with proportional verification
Diagnose and fix a bug in an isolated git worktree with reproduce-first, test-first methodology
| name | pr |
| description | Create a pull request with cleanup, fmt, and test gates |
| disable-model-invocation | true |
Open a pull request for the current branch. This is the only sanctioned path
to PR creation — a pr-skill-gate hook blocks any direct gh pr create that
doesn't carry this skill's bypass marker.
Optional arguments: $ARGUMENTS
Each phase has a gate. Do not proceed until it passes.
Run in parallel:
git status — warn if uncommitted changes (but proceed; the cleanup phase may add commits anyway).BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||' || echo main) — detect default branch.git branch --show-current — current branch.git rev-parse --abbrev-ref @{upstream} 2>/dev/null — does it track a remote?git log --oneline $(git merge-base HEAD "$BASE")..HEAD — commits on this branch.git diff --name-only "$BASE"...HEAD — files changed vs base. Save this list — it's the input to Phase 3.Gate: You have the changed-file list and the base branch.
Delete transient files left over from implementation, testing, and discovery — screenshots, Playwright MCP output, and tmp scratch — before the cleanup pass inspects the diff. Untracked only. Never touch tracked or staged files.
Identify untracked artifacts. Use git ls-files --others --exclude-standard
for unignored untracked files, and git ls-files --others --ignored --exclude-standard for ignored untracked files. Filter for these patterns:
*.png at the repo root only — these are typically Playwright/visual-audit screenshots. PNGs inside subdirectories (build outputs out/, dist/, build/, asset dirs public/, static/, source dirs src/, etc.) are legitimate and must NOT be deleted..playwright-mcp/ (directory)*.tmp (anywhere)tmp/ (directory, when at repo root or inside a subproject root)If the list is empty, skip the rest of this phase.
Confirmation gate — show the user the exact list of paths about to be
deleted (one line each) and ask explicit permission before deleting. Use
request_user_input when available, otherwise ask one concise direct
question:
About to permanently delete N untracked scratch files: . Proceed?
Options: "Delete all (Recommended)", "Skip cleanup — keep these files",
"Let me edit the list" (if the user picks edit, accept a revised path
list and re-confirm before any deletion). If request_user_input is
unavailable and the user does not affirm, skip deletion and proceed to
Phase 3.
Any path outside the worktree root (absolute paths, .. traversal) must be
rejected — fail this gate rather than delete.
Delete the confirmed paths. For files: rm -f <path>. For directories:
rm -rf <path>. Run from the repo root. Never pass /, ~, ., ..,
or a glob like * to rm — only the explicit confirmed paths from step 3.
Verify with git status --porcelain — none of the deletions should appear,
because every removed path was untracked. If any tracked file shows as
deleted, stop and surface it to the user (something matched a tracked
path; the patterns above are wrong for this repo).
Gate: Either the user confirmed and matching untracked artifacts were
removed, or the user declined and the phase was skipped. git status shows no
unexpected tracked-file deletions.
Do not launch the cleanup pass by default. First classify the diff from Phase 1:
refactor-cleaner agent (run_in_background: false) with the changed-file list from Phase 1 as scope. Pass file paths explicitly — don't let it roam the whole repo. If cleanup is not warranted, skip to step 4.If cleanup is warranted, spawn a Codex worker subagent scoped to the
changed-file list from Phase 1. Pass file paths explicitly — do not let it
roam the whole repo. Then call wait_agent to block on its completion
before continuing. If cleanup is not warranted, skip to step 4.
Inline brief for the worker (pass as the worker's prompt):
You are doing a narrow cleanup pass on a branch diff. Scope: the files listed below — do not read or edit anything outside this set.
Files:
<paste changed-file list from Phase 1>Allowed edits:
- Remove unused imports, dead variables, and unreachable code introduced by this diff.
- Remove debug/log statements added during implementation (
console.log,fmt.Println,print(...)for debugging, etc.).- Collapse trivially duplicated code added in this diff into a single call site when the duplication is obvious and local.
Forbidden:
- Behavioral changes, refactors that move code between files, API renames, dependency additions/removals, or any change to tests.
- Editing files outside the listed scope.
After your changes, report the files edited and any risk that needs a targeted proof command. Do not commit — the parent skill commits.
If the worker edited files:
make test/make test-fast only when the cleanup crossed package
boundaries or touched shared test/build infrastructure.git add -u && git commit -m "chore: ai-fmt".Then prune implementation-only tests. The cleanup pass above never touches tests — this step does.
Do it inline yourself; do not spawn a subagent.
assert true stubs, and cases fully subsumed or duplicated by another retained test. NEVER remove a test that is the sole coverage of a behavior, branch, edge case, error path, or regression — if unsure the coverage is unique, keep it.make test only when coverage spans multiple packages or the proof cannot be bounded. Commit the removals on their own: git add -A && git commit -m "test: remove implementation-only tests".Gate: Cleanup ran only when warranted; cleanup changes (if any) are committed and green; implementation-only tests are pruned in their own commit (or none qualified); no sole-coverage test was removed.
Check if the target exists first: make -n fmt >/dev/null 2>&1.
make fmt. Then check git status --porcelain. If anything changed, run the smallest relevant proof command, then commit with git add -u && git commit -m "chore: fmt". If nothing changed, skip the commit.fmt exists but the branch is docs/config-only or otherwise outside
formatter scope: skip and note why.fmt target: do not add one during PR
cleanup unless the user explicitly asked. Use a language-native formatter
only when it is obvious and scoped to changed files; otherwise proceed and
note that no formatter gate exists.Gate: Formatting ran when relevant, or was explicitly skipped as out of scope/missing.
make testCheck if the target exists first: make -n test >/dev/null 2>&1 (also accept test-fast per the test-gate hook's preference order).
fix: commit) and re-run.test/test-fast target: do not add one
during PR cleanup unless the user explicitly asked. Run an obvious native
project test command only if it is already documented/configured; otherwise
proceed and note in the PR body that tests were not gated.Gate: Either tests are green, or the user has been notified the target is missing and accepted that trade-off.
Compose the PR using all commits on the branch (not just the latest):
<type>: <description>. Pick the type that matches the primary change.If no upstream: git push -u origin $(git branch --show-current). If upstream exists but is behind: git push.
Create the PR. The AGENT_DASHBOARD_PR_SKILL=1 prefix is mandatory — without it the pr-skill-gate hook blocks the call:
AGENT_DASHBOARD_PR_SKILL=1 gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<bullets>
## Test plan
<checklist>
EOF
)"
Return the PR URL.
Gate: PR is open. URL displayed.