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
- Very specific: line 17
Do NOT write absolute inline paths like crate::Type or crate::Size inside function signatures or bodies.
- Very specific: line 36
Declarative Macros (
macro_rules!): Do NOT apply this refactor inside declarative macros, and NEVER touch or remove the $crate:: prefix. - Distinctive: line 48
If specific files are provided as arguments, target those files.
- Distinctive: line 49
If no arguments are supplied, find all modified staged and unstaged files (e.g., via git diff --name-only and git diff --cached …
- Very specific: line 54
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 …
- Very specific: line 59
Remove the crate:: prefix from the inline usages.
- Very specific: line 60
Verify the changes compile successfully using ./check.fish --check.
≈ “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.
Files
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 orifblock is preferred over a file-level import to minimize scope pollution.
Execution
When invoked:
- 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-onlyandgit diff --cached --name-only) and target all of them.
- Scan the targeted file(s) for instances of inline
crate::usage for types. - Group the required imports into a single
use crate::{...};statement.- For production code: Place the
usestatement at or near the top of the file, joining existing file-level imports (even if thecrate::usage is inside an inner module). - For test code: The
usestatement can be added to the closest inner test module where the other test imports are located.
- For production code: Place the
- Remove the
crate::prefix from the inline usages. - Verify the changes compile successfully using
./check.fish --check.
In this repository30 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- build-infra/AGENTS.mdAGENTS.md
- rust-analyzer-mcp-server/AGENTS.mdAGENTS.md
- task/AGENTS.mdAGENTS.md
- llms.txtllms.txt
- 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
- review-prSkill
- run-clippySkill
- safe-renamingSkill
- test-cross-platformSkill
- write-documentationSkill
- write-structured-tracingSkill
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.

