yamcodes/arkenv/arkenv
Claude Code and agent skill by yamcodes/arkenv
- community
Checking that the SKILL.md file is still in the repository.
Answer questions about ArkEnv and help implement environment variable validation. Use when developers: (1) Ask about environment variable validation or typesafety, (2) Want to setup ArkEnv in a project, (3) Need to define or update schemas using ArkType or Standard Schema, (4) Are integrating with Next.js, Nuxt, Vite, Bun, or Node.js runtimes. Triggers on: 'ArkEnv', 'env validation', 'typesafe env', 'createEnv', 'env.ts', 'arkenv'.
Install
npx vskill@latest install yamcodes/arkenv/arkenvSKILL.md
ArkEnv
ArkEnv is a typesafe environment variable validation library for modern JavaScript and TypeScript frameworks. It provides a single canonical surface across all frameworks: `import { env } from "./env"`.
In v1, ArkEnv offers two first-class validation engines:
- `@arkenv/core`: Built-in ArkType DSL engine for high-performance schema definition and automatic coercion.
- `@arkenv/standard`: Standard Schema engine supporting any compliant validator (Zod, Valibot, etc.).
Capabilities
Core usage
- Define typesafe schemas using
@arkenv/coreArkType DSL strings or@arkenv/standardwith Zod / Valibot. - Automatic coercion (
string.numeric,number.port, booleans, JSON objects, arrays) and default values ("boolean = true"). - Single, uniform developer experience: import
envdirectly across frontend and backend code.
Framework integration
- Vite (
@arkenv/vite-plugin): Plugin operates in transform mode, rewriting imports fromenv.tsin the client graph to inline publicVITE_*literals and replacing private server keys with throwing runtime guards. - Bun (
@arkenv/bun-plugin): Plugin interceptsenv.tsimports inBun.build/Bun.serveto inline publicBUN_PUBLIC_*values while guarding server secrets. - Next.js (
@arkenv/nextjs): Build-time and runtime validation with automatic client/server isolation proxy. - Nuxt (
@arkenv/nuxt): Nuxt module with Nitro boot validation and runtime proxy guard. - Node.js: Direct boot-time validation via
@arkenv/coreor@arkenv/standard.
CLI (setup & DevOps)
- Initialize ArkEnv in new or existing projects using
pnpm dlx arkenv init(ornpx arkenv init). - Automatically detect frameworks (
Next.js,Nuxt,Vite,Bun, etc.) and scaffoldenv.ts. - Select hosting provider preset during init (
--preset, -P <provider>). - Automatically configure
tsconfig.jsonwhen needed. Schema discovery for CLI commands uses--schemaor flat convention paths (env.ts,src/env.ts) — not apackage.json"arkenv"field, and not leftover split-layout filenames such asenv/server.ts.
Hosting presets
ArkEnv is code-first. You can select a hosting provider preset during initial project setup (--preset vercel, netlify, cloudflare, railway, render, fly) or copy-paste provider fields directly into ./env.ts from the documentation (/docs/core-concepts/hosting-presets). There are no machine-managed comment blocks or CLI mutation commands.
Agent setup (machine-readable)
AI agents SHOULD always use the CLI for project initialization to ensure consistency and reliability. Use the --agent flag for a fully automated, machine-readable experience.
- Command:
pnpm dlx arkenv init --agent - Behavior: The
--agentflag automatically enables the following behaviors: - `--yes`: Bypasses all interactive prompts and uses recommended defaults.
- `--quiet`: Suppresses spinners and ANSI formatting for cleaner terminal logs.
- `--json`: Emits a structured JSON summary to
stdoutupon completion (all other output is sent tostderr). - Success Verification: Parse the JSON settlement envelope on
stdout. Success isok: truewithcommandId: "init"; details (e.g. scaffolded paths) live underresult.
Handling refusals (ok: false)
--agent never implies --force. When a safety check trips, the CLI refuses and emits an errored settlement envelope to stdout:
- `error.code`: a stable dotted identifier you can branch on (
CLI.REQUIREMENTS_NOT_MET,CLI.GIT_TREE_DIRTY,CLI.NON_EMPTY_DIR, …).CLI.INTERNAL_ERRORmeans the CLI broke rather than refused — retrying with flags will not help. - `nextActions`: remediation steps. A
run-commandaction that includes--forcemeans the refusal is bypassable; emptynextActionsmeans it is not.
Escalation pattern: always run init --agent without --force first. If you get ok: false, inspect error.code and nextActions. Only re-run with --force (or the command from a run-command action) once you have deliberately decided the refusal is safe to bypass — do not add --force pre-emptively.
CLI commands
init
Set up ArkEnv in your project. It detects your framework and configures the appropriate plugin and schema.
Options:
--preset, -P <preset>: Specify hosting provider preset (none, vercel, netlify, cloudflare, railway, render, fly).--no-codegen: Disable Next.js codegen configuration setup.--force, -f: Bypass clean git working tree safety check.
check
Validate the environment against your schema file.
Options:
--schema, -s <path>: Explicit path to the schema module (overrides convention discovery).--verify-example [file]: Verify that all declared schema keys are present in.env.example(or a custom example file path) without mutating files.--env-file <path>: Specify one or more custom environment files to load.--json: Output structured JSON diagnostics to stdout.
Defining Schemas & Importing env
@arkenv/core (ArkType DSL)
@arkenv/standard (Standard Schema: Zod, Valibot)
Valibot uses the /valibot subpath (install @valibot/to-json-schema as well):
Consuming env in Application Code
Always import and read properties directly from the canonical env object:
Framework Setup Patterns
1. Vite (@arkenv/vite-plugin)
Register the plugin in vite.config.ts without schema arguments:
If you need environment variables inside vite.config.ts itself (e.g. server.port), validate them with loadEnv:
2. Bun (@arkenv/bun-plugin)
In bunfig.toml:
In Bun.build:
Security Boundaries & Layouts
- Flat layout (default):
src/env.tscontains all keys. Server graph runs full validation at boot; client graph receives inlined public literals while access to private server keys throws a runtime error. - Optional two-module recipe: When secret names/types must stay off the client type graph, use two modules (client + server) with two imports and optional
extends: [clientEnv]. Next can useimport "server-only"+@arkenv/corefor the server module. Nuxt: never import the server module from client code. Not a CLI--strictflag or package/client/serversurface.
Best Practices & Rules
- Always use `import { env } from "./env"`: Never use
import.meta.envorprocess.envdirectly for application environment variables in v1. - Never create ambient `.d.ts` augmentations:
ImportMetaEnvAugmentedandProcessEnvAugmentedare legacy v0 patterns dropped in v1. - Keep secrets on the server: Never prefix server secrets (
DATABASE_URL,API_SECRET_KEY) with client prefixes (VITE_,NEXT_PUBLIC_,BUN_PUBLIC_,NUXT_PUBLIC_).
Security
- Security scanPassed, 96 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/arkenv/SKILL.md
Popularity
- Repository stars
- 117
- Repository forks
- 5
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.
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
[](https://verified-skill.com/skills/yamcodes/arkenv/arkenv)