better-env

โดย neondatabase

การจัดการตัวแปรสภาพแวดล้อมที่ดีขึ้นสำหรับเอเจนต์และมนุษย์ ด้วยความปลอดภัยของประเภทข้อมูลที่สมบูรณ์ การซิงโครไนซ์สภาพแวดล้อมระยะไกลผ่าน CLI และการตรวจสอบความถูกต้องของสภาพแวดล้อม…

npx skills add https://github.com/neondatabase/better-env --skill better-env

Work With better-env In A Repo

Type-safe environment config modules

Follow this best practice to manage environment variables in TypeScript applications with full type safety and clear server/public boundaries.

better-env exports configSchema to define typed env modules and recommends placing them in feature-level config.ts files (for example src/lib/auth/config.ts and src/lib/database/config.ts).

Learn more:

  • references/config-schema.md

Validate existence of all env variables in the current environment

Run env validation early so missing or invalid values fail fast before dev, build, or deploy steps.

better-env validate --environment <name> loads .env* files with Next.js semantics, discovers src/lib/*/config.ts modules, and checks every declared variable from your configSchema modules.

If your dotenv files intentionally include keys that are not referenced by config modules, add per-env suppressions in better-env.ts:

environments.<env>.ignoreUnused: string[]

These suppress only the selected local environment during validate. Adapter defaults are merged in automatically; for Vercel, VERCEL_OIDC_TOKEN is ignored by default in development, preview, and production.

Learn more:

  • references/env-validation.md

Configure runtime syncing between local files and hosted providers

Use runtime configuration to keep local dotenv targets aligned with provider environments while preserving safe defaults.

Create better-env.ts with defineBetterEnv(...) and an adapter (vercelAdapter, netlifyAdapter, railwayAdapter, or cloudflareAdapter).

For a standard Vercel setup, prefer the minimal config:

export default defineBetterEnv({ adapter: vercelAdapter() });

Do not add an environments block when it only duplicates adapter defaults. Add environments only when you intentionally need custom mappings, custom env files, or per-environment ignoreUnused behavior.

Learn more:

  • references/config.md
  • references/runtime.md

Use the CLI for day-to-day environment operations

The CLI gives a consistent workflow for initialization, sync, validation, and remote variable management, which is great for local development and CI automation.

Choose the command runner to match the repo:

  • Use npx in npm/pnpm-based repos (for example lockfiles like package-lock.json or pnpm-lock.yaml and scripts run via npm/pnpm).
  • Use bunx in Bun-based repos (for example bun.lock and scripts run via bun).
  • Keep commands aligned with the project's existing package manager/runtime conventions; do not mix runners unless the repo already does.

Recommended flow in a repo:

  1. Run better-env init once to verify adapter prerequisites.
  2. Run better-env pull --environment <name> to sync local env files.
  3. Run better-env validate --environment <name> before app startup/build.
  4. Use add, upsert, update, delete, and load for remote env changes.

Choose command behavior intentionally:

  • upsert for idempotent automation and scripts
  • add when duplicate keys should fail
  • update when missing keys should fail
  • delete to remove remote keys
  • load for batch updates from dotenv files

Learn more:

  • references/cli.md
  • references/vercel-adapter.md

Skills เพิ่มเติมจาก neondatabase

claimable-postgres
neondatabase
ฐานข้อมูล Postgres แบบทันทีสำหรับการพัฒนาในเครื่อง การสาธิต การสร้างต้นแบบ และสภาพแวดล้อมการทดสอบ ไม่ต้องมีบัญชี ฐานข้อมูลจะหมดอายุหลังจาก 72 ชั่วโมง เว้นแต่จะถูกอ้างสิทธิ์ไปยังบัญชี Neon
official
neon-postgres-branches
neondatabase
ผลลัพธ์ของสกิลนี้ควรเป็นสาขา Neon ที่ถูกสร้างขึ้น (หรือขั้นตอนถัดไปที่ชัดเจนและสามารถดำเนินการได้ หากไม่สามารถดำเนินการสร้างต่อได้) เลือกประเภทสาขาที่ถูกต้อง จากนั้นดำเนินการสร้างสาขาผ่าน MCP หรือ CLI
official
neon-postgres-egress-optimizer
neondatabase
แนะนำผู้ใช้ในการวินิจฉัยและแก้ไขรูปแบบการค้นหาข้อมูลฝั่งแอปพลิเคชันที่ทำให้เกิดการถ่ายโอนข้อมูลมากเกินไป (egress) จากฐานข้อมูล Postgres ของพวกเขา ค่าใช้จ่าย egress ที่สูงส่วนใหญ่มาจากแอปพลิเคชันที่ดึงข้อมูลมากกว่าที่ใช้งานจริง
official
plugin-manager
neondatabase
จัดการโครงสร้างปลั๊กอินและการกำหนดค่าสำหรับพื้นที่เก็บข้อมูลนี้ทั้งใน Cursor และ Claude Code ใช้เมื่อสร้าง อัปเดต หรือตรวจสอบโฟลเดอร์ปลั๊กอิน…
official
skill-creator
neondatabase
คู่มือสำหรับการสร้างสกิลที่มีประสิทธิภาพ สกิลนี้ควรใช้เมื่อผู้ใช้ต้องการสร้างสกิลใหม่ (หรืออัปเดตสกิลที่มีอยู่) ที่ขยายความสามารถของ Claude...
official
add-neon-docs
neondatabase
ใช้ทักษะนี้เมื่อผู้ใช้ขอให้เพิ่มเอกสาร เพิ่มเอกสารอ้างอิง เพิ่มข้อมูลอ้างอิง หรือติดตั้งเอกสารเกี่ยวกับ Neon เพิ่มลิงก์อ้างอิงแนวทางปฏิบัติที่ดีที่สุดของ Neon…
official
neon-auth
neondatabase
ตั้งค่า Neon Auth สำหรับแอปพลิเคชันของคุณ กำหนดค่าการยืนยันตัวตน สร้างเส้นทางสำหรับการยืนยันตัวตน และสร้างส่วนประกอบ UI ใช้เมื่อเพิ่มการยืนยันตัวตนให้กับ Next.js,…
official
neon-drizzle
neondatabase
สร้างการตั้งค่า Drizzle ORM ที่ทำงานได้อย่างสมบูรณ์พร้อมฐานข้อมูล Neon ที่เตรียมไว้ ติดตั้ง dependencies จัดเตรียมข้อมูลรับรองฐานข้อมูล กำหนดค่าการเชื่อมต่อ…
official