env-handler
Manage environment variables securely. Handles distinction between .env (template) and .env.local (secrets).
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Environment Variable Handler
Core Rules
-
NO
.env.example: Do not create this file. Use.envas the template. -
Secrets in
.env.local: Actual sensitive values must live in.env.local(git-ignored). -
Placeholders: Every variable in
.env.localMUST have a corresponding entry in.env.- If sensitive:
KEY="" - If public/common:
KEY="default_value"
- If sensitive:
Instructions
1. Adding a New Sensitive Variable
When you need to add a secret (e.g., REPLICATE_API_TOKEN):
-
Update
.env: Add the variable with an empty string value.# .env REPLICATE_API_TOKEN="" -
Ask the User: Explicitly request the user to add the actual value to their local secrets file.
"I have added
REPLICATE_API_TOKENto your.envfile. Please open.env.localand add the actual token:REPLICATE_API_TOKEN=your_token_here"
2. Adding a Non-Sensitive Variable
When adding a public or configuration variable (e.g., NEXT_PUBLIC_APP_URL):
-
Update
.env: Add the variable with its default or development value.# .env NEXT_PUBLIC_APP_URL="http://localhost:3000"
3. Reading Variables
- Server-side:
process.env.KEY - Client-side:
process.env.NEXT_PUBLIC_KEY
Checklist
- Is the variable in
.env? - If sensitive, is the value in
.envempty? - Did I ask the user to update
.env.local?
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-28
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!