Production-grade TypeScript primitives and AI agent skills — zero-dependency, tree-shakeable, fully typed, and rigorously tested.
npm install typescript-bitsReusable agent skill instructions — extend OpenCode, Codex, Claude Code, and 50+ other AI coding agents with project-specific knowledge.
Production-ready TypeScript best practices — tsconfig, type patterns, generics, error handling, and code organization for strict, maintainable codebases
Node.js native test runner patterns — assertions, test structure, async tests, isolation, and mocking with node:test and node:assert/strict.
Type-safe error handling in TypeScript — Result type, error-as-value philosophy, typed hierarchies, Error.cause chaining, exhaustive matching, and Result combinators
Advanced TypeScript type system patterns — branded types, discriminated unions, conditional types, mapped types, template literals, type predicates, and variance
Guidelines for designing public TypeScript APIs — surface area, types, options objects, exports, tree-shaking, and backwards compatibility
Rust-inspired `Result<T, E>` type with `Ok` and `Err` variants that replaces throw/catch with explicit return types, making errors part of the function signature. Ships with `ok()`, `err()`, `isOk()`, `isErr()`, `unwrap()`, and `unwrapOr()` utilities for ergonomic handling.
A typed reactive container that holds a single value: call `get()` to read it, `set()` to update it and synchronously notify all subscribers, and `subscribe()` to register a listener — receiving an unsubscribe handle in return. `Atom.fn()` extends this model to plain functions, wrapping any callable so that every invocation fans out to subscribers, making it easy to build observable event emitters without a class. Zero dependencies.
Wraps any throwable sync or async operation and returns a `Result` instead of throwing. Smart overload detection handles raw Promises, async functions, and sync functions uniformly through a single `attempt` entry point. An optional `transform` parameter lets you shape caught errors into typed `Err` values before they reach the caller.