Automates the PR landing flow, from conflict checks and CI monitoring to final squash-merging.
Install
mkdir -p .claude/skills/land-karanhudia && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17471" && unzip -o skill.zip -d .claude/skills/land-karanhudia && rm skill.zipInstalls to .claude/skills/land-karanhudia
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Land a PR by monitoring conflicts, resolving them, waiting for checks, andKey capabilities
- →Locate the pull request for the current branch.
- →Run a fast-path preflight for already-green PRs.
- →Monitor CI checks and fix failures.
- →Resolve conflicts against main using the `pull` skill.
- →Address Codex review comments and required fixes.
How it works
This skill lands a pull request by monitoring its conflict status and CI checks, using a fast-path preflight for pre-verified PRs, and performing a squash-merge once all conditions are met.
Inputs & outputs
When to use land
- →Land a PR after review
- →Monitor CI for green status
- →Resolve minor conflicts
- →Automate squash-merges
About this skill
Land
Goals
- Ensure the PR is conflict-free with main.
- Keep CI green and fix failures when they occur.
- Use a fast path for already-green PRs whose head SHA matches the Human Review handoff.
- Treat Linear
Mergingas the human approval signal forreviewDecision=REVIEW_REQUIREDonly when the fast-path preflight is run with the explicit admin-bypass flag and reports that bypass is required. - Squash-merge the PR once checks pass.
- Do not yield to the user until the PR is merged; keep the watcher loop running unless the fast path proves the full watcher is unnecessary or landing is blocked.
- No need to delete remote branches after merge; the repo auto-deletes head branches.
Preconditions
ghCLI is authenticated.- You are on the PR branch with a clean working tree.
Steps
- Locate the PR for the current branch.
- Read the workpad final handoff notes and find the exact line:
Human Review handoff: head=<PR head SHA>; at=<ISO-8601 timestamp>; validation=<commands>. - Run the fast-path preflight:
python3 .codex/skills/land/land_watch.py --preflight --json --allow-review-required-admin-bypass --handoff-note '<handoff note>'. - If the preflight exits
0, skip full local validation and the full watcher loop for this already-green PR. The preflight has confirmed the head SHA is unchanged since Human Review, checks are green, and no new human/Codex feedback appeared since Human Review. Squash-merge with the PR title/body after one finalgh pr view --json mergeable,mergeStateStatus,reviewDecisioncheck still reports either a clean merge state or the exactBLOCKED + REVIEW_REQUIREDstate that requires administrator bypass. - If the preflight exits
6, fails, or reports missing/uncertain data, use the conservative fallback below. - Conservative fallback: confirm the Borg UI validation gauntlet is green
locally before any push:
git diff --check; backend checks for backend changes; frontend checks for frontend changes; and smoke/runtime checks for user-facing app changes. - If the working tree has uncommitted changes, commit with the
commitskill and push with thepushskill before proceeding. - Check mergeability and conflicts against main.
- If conflicts exist, use the
pullskill to fetch/mergeorigin/mainand resolve conflicts, then use thepushskill to publish the updated branch. - Ensure Codex review comments (if present) are acknowledged and any required fixes are handled before merging.
- Watch checks until complete.
- If checks fail, pull logs, fix the issue, commit with the
commitskill, push with thepushskill, and re-run checks. - When all checks are green and review feedback is addressed, squash-merge and delete the branch using the PR title/body for the merge subject/body.
- Context guard: Before implementing review feedback, confirm it does not conflict with the user’s stated intent or task context. If it conflicts, respond inline with a justification and ask the user before changing code.
- Pushback template: When disagreeing, reply inline with: acknowledge + rationale + offer alternative.
- Ambiguity gate: When ambiguity blocks progress, use the clarification
flow (assign PR to current GH user, mention them, wait for response). Do not
implement until ambiguity is resolved.
- If you are confident you know better than the reviewer, you may proceed without asking the user, but reply inline with your rationale.
- Per-comment mode: For each review comment, choose one of: accept, clarify, or push back. Reply inline (or in the issue thread for Codex reviews) stating the mode before changing code.
- Reply before change: Always respond with intended action before pushing code changes (inline for review comments, issue thread for Codex reviews).
Commands
# Ensure branch and PR context
branch=$(git branch --show-current)
pr_number=$(gh pr view --json number -q .number)
pr_title=$(gh pr view --json title -q .title)
pr_body=$(gh pr view --json body -q .body)
handoff_note='Human Review handoff: head=<sha>; at=<timestamp>; validation=<commands>'
# Fast path for already-green PRs. If this exits 0, skip local validation and
# the full watcher loop. If it exits 6 or errors, use the conservative fallback.
if preflight_json=$(python3 .codex/skills/land/land_watch.py --preflight --json --allow-review-required-admin-bypass --handoff-note "$handoff_note"); then
requires_admin_bypass=$(
printf '%s' "$preflight_json" |
python3 -c 'import json,sys; print("true" if json.load(sys.stdin).get("requires_admin_bypass") else "false")'
)
mergeable=$(gh pr view --json mergeable -q .mergeable)
merge_state=$(gh pr view --json mergeStateStatus -q .mergeStateStatus)
review_decision=$(gh pr view --json reviewDecision -q .reviewDecision)
merge_args=(--squash --subject "$pr_title" --body "$pr_body")
if [ "$requires_admin_bypass" = "true" ]; then
if [ "$mergeable" = "MERGEABLE" ] && [ "$merge_state" = "BLOCKED" ] && [ "$review_decision" = "REVIEW_REQUIRED" ]; then
merge_args+=(--admin)
gh pr merge "${merge_args[@]}"
merge_rc=$?
if [ "$merge_rc" -eq 0 ]; then
exit 0
fi
exit "$merge_rc"
fi
elif [ "$mergeable" = "MERGEABLE" ] && { [ "$merge_state" = "CLEAN" ] || [ "$merge_state" = "HAS_HOOKS" ]; }; then
gh pr merge "${merge_args[@]}"
merge_rc=$?
if [ "$merge_rc" -eq 0 ]; then
exit 0
fi
exit "$merge_rc"
fi
fi
# Check mergeability and conflicts for the conservative fallback.
mergeable=$(gh pr view --json mergeable -q .mergeable)
if [ "$mergeable" = "CONFLICTING" ]; then
# Run the `pull` skill to handle fetch + merge + conflict resolution.
# Then run the `push` skill to publish the updated branch.
fi
# Conservative fallback: Borg UI local validation before merge. Keep this
# scope-sensitive for the PR.
git diff --check
if git diff --name-only origin/main...HEAD | rg -q '^(app|tests|requirements.txt|pytest.ini|ruff.toml)(/|$)'; then
ruff check app tests
ruff format --check app tests
pytest tests/unit -v
fi
if git diff --name-only origin/main...HEAD | rg -q '^frontend/'; then
(cd frontend && npm run check:locales && npm run typecheck && npm run lint && npm run build)
fi
# Fallback watcher path. The manual loop is a fallback when Python cannot run or
# the helper script is unavailable.
# Wait for review feedback: Codex reviews arrive as issue comments that start
# with "## Codex Review — <persona>". Treat them like reviewer feedback: reply
# with a `[codex]` issue comment acknowledging the findings and whether you're
# addressing or deferring them.
while true; do
gh api repos/{owner}/{repo}/issues/"$pr_number"/comments \
--jq '.[] | select(.body | startswith("## Codex Review")) | .id' | rg -q '.' \
&& break
sleep 10
done
# Watch checks
if ! gh pr checks --watch; then
gh pr checks
# Identify failing run and inspect logs
# gh run list --branch "$branch"
# gh run view <run-id> --log
exit 1
fi
# Squash-merge (remote branches auto-delete on merge in this repo)
gh pr merge --squash --subject "$pr_title" --body "$pr_body"
Fast Path Preflight
For already-green PRs, the preflight command checks current GitHub state instead of repeating local validation:
python3 .codex/skills/land/land_watch.py --preflight --json --allow-review-required-admin-bypass --handoff-note "$handoff_note"
The handoff note must come from the workpad final handoff notes:
Human Review handoff: head=<PR head SHA>; at=<ISO-8601 timestamp>; validation=<commands>
The normal fast path is allowed only when all of these are true:
- The current PR head SHA matches the Human Review handoff SHA.
- Mergeability is
MERGEABLEand merge state isCLEANorHAS_HOOKS. - GitHub check runs exist and are complete with successful, neutral, or skipped conclusions.
- No human issue comments, human inline review comments, blocking review states, Codex review issue comments, or Codex inline comments appeared after the Human Review handoff timestamp.
The review-required administrator-bypass fast path is allowed only when the
same head/check/feedback requirements pass, the preflight was run with
--allow-review-required-admin-bypass, mergeability is MERGEABLE, merge state
is BLOCKED, and reviewDecision is REVIEW_REQUIRED. In that case the
preflight JSON includes "requires_admin_bypass": true; merge with
gh pr merge --admin. If GitHub rejects the admin merge, record the missing
merge permission or branch-policy error in the workpad as the landing blocker.
Exit codes:
- 0: Fast path ready; skip full local validation and full watcher mode. Check
the JSON
requires_admin_bypassfield before choosing merge arguments. - 6: Full validation required; use the conservative fallback.
Async Watch Helper
Use the asyncio watcher in the conservative fallback to monitor review comments, CI, and head updates in parallel:
python3 .codex/skills/land/land_watch.py
Exit codes:
- 2: Review comments detected (address feedback)
- 3: CI checks failed
- 4: PR head updated (autofix commit detected)
- 5: PR has merge conflicts
- 6: Fast-path preflight requires full validation
Failure Handling
- If checks fail, pull details with
gh pr checksandgh run view --log, then fix locally, commit with thecommitskill, push with thepushskill, and re-run the watch. - Run the full local validation and watcher fallback when the preflight reports changed PR head, missing handoff data, conflicts, missing/pending/failed/ inconclusive checks, feedback after Human Review, or any uncertain GitHub state.
- Use judgment to identify flaky failures. If a failure is a flake (e.g., a timeout on only one platform), you may proceed without fixing it.
- If CI pushes an auto-fix commit (authored by GitHub Actions), it do
Content truncated.
When not to use it
- →Do not yield to the user until the PR is merged.
- →Do not delete remote branches after merge.
- →Do not implement review feedback if it conflicts with the user’s stated intent or task context.
Prerequisites
Limitations
- →The skill requires `gh` CLI to be authenticated.
- →It requires being on the PR branch with a clean working tree.
- →It does not delete remote branches after merge, relying on repo auto-deletion.
How it compares
This skill automates the PR landing process with a fast-path preflight and integrated conflict resolution, providing a more efficient and controlled merge than manual monitoring and merging.
Compared to similar skills
land side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| land (this skill) | 0 | 2mo | Review | Intermediate |
| github-workflow-automation | 11 | 2mo | Review | Advanced |
| testing-workflow | 16 | 9mo | Review | Intermediate |
| github-actions-templates | 7 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by karanhudia
View all by karanhudia →You might also like
github-workflow-automation
ruvnet
Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management
testing-workflow
amo-tech-ai
Comprehensive testing workflow for E2E, integration, and unit tests. Use when testing applications layer-by-layer, validating user journeys, or running test suites.
github-actions-templates
wshobson
Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications. Use when setting up CI/CD with GitHub Actions, automating development workflows, or creating reusable workflow templates.
glab
NikiforovAll
Expert guidance for using the GitLab CLI (glab) to manage GitLab issues, merge requests, CI/CD pipelines, repositories, and other GitLab operations from the command line. Use this skill when the user needs to interact with GitLab resources or perform GitLab workflows.
create-pr
n8n-io
Creates GitHub pull requests with properly formatted titles that pass the check-pr-title CI validation. Use when creating PRs, submitting changes for review, or when the user says /pr or asks to create a pull request.
gh-fix-ci
openai
Use when a user asks to debug or fix failing GitHub PR checks that run in GitHub Actions; use `gh` to inspect checks and logs, summarize failure context, draft a fix plan, and implement only after explicit approval. Treat external providers (for example Buildkite) as out of scope and report only the details URL.