transformers-mlinter
AGENTS.md7 starsChanged 2 months agoApache-2.0View on GitHub
Run make format or make lint and make test before wrapping up a change. - Rule modules live in mlinter/trf*.py. - Rule metadata lives in mlinter/rules.toml. - Rule-specific tests live in tests/test_trfXXX.py, one file per rule. - Shared rule-test helpers live in tests/rule_test_utils.py; rule test classes should inherit from RuleTestCase when they use the standard _run(rule, source, file_name=...) helper. - General CLI, registry, cache, discovery, and public-API tests live in tests/test_mlinter.py. - Skills live under .ai/skills/. - The docs site…
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,773 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.
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
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
- Very specific: line 9
Run make format or make lint and make test before wrapping up a change.
- Distinctive: line 26
Never hand-edit it, and never commit it.
- Very specific: line 31
Only the hand-written pages (index.md, usage.md, suppressing.md, contributing.md, release.md) are committed under docs/.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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
Useful commands
make format: auto-fixes style issues with Ruff.make lint: runs Ruff checks and format verification.make test: runs the test suite undertests/.make typecheck: runstyonmlinter/.make docs: regenerates the rule pages, builds the docs site, and checks internal links.make docs-serve: live preview of the docs site.
Run make format or make lint and make test before wrapping up a change.
Repo structure
- Rule modules live in
mlinter/trf*.py. - Rule metadata lives in
mlinter/rules.toml. - Rule-specific tests live in
tests/test_trfXXX.py, one file per rule. - Shared rule-test helpers live in
tests/rule_test_utils.py; rule test classes should inherit fromRuleTestCasewhen they use the standard_run(rule, source, file_name=...)helper. - General CLI, registry, cache, discovery, and public-API tests live in
tests/test_mlinter.py. - Skills live under
.ai/skills/. - The docs site source lives in
docs/(Jekyll + just-the-docs), published to https://huggingface.github.io/transformers-mlinter/ by.github/workflows/pages.yml.
Docs site
docs/rules/is generated byscripts/build_docs.pyfromrules.tomland is git-ignored. Never hand-edit it, and never commit it.- Adding a rule to
rules.tomltherefore documents it: there is no page to write. Thedescriptionandexplanationfields are the published prose, so write them for a contributor reading a failing CI job. The same holds for adeprecated = truetombstone: itsdescriptionis the whole of the retired rule's page, which the site keeps publishing so an old rule id never 404s. - Only the hand-written pages (
index.md,usage.md,suppressing.md,contributing.md,release.md) are committed underdocs/.docs/rules/,docs/changelog.md(copied from the rootCHANGELOG.md) anddocs/_data/mlinter.yml(version frompyproject.toml) are all generated. - Rule prose may contain
code spans; the generator escapes Markdown metacharacters around them, so<Model>Configandmodeling_*.pyrender literally. Don't pre-escape them in the TOML. - The Ruby toolchain needs
cd docs && bundle installonce beforemake docsworks.
Mlinter rules
- Rules must use static analysis only with Python's
astmodule. - Rule modules must expose
check(tree, file_path, source_lines) -> list[Violation]. - Rule specs use
what_it_does,why_bad, anddiff; keep examples in a single diff block. - Cross-file rules may need to read companion
configuration_*.pyfiles from disk. - Modular files often inherit from classes imported from another model. If a rule depends on inherited
methods or base-class structure, treat an unresolved imported base as inconclusive (usually skip or
inspect the generated
modeling_*.py) instead of reporting that inherited behavior is absent.
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.

