Back/Engineering/GitHub Copilot
AdvancedEngineering

Automate Your Pre-Merge PR Checklist with a Custom AI `/ship` Skill

Turn your repository's real preflight routine into a `/ship` skill. It checks the commit, runs the correct lint and build commands, pushes the branch, watches CI, fixes minor failures, and reports when the pull request is ready.

Automate Your Pre-Merge PR Checklist with a Custom AI `/ship` Skill

Alex opens his personal dev box skills and shows `/ship` running repository checks, pushing the branch, monitoring Buildkite, and retrying minor CI fixes before he returns.

Before you start

What you need

  • The repository's real premerge checklist and commands
  • A coding agent with repository and CI access
  • A branch that is ready to ship
  • Documented retry and timeout limits

What you’ll make

A reusable `/ship` skill that takes a ready branch through local checks, push, CI monitoring, minor fixes, and a final status report.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

6 steps

Step01

Document Your Pre-Merge SOP

Copy the repository's actual premerge routine into one checklist. Include commit inspection, lint, targeted tests, build commands, branch push, pull request lookup, CI status, and the minor failures that are safe for the agent to repair.

Step02

Define a Custom AI Skill

Create a /ship skill from that checklist. Use exact commands, define which CI failures may be repaired, cap retries, and require a final status report. Keep destructive actions and secrets out of the automation.

Example prompt
Create a `/ship` skill for this repository. First inspect the current commit for unrelated files or credentials. Run `[repository lint command]`, `[repository test command]`, and `[repository build command]`. If they pass, push the current branch without force and find or open its pull request. Monitor `[CI provider]` for up to one hour. For a minor lint or formatting failure, apply the smallest fix, commit it, push, and retry, up to five total attempts. Stop on repeated failures or changes outside the failing check. Finish with the pull request URL, commits pushed, checks run, and current CI status.
Step03

Script Pre-flight Checks and Repo Pushes

Implement the local preflight phase with the same commands developers already use. Inspect the commit, run lint, tests, and the correct build target, then push the current branch only after those commands pass.

Step04

Add CI Monitoring and Auto-Fix Logic

Add pull request and CI polling. When a minor lint or formatting job fails, read the log, make the smallest relevant change, commit it, push, and continue monitoring. Stop at the retry or time limit and report the remaining failure.

Step05

Implement Safety Rails

Keep a few hard constraints inside the skill: never force push, never add credentials, never rewrite shared branch history, and never hide a failed check. These are stable operating rules, not a separate approval ceremony.

Safety constraints are crucial for giving the team confidence to use powerful automation tools.

Step06

Execute the Skill to Ship Code

When the branch is ready, run /ship and move on to other work. Return to the final report or notification, which should identify the pull request, the checks that ran, any repair commits, and whether CI is green.

What good looks like

  • The skill runs the repository's correct lint, test, and build commands.
  • It never force pushes or includes credentials in a commit.
  • Minor CI failures can be fixed and retried within the stated limit.
  • The final report links the pull request and names every check that passed or failed.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

The skill runs generic checks that do not match the repository
Replace placeholders with commands copied from the repository documentation and package scripts. Keep repository specific setup close to the skill.
The skill pushes but cannot read CI
Configure the repository and CI credentials used by your normal CLI, then test the status command on an existing pull request before invoking `/ship` again.
The skill keeps retrying a failure it cannot fix
Set a retry count and wall clock timeout. Stop retrying when the same failure repeats, then report the failing job and relevant log excerpt.
An automated fix changes unrelated files
Require each retry to show the failure it addresses and the resulting diff. Revert that retry commit and stop when the change is outside the failing check.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready