neon-postgres-branches – skill Viết lách & Nội dung cho agent AI
Chọn và tạo đúng loại nhánh Neon để kiểm thử và phát triển. Dùng khi người dùng hỏi về phân nhánh Neon, kiểm thử migration với dữ liệu thật, môi trường kiểm thử tách biệt, quy trình nhánh chỉ có schema cho dữ liệu nhạy cảm, hoặc tạo nhánh qua Neon CLI hoặc Neon MCP.
Cài skill neon-postgres-branches bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/neon-postgres-branches-50cf9.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /neon-postgres-branches – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/neon-postgres-branches-50cf9.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $neon-postgres-branches – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/neon-postgres-branches-50cf9.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /neon-postgres-branches – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/neon-postgres-branches-50cf9.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /neon-postgres-branches – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Neon Postgres Branching
When to Use
Use this skill when you need choose 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...
The outcome of this skill should be a created Neon branch (or a clear, actionable next step if creation cannot proceed).
For a creation request, choose the correct branch type and execute within the authorized project/data/cost scope. Advice-only questions do not authorize provisioning.
- 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:
1. If the user wants to test complex migrations, performance, or behavior against production-like data, choose a normal branch.
2. 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
Always support both Neon CLI and Neon MCP server. Prefer the tool the user already has installed and authenticated.
MCP link: https://neon.com/docs/ai/neon-mcp-server.md
CLI link: https://neon.com/docs/reference/cli-quickstart
Selection order
1. Check MCP first in MCP-enabled environments:
- If Neon MCP tools are available and authenticated (for example, listing projects works), use MCP.
2. If MCP is unavailable or not authenticated, check CLI:
- Run
neon --versionto confirm CLI is installed. - Run
neon projects listto confirm auth/context.
3. If CLI is missing, direct installation via quickstart.
4. If CLI is installed but not authenticated, guide the user through neon auth (or API key auth), then continue.
5. If both MCP and CLI paths are unsuccessful, use the Neon REST API:
- https://neon.com/docs/guides/branching-neon-api.md
MCP branch flow
1. Choose normal vs schema-only based on data sensitivity and migration-testing goals.
2. Use branch tools (for example, create_branch) to create the branch.
3. Validate with read tools (for example, describe_branch).
4. 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
1. Use MCP if already available/authenticated; otherwise verify CLI with neon --version.
2. Ensure project context is set (neon set-context --project-id <your-project-id>) or include --project-id on commands.
3. Create branch:
neon branches create \
--name <branch-name> \
--parent <parent-branch-id-or-name> \
--expires-at 2026-12-15T18:02:16Z4. 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
1. Use MCP if already available/authenticated; otherwise verify CLI with neon --version.
2. Create 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:
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:
1. Ask them to share feedback in the Neon Console:
- https://console.neon.tech/app/projects?modal=feedback
2. 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 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.
- Ephemeral lifecycle hygiene: Set branch expiration and automate cleanup so old branches do not accumulate avoidable storage/history cost.
Post-creation environment update prompt
After branch creation, ask whether the user wants to update local environment credentials to point at the new branch.
- Ask: "Do you want me to update your
.envDATABASE_URLto this new branch connection string?" - If yes, write the new branch connection string to the requested env file/key.
- If no, leave credentials unchanged; share retrieval instructions rather than exposing the credential-bearing connection string in chat.
- Never overwrite an existing env key without explicit confirmation.
Neon Infrastructure as Code (neon.ts)
Beyond creating branches imperatively (CLI / MCP / API above), you can program what configuration new branches receive declaratively in neon.ts — Neon's infrastructure-as-code file (see the neon skill for the full reference). The branch property is a function of the branch being evaluated that returns its settings, so every branch born from your project gets a consistent lifecycle and compute profile without per-branch flags.
npm i @neon/config// neon.ts
import { defineConfig } from "@neon/config/v1";
export default defineConfig({
branch: (branch) => {
if (branch.exists) return {}; // never reconcile existing bra… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- neon-postgres-egress-optimizer – Chẩn đoán và khắc phục lưu lượng egress (truyền dữ liệu mạng) Postgres quá mức trong…
- obsidian-bases – Tạo và chỉnh sửa Obsidian Bases (tệp .base) với view, bộ lọc, công thức và tổng hợp…
- obsidian-clipper-template-creator – Hướng dẫn tạo template cho Obsidian Web Clipper. Dùng khi muốn tạo template clip mới…
- odoo-orm-expert – Nắm vững các mẫu ORM của Odoo: search, browse, create, write, domain filter, computed…
- odoo-performance-tuner – Hướng dẫn chuyên sâu chẩn đoán và khắc phục sự cố hiệu năng Odoo: truy vấn chậm, cấu…
- odoo-upgrade-advisor – Trợ lý nâng cấp phiên bản Odoo từng bước: checklist trước nâng cấp, lộ trình nâng cấp…
- onboarding – Khi người dùng muốn tối ưu onboarding sau đăng ký, kích hoạt người dùng, trải nghiệm lần…
- php-pro – Viết code PHP đúng chuẩn idiom với generator, iterator, cấu trúc dữ liệu SPL và tính…