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 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/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.
<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>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.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 |
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.
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.
- 1mo 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 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.
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.
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.
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.
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.
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…
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.