Create pr

From shenxingy/Clade · View interactive version

Create pr is an AI agent skill from the GitHub repository shenxingy/Clade. Publish or update one repository-adaptive, exact-SHA pull request without duplicating or broadening authority

How to use this skill

Skill file

Clade for Codex

This package composes the provider-neutral Clade core contract with the native

Codex surface adapter. Run the workflow directly in Codex; do not launch

another agent CLI or route it through Clade MCP.

Package provenance:

Canonical Clade workflow

You are the Create PR skill. Publish or update the active Clade delivery

idempotently.

1. Resolve policy and authority

Locate/read the sibling delivery skill, relevant surface overlay, and active

delivery state. Run its context probe again immediately before publication.

Stop or choose a non-PR fallback when:

GitHub uses gh; GitLab/Bitbucket use their available adapters; plain Git

returns a pushed branch, request-pull, or patch/bundle. Never invoke gh in a

non-GitHub repository.

2. Scope and exact candidate gate

Inspect the complete diff/commits from the resolved PR base. Map every file to

one behavior/root cause. Multiple commits do not make a multi-feature branch

acceptable.

scope.

“while here” fixes are separate scopes.

foundation explains it.

For multiple scopes, preserve the source branch, then create independent or

stacked delivery records in isolated worktrees. Each stacked PR targets its

immediate parent and owns its own candidate/remote evidence. Never close or

rewrite the recovery branch before replacements are reachable.

Require complete candidate evidence for the exact current head:

python3 "$DELIVERY_PY" show --id "<id>"
git rev-parse HEAD

If evidence is absent or names another head, run full repository checks on

this head and record delivery candidate before publication. Align the base

only to resolve a conflict or a stack parent that landed: main moving alone

never makes a candidate stale (configs/CLAUDE.md, "Merge, then test").

3. Reuse existing PR

Query the forge for an open PR with this exact head branch before creating one.

authority was explicit.

PR creation is idempotent. Never open a duplicate because a previous process

crashed after the forge write but before local state recording.

4. Build repository-native metadata

Honor the repository PR template, required labels/reviewers, contribution

token/instructions, and forge conventions. The body records:

Every PR body carries these two lines, spelled exactly so, because /retro

parses them (pr-verification-gaps.py). A repository template governs the rest

of the body, not these words:

Review depth: none | skimmed | read-in-full
Could not verify: none | <item>; <item>

human reviewer, or an independent review run such as /review-pr or a

second-opinion agent, optionally named after the value. The author's own

reading never counts, and a reading you did not see is never claimed, so at

creation the line is almost always none. When a review lands, update the

line: it states the depth at merge.

the surface, with the reason in parentheses, items separated by ;. Write

none only when every claim in the PR was checked. Reuse an earlier PR's

wording for the same gap: /retro counts items by their words, so a

rephrased item hides a gap that recurs.

For example:

Review depth: skimmed (by @reviewer)
Could not verify: macOS run (no Mac reachable); live hook firing (needs an interactive session)

Do not include secrets, raw auth endpoints, machine-private paths, or claims of

independent human approval.

Draft only when requested, repository policy opens drafts early, or remote CI

must run before ready.

5. Publish and record

--dry-run stops here. Report the resolved base, the scope verdict, the

candidate-evidence status, and the PR title and body you would post — then stop

without pushing and without calling gh pr create. This flag was in the

argument-hint and read by nothing, so a run that asked to preview published a

PR instead; of every flag in this toolkit that is the one whose absence is

visible to other people.

Push with an explicit same-name refspec/upstream only under recorded push

authority. Then create or update the PR through the selected forge adapter.

Record the result:

python3 "$DELIVERY_PY" publish \
  --id "<id>" --pr <number> --url "<url>" \
  --base "<resolved-base>" --head-sha "$(git rev-parse HEAD)" [--draft]

If recording fails after PR creation, re-query by head and repair the existing

record; do not create another PR.

Do not wait on hosted checks: the exact-head candidate is the gate and hosted

CI is the receipt. When integration is authorized, go straight to ready:

with --checks receipt, the default, pending checks do not block, a failed

one does, and branch protection gets auto-merge, never a bypass. When a check

fails, before or after the merge, fix forward with new checkpoint commits,

rerun full candidate verification for the new SHA, push, update the same PR

(or open a follow-up after a merge), and record publish again so

pull_request.head_sha names the pushed head (published stays true; a new

candidate does not un-publish the delivery). Completion reports the URL,

base/head, stack position, exact evidence, the hosted checks still running,

and remaining external review.

Codex surface adapter

Codex surface adapter

$clade:delivery, and use $clade:<skill-name> for companion workflows.

AGENTS.override.md before AGENTS.md at each scope and does not merge

them, so where an override exists that scope's AGENTS.md is not in effect.

CLAUDE.md is Clade's legacy fallback rather than a filename Codex resolves;

read it only when it is trusted repository guidance.

is valid, but create/attach an owned branch or preserve a reachable Clade ref

before the runtime deletes the worktree.

one branch cannot be checked out by multiple worktrees.

not launch Claude Code or a nested Codex CLI to emulate the workflow.

connections remain user-scoped and cannot be donated by repository files.

Additional skill reference

Create or update PR

Publish one independently reviewable and reversible delivery unit. Use the

shared $clade:delivery context/state controller; do not assume GitHub, origin,

main, branch ownership, or autonomous PR authority.

One PR = one independently reviewable and reversible delivery unit.

Tests, migrations, generated files, and documentation for that same behavior

belong together. Independent behavior becomes independent or explicitly

stacked delivery records.

Delivery completion

If this workflow changes files or external state:

repository task.

$clade:delivery and create a repository-compliant checkpoint or preserve

the work when committing is unavailable.

deployment, or live verification part of the task, do not silently downgrade

the result to local-only work.

or reachable external state, report BLOCKED or NEEDS_CONTEXT rather than

appending a "not committed/pushed/deployed" caveat after DONE.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.