---
name: pr-file
description: Use when the user asks to file a pull request or put the current branch up for review.
title: pr-file
canonical_url: https://skilld.dev/gh/mia-cx/skills/pr-file
last_updated: 2026-11-12T08:12:24.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install mia-cx/skills/pr-file`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/pr-file`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/mia-cx/skills/pr-file) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/pr-file`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/pr-file --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/pr-file --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# File a pull request

Rebase the finished branch, push it safely, and open a real PR. Run immediately
when the user asks to file the PR; do not add an approval round-trip.

## Workflow

### 1. Read the branch and repository conventions

- Confirm the repository root, current branch, working tree, and remotes.
- Use the base branch supplied by the user or harness. Otherwise use the repo's
  default branch, usually `main`.
- Stop if the current branch is the base, has no commits to file, or the working
  tree is dirty. Do not stash, discard, or mix uncommitted work into the PR.
- Check for an existing open PR from the current branch. If one exists, report
  its URL instead of creating a duplicate.
- Find the issue this branch completes: the one the user named, the branch
  name, or the commit messages. Every PR links an issue, because milestones and
  projects track issues, and a PR without one is untracked work. When none
  exists, create it first with `gh issue create`, one or two sentences on the
  problem, and add it to the milestone or project the sibling issues use.
- Read relevant `AGENTS.md`, `CONTRIBUTING.md`, and pull-request templates before
  composing the PR. Repository conventions win where they are more specific.

### 2. Rebase onto the latest base

Fetch the remote state, first making sure the current branch is not behind or
diverged from its published upstream. Then rebase onto the latest remote base:

```bash
git fetch origin
git rebase "origin/<base>"
```

Resolve straightforward conflicts according to the code's intent and run
focused validation afterward. If a resolution is genuinely ambiguous, report
the conflicting files and stop. Never skip the rebase merely to get the PR open.

### 3. Understand what the PR delivers

Read the commits and full diff against the rebased base:

```bash
git log --oneline "origin/<base>..HEAD"
git diff --stat "origin/<base>...HEAD"
git diff "origin/<base>...HEAD"
```

Run the repository's focused required checks after the rebase when they are
discoverable. Do not invent results or add ceremonial test runs.

### 4. Write the title and body

Use a conventional title:

```text
type(scope): short description of the problem solved
```

- Keep it under about 72 characters, with no trailing period or PR number.
- Describe the user-visible outcome or problem solved, not the implementation
  technique. Prefer `fix(web): tile fetches are no longer intercepted` over
  `fix(web): add early return to fetch handler`.

Follow the repository's PR template when present. Otherwise keep the body this
simple:

```markdown
<One or two sentences stating the problem or desired feature.>

<One or two sentences explaining how this PR solves it.>

Risk: <low|standard|high>, <why, in one clause>
Revert: <the one step that undoes it, plus anything a revert leaves behind>

<Closes #N>

---
Made with <actual model> using <actual harness>.
```

- Open with the problem, then the solution. Remove headings that add no clarity.
- `Risk` and `Revert` go in every body, repo template or not, because review
  depth and merge rules read them. Risk is set by what the diff touches, never
  by who wrote it:
  - **low**: docs, copy, tests, or UI whose behavior nothing else shares.
  - **high**: auth, permissions, billing, CI and release workflows, installers
    and updaters, migrations and persisted formats, destructive operations.
  - **standard**: everything else.
- `Revert` is usually "revert this PR". Name what a revert leaves behind: an
  applied migration, a published package, external state.
- Name the actual model and harness that produced the change; never guess or use
  a generic attribution. Name multiple contributors succinctly when needed.
- Include validation only when the repo template requires it or the result is
  important context. State only checks actually run.
- `Closes #N` is required: the issue from step 1. Reference only issues the
  merge completes; the paired `pr-merge` skill treats every direct issue
  reference, `Refs` included, as close intent. When the PR only advances a
  larger issue, file a sub-issue for this slice and close that.

### 5. Pick the 0rwx label

Every PR gets one 0rwx label (see `AGENTS.md`, AI disclosure), judged from
who wrote the diff and whether the user reads it before it merges:

| Label  | When                                                          |
| ------ | ------------------------------------------------------------- |
| `AI:0` | The user wrote it with no AI input.                           |
| `AI:R` | The user wrote it; AI only researched or advised.             |
| `AI:W` | AI wrote it and the PR waits for the user's review.           |
| `AI:X` | A simple change AI wrote and self-reviewed; merges unread.    |

Create the label when the repo lacks it. `--force` makes this safe to rerun:

```bash
gh label create "AI:W" --force --color 6e40c9 \
  --description "0rwx: AI wrote it; a human read it"
```

Descriptions: `AI:0` "0rwx: hand made", `AI:R` "0rwx: AI read, a human
wrote it", `AI:X` "0rwx: AI made, unread". When the label no longer fits,
because review was skipped or the user rewrote the diff, swap it with
`gh pr edit --remove-label --add-label`.

### 6. Push and create the PR

Push the current branch. Use a normal push when possible. If the rebase rewrote
an already-published branch, use `--force-with-lease` only after confirming the
remote has not advanced; never use `--force`.

Create the PR with the chosen base, current branch, title, and body:

```bash
gh pr create \
  --base "<base>" \
  --head "<current-branch>" \
  --title "type(scope): short description" \
  --body-file "<body-file>" \
  --label "AI:W"
```

Do not pass `--draft`. The requested result is a real PR ready for CI and review.

### 7. Verify and report

Verify the created PR's URL, title, base, head, label, and non-draft state with
`gh pr view`. Report the URL, rebase result, and checks actually run.
