forinda/kickjs-examples-archive/env-wiring-check

Claude Code and agent skill by forinda/kickjs-examples-archive

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when ConfigService.get('SOME_KEY') returns undefined or @Value silently falls back to process.env.

Install

npx vskill@latest install forinda/kickjs-examples-archive/env-wiring-check

SKILL.md

The same SKILL.md was published earlier as forinda/kickjs-examples-archive/env-wiring-check.

Fastest path: kick explain "ConfigService.get('MY_KEY') returned undefined" — pipe a failing run straight in if you prefer (pnpm test 2>&1 | pnpm exec kick explain). It distinguishes the entry-file cause from the test-file one, which is the step most people lose time on. The manual checks below are the same reasoning.

Diagnosis (in order):

  1. Open src/index.ts. The first non-`reflect-metadata` import MUST be import './config'.
  2. Open src/config/index.ts. It MUST run the loader as a top-level side effect — not just declare the schema. This is what kick new generates:

``ts import { loadEnvFromSchema } from '@forinda/kickjs/config' import { fromZod } from '@forinda/kickjs-schema/zod' const envSchema = fromZod(z.object({ DATABASE_URL: z.url() })) export const env = loadEnvFromSchema(envSchema) ``

  1. The new key MUST be declared in the schema. @Value('NEW_KEY') accepts any string at the type level and falls back to raw `process.env` when the schema doesn't know the key — silently skipping its parsing and defaults.
  2. After adding a key, re-run kick typegen (or restart kick dev if the typegen watcher missed it) so the global KickEnv augmentation picks it up.
  1. In a test? createTestApp never loads src/index.ts, so the entry's

import './config' never runs no matter how correct it is. The test file must import it itself: ``ts import '@/config' `` Symptom is identical to the missing-entry-import case, and step 1 will look fine, which is what makes it slow to spot.

Why `@Value` "works" but `ConfigService.get` doesn't: @Value has the process.env fallback that masks missing-side-effect-import bugs; ConfigService has none. If @Value('FOO') returns a value but ConfigService.get('FOO') returns undefined, the side-effect import of ./config is missing.

`reloadEnv` vs `resetEnvCache` — distinct, frequently mixed up:

  • reloadEnv() — re-reads process.env against the already registered schema. Use in HMR plugins after .env file changes. Schema survives.
  • resetEnvCache() — drops the registered schema entirely. Test-only. Calling it between dev requests drops the project's keys.

Nuances:

  • dotenv is an optional peer dep in v5+ — projects upgrading from older versions may need to add it explicitly.
  • For HMR-friendly .env edits, add envWatchPlugin() to vite.config.ts — calls reloadEnv() automatically.

Fix recipe: add the key to the schema; add import './config' as the first non-reflect-metadata import in src/index.ts; add import '@/config' to any test that reads config; re-run kick typegen.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/forinda/kickjs-examples-archive/env-wiring-check/badge)](https://verified-skill.com/skills/forinda/kickjs-examples-archive/env-wiring-check)

Something wrong with this skill or its page? Tell us.