agentleFS
r3bl-orgr3bl-org/r3bl-open-core/.agents/skills/remove-crate-prefix/SKILL.md

remove-crate-prefix

Skill486 starsChanged 15 days agoApache-2.0View on GitHub

Enforce the "Clean Imports over Inline Absolute Paths" rule by removing inline crate:: prefixes and adding proper use statements.

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

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

    Do NOT write absolute inline paths like crate::Type or crate::Size inside function signatures or bodies.

    line 17
  2. Very specific:

    Declarative Macros (macro_rules!): Do NOT apply this refactor inside declarative macros, and NEVER touch or remove the $crate:: prefix.

    line 36
  3. Distinctive:

    If specific files are provided as arguments, target those files.

    line 48
  4. Distinctive:

    If no arguments are supplied, find all modified staged and unstaged files (e.g., via git diff --name-only and git diff --cached …

    line 49
  5. Very specific:

    For production code: Place the use statement at or near the top of the file, joining existing file-level imports (even if the crate:: usage …

    line 54
  6. Very specific:

    Remove the crate:: prefix from the inline usages.

    line 59
  7. Very specific:

    Verify the changes compile successfully using ./check.fish --check.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill 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
SKILL.md

Remove Crate Prefix Skill

Purpose

This skill enforces the "Clean Imports over Inline Absolute Paths (Mandatory)" rule defined in the project's AGENTS.md. It automatically scans code for inline crate:: prefixes (e.g. crate::Type, crate::Size) and refactors the code to use clean imports at the top of the file or scope.

Rules

Do NOT write absolute inline paths like crate::Type or crate::Size inside function signatures or bodies.

✅ Good:

use crate::{Size, Pos};

pub fn render(size: Size) -> Pos { ... }

❌ Bad:

pub fn render(size: crate::Size) -> crate::Pos { ... }

Exceptions

  • Declarative Macros (macro_rules!): Do NOT apply this refactor inside declarative macros, and NEVER touch or remove the $crate:: prefix. Modifying $crate:: will result in a syntax error because it turns a built-in macro keyword into an undeclared macro variable.
  • Macro invocations often require absolute paths (e.g., crate::key_press!). This rule primarily targets structs, traits, and enums (e.g., crate::ModifierKeysMask).
  • Sometimes in generated code or highly isolated scopes, a use crate::{...} block directly inside a function or if block is preferred over a file-level import to minimize scope pollution.

Execution

When invoked:

  1. Determine Target Files:
    • If specific files are provided as arguments, target those files.
    • If no arguments are supplied, find all modified staged and unstaged files (e.g., via git diff --name-only and git diff --cached --name-only) and target all of them.
  2. Scan the targeted file(s) for instances of inline crate:: usage for types.
  3. Group the required imports into a single use crate::{...}; statement.
    • For production code: Place the use statement at or near the top of the file, joining existing file-level imports (even if the crate:: usage is inside an inner module).
    • For test code: The use statement can be added to the closest inner test module where the other test imports are located.
  4. Remove the crate:: prefix from the inline usages.
  5. Verify the changes compile successfully using ./check.fish --check.

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.