agentleFS
ku5icku5ic/claude-kit/skills/pr-publish/SKILL.md

pr-publish

Skill2 starsChanged 15 days agoMITView on GitHub

Post an approved PR draft: a review, replies, or a description

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never push, approve, request changes, resolve threads, or edit or delete existing comments.

    line 23
  2. Very specific:

    Read the draft's header: Kind, PR or Branch, Head.

    line 31
  3. Very specific:

    Read the draft's post log, <draft path without .md>.posted.log, if it exists.

    line 32
  4. Very specific:

    Every pr-* draft starts with this header, and this skill parses it.

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/pr-publish

Post a draft the user approved: a review, replies, or a description.

Never push, approve, request changes, resolve threads, or edit or delete existing comments.

Tone and shape: skills/kit-rules/reference/output.md section 4, which wins over this file; the sections this file defines stay.

Find the draft

  1. With a PR number: the drafts in kit scratch-dir with prefix pr-review-<n> or pr-reply-<n>, plus any pr-description-*.md whose header PR: line names #<n>. Without one: the current branch's drafts with prefix pr-description-<branch> (/ in the branch name becomes -), plus the review and reply drafts of its open PR, if any. A branch draft counts only when its header's Branch: line names the branch or its PR: line names that open PR: another branch's draft can share its name. Never a wider glob: pr-review-1* picks up PR 12's.
  2. Take the newest file per kind (ls -t). If there's none, stop and name the drafting kind to run. If there's more than one kind, ask which via AskUserQuestion.
  3. Read the draft's header: Kind, PR or Branch, Head. <repo> comes from the PR: line, or from the repository path for a Branch: header.
  4. Read the draft's post log, <draft path without .md>.posted.log, if it exists. Sections it lists are already posted and are skipped. Every section posted: say so and stop.

Check before posting

  1. Head, for a review: the PR's head SHA; for a description: git rev-parse HEAD. Different from the header's Head: stop, say so, and offer to re-draft. A reply skips this check: pushing the fixes it promises moves the head, and its anchors are comment ids, not lines.
  2. Review: every inline anchor's line still falls inside a hunk of the PR's diff.
  3. Description: whether the branch has an open PR is checked now, never taken from the header. No open PR: git ls-remote origin "refs/heads/<branch>" must print the header's Head. Missing or different: stop with "push first". Never push.
  4. Split the draft into one body file per unposted comment under scratch, through Write, each byte-identical to its section's postable text with surrounding blank lines trimmed. The header, headings, and a reply's leading quote are not comment text. A description gets a title file holding the Title: line's text and a body file holding everything after that line.
  5. One AskUserQuestion with options Post and Cancel: "Post N comments to PR <n>?", or for a description "Update the title and body of PR <n>?" or "Open a PR from <branch>?". Nothing is posted without Post from this session.

Post

Review and reply post one comment per API call, at least 30 s apart, in file order, except a review's summary, which goes last. A batched review can't be paced, so never use one.

Each section's call is the Post table in skills/code-host-patterns.

The title comes from a file because a title like feat(pr): /pr skill would be shell-expanded inside a typed double-quoted string; a command substitution's output isn't.

Run the review or reply loop as one Bash call with run_in_background, sleep 30 between posts inside it; the harness blocks a foreground sleep. After each post, append the section heading and the URL and created_at that skills/code-host-patterns names as one tab-separated line to the post log. A failed post stops the loop: report it, never retry blind; a rerun resumes from the log.

30 s sits under each host's content limits (skills/code-host-patterns). Some endpoints have lower, unnamed limits, so a 403 or 429 means stop and report.

Check, then reply

  1. Fetch each posted comment (a description: the PR's title and body) and diff its text against its body file. Any difference is reported, never silently edited.
  2. Inline review comments: the returned path and line match the anchor.
  3. Consecutive created_at values in the post log are at least 30 s apart.

Reply: the PR URL, the posted count, and any mismatch. Ask before deleting the body files; keep the draft and its post log.

Draft header

Every pr-* draft starts with this header, and this skill parses it.

# PR <n or branch> <kind> draft (not posted)

Kind: <description|review|reply>
PR: <repo>#<n>
Head: <full head SHA the draft was written against>

<repo> is the host's repository path (skills/code-host-patterns). A description for a branch with no PR yet writes Branch: <name> in place of the PR: line.

Arguments: $ARGUMENTS

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.