Skip to content

Repository files navigation

stdlib

A standard library with no code.

stdlib is a spec-only standard library: each module is defined by a human-readable specification (SPEC.md) and a language-agnostic test suite (tests.yaml). No implementation is bundled. You — or an LLM — generate the implementation in whatever language you want, then verify it against the tests.

Inspired by whenwords, scaled to multiple domains.

Why?

  • Language-agnostic by design. The spec is the product; code is just one possible shadow of it.
  • LLM-native. Paste the spec + tests into any model, get a working implementation.
  • Teaches Document-Driven Development. Docs come first, code comes second, and the docs stay the source of truth.

Domains

Each folder is a self-contained ghost library. Take one, take all — they don't depend on each other.

Domain What it covers
strings/ Text manipulation: slugify, truncate, pluralize
collections/ Sequence helpers: chunk, partition, group_by
validation/ Predicates: is_email, is_url, is_uuid
numbers/ Numeric helpers: clamp, round_to, lerp, is_close, sign
dates/ Calendar ops: add_days, days_between, is_weekend, format_relative, parse_iso
paths/ Pure path string ops: join, parent, extension, basename, normalize
urls/ URL string ops: parse, build, add_query_param, strip_query, url_join
iter/ Sequence streams: take, drop, take_while, zip_longest, flatten
text/ Heavier text: word_count, sentence_split, levenshtein, tokenize
functional/ Function combinators: compose, pipe, memoize, curry
hash/ Stable digests: md5_hex, sha256_hex, fingerprint
color/ Color math: hex_to_rgb, rgb_to_hex, rgb_to_hsl, lighten
random/ Seedable randomness: pick, shuffle, weighted_pick
money/ Currency strings: format_currency, parse_currency, round_to_cents
json_path/ Nested data access: get_path, set_path, merge_deep, flatten

How to use

  1. Pick a domain. Read its SPEC.md.
  2. Hand the spec + tests.yaml to your favorite LLM (or write the code yourself, in any language).
  3. Run the tests against your implementation. If they pass, you have a working module.

This repository contains no implementations. That's the point — the spec is the artifact. Implementations live in your own project, in your own language, generated however you like.

For the rules every spec and test file follows, see CONVENTIONS.md. To add a new domain, see WRITING_A_DOMAIN.md.

Layout

stdlib/
├── README.md
└── <domain>/                  # 15 domains: strings, collections, validation,
    ├── SPEC.md                # numbers, dates, paths, urls, iter, text,
    └── tests.yaml             # functional, hash, color, random, money, json_path

About

A standard library with no code.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors