xiaohongshu
xiaohongshu
env-configuration
Apply when managing application configuration: environment variables, secrets management, and config validation.
Full skill instructions
Apply when managing application configuration: environment variables, secrets management, and config validation.
# Source: https://12factor.net/config
# .env.example (commit this - template without secrets)
DATABASE_URL=postgres://user:pass@localhost:5432/myapp
REDIS_URL=redis://localhost:6379
API_KEY=your-api-key-here
NODE_ENV=development
# .env.local (DO NOT COMMIT - actual secrets)
DATABASE_URL=postgres://prod:secret@prod-db:5432/myapp
API_KEY=sk_live_abc123
# .env.development / .env.production (environment defaults)
NEXT_PUBLIC_API_URL=http://localhost:3000/api
LOG_LEVEL=debug
// Source: https://zod.dev/
// src/config/env.ts
import { z } from 'zod';
const envSchema = z.object({
NODE_ENV: z.enum(['development', 'production', 'test']),
DATABASE_URL: z.string().url(),
REDIS_URL: z.string().url().optional(),
API_KEY: z.string().min(1),
PORT: z.coerce.number().default(3000),
LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
});
// Validate on import - fails fast at startup
export const env = envSchema.parse(process.env);
// Type-safe access throughout app
console.log(env.DATABASE_URL); // string (validated)
// Source: https://nextjs.org/docs/app/building-your-application/configuring/environment-variables
// NEXT_PUBLIC_ prefix = exposed to browser
// Without prefix = server-only
// .env.local
DATABASE_URL=secret // Server only
NEXT_PUBLIC_API_URL=/api // Available in browser
// Usage in code
// Server component/API route
const dbUrl = process.env.DATABASE_URL;
// Client component
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
// Source: Best practice pattern
// src/config/index.ts
import { env } from './env';
export const config = {
isDev: env.NODE_ENV === 'development',
isProd: env.NODE_ENV === 'production',
server: {
port: env.PORT,
host: env.HOST || '0.0.0.0',
},
database: {
url: env.DATABASE_URL,
poolSize: env.DB_POOL_SIZE || 10,
},
auth: {
jwtSecret: env.JWT_SECRET,
tokenExpiry: '1h',
},
features: {
enableBeta: env.ENABLE_BETA_FEATURES === 'true',
},
} as const;
// Usage
import { config } from '@/config';
if (config.features.enableBeta) { /* ... */ }
# Environment files
.env
.env.local
.env.*.local
.env.development.local
.env.production.local
# Keep example
!.env.example
// Source: https://zod.dev/
const envSchema = z.object({
// Required - app won't start without these
DATABASE_URL: z.string().url(),
JWT_SECRET: z.string().min(32),
// Optional with defaults
PORT: z.coerce.number().default(3000),
LOG_LEVEL: z.string().default('info'),
// Optional without default
SENTRY_DSN: z.string().url().optional(),
// Conditional (required in production)
REDIS_URL: z.string().url().optional()
.refine(
(val) => process.env.NODE_ENV !== 'production' || val,
'REDIS_URL required in production'
),
});
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience