agentleFS
RailtownAIRailtownAI/railtracks/.claude/skills/code-style/SKILL.md

code-style

Skill230 starsChanged 2 months agoMITView on GitHub

Apply railtracks' code-style conventions whenever writing or editing Python code in this repo: new functions, modified signatures, docstrings, comments, imports, error handling. Use this automatically as part of any code change, not just when explicitly asked to clean up code.

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use debugging and testing.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • BlockSkill

    debugging

    Debugging guidelines and best practices

    Also in 3 projects that use this

  • NVIDIASkill

    testing

    Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 5 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Lint/format: run ruff check --fix and ruff format, required for every PR (CI-enforced).

    line 14
  2. Very specific:

    Imports: prefer top-level imports. Local/inline imports are fine when there's a real reason (e.g.

    line 15
  3. Very specific:

    Docstrings: must match the actual signature (param names, types, | None / Iterable[...] etc.).

    line 20
  4. Distinctive:

    Update the docstring any time a signature changes.

    line 21
  5. Very specific:

    Typing: no bare Any when a concrete type is available or already imported nearby.

    line 27
  6. Very specific:

    TODOs: no inline # TODO comments.

    line 29
  7. Distinctive:

    Cruft: no dead/commented-out code, no stray debug/scratch files left in a change.

    line 30
  8. Distinctive:

    Documentation paragraphs: keep prose paragraphs on one line, matching the existing docs.

    line 31
  9. Very specific:

    Mutable defaults: don't store a mutable default (x or []) by reference and mutate it later.

    line 32
  10. Very specific:

    Errors: use repr(e) rather than str(e) in error/log messages.

    line 34
  11. Very specific:

    __init__.py: don't add docstrings to __init__.py files.

    line 35
  12. Distinctive:

    Consistency with siblings: when adding a new variant of something that already has 2+ siblings (chunkers, loaders, LLM providers, etc.), …

    line 36
  13. Distinctive:

    Model references in examples: use current, provider-documented model IDs in user-facing examples and bundled CLI skills.

    line 39

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “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

railtracks Code Style

Code changes in this repo should be reviewed against these rules. Each one comes from a recurring, repeated PR review comment on railtracks, not a hypothetical style preference.

  • Lint/format: run ruff check --fix and ruff format, required for every PR (CI-enforced).
  • Imports: prefer top-level imports. Local/inline imports are fine when there's a real reason (e.g. deferring an expensive or optional dependency like litellm); don't add them out of habit, and don't let a lint failure be the excuse either way.
  • Tests: new functionality gets tests in the matching package's tests/ directory; don't leave a behavior change uncovered.
  • Docstrings: must match the actual signature (param names, types, | None / Iterable[...] etc.). Update the docstring any time a signature changes.
  • Tool docstrings/type hints: for any @rt.function_node-wrapped tool, the docstring is the literal tool description the LLM sees and the type hints define its JSON schema parameters; don't write vague docstrings or omit type hints on a tool function.
  • Module-level comment strings: a docstring at the top of a file is welcome. Avoid long inline paragraph-style comments in the body of the code; keep inline comments short and targeted.
  • Typing: no bare Any when a concrete type is available or already imported nearby. Don't reach for Any as a quick fix to silence something that's actually broken, either; fix the real type mismatch.
  • TODOs: no inline # TODO comments. Either fix it now or file a tracked GitHub issue and reference it.
  • Cruft: no dead/commented-out code, no stray debug/scratch files left in a change.
  • Documentation paragraphs: keep prose paragraphs on one line, matching the existing docs; do not hard-wrap sentences. Preserve code-block formatting.
  • Mutable defaults: don't store a mutable default (x or []) by reference and mutate it later; copy defensively.
  • Errors: use repr(e) rather than str(e) in error/log messages.
  • __init__.py: don't add docstrings to __init__.py files; not this repo's convention.
  • Consistency with siblings: when adding a new variant of something that already has 2+ siblings (chunkers, loaders, LLM providers, etc.), match their existing shape/behavior rather than introducing an ad hoc one-off.
  • Model references in examples: use current, provider-documented model IDs in user-facing examples and bundled CLI skills. Verify IDs against the provider's model catalog and deprecation page when adding or refreshing examples. Keep a model-specific reference only when the example demonstrates behavior unique to that model, and explain that choice nearby when it would otherwise look stale. Historical upgrade guides and tests that intentionally exercise model-name passthrough may retain older IDs.

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.