neon-branch-cleanup

Delete stale Neon database branches while preserving primary branches and open PRs.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mojwang/macbook-dev-setup --skill neon-branch-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: neon-branch-cleanup
Source: https://github.com/mojwang/macbook-dev-setup/tree/main/.claude/skills/neon-branch-cleanup
Command: npx skills add https://github.com/mojwang/macbook-dev-setup --skill neon-branch-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Neon projects often accumulate preview branches in Neon that can lead to hitting branch limits or clutter deployments. This Skill identifies stale Neon database branches and can safely remove them while preserving branches tied to active work.

Core Features & Use Cases

  • Cross-reference each branch's matching GitHub PR state to avoid deleting branches backing open PRs.
  • Never delete primary or default branches.
  • End-to-end cleanup flow with safeguards and a confirmation step.

Quick Start

Run a safe Neon branch cleanup plan for the active project, cross-referencing GitHub PR states and preserving primary branches.

Frequently Asked Questions about neon-branch-cleanup

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

FAQPage Schema
How do I clean up stale Neon database branches tied to Vercel previews?

To clean up stale Neon branches, the skill cross-references each branch's GitHub PR state and safely deletes non-production branches while preserving those tied to open or draft PRs.

What happens to Neon branches with open pull requests during cleanup?

Neon branches with open or draft pull requests are never deleted. The process cross-checks GitHub PR states and includes safeguards to preserve primary, default, and active branches.

Can I use this branch cleanup automation without hitting Vercel deployment limits?

Yes, this cleanup automation applies when Neon projects accumulate non-production branches or Vercel deployment previews reach limits. It prunes stale branches to keep preview environments clean and within quota.

How do I safely prune Neon branches without deleting primary databases?

To safely prune Neon branches, the cleanup flow includes strict safeguards that never delete primary or default branches. It uses Neon MCP commands to list, describe, and remove only safe, stale branches.

Do I need the Neon MCP and GitHub CLI to automate branch deletion?

Yes, you need the Neon MCP to list, describe, and delete database branches, and the GitHub CLI (gh) to cross-check PR states. These tools verify which branches are safe for deletion.