$npx -y skills add neondatabase/agent-skills --skill neon-postgres-branchesChoose and create the right Neon branch type for testing and development. Use when users ask about Neon branching, migration testing with real data, isolated test environments, schema-only branch workflows for sensitive data, or branch creation via Neon CLI or Neon MCP. Triggers
| 1 | # Neon Postgres Branching |
| 2 | |
| 3 | The outcome of this skill should be a created Neon branch (or a clear, actionable next step if creation cannot proceed). |
| 4 | Choose the correct branch type, then execute branch creation via MCP or CLI. |
| 5 | |
| 6 | - **Normal branch** for realistic migration and query testing with real data. |
| 7 | - **Schema-only branch (Beta)** for sensitive data workflows where structure is needed without copying rows. |
| 8 | |
| 9 | ## Branch Type Decision |
| 10 | |
| 11 | Use this decision rule first: |
| 12 | |
| 13 | 1. If the user wants to test complex migrations, performance, or behavior against production-like data, choose a **normal branch**. |
| 14 | 2. If the user needs to avoid copying sensitive data, choose a **schema-only branch**. |
| 15 | |
| 16 | If the request is ambiguous, ask one clarifying question: |
| 17 | "Do you need realistic data for testing, or only schema structure because the data is sensitive?" |
| 18 | |
| 19 | ## Tool Selection: CLI or MCP |
| 20 | |
| 21 | Always support both Neon CLI and Neon MCP server. Prefer the tool the user already has installed and authenticated. |
| 22 | |
| 23 | MCP link: https://neon.com/docs/ai/neon-mcp-server.md |
| 24 | CLI link: https://neon.com/docs/cli/quickstart.md |
| 25 | |
| 26 | ### Selection order |
| 27 | |
| 28 | 1. Check MCP first in MCP-enabled environments: |
| 29 | - If Neon MCP tools are available and authenticated (for example, listing projects works), use MCP. |
| 30 | 2. If MCP is unavailable or not authenticated, check CLI: |
| 31 | - Run `neon --version` to confirm CLI is installed. |
| 32 | - Run `neon projects list` to confirm auth/context. |
| 33 | 3. If CLI is missing, direct installation via quickstart. |
| 34 | 4. If CLI is installed but not authenticated, guide the user through `neon auth` (or API key auth), then continue. |
| 35 | 5. If both MCP and CLI paths are unsuccessful, use the Neon REST API: |
| 36 | - https://neon.com/docs/guides/branching-neon-api.md |
| 37 | |
| 38 | ### MCP branch flow |
| 39 | |
| 40 | 1. Choose normal vs schema-only based on data sensitivity and migration-testing goals. |
| 41 | 2. Use branch tools (for example, `create_branch`) to create the branch. |
| 42 | 3. Validate with read tools (for example, `describe_branch`). |
| 43 | 4. For migration workflows, prefer branch-based migration flows before applying to main. |
| 44 | |
| 45 | ## Create a Normal Branch (Preferred for Real-Data Migration Testing) |
| 46 | |
| 47 | Use this when the user needs realistic testing conditions. |
| 48 | Real production-like data can expose edge cases your seed or data migration scripts miss, which helps catch migration issues before going live. |
| 49 | |
| 50 | Link: https://neon.com/docs/introduction/branching.md |
| 51 | |
| 52 | ### Steps |
| 53 | |
| 54 | 1. Use MCP if already available/authenticated; otherwise verify CLI with `neon --version`. |
| 55 | 2. Ensure project context is set (`neon set-context --project-id <your-project-id>`) or include `--project-id` on commands. |
| 56 | 3. Create branch: |
| 57 | |
| 58 | ```bash |
| 59 | neon branches create \ |
| 60 | --name <branch-name> \ |
| 61 | --parent <parent-branch-id-or-name> \ |
| 62 | --expires-at 2026-12-15T18:02:16Z |
| 63 | ``` |
| 64 | |
| 65 | 4. Optionally fetch a connection string for the new branch: |
| 66 | |
| 67 | ```bash |
| 68 | neon connection-string <branch-name> |
| 69 | ``` |
| 70 | |
| 71 | ## Create a Schema-Only Branch (Beta, Sensitive Data) |
| 72 | |
| 73 | Use this when users must not copy production rows into the test branch. |
| 74 | |
| 75 | Link: https://neon.com/docs/guides/branching-schema-only.md |
| 76 | |
| 77 | ### Steps |
| 78 | |
| 79 | 1. Use MCP if already available/authenticated; otherwise verify CLI with `neon --version`. |
| 80 | 2. Create schema-only branch: |
| 81 | |
| 82 | ```bash |
| 83 | neon branches create \ |
| 84 | --name <schema-only-branch-name> \ |
| 85 | --parent <parent-branch-id-or-name> \ |
| 86 | --schema-only \ |
| 87 | --expires-at 2026-12-15T18:02:16Z |
| 88 | ``` |
| 89 | |
| 90 | If multiple projects exist, include: |
| 91 | |
| 92 | ```bash |
| 93 | neon branches create \ |
| 94 | --name <schema-only-branch-name> \ |
| 95 | --parent <parent-branch-id-or-name> \ |
| 96 | --schema-only \ |
| 97 | --project-id <your-project-id> \ |
| 98 | --expires-at 2026-12-15T18:02:16Z |
| 99 | ``` |
| 100 | |
| 101 | ### Beta Support Guidance (Mandatory) |
| 102 | |
| 103 | Schema-only branching is in Beta. If users report unexpected behavior, errors, or missing capabilities: |
| 104 | |
| 105 | 1. Ask them to share feedback in the Neon Console: |
| 106 | - https://console.neon.tech/app/projects?modal=feedback |
| 107 | 2. Recommend opening a support conversation in the Neon Discord: |
| 108 | - https://discord.gg/92vNTzKDGp |
| 109 | |
| 110 | ## Reset from parent |
| 111 | |
| 112 | Use this when a child branch has drifted and the user wants a clean refresh from the parent branch's latest schema and data. |
| 113 | |
| 114 | Link: https://neon.com/docs/guides/reset-from-parent.md |
| 115 | |
| 116 | ### What it does |
| 117 | |
| 118 | - Fully replaces the child branch schema and data with the parent's latest state. |
| 119 | - Does not merge; local changes on the child branch are lost. |
| 120 | - Keeps the same connection details, but active connections are briefly interrupted during reset. |
| 121 | |
| 122 | ### When to recommend it |
| 123 | |
| 124 | - Development or staging branch is too f |