一键导入
environment-config
Strict rules for environment variable management using Zod validation and src/config/env.ts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Strict rules for environment variable management using Zod validation and src/config/env.ts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
ZGO API development standards including pagination, error handling, and RESTful design
Test patterns, mocking strategies, and organization best practices
Standardized error format, error code clusters, and API client usage for consistent error handling.
Specifications for Zustand stores, React Query hooks, and the Service-Hook-Type pattern with optimistic updates.
Guidelines for managing internationalization (i18n) in the project using next-intl and unified translation patterns.
High-level overview of project structure, mock API architecture, and authentication flow.
| name | environment-config |
| description | Strict rules for environment variable management using Zod validation and src/config/env.ts. |
This skill provides guidelines for managing environment variables in the project. It ensures type safety and prevents runtime errors by using a single source of truth and schema validation.
All environment variables MUST be defined, validated, and exported from src/config/env.ts.
❌ DO NOT:
const apiUrl = process.env.NEXT_PUBLIC_API_URL; // Unsafe, untyped
✅ DO:
import { env } from '@/config/env';
const apiUrl = env.NEXT_PUBLIC_API_URL; // Typed, validated
The project uses zod to validate environment variables at runtime. If a required variable is missing, the application will fail to start with a clear error message.
.env.local: Define the variable and its value.src/config/env.ts:
envSchema object.env export.| Variable | Required | Default | Description |
|---|---|---|---|
NEXT_PUBLIC_API_URL | No | /api | Base URL for API requests. |
NEXT_PUBLIC_GA_MEASUREMENT_ID | No | - | Google Analytics ID. |
NODE_ENV | No | development | App environment (development | production | test). |
[!IMPORTANT] Always use the
envobject from@/config/envto access environment variables. Directly accessingprocess.envis strictly prohibited outside of the config file.