agentleFS
ek33450505ek33450505/claude-agent-team/skills/python-conventions/SKILL.md

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

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
  1. Distinctive:

    Use f-strings for string formatting

    line 16
  2. Distinctive:

    No global state — each script execution is independent

    line 18
  3. Very specific:

    All new scripts written here must ALSO be committed to the repo scripts/ directory — never write only to ~/.claude/scripts/

    line 26

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Conventions

  • Stdlib only unless task spec allows pip installs
  • DB access: use scripts/cast_db.py abstraction (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 EXISTS and ALTER TABLE ... ADD COLUMN with 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_event from ~/.claude/scripts/cast-events.sh
  • JSON output scripts: always emit valid JSON even on error ({"error": "..."})

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.