create-bun-api
AGENTS.md11 starsChanged 22 days agoApache-2.0View on GitHub
A toolkit that scaffolds agent-ready Bun HTTP APIs. It has three parts: Releases: never publish to npm or crates.io, or push release tags, without the owner's explicit go-ahead. Releases are staged by .github/workflows/release.yml and approved by the owner with 2FA; see docs/releasing.md. Every user-visible change gets a line under [Unreleased] in CHANGELOG.md. The roadmap is docs/PLAN.md; the reasons behind it are in docs/decisions/. - Contract changes (commands, flags, exit codes, error codes, JSON fields) start in src/manifest.ts and schemas/result.v1.json. Tests…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-endpointSkill
- add-modelSkill
- create-bun-apiSkill
- verify-and-debugSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Releases: never publish to npm or crates.io, or push release tags, without the owner's explicit go-ahead.
- Very specific: line 31
Every expected failure is a CliError(code, message, hint).
- Distinctive: line 32
Never exit 0 after a failed step.
- Very specific: line 42
Update its lockfile by running bun install in that directory.
- Distinctive: line 47
Keep every AGENTS.md at 150 lines or fewer (a test checks this).
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
create-bun-api
A toolkit that scaffolds agent-ready Bun HTTP APIs. It has three parts:
src/: the CLI (TypeScript on Bun, zero runtime dependencies). Its public contract issrc/manifest.ts.templates/api/: the template, a real runnable project with its ownbun.lock, tests, andAGENTS.md.skills/: Agent Skills (SKILL.md), copied into generated projects and also installable on their own.
Releases: never publish to npm or crates.io, or push release tags, without the owner's explicit
go-ahead. Releases are staged by .github/workflows/release.yml and approved by the owner with 2FA;
see docs/releasing.md. Every user-visible change gets a line under [Unreleased] in CHANGELOG.md.
The roadmap is docs/PLAN.md; the reasons behind it are in docs/decisions/.
Commands
| Task | Command |
| Setup | bun install && (cd templates/api && bun install) |
| Run the CLI | bun src/cli.ts <dir> [flags], e.g. bun src/cli.ts /tmp/demo --json |
| All tests (about 30 s) | bun test tests |
| Fast subset | bun test tests/unit.test.ts tests/contract.test.ts |
| Template checks | cd templates/api && bun run verify |
| Everything CI would run | bun run ci |
| Before tagging a release | bun run release:check vX.Y.Z |
Rules
- Contract changes (commands, flags, exit codes, error codes, JSON fields) start in
src/manifest.tsandschemas/result.v1.json. Tests compare the two. Removing or renaming anything is a breaking change: bump the schema id (for examplebun-api/result@2). - Every expected failure is a
CliError(code, message, hint). The hint says what to do next. Never exit 0 after a failed step. newbuilds in a temporary sibling directory and renames it into place at the end, so a failed run leaves nothing behind.tests/faults.test.tschecks this; keep it true.- The CLI never prompts without a TTY, never runs remote scripts, and never goes through a shell:
run()takes an argv array. - With
--json, stdout carries exactly one JSON object. Human progress goes to stderr. - Templates contain no template syntax. The only substitution is the placeholder
bun-api-template-app, in the files listed inTEMPLATES[].substituteIn. Dotfiles that npm drops are stored without the dot (gitignore) and renamed on copy throughrename. - Template changes: edit
templates/api, run itsbun run verify, thenbun test tests/e2e.test.ts. Update its lockfile by runningbun installin that directory. Never hand-editbun.lock. - Skills:
nameequals the directory name.descriptionsays what the skill does and includes "Use when …". The body stays under 500 lines, with details inreferences/.tests/skills.test.tsapplies the code inskills/add-endpoint/references/notes-module.mdto a new project and runs verify. Regenerate that file from a working project; don't edit it blindly. - Keep every
AGENTS.mdat 150 lines or fewer (a test checks this).
Layout
src/cli.ts argv → command → result → output and exit code
src/manifest.ts commands, flags, exit and error codes, templates (the single source of truth)
src/commands/ new.ts, doctor.ts, describe.ts
src/engine/ name validation, file planning, subprocess runner, version comparison
schemas/ JSON Schema for --json output
scripts/ check-release.ts: tag, version, CHANGELOG, and repository.url checks before a release
templates/api/ the API template; its own AGENTS.md describes its conventions
skills/ create-bun-api (for the toolkit), plus add-endpoint, add-model, verify-and-debug (copied into projects)
tests/ unit, contract, faults (failure injection), e2e, skills, pack (the published tarball)
evals/ agent task evaluations (see evals/README.md)
docs/ PLAN.md, decisions/Test-only hook
BUN_API_TEMPLATES_DIR points the CLI at another templates directory. Tests use it to inject
broken templates. It isn't part of the public contract.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

