lgtm

Merges approved GitHub pull requests and removes their remote branches and linked worktrees.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/TrayMachi/dotfiles --skill lgtm-traymachi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: lgtm
Source: https://github.com/TrayMachi/dotfiles/tree/main/agents/skills/lgtm
Command: npx skills add https://github.com/TrayMachi/dotfiles --skill lgtm-traymachi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After a pull request is approved, developers still need to merge it, delete the remote branch, and clean up the local worktree by hand. This Skill automates that entire post-approval workflow safely, with strict validation at every step so nothing is merged or deleted by mistake. ## Core Features & Use Cases - Validated PR merging: Resolves the target PR, checks required status checks, review decisions, draft state, and merge state before merging with squash, merge, or rebase via the GitHub CLI. - Remote branch cleanup: Deletes the merged head branch on the remote only after confirming the PR is merged, and verifies deletion with git ls-remote. - Safe worktree removal: Removes the linked git worktree from the primary checkout without force flags, refusing to proceed if the worktree is dirty or the path is not a recognized worktree. - Use Case: A reviewer types "LGTM" on a PR created in a ship worktree; the Skill merges the PR with squash, deletes the remote branch, removes the worktree, and reports exactly what was done. ## Quick Start Say "LGTM, merge this PR" from the pull request's linked worktree to merge it and clean up the branch and worktree.

Frequently Asked Questions about lgtm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I merge a GitHub pull request from the command line?▼

Use the GitHub CLI with `gh pr merge <number> --squash --match-head-commit <sha>` after verifying checks pass. This Skill automates that flow, validating review state, required checks, and merge status before merging.

How do I delete a remote branch after merging a pull request?▼

Delete the remote branch with `git push origin --delete <branch>` only after confirming the PR is merged. Verify deletion with `git ls-remote --heads origin <branch>` before removing any local worktree.

Can I remove a git worktree that has uncommitted changes?▼

No, `git worktree remove` refuses to remove dirty worktrees unless forced. This Skill never uses `--force`; it stops and reports the blocker so uncommitted work is never discarded.

What tools are required to merge PRs and clean up worktrees automatically?▼

You need git and the GitHub CLI (gh), and you must run from the PR's linked worktree. The Skill is GitHub-only and requires the worktree to live under a `<repo>-worktrees` directory next to the primary checkout.

Why does PR merging stop when checks are pending or changes are requested?▼

Merging is blocked when required checks fail or are pending, when the review decision is CHANGES_REQUESTED or REVIEW_REQUIRED, or when the PR is a draft. These guardrails prevent merging unreviewed or broken code.