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.
npx agentmods add skills/stephansama/packages/typed-envnpx skills add stephansama/packages --skill typed-envgit clone --depth 1 https://github.com/stephansama/packagesWrote 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.
[](https://agentmods.dev/skills/stephansama/packages/typed-env)<a href="https://agentmods.dev/skills/stephansama/packages/typed-env"><img src="https://agentmods.dev/badge/skills/stephansama/packages/typed-env.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00064 | $0.01032 |
| Opus 5 | $0.00032 | $0.00516 |
| Sonnet 5 | $0.00013 | $0.00206 |
| Haiku 4.5 | $0.00006 | $0.00103 |
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 5d 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.
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"
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.
- 5d ago First seen · 162 lines · 64 tokens per session scan A 4ce79d8e20e1
typed-env is a skill published in the GitHub repository stephansama/packages (5 stars, last pushed 1mo ago), licensed MIT. It adds 64 tokens to every session and 1,032 once invoked, about $0.0003 per session on Opus 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.
Other skills, from other repositories
pixi-vn-getting-started
Use when setting up a new or existing project on @drincs/pixi-vn, wiring the main.ts entry point, or calling the top-level Game API (Game.init, Game.start, Game.onEnd, Game.addOnError, Game.onNavigate, Game.clear) — this is the entry point every Pixi'VN project needs before touching canvas, narration, sound, storage…
lint-all
Lint all code (Rust + JS/TS). Use before opening a PR when Rust code was changed.
lint-js
Lint JS/TS code only. Use before opening a PR when only JavaScript or TypeScript files were changed (no Rust).
ast-visitor-pattern
Use the frozen-class/visitor pattern for discriminated unions that have multiple dispatch sites. Use when creating a new set of variants (commands, IR nodes, factory calls) that will be switched over in 2+ places, or when refactoring an existing union type that has grown multiple switch sites.
no-bare-casts
Writing as in TypeScript or TSX production code, modifying a file that contains a bare as cast, silencing a type error with a cast, encountering as unknown as, or reviewing a cast site.
bumping-biome
Bumps biome package versions (e.g. @biomejs/biome) using pnpm, aligns biome.jsonc files with the new version/s across the repository and runs biome-related checks. Use when required to update biome to a newer version - explicitly or implicitly (e.g. after running pnpm up, pnpm update, pnpm upgrade without specific…