Neon Postgres Branches
>-
- Skill ID
- neondatabase/agent-skills/neon-postgres-branches
- Publisher
- neondatabase
- Repository
- agent-skills
- Installs
- 381
- Files
- 1
- Synced
- Sep 16, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
neondatabase/agent-skills/neon-postgres-branchesInstalls these files- SKILL.md
What this skill tells the agent
FIRST: Use the parent neon skill for a Neon overview, getting started with Neon, Neon development best practices, and more.
If the neon skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:
neon skills -s neon -yLakebase Postgres Branching
Outcome: a created Neon branch — or a clear, actionable next step if creation cannot proceed. Choose the correct branch type, then execute branch creation with the CLI (or MCP where the CLI isn't usable).
- Normal branch for realistic migration and query testing with real data.
- Schema-only branch (Beta) for sensitive data workflows where structure is needed without copying rows.
Branch Type Decision
Use this decision rule first:
- If the user wants to test complex migrations, performance, or behavior against production-like data, choose a normal branch.
- If the user needs to avoid copying sensitive data, choose a schema-only branch.
If the request is ambiguous, ask one clarifying question: "Do you need realistic data for testing, or only schema structure because the data is sensitive?"
Tool Selection: CLI or MCP
Support both the Neon CLI and the Neon MCP server, but default to the CLI. Use MCP only when the CLI is unavailable or blocked in your environment, cannot be authenticated, or the user explicitly asks for MCP.
- CLI link: https://neon.com/docs/cli/quickstart.md
- MCP link: https://neon.com/docs/ai/neon-mcp-server.md
Selection order
- Check the CLI first:
- Run
neon --versionto confirm the CLI is installed. - Run
neon projects listto confirm auth/context.
- If the CLI is missing, direct installation via quickstart.
- If the CLI is installed but not authenticated, guide the user through
neon auth(or API key auth), then continue. - Switch to MCP when the CLI cannot be used — no CLI access in the environment, execution blocked, or authentication not possible — or when the user explicitly asks for MCP. Confirm Neon MCP tools are available and authenticated (for example, listing projects works), then follow the MCP branch flow below.
- If neither path is successful, use the Neon REST API:
- https://neon.com/docs/guides/branching-neon-api.md
MCP branch flow
- Choose normal vs schema-only based on data sensitivity and migration-testing goals.
- Use branch tools (for example,
create_branch) to create the branch. - Validate with read tools (for example,
describe_branch). - For migration workflows, prefer branch-based migration flows before applying to main.
Create a Normal Branch (Preferred for Real-Data Migration Testing)
Use this when the user needs realistic testing conditions. Real production-like data can expose edge cases your seed or data migration scripts miss, which helps catch migration issues before going live.
Link: https://neon.com/docs/introduction/branching.md
Steps
- Settle the tool path first (see Selection order): verify the CLI with
neon --version, and fall back to MCP only if the CLI isn't usable. - Ensure project context is set (
neon set-context --project-id <your-project-id>) or include--project-idon commands. - Create the branch:
neon branches create \
--name <branch-name> \
--parent <parent-branch-id-or-name> \
--expires-at 2026-12-15T18:02:16Z- Optionally fetch a connection string for the new branch:
neon connection-string <branch-name>Create a Schema-Only Branch (Beta, Sensitive Data)
Use this when users must not copy production rows into the test branch.
Link: https://neon.com/docs/guides/branching-schema-only.md
Steps
- Settle the tool path first (see Selection order): verify the CLI with
neon --version, and fall back to MCP only if the CLI isn't usable. - Create the schema-only branch:
neon branches create \
--name <schema-only-branch-name> \
--parent <parent-branch-id-or-name> \
--schema-only \
--expires-at 2026-12-15T18:02:16ZIf multiple projects exist, include --project-id:
neon branches create \
--name <schema-only-branch-name> \
--parent <parent-branch-id-or-name> \
--schema-only \
--project-id <your-project-id> \
--expires-at 2026-12-15T18:02:16ZBeta Support Guidance (Mandatory)
Schema-only branching is in Beta. If users report unexpected behavior, errors, or missing capabilities:
- Ask them to share feedback in the Neon Console:
- https://console.neon.tech/app/projects?modal=feedback
- Recommend opening a support conversation in the Neon Discord:
- https://discord.gg/92vNTzKDGp
Reset from Parent
Use this when a child branch has drifted and the user wants a clean refresh from the parent branch's latest schema and data.
Link: https://neon.com/docs/guides/reset-from-parent.md
What it does
- Fully replaces the child branch schema and data with the parent's latest state.
- Does not merge; local changes on the child branch are lost.
- Keeps the same connection details, but active connections are briefly interrupted during reset.
When to recommend it
- Development or staging branch is too far behind production.
- User wants to start a new feature from a clean parent-aligned state.
- Team wants to refresh staging from production for consistent testing baselines.
Hard constraints and blockers
- Only child branches can be reset (root branches and schema-only root branches cannot be reset from parent).
- If the target branch has children, reset is blocked until those child branches are removed.
- After a parent branch is restored from snapshot, reset-from-parent may be unavailable for up to 24 hours.
- Reset-from-parent always uses the current parent state; use Instant restore for point-in-time recovery needs.
CLI usage
neon branches reset <id|name> --parent --preserve-under-name <backup-branch-name>If project context is not already set, include the project ID:
neon branches reset <id|name> --parent --preserve-under-name <backup-branch-name> --project-id <project-id>--preserve-under-name keeps the pre-reset state as a backup branch for rollback, but adds one extra branch to clean up later.
Optional context setup to avoid repeating --project-id:
neon set-context --project-id <project-id>Console and API usage
- Console: Open the target child branch, then select Reset from parent from Actions.
- API: Use the restore endpoint for the branch and set
source_branch_idto the parent branch ID.
Notes and Caveats
- Schema-only branches are for structure-only cloning and sensitive/compliant data controls.
- Schema-only branches are independent root branches (no parent branch and no shared history), so reset-from-parent does not apply.
- For migration testing that depends on real-world row shapes, volumes, and edge cases, prefer normal branches.
- Root branch allowances and per-branch storage limits can cap how many schema-only branches users can create.
- If a user is unsure, default recommendation is:
- Normal branch for migration validation.
- Schema-only branch for compliance and privacy constraints.
Useful Workflow Patterns
If the user asks for process recommendations (not just a single command), suggest these:
- One branch per PR: Create branch when PR opens, delete when merged/closed, keep migration tests isolated.
- One branch per test run: Create branch at pipeline start, run migrations/tests, delete at end for deterministic CI.
- One branch per developer: Isolated dev environments with production-like shape; avoid team collisions on shared test data.
- PII-aware branching: If production has sensitive data, derive dev/PR branches from an anonymized branch or use schema-only branches.
