forge-cleanup

Automates post-merge branch cleanup and issue updates for merged GitHub pull requests.

1|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/jp5labs/forge-workflow --skill forge-cleanup-jp5labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: forge-cleanup
Source: https://github.com/jp5labs/forge-workflow/tree/main/forge_workflow/templates/skills/forge-cleanup
Command: npx skills add https://github.com/jp5labs/forge-workflow --skill forge-cleanup-jp5labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After a pull request is merged, developers often forget to delete stale local and remote branches, sync main, or update the linked issue's project status, leaving repositories cluttered and project boards out of date. ## Core Features & Use Cases - Branch Cleanup: Checks out main, syncs from origin, and deletes both local and remote feature branches via the jp5 pr cleanup CLI. - Issue Management: Optionally posts a final comment to the linked issue and sets its project Status to Review. - Worktree Support: Detects git worktree contexts and adapts behavior, skipping checkout and local branch deletion while rebasing onto origin/main. - Session Telemetry: Posts a session telemetry comment with model, PRs, commits, and skills used, preferring hook-generated exact token data. - Use Case: After your PR #42 merges, run the cleanup to delete the feature branch locally and remotely, comment on issue #38, and move it to Review on the project board. ## Quick Start Tell the assistant the PR has been merged and ask it to run the forge cleanup for that PR number with its linked issue.

Frequently Asked Questions about forge-cleanup

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

FAQPage Schema
How do I clean up branches after a PR is merged on GitHub?

Run jp5 pr cleanup with the merged PR number to check out main, sync from origin, and delete both the local and remote feature branches. Add --dry-run first to validate the operation without making changes.

How to delete local and remote git branches after merge?

The cleanup command deletes the local feature branch and the remote branch on origin in one step. Use --skip-local-branch-delete or --skip-remote-branch-delete if you need to keep either one.

Does branch cleanup work inside a git worktree?

Yes, the cleanup detects worktree contexts automatically. It skips checking out main, rebases the worktree branch onto origin/main, skips local branch deletion, and still deletes the remote branch and handles issue updates.

Why does post-merge cleanup fail with uncommitted changes?

The cleanup runs a preflight check that blocks execution when the working tree has unrelated dirty files. Commit or stash your changes first, or pass --allow-dirty to bypass the clean-tree requirement.

Can I update a GitHub issue status after merging a PR?

Yes, pass --issue with the issue number, --issue-comment-file with a markdown comment, and --set-review to post a final comment and set the linked issue's project Status to Review automatically.