agentleFS
s3s-projects3s-project/s3s/.agents/skills/codegen/SKILL.md

codegen

Skill315 starsChanged 27 days agoApache-2.0View on GitHub

Change generated code in this repository. Use when editing anything that looks like a generated file, when the Smithy models or the data under data/ change, when a codegen run leaves a diff, or when adding a generated module.

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 0

    Distinctive

    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. Very specific:

    Every mergeable module is generated twice — into generated.rs and generated_minio.rs — and postprocess() merges the pair back into the …

    line 30
  2. Very specific:

    Verify both builds. cargo test --all-features and a plain cargo test execute different halves of a merged file, and the same holds for …

    line 32

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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
SKILL.md

Codegen

Most of the API surface of s3s and s3s-aws is generated from the Smithy models in data/. A generated file is an output: the change belongs in the generator, and the output is committed together with it.

The loop

  • just crawl refreshes the models and the error-code table under data/ (cargo run -p xtask -- crawl update).
  • just codegen regenerates the workspace from that data, then runs cargo fmt --all and cargo check.
  • just ci-rust ends with just assert_unchanged, which requires an empty git status, so a codegen run that leaves a diff fails CI. Run just codegen before pushing anything that touches the models, the data or an emitter.

The boundary

  • Generated files carry a //! Auto generated by ... marker. They live under crates/s3s/src/{dto,xml,access,error,header}/generated.rs, crates/s3s/src/ops/generated/, crates/s3s-aws/src/{conv,proxy}/generated.rs and crates/s3s/tests/generated/.
  • Hand-written code sits beside them (dto/mod.rs, xml/mod.rs, ops/mod.rs, ...). Edit that file, or the emitter, never the generated one.
  • An emitter change and the output it produces belong to the same commit: every commit has to leave a consistent tree, and assert_unchanged enforces exactly that.

Where the generators live

codegen/src/v1/ holds one module per family (dto.rs, xml.rs, ops.rs, s3_trait.rs, access.rs, error.rs, headers.rs, aws_conv.rs, aws_proxy.rs, gen_tests/), driven from mod.rs: run() reads the model data and calls each module, write_file and write_dir_file write into the checkout, and postprocess() finishes the job. Output has to be deterministic and stable under cargo fmt, so iterate maps in a fixed order.

The MinIO variant

Every mergeable module is generated twice — into generated.rs and generated_minio.rs — and postprocess() merges the pair back into the first file: the differences become inline #[cfg(feature = "minio")] / #[cfg(not(feature = "minio"))] blocks, and the temporary *_minio.rs is deleted. Two consequences:

  • Verify both builds. cargo test --all-features and a plain cargo test execute different halves of a merged file, and the same holds for cargo check with and without the feature.
  • A type or a value subtree that differs between the two models is generated once per branch, so a test that covers it needs the same gates.

Generated tests

codegen/src/v1/gen_tests/ writes the coverage test suite into crates/s3s/tests/generated/. The same rule applies there: extend the emitter instead of editing the generated tests by hand.

Download now (ZIP)

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. vercel-labs/json-render★ 19ksame name
    2. NVIDIA/nvcf★ 253same name
    3. rsicarelli/fakt★ 67same name
    4. AterDev/Perigon.CLI★ 54same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository10 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.