agentleFS
GitHubKnown publishergithub/gh-actions-lock/AGENTS.md

gh-actions-lock

AGENTS.md161 starsChanged 4 months agoMITView on GitHub

Write Go that follows the Google Go Style Guide and lines up with cli/cli conventions. Keep it readable and simple. Doc comments earn their keep by saying something the code doesn't. Skip: When in doubt, fewer words. If a comment reads like marketing or a victory lap, delete it. There are two test layers with different guarantees. Put a test in the cheapest layer that can actually prove the thing, and don't restate the same claim in both. - Go…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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.

The file

We split this AGENTS.md into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write Go that follows the Google Go Style Guide and lines up with cli/cli conventions.

    line 5
  2. Distinctive:

    When in doubt, fewer words.

    line 22
  3. Distinctive:

    Prefer short, lowercase package names.

    line 26
  4. Very specific:

    Don't pre-declare var foo Type then assign — declare at first use.

    line 29
  5. Distinctive:

    Don't golden-snapshot what you can assert structurally.

    line 35
  6. Very specific:

    Same-assertion duplication is not defense-in-depth: If a Go command test already asserts the observable behavior deterministically, add a …

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent instructions

Code style

Write Go that follows the Google Go Style Guide and lines up with cli/cli conventions. Keep it readable and simple.

Comments

Doc comments earn their keep by saying something the code doesn't. Skip:

  • Restating the signature ("Foo does foo").
  • Meta-commentary about what the package isn't ("intentionally pure", "no HTTP, no filesystem"). If it's true, the imports show it.
  • Stability sermons on every type. One short note in the package doc is enough.
  • Decorative em-dashes, hedging, or apologetic phrasing.

Keep:

  • Why a non-obvious choice was made.
  • Invariants the type or function relies on.
  • Pointers to related code when the link isn't obvious from names.

When in doubt, fewer words. If a comment reads like marketing or a victory lap, delete it.

Naming and shape

  • Prefer short, lowercase package names. No underscores.
  • Exported identifiers get a doc comment that starts with the identifier name.
  • Errors are values; wrap with fmt.Errorf("...: %w", err) and expose sentinels with errors.Is.
  • Don't pre-declare var foo Type then assign — declare at first use.

Tests

  • Table-driven by default; subtests named with what they assert, not how.
  • One assertion per logical claim; multiple assert.X calls beat one giant struct compare.
  • Don't golden-snapshot what you can assert structurally.

Where does a test belong?

There are two test layers with different guarantees. Put a test in the cheapest layer that can actually prove the thing, and don't restate the same claim in both.

  • Go unit (internal/**/*_test.go) — internal logic: traversal, ref classification, error types, dedup. Fast, hermetic, no token. This is the primary safety net. Logic like BFS or $/ classification can only live here; it can't be expressed in the catalog.
  • Go command test (cmd/**/*_test.go with httpmock) — full CLI wiring end to end, but with a stubbed resolver so it stays deterministic. Runs in the blocking test CI job with no token. Reach for this to prove the command plumbs its pieces together.
  • Catalog scenario (test/scenarios/catalog.yml, run by the Ruby harness) — the real compiled binary against the real API or a stub server. Use it only for what a Go mock can't prove: real arg parsing, the real lockfile emitter, live transitive resolution over real fixtures.

Pitfalls that have bitten us:

  • needs_token: true scenarios do not guard merge. They run only in the non-blocking integration-live CI job. Never let a token-gated scenario be the only coverage for a behavior — back it with a Go test.
  • Only stub-tagged scenarios run in the blocking integration-stub job. An untagged, no-token scenario runs nowhere in required CI.
  • Same-assertion duplication is not defense-in-depth. If a Go command test already asserts the observable behavior deterministically, add a catalog scenario only for the real-binary / real-API delta, and say so in its description. Otherwise you're paying for a second, slower, flakier copy of a test you already have.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.