home / skills / andrelandgraf / fullstackrecipes / config-schema-setup
This skill validates and enforces type-safe environment configurations using a Zod-inspired schema, covering server and client fields, feature flags, and
npx playbooks add skill andrelandgraf/fullstackrecipes --skill config-schema-setupReview the files below or copy the command above to add this skill to your agents.
---
name: config-schema-setup
description: Type-safe environment variable validation using Zod with a Drizzle-like schema API. Supports server/public fields, feature flags, either-or constraints, and client-side protection.
---
# Type-Safe Environment Configuration
To set up Type-Safe Environment Configuration, refer to the fullstackrecipes MCP server resource:
**Resource URI:** `recipe://fullstackrecipes.com/config-schema-setup`
If the MCP server is not configured, fetch the recipe directly:
```bash
curl -H "Accept: text/plain" https://fullstackrecipes.com/api/recipes/config-schema-setup
```
This skill provides a TypeScript-first, type-safe environment variable validation system using Zod with a Drizzle-like schema API. It organizes configuration into server-only and public fields, supports feature flags, either-or constraints, and includes client-side protection patterns. The goal is predictable runtime validation and clear compile-time types for full-stack AI apps. It ships as a set of production-ready patterns and step-by-step recipes.
You define a declarative schema using a Drizzle-style API that maps directly to Zod validators. The system generates strict runtime checks and infers TypeScript types so you get end-to-end type safety for env vars. It enforces server/public separation, validates mutually exclusive or either-or constraints, and produces client-safe subsets to avoid leaking secrets. Validation runs at startup and fails fast with descriptive errors.
Can I use this with existing Zod schemas?
Yes. The API is Zod-compatible and can compose with existing Zod validators and refinements.
How does client-side protection work?
Schemas mark fields as public or server-only and the tool extracts only public fields for client bundles, preventing secret leakage.