agent-utils
CLAUDE.md0 starsChanged 44 days agoMITView on GitHub
Guidance for AI coding agents working in this repository. People contributing by hand should start with CONTRIBUTING.md, which holds the full checklist; this file adds the rules and context an agent needs to apply it well. agent-utils is an agent-first CLI: a single static Go binary of small, exact utilities (encode, format, convert, generate, inspect) built to be called by AI agents, with shell scripts and humans as equally welcome users. Every change ships complete: logic, tests, docs, and an…
- Commits and pushes
In this repository2 other files it gives its agents.
- add-commandSkill
- releaseSkill
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Predictable I/O: read stdin or an optional file argument, write results to stdout, diagnostics to stderr.
- Very specific: line 28
Structured output for structured data: if the natural result is a document, emit pretty-printed JSON with snake_case keys that pipes into …
- Very specific: line 53
Review before the PR: run the contract-reviewer agent on any change to a command's behavior, and the hardening-auditor agent on anything …
- Distinctive: line 59
Be candid: call out what's weak or debatable in your own code.
- Distinctive: line 77
Probe dependencies empirically: before trusting them: verify the behaviors that matter (ordering, edge cases, silent truncation, resource …
- Very specific: line 90
Functions: no stutter with the package prefix: generate.UUID, img.PNGToJPEG (XToY for conversions), encode.Base64.
- Distinctive: line 129
Add a dependency without the evaluation in the PR.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.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
CLAUDE.md
Guidance for AI coding agents working in this repository. People contributing by hand should start with CONTRIBUTING.md, which holds the full checklist; this file adds the rules and context an agent needs to apply it well.
agent-utils is an agent-first CLI: a single static Go binary of small, exact
utilities (encode, format, convert, generate, inspect) built to be called by AI agents,
with shell scripts and humans as equally welcome users. Every change ships complete:
logic, tests, docs, and an end-to-end check of the built binary.
Mission
An agent should reach for agent-utils instead of doing a transformation "by hand" in
the model, because the tool is instant, token-free, and exact. Every design decision
starts from the question: what makes this trivially usable by an agent?
Agent-first contract (every command must satisfy this)
- Deterministic: same input, same output. Randomness only where randomness is the
point (
uuid,password), and then fromcrypto/rand. The clock is injected frommain.go, never read inside a core package. - Predictable I/O: read
stdinor an optional file argument, write results tostdout, diagnostics tostderr. Never prompt, never color, never animate. - Exit codes carry meaning: 0 success, 1 runtime failure (including bad data in a
value argument), 2 usage error, 3 a yes/no check answered no (return
cli.FalseError). An agent must be able to branch on the code alone. - Structured output for structured data: if the natural result is a document, emit
pretty-printed JSON with
snake_casekeys that pipes intojq. - Loud failures: bad input and misused flags produce a specific, actionable error and a non-zero exit; nothing is silently ignored, defaulted, or truncated.
- Bounded resources: input is untrusted. A small input must never cost unbounded memory or time (decompression bombs, alias expansion, huge exponents, deep nesting, searches that never end); cap the work and fail with an error that names the limit.
- Discoverable: the command registers a one-line summary (surfaced by both the help
text and the
commandsJSON manifest) and documents its flags via-h. - Offline by default: network access only where the utility's purpose is network
access (
video), and stated plainly in its docs.
How to work
- Plan briefly first: what you're about to build, how it fits the structure below, and any decision worth surfacing (naming, flags, output shape, a dependency). Command names, flags, and output shapes are public contract, so agree them before building.
- Implement completely: two-layer design, table-driven tests, wrapped errors,
gofmt/go vetclean. No placeholder code; everything written should still belong here when the tool has 100 commands. For a new command or mode, use the/add-commandskill: it lists every file to touch and the design precedents already set. - Verify end to end: build the binary and exercise the change the way an agent would (pipes, files, error cases, exit codes) before calling it done. For a bug, reproduce it with the built binary first, so the fix addresses the real failure.
- Review before the PR: run the
contract-revieweragent on any change to a command's behavior, and thehardening-auditoragent on anything that parses untrusted formats, allocates in proportion to input, or adds a dependency. - Update the docs:
docs/commands/<name>.md, examples inexamples.go, and the README (command table, the agent snippet, and the lists in "The contract").go testenforces the page and example basics. Docs describe only what the binary does. - Be candid: call out what's weak or debatable in your own code; flag trade-offs instead of glossing over them.
Code standards
- Two layers, always: a pure, CLI-agnostic core in
internal/<category>; a thin CLI layer ininternal/cliparses flags and calls it, andmain.gowires the two (theclipackage never imports a core package). Core signatures match the data shape:io.Reader->io.Writerfor stream transforms, returned values for generators, plain arguments for small inputs. Reuse the existing CLI builders (EncodeCommand,TransformCommand,StringTransformCommand,ConvertCommand) before writing a new one. - Tests ship with the code, table-driven with
t.Runsubtests, covering happy path, empty input, and error cases, including the exit code each error maps to (TestExitCodesinmain_test.go). Parsers get a fuzz target that is kept. - Idiomatic over clever; standard library first. Any third-party dependency is justified in the PR (maintenance, API quality, license, transitive dependencies, binary size, and startup cost) before it is added. No cgo.
- Probe dependencies empirically before trusting them: verify the behaviors that matter (ordering, edge cases, silent truncation, resource use) with a scratch program, and encode the findings as tests.
- No over-engineering. Build for the utility in front of us; no CLI framework, and the hand-rolled command registry stays until it's a real bottleneck.
- Comments explain why, not what: a non-obvious decision, a workaround, a constraint the code can't express. Readable code gets no comment.
Naming
- Packages: lowercase, one word, no underscores; never colliding with a stdlib
package we'd import alongside (
img, notimage). One package per category underinternal/, split into files only for readability. - Functions: no stutter with the package prefix:
generate.UUID,img.PNGToJPEG(XToYfor conversions),encode.Base64. Initialisms stay capitalized (JSON,URL,QR,JWT). - Commands:
x2yfor conversions (png2jpeg);noun/noun-verbotherwise (uuid,json-fmt,jwt-decode).
Writing style
Docs, help text, and PR descriptions are plain, precise American English. Never use the em dash; restructure with a colon, comma, or parentheses instead. Hyphens belong only in flags and compound words.
Workflow: PRs and releases
- All changes land through pull requests.
mainis protected: branch (feat/<name>,fix/<name>), commit, push, and open a PR withgh pr createfollowing the template, including a runbook (exact commands, expected output, and exit codes) so the change can be verified independently. Merge only after CI is green, by squash, somainstays one commit per change. Never push tomaindirectly, and commit or push only when the person you're working with asks. - Conventional Commits (
feat,fix,docs,test,refactor,perf,build,ci,chore): the PR title becomes the commit onmainand the changelog line, and CI checks it. Breaking changes use!(feat!:) and get their own changelog section. - Stacked or parallel PRs: rebase each onto the updated
mainbefore merging, then rebuild and run the full suite. A rebase without textual conflicts can still break the build when two branches change the same package. - Releases are tags, cut by a maintainer with the
/releaseskill. SemVer: patch for fixes, minor for new commands, flags, or JSON fields, major for breaking the CLI contract (renamed commands or flags, changed output shapes, exit-code meaning). Never create or push a tag unless a maintainer asks for that release.
Planning
There is no roadmap file. Future utilities and larger ideas are tracked as GitHub issues; each utility ships complete in its own PR.
Don't
- Ship code without tests, or without exercising the built binary end to end.
- Add a dependency without the evaluation in the PR.
- Break the agent-first contract: no interactivity, no color, no silent behavior, no unbounded work.
- Over-engineer or add abstractions ahead of need.
- Present planned behavior as current in README.md.
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.

