
arkenv
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'.
- Installs
- 192
- Last 24h
- +9
- Trending rank
- #8947
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/onmax/nuxt-skills --skill arkenv- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads arkenv automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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 tostdoutupon 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:
{
"ok": false,
"commandId": "init",
"error": {
"code": "CLI.GIT_TREE_DIRTY",
"severity": "error",
"summary": "Git working tree is not clean.",
"why": "Commit or stash your changes before running arkenv init.",
"nextActions": [
{
"kind": "run-command",
"label": "Re-run with --force to bypass git working tree check",
"command": "arkenv init --force"
}
]
},
"diagnostics": [],
"nextActions": [
{
"kind": "run-command",
"label": "Re-run with --force to bypass git working tree check",
"command": "arkenv init --force"
}
]
}
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. Arun-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.
pnpm dlx arkenv init [options]
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.
pnpm arkenv check [options]
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)
import arkenv from "@arkenv/core";
export const env = arkenv({
PORT: "number.port = 3000",
DATABASE_URL: "string",
VITE_API_URL: "string",
NODE_ENV: "'development' | 'production' | 'test' = 'development'",
});
@arkenv/standard (Standard Schema: Zod, Valibot)
import arkenv from "@arkenv/standard";
import * as z from "zod";
export const env = arkenv({
PORT: z.number().default(3000),
DATABASE_URL: z.string(),
VITE_API_URL: z.url(),
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
});
Valibot uses the /valibot subpath (install @valibot/to-json-schema as well):
import { arkenv } from "@arkenv/standard/valibot";
import * as v from "valibot";
export const env = arkenv({
PORT: v.optional(v.number(), 3000),
DATABASE_URL: v.pipe(v.string(), v.url()),
});
Consuming env in Application Code
Always import and read properties directly from the canonical env object:
import { env } from "./env";
export default function App() {
const apiUrl = env.VITE_API_URL; // string
return <div>API URL: {apiUrl}</div>;
}
Framework Setup Patterns
1. Vite (@arkenv/vite-plugin)
Register the plugin in vite.config.ts without schema arguments:
import { defineConfig } from "vite";
import arkenvPlugin from "@arkenv/vite-plugin";
export default defineConfig({
plugins: [arkenvPlugin()],
});
If you need environment variables inside vite.config.ts itself (e.g. server.port), validate them with loadEnv:
import { defineConfig, loadEnv } from "vite";
import arkenvPlugin from "@arkenv/vite-plugin";
import arkenv, { type } from "@arkenv/core";
export const Env = type({
PORT: "number.port = 5173",
VITE_API_URL: "string",
});
export default defineConfig(({ mode }) => {
const env = arkenv(Env, { env: loadEnv(mode, process.cwd(), "") });
return {
plugins: [arkenvPlugin()],
server: { port: env.PORT },
};
});
2. Bun (@arkenv/bun-plugin)
In bunfig.toml:
[serve.static]
plugins = ["@arkenv/bun-plugin"]
In Bun.build:
import arkenvPlugin from "@arkenv/bun-plugin";
await Bun.build({
entrypoints: ["./src/index.tsx"],
outdir: "./dist",
plugins: [arkenvPlugin],
});
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 useimport.meta.envorprocess.envdirectly for application environment variables in v1. - Never create ambient
.d.tsaugmentations: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_).
FAQ
What does the arkenv skill do?
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'.
How do I install arkenv?
Run npx skills add https://github.com/onmax/nuxt-skills --skill arkenv in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/arkenv/ (personal) or .claude/skills/arkenv/ (project).
Which AI agents can use arkenv?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is arkenv safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains arkenv?
It is published by onmax in onmax/nuxt-skills. It has 192 recorded installs.
More from onmax/nuxt-skills
nuxt
onmax/nuxt-skills
Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
vue
onmax/nuxt-skills
Vue 3 Composition API, script setup macros, reactivity system, and built-in components. Use when writing Vue SFCs, defineProps/defineEmits/defineModel, watchers, or using Transition/Teleport/Suspense/KeepAlive.
reka-ui
onmax/nuxt-skills
Use when building with Reka UI (headless Vue components) - provides component API, accessibility patterns, composition (asChild), controlled/uncontrolled state, virtualization, and styling integration. Formerly Radix Vue.
nuxt-ui
onmax/nuxt-skills
Build UIs with @nuxt/ui v4 — 125+ accessible Vue components with Tailwind CSS theming. Use when creating interfaces, customizing themes to match a brand, building forms, or composing layouts like dashboards, docs sites, and chat interfaces.
vitest
onmax/nuxt-skills
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
nuxt-seo
onmax/nuxt-skills
Nuxt SEO meta-module with robots, sitemap, og-image, schema-org. Use when configuring SEO, generating sitemaps, creating OG images, or adding structured data.
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.