typed-env

typed-env is a skill for Claude Code, Codex from stephansama/packages. It costs 64 tokens per session (1,032 once invoked), scanned A, original, MIT.

A TypeScript helper for checking environment variables, such as database URLs and API keys, against a schema when an application starts. It can also load `.env` files and create an example file showing the required variable names.

In plain words
What is it for?
Use it to validate startup configuration, load values from `.env` files, and generate `.env.example` placeholders from a schema. It supports Zod, Valibot, and ArkType schemas.
Why use it?
It catches missing or invalid configuration before the application runs, instead of leaving errors to appear later. The checked values also have usable TypeScript types.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to validate startup configuration, load values from .env files, and generate .env.example placeholders from a schema. It supports Zod, Valibot, and ArkType schemas.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/stephansama/packages/typed-env
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add stephansama/packages --skill typed-env
Clone the repo
git clone --depth 1 https://github.com/stephansama/packages

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for typed-env

README.md
[![agentmods](https://agentmods.dev/badge/skills/stephansama/packages/typed-env/github.svg)](https://agentmods.dev/skills/stephansama/packages/typed-env)
Your own site
<a href="https://agentmods.dev/skills/stephansama/packages/typed-env"><img src="https://agentmods.dev/badge/skills/stephansama/packages/typed-env/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for typed-env

Your own site · 80×15
<a href="https://agentmods.dev/skills/stephansama/packages/typed-env"><img src="https://agentmods.dev/badge/skills/stephansama/packages/typed-env.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,032 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00064 $0.01032
Opus 5.5 $0.00026 $0.00413
Sonnet 5.5 $0.00013 $0.00206
Haiku 4.5 $0.00006 $0.00103

Measured 1mo ago against content hash 4ce79d8e20e1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

typed-env scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

core/typed-env/skills/typed-env/SKILL.md · 162 lines

How it starts

The opening of the file, as written. The whole thing — 162 lines — stays where its author put it; the contents beside it link to each section on GitHub.

typed-env

Runtime environment validation with full TypeScript inference. createEnvironment wraps a standard-schema object schema and returns helpers for loading, validating, and documenting your environment.

Setup

import * as z from "zod";
import { createEnvironment } from "@stephansama/typed-env";

export const env = createEnvironment(
  z.object({
    DATABASE_URL: z.string().url(),
    API_KEY: z.string().min(1),
  }),
  true, // auto-load .env quietly via dotenvx
);

Call env.validate() once at application startup to fail fast with a descriptive error on missing or invalid values.

Core Patterns

Validate at startup

// src/env.ts
import * as z from "zod";
import { createEnvironment } from "@stephansama/typed-env";

export const env = createEnvironment(
  z.object({
    PORT: z.coerce.number().default(3000),
    DATABASE_URL: z.string().url(),
  }),
  true,
);

// src/main.ts
import { env } from "./env";

const config = await env.validate();
// config is fully typed: { PORT: number; DATABASE_URL: string }

Generate a .env.example file

import { env } from "./env";

// writes placeholder values (***) for each key in the schema
await env.generateExample(".env.example");

Run this as a script or CI step to keep .env.example in sync with the schema. Requires zod, valibot, or arktype — the schema's vendor field determines how keys are extracted.

Custom dotenvx options

export const env = createEnvironment(schema, {
  path: ".env.production",
  override: true,
});

Pass a DotenvConfigOptions object as the second argument instead of true for custom .env file paths, override behaviour, or encryption options.

Load env without auto-loading

export const env = createEnvironment(schema);
// load manually when needed
env.loadEnv({ path: ".env.local" });
const config = await env.validate();

Common Mistakes

CRITICAL Schema library other than zod, valibot, or arktype

Wrong:

import { Type } from "@sinclair/typebox";
const env = createEnvironment(Type.Object({ KEY: Type.String() }));
await env.generateExample(".env.example"); // throws: "invalid schema provider"

Read the full file on GitHub · 162 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 162 lines · 64 tokens per session scan A 4ce79d8e20e1

Subscribe to this mod's changes

typed-env is a skill published in the GitHub repository stephansama/packages (5 stars, last pushed yesterday), licensed MIT. It adds 64 tokens to every session and 1,032 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

javascript-expert

Expert-level JavaScript development with modern ES2024+ features, Node.js, npm ecosystem, and best practices. Use when the user mentions ECMAScript, ES2024, Node.js, npm, or web, or when the task involves Modern JavaScript, Node.js Development, Modern Tooling, or Functional Programming.

personamanagmentlayer/pcl · 69 tokens

typescript-expert

Expert-level TypeScript development with modern tooling, advanced types, and best practices. Use this skill for TypeScript projects requiring type-safe code, modern bundling, and comprehensive testing.

personamanagmentlayer/pcl · 40 tokens

modernize-ecmascript

A guide for writing or reviewing JavaScript and TypeScript using newer ECMAScript language features. ECMAScript is the standard behind JavaScript, and the guide checks whether the project's tools and target browsers or runtimes can handle each feature.

bosens-China/tc39-atlas · 130 tokens

api-first

Maintain the OpenAPI contract in docs, regenerate TypeScript types into src/generated/api, and wire client/server imports without hand-editing generated files.

bishopZ/2026-Boilerplate · 32 tokens

dependabot-triage-py

Triage and fix Dependabot vulnerability alerts in Python repos (pip, poetry, uv, pdm, pipenv). v2.1 workflow with Standard (defensive) and Fast-Track (low-risk) modes — defensive minimal-patched versioning (PEP 440 ranges), exposure mapping (Public/API · Internal/Dev), CI workflow inspection to detect every PM in…

akshayrao14/git-practices · 194 tokens

graphql-api-development

Comprehensive guide for building GraphQL APIs including schema design, queries, mutations, subscriptions, resolvers, type system, error handling, authentication, authorization, caching strategies, and production best practices.

manutej/luxor-claude-marketplace · 42 tokens