agentleFS
alphacrackalphacrack/readme2demo/.claude/skills/python-standards/SKILL.md

python-standards

Skill9 starsChanged 4 months agoMITView on GitHub

Python coding standards, testing patterns, and pydantic/typing conventions for the readme2demo codebase. Use when writing or reviewing any Python in src/readme2demo/ or tests/, adding a module, or before committing code changes.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    EVERY bug fix carries a regression test whose docstring starts """Regression (<repo> run): ...""" and describes the real failure.

    line 40
  2. Very specific:

    Prefer table-style asserts on the actual artifact (the rendered commands.sh, the tape text, the guide markdown), not on internal state.

    line 45
  3. Very specific:

    Run /ship-check. Minimum: full suite green, python -m compileall -q src/ clean, no runs/ or secrets staged.

    line 60

“Common” is measured: kept by at least 6 in 10 of the 6 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

Python standards for readme2demo

Python ≥3.10. Match the surrounding code; these are the invariants.

Types & models

  • Type hints on every public function signature; return types included.
  • Data contracts are pydantic v2 models in types.py — the single source of truth every stage serializes through. Add a field THERE first, never invent an ad-hoc dict that crosses a stage boundary. Use model_dump_json(indent=2) / model_validate_json for run-dir I/O.
  • Optional[X] for nullable; default containers via Field(default_factory=...).
  • New fields must be backward-compatible (defaulted) — old run dirs on disk must still load.

Purity boundary (enforced, not stylistic)

  • normalize.py and every engine parse_transcript are PURE and deterministic: no LLM calls, no network, no docker, no clock/random that changes output. They are tested against fixtures. If you need an LLM, you are in the wrong module.
  • LLM calls live only in ingest (planner), distill, tutorial — via llm.py.

Docstrings

  • One-line summary; then WHY when non-obvious. Regression-critical functions carry the failure they defend against (search for "Regression (" in tests).
  • Public functions in the pipeline path get a docstring naming their invariant.

Testing (this is where the repo's value lives)

  • python -m pytest tests/ -q runs in <1s with NO docker/network/API. Keep it that way: mock llm.complete_json, feed fixture transcripts, build models inline. Anything needing real infra is marked @pytest.mark.integration.
  • EVERY bug fix carries a regression test whose docstring starts """Regression (<repo> run): ...""" and describes the real failure. It must fail on the old code.
  • For grounding/equivalence changes: test BOTH directions — the new-variant is accepted AND an unproven/evil command is still rejected.
  • Prefer table-style asserts on the actual artifact (the rendered commands.sh, the tape text, the guide markdown), not on internal state.

Style

  • stdlib > third-party; the runtime deps are deliberately few (typer, rich, pydantic, jinja2, anthropic). Don't add a dependency for something stdlib does.
  • subprocess.run(..., capture_output=True, text=True, timeout=..., errors="replace") is the house pattern for shelling out; always set a timeout.
  • Fail with a specific, actionable message (name the env var, the file, the fix command) — see the preflight and EngineError messages for the tone.

Before you commit

Run /ship-check. Minimum: full suite green, python -m compileall -q src/ clean, no runs/ or secrets staged.

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.