agentleFS
1bye1bye/rake/.agents/workflow/rust/AGENTS.md

rake / rust

AGENTS.md131 starsChanged 5 days agoApache-2.0View on GitHub

Use these defaults for Rust work. Follow the task's explicit requirements and the target project's more specific instructions. Preserve established structure during focused changes; apply structural migrations only within the task's scope. - Read architecture.md when adding modules, changing ownership, designing an API, or refactoring. - Read testing.md when adding or changing behavior and its tests. - Read rustdoc.md when adding or changing public contracts or docs. - Read stacks.md for the selected runtime and target profiles, and configs/README.md when…

  • 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 repository3 other files it gives its agents.

The file

Show its rules and text

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

23 rules. About 0 are common, 18 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use these defaults for Rust work.

    line 3
  2. Distinctive:

    Read architecture.md when adding modules, changing ownership, designing an API, or refactoring.

    line 9
  3. Distinctive:

    Read testing.md when adding or changing behavior and its tests.

    line 11
  4. Distinctive:

    Read rustdoc.md when adding or changing public contracts or docs.

    line 12
  5. Distinctive:

    Read stacks.md for the selected runtime and target profiles, and configs/README.md when adopting or changing tooling.

    line 13
  6. Distinctive:

    Keep changes with their domain owner.

    line 20
  7. Distinctive:

    Keep public APIs and behavior stable during a structural refactor.

    line 22
  8. Very specific:

    Prefer &str and slices for read-only inputs when the API does not need the container's ownership or capabilities.

    line 36
  9. Very specific:

    Use Arc, Rc, locks, and interior mutability for real sharing requirements.

    line 39
  10. Distinctive:

    Do not introduce them merely to silence a borrow-checker error.

    line 40
  11. Distinctive:

    Use enums for meaningful alternatives and newtypes when they prevent concrete mistakes, such as confusing coordinate spaces or units.

    line 42
  12. Distinctive:

    Prefer concrete types. Introduce traits or generics for actual substitution, interoperability, or reusable algorithms.

    line 45
  13. Distinctive:

    Add error context at useful boundaries and preserve causes.

    line 58
  14. Distinctive:

    Keep spawned work owned: define cancellation, error observation, and shutdown.

    line 64
  15. Distinctive:

    Keep blocking operations away from an async executor's worker threads.

    line 65
  16. Distinctive:

    Keep unsafe code confined to necessary boundaries.

    line 66
  17. Very specific:

    Use descriptive domain names and explicit units (timeout_ms, width_px).

    line 71
  18. Distinctive:

    Keep orchestration in execution order and name intermediate values when they explain a stage, unit conversion, or invariant.

    line 72
  19. Very specific:

    Keep chains and argument lists cohesive.

    line 85
  20. Very specific:

    Use stable rustfmt with the project's configuration.

    line 88
  21. Distinctive:

    Run the project's existing checks for the affected package, features, and targets.

    line 94
  22. Distinctive:

    Test observable behavior, meaningful failure cases, and regressions.

    line 97
  23. Distinctive:

    Check externally consumed APIs through a consumer test and documentation examples.

    line 99

≈ “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.

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

Rust defaults

Use these defaults for Rust work. Follow the task's explicit requirements and the target project's more specific instructions. Preserve established structure during focused changes; apply structural migrations only within the task's scope.

Read by task

  • Read architecture.md when adding modules, changing ownership, designing an API, or refactoring.
  • Read testing.md when adding or changing behavior and its tests.
  • Read rustdoc.md when adding or changing public contracts or docs.
  • Read stacks.md for the selected runtime and target profiles, and configs/README.md when adopting or changing tooling.

Working method

  • Inspect the owning module, callers, public exports, tests, Cargo manifests, features, and target-specific code before changing behavior.
  • Keep changes with their domain owner. Reuse existing code, the standard library, and installed dependencies before adding an abstraction or crate.
  • Keep public APIs and behavior stable during a structural refactor. Identify intended breaking changes explicitly and migrate affected consumers together.
  • Preserve the project's edition, minimum supported Rust version (MSRV), lockfile, feature choices, and toolchain. An edition change is a separate migration.
  • Complete the requested behavior; leave placeholders only for requested scaffolds.

Ownership and types

  • Give mutable state and resources a concrete owner and lifetime. Use struct and impl for cohesive state or invariants, and functions for straightforward transformations. A static-only service type is unnecessary for grouping functions.
  • Borrow for temporary access, move when transferring ownership, and clone when an independent value or shared handle is actually required. Understand what a clone copies; Arc::clone and cloning a large collection have different costs.
  • Prefer &str and slices for read-only inputs when the API does not need the container's ownership or capabilities. Return owned values when that simplifies the caller's lifetime without a demonstrated performance cost.
  • Use Arc, Rc, locks, and interior mutability for real sharing requirements. Do not introduce them merely to silence a borrow-checker error. First examine the data owner, borrow duration, and operations that can be separated.
  • Use enums for meaningful alternatives and newtypes when they prevent concrete mistakes, such as confusing coordinate spaces or units. Avoid redundant state that can disagree with the authoritative value.
  • Prefer concrete types. Introduce traits or generics for actual substitution, interoperability, or reusable algorithms; choose dynamic dispatch when runtime selection is needed. Do not build a trait hierarchy for a single local helper.
  • Validate external input at its boundary. Preserve invariants through constructors and methods when exposing mutable fields would let callers violate them.

Errors and resources

  • Return Result for expected failures and Option for meaningful absence. Use exhaustive matching instead of hiding unexpected states with a fallback.
  • Give library consumers errors they can inspect, name, and propagate. Implement std::error::Error where appropriate; reuse an existing error derive dependency. Applications may use their established contextual error type.
  • Add error context at useful boundaries and preserve causes. Log a failure at its handling boundary rather than repeatedly logging and propagating it.
  • Reserve panic/expect for documented programmer invariants. Handle invalid user input and external failures without panic. Test setup may use clear expects.
  • Let resource owners clean up through Drop where suitable. Explicitly finish work whose completion can fail or must be awaited; Drop cannot await shutdown.
  • Keep spawned work owned: define cancellation, error observation, and shutdown. Keep blocking operations away from an async executor's worker threads.
  • Keep unsafe code confined to necessary boundaries. Explain each safety argument and every caller obligation; safe wrappers must enforce their own promises.

Readability and spacing

  • Use descriptive domain names and explicit units (timeout_ms, width_px). Keep orchestration in execution order and name intermediate values when they explain a stage, unit conversion, or invariant.
  • Separate setup, validation, execution, and result construction with one blank line. Keep related short declarations together; separate multiline declarations and completed declaration groups from subsequent operations.
  • Separate standalone if, match, loops, and let ... else guards from adjacent work. Keep else attached, match arms cohesive, and short guard blocks compact.
  • Separate a final result expression or early return from preceding work when it marks a distinct result phase. Keep compact expression bodies compact; do not add return solely to satisfy a spacing convention.
  • Separate type definitions, implementations, functions, and methods with one blank line. Keep documentation and attributes attached to their item; keep struct fields and enum variants cohesive.
  • Keep chains and argument lists cohesive. Prefer a loop over a dense iterator chain when control flow or mutation is clearer. Avoid blank lines after every statement, artificial file-size limits, and generic utils dumping grounds.
  • Use stable rustfmt with the project's configuration. Stable rustfmt does not enforce logical statement padding. Projects can adopt the shared Dylint spacing library in rust/spacing to check the conditional spacing policy automatically.

Verification

  • Run the project's existing checks for the affected package, features, and targets. Use the config guide as a starting point when commands have not yet been established.
  • Test observable behavior, meaningful failure cases, and regressions. Demonstrate a regression test failing before the fix when practical; do not weaken a test.
  • Check externally consumed APIs through a consumer test and documentation examples. Internal tests alone do not establish usable public exports.
  • Native checks do not establish WASM compatibility. Check supported combinations explicitly; --all-targets selects Cargo targets, not every platform triple, and --all-features can enable unsupported combinations.
  • Measure performance-sensitive changes against a relevant baseline. Avoid adding allocation tricks, caches, or concurrency without identifying the cost and owner.
  • Report checks run, their scope, and missing prerequisites. Keep source-formatting fixes separate from checks; compilation and tests can still write build artifacts.

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.