xiaohongshu
xiaohongshu
env-var-hygiene
Environment variable management across Vercel, Convex, and other platforms. Invoke for: trailing whitespace issues, cross-platform parity, Invalid character errors, webhook secrets, API key management, production deployment, dev vs prod configuration.
Full skill instructions
Best practices for managing environment variables across deployment platforms.
Invoke when user mentions:
Env vars with \n or trailing spaces cause cryptic errors:
Root Cause: Copy-paste or echo introduces invisible characters.
Prevention:
# ✅ Use printf, not echo
printf '%s' 'sk_live_xxx' | vercel env add STRIPE_SECRET_KEY production
# ✅ Trim when setting
npx convex env set --prod KEY "$(echo 'value' | tr -d '\n')"
# ❌ Don't use echo directly
echo "sk_live_xxx" | vercel env add KEY production # May add \n
Shared tokens (webhook secrets, auth tokens) must be identical across platforms:
Common Pitfall: Set token on one platform, forget the other.
Prevention:
# Generate token once
TOKEN=$(openssl rand -hex 32)
# Set on ALL platforms
npx convex env set --prod CONVEX_WEBHOOK_TOKEN "$(printf '%s' "$TOKEN")"
printf '%s' "$TOKEN" | vercel env add CONVEX_WEBHOOK_TOKEN production
API keys have specific formats. Validate before deployment:
| Service | Pattern | Example |
|---|---|---|
| Stripe Secret | sk_(test|live)_[A-Za-z0-9]+ | sk_live_xxx |
| Stripe Public | pk_(test|live)_[A-Za-z0-9]+ | pk_live_xxx |
| Stripe Webhook | whsec_[A-Za-z0-9]+ | whsec_xxx |
| Stripe Price | price_[A-Za-z0-9]+ | price_xxx |
| Clerk Secret | sk_(test|live)_[A-Za-z0-9]+ | sk_live_xxx |
Separate deployments have separate env var stores:
.env.local doesn't affect productionAlways verify prod separately:
# Convex
npx convex env list --prod
# Vercel
vercel env ls --environment=production
CONVEX_DEPLOYMENT=prod:xxx npx convex data may return dev data.
Always use explicit flags:
# ❌ Unreliable
CONVEX_DEPLOYMENT=prod:xxx npx convex data
# ✅ Reliable
npx convex run --prod module:function
npx convex env list --prod
Convex:
# Dev
npx convex env set KEY "value"
# Prod (use --prod flag)
npx convex env set --prod KEY "$(printf '%s' 'value')"
Vercel:
# Production
printf '%s' 'value' | vercel env add KEY production
# With explicit environment
vercel env add KEY production --force
Convex:
npx convex env list # dev
npx convex env list --prod # prod
Vercel:
vercel env ls # all
vercel env ls --environment=production # prod only
Trailing whitespace:
# Check Convex prod
npx convex env list --prod | while IFS= read -r line; do
if [[ "$line" =~ [[:space:]]$ ]]; then
echo "WARNING: $(echo "$line" | cut -d= -f1) has trailing whitespace"
fi
done
Format validation:
# Validate Stripe key format
value=$(npx convex env list --prod | grep "^STRIPE_SECRET_KEY=" | cut -d= -f2-)
[[ "$value" =~ ^sk_(test|live)_[A-Za-z0-9]+$ ]] || echo "Invalid format"
See references/ directory:
format-patterns.md - Regex patterns for common servicesplatform-specifics.md - Vercel, Convex, Railway platform detailshygiene-checklist.md - Pre-deployment validation checklistparity-verification.md - Cross-platform token verification/pre-deploy - Comprehensive pre-deployment checklist/env-parity-check - Cross-platform token verification/stripe-check - Stripe-specific environment auditBased on 2026-01-17 incident: Trailing \n in STRIPE_SECRET_KEY caused "Invalid character in header" error. Token mismatch between Vercel and Convex caused silent webhook failures.
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