python-conventions
Skill8 starsChanged 31 days agoMITView on GitHub
Python and shell-script conventions for CAST projects. Load when writing, reviewing, or debugging Python scripts, hook scripts, or files under scripts/ or bin/. Covers stdlib-only policy, DB access patterns, exit codes, idempotency, stdin parsing, and hook script conventions.
- Installs packages
7 other projects use a version of this.
Adopted by
Most recently taken up by
- NicoGenti/opencode-orchestrator-kittheir own version, first seen Nov 8, 2026
- leroyguillaume/claudetheir own version, first seen Oct 30, 2026
- andr-ca/agentharnesstheir own version, first seen Oct 15, 2026
- wtsi-hgi/agentskillstheir own version, first seen Oct 4, 2026
- techmefr/mentistheir own version, first seen Sep 11, 2026
- HermeticOrmus/python-conventions-skillstheir own version, first seen May 23, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- tae0y/python-project-template★ 14same name
- NicoGenti/opencode-orchestrator-kit★ 9same name
- leroyguillaume/claude★ 7same name
- HermeticOrmus/python-conventions-skills★ 2same name
- andr-ca/agentharness★ 1same name
- wtsi-hgi/agentskills★ 1same name
- techmefr/mentis★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- commands/agents.mdAGENTS.md
- rules-core/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-registrySkill
- briefing-writerSkill
- careful-modeSkill
- cast-auditSkill
- cast-conventionsSkill
- deep-researchSkill
- freeze-modeSkill
- git-activitySkill
- laconicSkill
- mergeSkill
- orchestrateSkill
- planSkill
- seo-checklistSkill
- seo-index-censusSkill
- shipSkill
- stack-referenceSkill
- typescript-conventionsSkill
- wizardSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use f-strings for string formatting
- Distinctive: line 18
No global state — each script execution is independent
- Very specific: line 26
All new scripts written here must ALSO be committed to the repo scripts/ directory — never write only to ~/.claude/scripts/
“Common” is measured: kept by at least 6 in 10 of the 7 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.
Files
Python Conventions
- Stdlib only unless task spec allows pip installs
- DB access: use
scripts/cast_db.pyabstraction (db_write,db_query,db_execute) - DB path:
os.environ.get('CAST_DB_PATH', os.path.expanduser('~/.claude/cast.db')) - Error handling: catch specific exceptions, log to
~/.claude/logs/, never crash the hook pipeline - Schema changes: use
CREATE TABLE IF NOT EXISTSandALTER TABLE ... ADD COLUMNwith try/except for idempotency - Stdin parsing:
json.loads(os.environ.get("CAST_INPUT", ""))pattern with try/except - Use f-strings for string formatting
- Type hints on function signatures where practical
- No global state — each script execution is independent
Script File Conventions
- Python scripts: use stdlib only unless the task spec explicitly allows pip installs
- DB access: always use
os.environ.get('CAST_DB_PATH', os.path.expanduser('~/.claude/cast.db'))for path resolution - Exit codes: 0 = success, 1 = error; print errors to stderr, results to stdout
- Idempotency: migration scripts must be safe to run multiple times (check before CREATE/ALTER)
- All new scripts written here must ALSO be committed to the repo
scripts/directory — never write only to~/.claude/scripts/ - Hook scripts that emit events: use
cast_emit_eventfrom~/.claude/scripts/cast-events.sh - JSON output scripts: always emit valid JSON even on error (
{"error": "..."})
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.

