Command Palette

Search for a command to run...

Back to skills
skill № 53163

Python

Writes, debugs, and reviews Python code — runtime traps, packaging, typing, async, tests, performance. Use when Python raises or misbehaves…

FreeNo executable scripts
clawicby clawic★ 23 GitHub stars

Install Python in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

User preferences live in ~/Clawic/data/py/config.yaml (see Configuration); nothing else is stored on the user's machine. If you have data at an old location (~/py/ or ~/clawic/py/), move it to ~/Clawic/data/py/, and say in one line that you moved it and from where.

When To Use

  • Writing or reviewing Python — scan Core Rules and Output Gates before committing
  • Debugging wrong results without exceptions: state leaking across calls, aliased mutations, silent coercion
  • Any traceback whose cause is not obvious in ten seconds, plus hangs, memory growth, and segfaults
  • Environment and dependency work: venvs, lockfiles, editable installs, publishing, version upgrades
  • Choosing a concurrency model, a data model, or a typing strategy, and living with the consequences
  • Hardening a script into a tool: arguments, exit codes, logging, timeouts, retries, untrusted input
  • Not for library-specific issues — pandas, numpy, django, fastapi, flask have their own skills

Quick Reference

Situation Play
Wrong value, no exception repr() at input, midpoint, output; the first wrong one is the bug — suspect aliasing, coercion, stale default → debugging.md
A traceback you have not seen before Message → cause table, then the matching chain → debugging.md
Installed it, still ModuleNotFoundError Wrong interpreter: check sys.executable, then use python -m pip → packaging.md
venvs, lockfiles, uv vs pip vs poetry, publishing Applications pin everything with hashes; libraries declare ranges → packaging.md
cannot import name X from partially initialized module Circular import; switch to import a + a.f() before restructuring → imports.md
is vs ==, float rounding, money, NaN, string surgery is only for None/True/False/sentinels; Decimal from strings → types.md
Aliasing, copies, ordering, membership cost [[]]*3 shares one list; x in list is O(n) → collections.md
State leaks across calls: defaults, closures, decorators, generators Defaults evaluate once, at def time → functions.md
Class design: shared attributes, hashability, MRO, __slots__ __eq__ without __hash__ makes instances unhashable → classes.md
dict vs dataclass vs NamedTuple vs pydantic; validating input Validate once at the boundary, plain objects inside → data-modeling.md
Slow, hanging, or racy: GIL, threads, asyncio, multiprocessing Pure-Python CPU → processes; I/O → threads or asyncio → concurrency.md
Too slow, or too much memory Profile first, then fix the top line or nothing → performance.md
Tests pass but should not; mock patches nothing; async tests skipped Patch where the name is USED; autospec=True → testing.md
mypy or pyright errors, annotating a legacy codebase Freeze a baseline, then ratchet one package at a time → type-checking.md
Formatting, import order, lint rules, pre-commit, style review comments One formatter owns layout; ruff check for bugs; same versions in hook and CI → linting.md
UnicodeDecodeError, CSV and JSON traps, atomic writes, temp files Declare encoding="utf-8"; write temp then os.replace → files.md
Timezones, DST, parsing dates, measuring elapsed time Aware datetimes everywhere; time.monotonic() for durations → datetime.md
Calling git/ffmpeg/anything external, hanging or failing silently run([...], check=True, timeout=…), never shell=True with interpolation → subprocess.md
Writing a script or CLI: arguments, exit codes, pipes, signals sys.exit(main()); stdout for data, stderr for logs → cli.md
Nothing appears in the logs, or deciding what to log Four gates: basicConfig no-op, logger level, handler level, propagation → logging.md
Exception design, chaining, retries, timeouts raise X from exc; exponential backoff with jitter → errors.md
Calling an HTTP API: sessions, status codes, redirects, streaming a big body One client per process; raise_for_status() before .json() → http.md
A local database, cache, or queue in a file; database is locked WAL plus an explicit busy timeout; one connection per thread → sqlite.md
Untrusted input: pickle, eval, SQL, paths, archives, secrets Unpickling executes code; parameterize SQL; contain paths → security.md
"Is there something in the stdlib for this?" Counter, deque, bisect, itertools, pathlib, secrets, sqlite3 → stdlib.md
Notebook works for you and nobody else; results change between runs Restart and run all; %pip not !pip; strip outputs before committing → notebooks.md
Upgrading Python, choosing a version, a module that vanished Run the suite with -W error::DeprecationWarning on the OLD version first → versions.md
Anything else Core Rules below, then reproduce with python -I -c '<the five suspect lines>' and re-add one thing at a time

Each file above is one sub-job and

Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • _meta.json
  • classes.md
  • cli.md
  • collections.md
  • concurrency.md
  • data-modeling.md
  • datetime.md
  • debugging.md
  • errors.md
  • files.md
  • functions.md
  • http.md
  • imports.md
  • linting.md
  • logging.md
  • notebooks.md
  • packaging.md
  • performance.md
  • security.md
  • sqlite.md
  • stdlib.md
  • subprocess.md
  • testing.md
  • type-checking.md
  • types.md
  • versions.md

FAQ

What does the Python skill do?

Writes, debugs, and reviews Python code — runtime traps, packaging, typing, async, tests, performance. Use when Python raises or misbehaves: ModuleNotFoundError, circular imports, AttributeError on None, UnboundLocalError, UnicodeDecodeError, mutable default arguments, `is` vs `==`, float rounding, naive vs aware datetimes, or a wrong answer with no exception; when pip, uv, poetry, venv, pyproject or a lockfile fight over dependencies, or a package installs but will not import; when threads, asyncio, multiprocessing or the GIL hang, deadlock, or leak memory; when pytest passes but should not, mocks patch the wrong module, or async tests never run; when mypy or pyright errors need clearing; when a script is slow, eats RAM, or gets OOM-killed; when subprocess calls hang or logs never appear; or when upgrading Python breaks the build. Not for library-specific problems — pandas, numpy, django, fastapi and flask have their own skills.

How do I install the Python skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the Python skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare Python with