infra-env-setup-env — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited infra-env-setup-env (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Quick Guide: Per-app .env files (apps/client-next/.env). Framework-specific prefixes (NEXTPUBLIC\_, VITE\_\_). Zod validation at startup. Maintain .env.example templates. Never commit secrets (.gitignore). Environment-based feature flags.
<critical_requirements>
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)(You MUST validate ALL environment variables with Zod at application startup)
*(You MUST use framework-specific prefixes for client-side variables - NEXTPUBLIC\ for Next.js, VITE\_\ for Vite)*
(You MUST maintain .env.example templates with ALL required variables documented)
(You MUST never commit secrets to version control - use .env.local and CI secrets)
(You MUST use per-app .env files - NOT root-level .env files)
</critical_requirements>
Auto-detection: Environment variables, .env files, Zod validation, t3-env, @t3-oss/env, secrets management, NEXTPUBLIC prefix, VITE\_ prefix, feature flags, z.stringbool
When to use:
When NOT to use:
Key patterns covered:
Detailed Resources:
<philosophy>
Environment management follows the principle that configuration is code - it should be validated, typed, and versioned. The system uses per-app .env files with framework-specific prefixes, Zod validation at startup, and strict security practices to prevent secret exposure.
When to use this environment management approach:
When NOT to use:
</philosophy>
<patterns>
Each app/package has its own .env file to prevent conflicts and clarify ownership.
#### File Structure
apps/
├── client-next/
│ ├── .env # Local development (NEXT_PUBLIC_API_URL)
│ └── .env.production # Production overrides
├── client-react/
│ ├── .env # Local development
│ └── .env.production # Production overrides
└── server/
├── .env # Local server config
├── .env.example # Template for new developers
└── .env.local.example # Local overrides template
packages/
├── api/
│ └── .env # API package config
└── api-mocks/
└── .env # Mock server config#### File Types and Purpose
.env)#### Loading Order and Precedence
Next.js loading order (highest to lowest priority):
process.env (already set in environment).env.$(NODE_ENV).local (e.g., .env.production.local).env.local (not loaded when NODE_ENV=test).env.$(NODE_ENV) (e.g., .env.production).envVite loading order:
.env.[mode].local (e.g., .env.production.local).env.[mode] (e.g., .env.production).env.local.envException: Shared variables can go in your build tool's env configuration (e.g., turbo.json env array) for cache invalidation
See examples/core.md for complete code examples.
Validate environment variables at application startup using Zod schemas. Define a schema, parse at startup, export a typed env object.
// lib/env.ts
const envSchema = z.object({
VITE_API_URL: z.string().url(),
VITE_API_TIMEOUT: z.coerce.number().default(DEFAULT_API_TIMEOUT_MS),
VITE_ENABLE_ANALYTICS: z.stringbool().default(false), // Zod 4+ (NOT z.coerce.boolean())
});
export const env = envSchema.parse(import.meta.env);Key gotchas:
z.coerce.boolean() converts "false" to true (string is truthy) - always use z.stringbool() insteaderror.issues (not error.errors) for Zod 4 error handlingNote: For Next.js/Vite projects, consider T3 Env (@t3-oss/env-nextjsor@t3-oss/env-core) for client/server variable separation and build-time validation. See examples/t3-env.md.
See examples/core.md for complete good/bad comparisons.
Use framework-specific prefixes for client-side variables and SCREAMING_SNAKE_CASE for all environment variables.
#### Mandatory Conventions
NEXT_PUBLIC_* (Next.js) or VITE_* (Vite) for client-side variables#### Framework Prefixes
Next.js:
NEXT_PUBLIC_* - Client-side accessible (embedded in bundle) - use for API URLs, public keys, feature flagsVite:
VITE_* - Client-side accessible (embedded in bundle) - use for API URLs, public configurationNode.js/Server:
NODE_ENV - Standard environment (development, production, test)PORT - Server port numberSee examples/naming-and-templates.md for complete code examples with good/bad comparisons.
</patterns>
<integration>
Core dependencies:
@t3-oss/env-nextjs, @t3-oss/env-core): Recommended wrapper for client/server separationFramework support:
NEXT_PUBLIC_* prefix for client-sideVITE_* prefix for client-sideMonorepo considerations:
Replaces / Conflicts with:
</integration>
<decision_framework>
Need environment configuration?
├─ Is it a secret (API key, password)?
│ ├─ YES → Use .env.local (gitignored) + CI secrets
│ └─ NO → Can it be public (embedded in client bundle)?
│ ├─ YES → Use NEXT_PUBLIC_* or VITE_* prefix
│ └─ NO → Server-side only (no prefix)
├─ Does it change per environment?
│ ├─ YES → Use .env.{environment} files
│ └─ NO → Use .env with defaults
└─ Is it app-specific or shared?
├─ App-specific → Per-app .env file
└─ Shared → Declare in turbo.json env arraySee reference.md for complete decision frameworks including feature flag decisions.
</decision_framework>
<red_flags>
High Priority Issues:
Medium Priority Issues:
Gotchas:
z.coerce.number() for numbers, use z.stringbool() for booleans (Zod 4+)z.coerce.boolean() converts "false" to true (string is truthy) - use z.stringbool() (Zod 4+) insteadundefined - use T3 Env's emptyStringAsUndefined: true optionturbo.json env arraySee reference.md for complete RED FLAGS, anti-patterns, and checklists.
</red_flags>
<critical_reminders>
All code must follow project conventions in CLAUDE.md
(You MUST validate ALL environment variables with Zod at application startup)
*(You MUST use framework-specific prefixes for client-side variables - NEXTPUBLIC\ for Next.js, VITE\_\ for Vite)*
(You MUST maintain .env.example templates with ALL required variables documented)
(You MUST never commit secrets to version control - use .env.local and CI secrets)
(You MUST use per-app .env files - NOT root-level .env files)
Failure to follow these rules will cause runtime errors, security vulnerabilities, and configuration confusion.
</critical_reminders>
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.