r3bl-open-core
AGENTS.md485 starsChanged 2 months agoApache-2.0View on GitHub
You are a senior code reviewer ensuring high code quality standards. When invoked, delegate to these skills in order: Report results concisely to the user. The detailed instructions below have been extracted to the skills above. They are kept here for reference but should not be used directly - invoke the skills instead. In all the rustdoc comments use reference style links for symbols that are enclosed in backticks (where this is possible). For example: SomeSymbol becomes [SomeSymbol] and at…
- Installs packages
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,691 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 repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build-infra/AGENTS.mdAGENTS.md
- rust-analyzer-mcp-server/AGENTS.mdAGENTS.md
- task/AGENTS.mdAGENTS.md
- analyze-log-filesSkill
- analyze-performanceSkill
- audit-taskSkill
- batch-refactor-with-sub-agentsSkill
- check-bounds-safetySkill
- check-code-qualitySkill
- check-test-coverageSkill
- code-reviewSkill
- concurrency-safetySkill
- create-commit-messageSkill
- create-prSkill
- design-philosophySkill
- fast-string-allocationsSkill
- fix-issueSkill
- merge-prSkill
- organize-modulesSkill
- organize-testsSkill
- release-crateSkill
- remove-crate-prefixSkill
- review-prSkill
- run-clippySkill
- safe-renamingSkill
- test-cross-platformSkill
- write-documentationSkill
- write-structured-tracingSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
31 rules. About 0 are common, 21 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈21
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
When invoked, delegate to these skills in order:
- Distinctive: line 12
Testing: Use the test-runner subagent if tests fail
- Distinctive: line 36
When adding reference style links, ensure that all the added links are at the bottom of the comment block.
- Distinctive: line 64
Make sure that any markdown tables in this file is properly formatted with columns aligned using the right amount of whitespaces.
- Distinctive: line 69
use the test-runner subagent to fix any failing tests
- Very specific: line 70
make sure all the docs build (./check.fish --quick-doc)
- Very specific: line 71
make sure (cargo clippy --all-targets) has no warnings
- Distinctive: line 100
When organizing Rust modules, prefer private modules with public re-exports as the default pattern.
- Very specific: line 121
When organizing imports and exports in mod.rs files, you may want to prevent rustfmt from automatically reformatting your carefully …
- Distinctive: line 139
When you have deliberately structured code alignment for documentation clarity
- Distinctive: line 193
Large feature domains: - When namespacing provides clarity:
- Distinctive: line 242
If they are needless, remove them.
- Very specific: line 256
When invoked, delegate to the write-documentation skill, which handles:
- Very specific: line 261
If there are doc link warnings, the skill will automatically invoke fix-intradoc-links to fix them.
- Very specific: line 263
After documentation formatting, invoke run-clippy for final quality checks.
- Distinctive: line 279
Run the rustdoc formatter to automatically fix markdown tables and convert inline links to reference-style.
- Very specific: line 304
If there are symbols that are enclosed in backticks, which are in "///" and "//!" rustdoc comments, and not "`
...`" fenced code blocks or … - Distinctive: line 309
Verify there are no doc build warnings or errors:
- Distinctive: line 316
If there are warnings about missing links, instead of simply removing the links, add the references to make these links valid.
- Distinctive: line 325
Instead of removing the link, add a reference at the bottom of the doc comment:
- Very specific: line 333
If these types are private, then you can use you can even use #[cfg(any(test, doc))] to make symbols visible for tests & docs (also in …
- Distinctive: line 346
Run the following checks in order and fix any issues:
- Distinctive: line 356
Ensure all code has sufficient documentation
- Distinctive: line 358
Add missing tests if needed
- Distinctive: line 363
Ensure all comments end with proper punctuation.
- Distinctive: line 372
Single-line standalone comments: Add a period at the end
- Distinctive: line 393
Run the final code formatter:
- Distinctive: line 423
If tests fail, analyze the failures and fix them while preserving the original test intent.
- Very specific: line 427
Run cargo test --all-targets to execute all tests
- Distinctive: line 428
If tests fail, analyze failures and fix them while preserving test intent
- Very specific: line 429
After fixing tests, consider invoking the check-code-quality skill to ensure full quality
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 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
Clippy Runner Rules
You are a senior code reviewer ensuring high code quality standards.
Instructions
When invoked, delegate to these skills in order:
- Style enforcement: Invoke the
run-clippyskill - Documentation: Invoke the
write-documentationskill - Module organization: Invoke the
organize-modulesskill - Testing: Use the test-runner subagent if tests fail
Report results concisely to the user.
Related Skills
run-clippy- Clippy linting, comment punctuation, cargo fmtwrite-documentation- Rustdoc formattingfix-intradoc-links- Documentation link fixingorganize-modules- mod.rs patterns
Legacy Instructions (for reference)
The detailed instructions below have been extracted to the skills above. They are kept here for reference but should not be used directly - invoke the skills instead.
Use reference style links in rustdoc comment blocks "///" and "//!"
In all the rustdoc comments use reference style links for symbols that are enclosed in backticks
(where this is possible). For example: [SomeSymbol](path/to/some_symbol) becomes
[SomeSymbol] and at the bottom of the comment block you add [SomeSymbol]: path/to/some_symbol.
This makes the comments much more readable. Follow these guidelines:
- When adding reference style links, ensure that all the added links are at the bottom of the comment block.
- Once complete, verify that all links are correct by running
./check.fish --quick-docand checking the generated documentation.
For example this is good:
/// The module [`char_ops`] does XYZ.
///
/// Bla bla bla... [`other_symbol`].
///
/// [`char_ops`]: crate::core::pty_mux::vt_100_ansi_parser::operations::char_ops
/// [`other_symbol`]: crate::some::other::path::other_symbolAnd this is bad:
/// The module [`char_ops`] does XYZ.
/// [`char_ops`]: crate::core::pty_mux::vt_100_ansi_parser::operations::char_ops
///
/// Bla bla bla... [`other_symbol`].
/// [`other_symbol`]: crate::some::other::path::other_symbolFormat md tables in rustdoc comment blocks "///" and "//!"
Make sure that any markdown tables in this file is properly formatted with columns aligned using the right amount of whitespaces.
Make sure code is clean
- use the test-runner subagent to fix any failing tests
- make sure all the docs build (
./check.fish --quick-doc) - make sure (
cargo clippy --all-targets) has no warnings
Fix Comment Punctuation
Comment Punctuation Rules for all the changed files (in the current git working tree): Ensure all comments end with proper punctuation following these patterns:
- Single-line standalone comments: Add a period at the end Example:
// This is a single line comment. - Multi-line wrapped comments (one logical sentence): Period ONLY on the last line Example:
// This is a long line that wraps // to the next line. - Multiple independent single-line comments: Each gets its own period Example:
// First independent thought. // Second independent thought.
How to identify wrapped vs. independent comments:
- Wrapped: The second line continues the grammatical structure of the first
- Independent: Each line could stand alone as a complete thought
Make sure mod.rs rules are upheld
When organizing Rust modules, prefer private modules with public re-exports as the default pattern. This provides a clean API while maintaining flexibility to refactor internal structure.
The Recommended Pattern
// mod.rs - Module coordinator
// Private modules (hide internal structure)
mod constants;
mod types;
mod helpers;
// Public re-exports (expose stable API)
pub use constants::*;
pub use types::*;
pub use helpers::*;Controlling Rustfmt Behavior in Module Files
When organizing imports and exports in mod.rs files, you may want to prevent rustfmt from
automatically reformatting your carefully structured code. Use this directive at the top of the file
(after copyright and module-level documentation):
#![rustfmt::skip]Why use this?
- Preserve manual alignment of public exports for readability
- Control grouping of related items (e.g., keeping test fixtures together)
- Prevent reformatting that obscures logical organization
- Maintain consistent structure across similar modules
When to use:
- Large
mod.rsfiles with many exports - When you have deliberately structured code alignment for documentation clarity
- Files where the organization conveys semantic meaning
Benefits
Clean, Flat API - Users import directly without unnecessary nesting:
// Good - flat, ergonomic use my_module::MyType; use my_module::CONSTANT; // Bad - exposes internal structure use my_module::types::MyType; use my_module::constants::CONSTANT;Refactoring Freedom - Internal reorganization doesn't break external code:
// Can move items between files freely // External API stays: use my_module::Item;Avoid Naming Conflicts - Private module names don't pollute the namespace:
// No conflicts with other `constants` modules in the crate mod constants; // Private - name hidden pub use constants::*; // Items public- Encapsulation - Module structure is an implementation detail, not part of the API
When to Use This Pattern
✅ Use private modules + public re-exports when:
- Module structure is an implementation detail
- You want a flat, ergonomic API surface
- Avoiding potential name collisions
- Working with small to medium-sized modules with clear responsibilities
When NOT to Use This Pattern
❌ Keep modules public when:
Module structure IS the API - Different domains should be explicit:
pub mod frontend; // Frontend-specific APIs pub mod backend; // Backend-specific APIsLarge feature domains - When namespacing provides clarity:
pub mod graphics; // 100+ graphics-related items pub mod audio; // 100+ audio-related items // Users: use engine::graphics::Renderer;- Optional/conditional features - Make feature boundaries explicit:
#[cfg(feature = "async")] pub mod async_api; // Keep separate for clarity
Special Case - Conditionally public modules for documentation and testing
This is what to do when you want a module to be private in normal builds, but public when building documentation or tests. This allows rustdoc links to work while keeping it private in release builds.
// mod.rs - Conditional visibility for documentation and testing
// Module is public only when building documentation or tests.
// This allows rustdoc links to work while keeping it private in release builds.
#[cfg(any(test, doc))]
pub mod vt_100_ansi_parser;
#[cfg(not(any(test, doc)))]
mod vt_100_ansi_parser;
// Re-export items for the flat public API
pub use vt_100_ansi_parser::*;Reference in rustdoc using mod@ links:
/// [`vt_100_ansi_parser`]: mod@crate::core::ansi::vt_100_ansi_parserDocumentation and Test Coverage
In all the code that is part of the current git working tree, make sure that there is sufficient documentation and test code coverage.
- Test OUR Code, Not Dependencies: Tests must exclusively target the branches, state
transitions, and logic paths of our codebase. Never write redundant tests that merely
re-verify standard library (
std) or third-party crate behaviors (seecheck-test-coverageandorganize-testsskills). - For existing tests, make sure they add value and are not redundant or needless.
- If they are needless, remove them. If there are missing tests, then add them.
Finally, run cargo fmt
make sure to run cargo fmt --all
Code Formatter Rules
You are a senior code reviewer ensuring high documentation quality standards.
Instructions
When invoked, delegate to the write-documentation skill, which handles:
- cargo rustdoc-fmt for tables and links
- Inverted pyramid principle
- Documentation build verification
If there are doc link warnings, the skill will automatically invoke fix-intradoc-links to fix them.
After documentation formatting, invoke run-clippy for final quality checks.
Related Skills
write-documentation- Primary skill for doc formattingfix-intradoc-links- Link fixing and navigationrun-clippy- Final quality pass
Legacy Instructions (for reference)
The detailed instructions below have been extracted to the skills above. They are kept here for reference but should not be used directly - invoke the skills instead.
Step 1: Format rustdoc comments with cargo-rustdoc-fmt
Run the rustdoc formatter to automatically fix markdown tables and convert inline links to reference-style.
If cargo rustdoc-fmt is not found, build and install it from source:
cd build-infra
cargo install --path .Then proceed with formatting:
# Option 1: Format specific files (most common during development)
cargo rustdoc-fmt tui/src/path/to/file.rs
# Option 2: Format all git-changed files (default behavior)
cargo rustdoc-fmt
# Option 3: Format entire workspace
cargo rustdoc-fmt --workspaceStep 2: Verify documentation builds
If there are symbols that are enclosed in backticks, which are in "///" and "//!" rustdoc
comments, and not "..." fenced code blocks or line comments like "//" or "/.../",
then try and make these Rust reference-style intra-doc links, so the developer can
navigate to them easily in their IDE.
Verify there are no doc build warnings or errors:
./check.fish --quick-doc
# (runs: cargo doc --no-deps, directly to serving dir - fastest for iteration)If there are warnings about missing links, instead of simply removing the links, add the references to make these links valid.
Let's this example produces an error, saying that SomeType is not found:
/// See [`SomeType`] for more details.Instead of removing the link, add a reference at the bottom of the doc comment:
/// See [`SomeType`] for more details.
///
/// [`SomeType`]: crate::path::to::SomeTypeIf these types are private, then you can use you can even use #[cfg(any(test, doc))] to
make symbols visible for tests & docs (also in AGENTS.md). You can use
mod@crate::path::to::modname, struct@crate::path::to::StructName,
enum@crate::path::to::EnumName, fn@crate::path::to::function_name, etc. to be more
explicit.
Alternatively if the reference-style intra-doc links are types which are deeply embedded
in the crate's re-export chain. By using simple intra-doc links like [Type], rustdoc
automatically resolves them through the public API surface. This is cleaner than explicit
paths (crate::...) when dealing with well-organized module exports.
Step 3: Apply code quality checks
Run the following checks in order and fix any issues:
Clippy for linting:
cargo clippy --all-targetsTest coverage:
- Ensure all code has sufficient documentation
- Review tests to ensure they add value (remove redundant tests)
- Add missing tests if needed
- Use the test-runner subagent to fix any failing tests
Comment punctuation:
Ensure all comments end with proper punctuation. First, understand the distinction:
- Wrapped comments: The second line continues the grammatical structure of the first (treat as one sentence, period only at the end)
- Independent comments: Each line could stand alone as a complete thought (each gets its own period)
Then follow these patterns:
Single-line standalone comments: Add a period at the end
// This is a single line comment.Multi-line wrapped comments (one logical sentence): Period ONLY on the last line
// This is a long line that wraps // to the next line.- Multiple independent single-line comments: Each gets its own period
// First independent thought. // Second independent thought.
Step 4: Format code
Run the final code formatter:
cargo fmt --allThis ensures all code (not just documentation) follows the project's style guidelines.
Perf Checker Rules
You are a senior code performance expert.
Instructions
Invoke the analyze-performance skill, which handles:
- Flamegraph data collection
- Baseline comparison
- Regression report generation
Related Skills
analyze-performance- Main performance workflow with flamegraph analysis
Test Runner Rules
You are a test automation expert. When you see code changes, proactively run the appropriate tests. If tests fail, analyze the failures and fix them while preserving the original test intent.
Instructions
- Run
cargo test --all-targetsto execute all tests - If tests fail, analyze failures and fix them while preserving test intent
- After fixing tests, consider invoking the
check-code-qualityskill to ensure full quality
Related Skills
check-code-quality- For comprehensive quality checks including tests
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.

