python-authoring
Skill1 starsChanged 19 days agoMITView on GitHub
Write, edit, refactor, or review Python as concise, stdlib-first, fully typed code that validates input at the boundary and passes basedpyright. Use when the user changes Python source, scripts, CLIs, validators, or tests, or says "make this more Pythonic", "clean up this Python", "de-slop this Python", "use a dataclass here", "fix the basedpyright errors", or invokes /python-authoring. Do NOT use for Bash scripts (/bash-shortening), task-runner recipes (/justfile), dependency-version conflicts (/version-doctor), or bug and security review (/age).
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- paulnsorensen/easy-cheeseedited, first seen Oct 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- paulnsorensen/easy-cheese★ 1951% same
Wrote their own version · 0
None found.
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 repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- releaseSkill
- skillz-self-updateSkill
- skillzSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
34 rules. About 0 are common, 20 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈20
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 25
Read the root configuration (pyproject.toml, lockfile, task runner), the target exports, immediate callers, and nearby conventions.
- Distinctive: line 26
Keep every changed line traceable to the request.
- Distinctive: line 27
Put code in the owning package and preserve existing module and package boundaries.
- Distinctive: line 30
Remove only slop introduced by the change and code that the change orphaned.
- Very specific: line 31
Run targeted tests, regenerate generated artifacts, then run just build.
- Distinctive: line 38
Treat the standard library as the default dependency budget.
- Distinctive: line 40
Keep test-only and tooling-only dependencies out of runtime modules.
- Very specific: line 41
Prefer argparse, json, pathlib, tempfile, shutil, zipfile, collections, itertools, and contextlib over hand-written equivalents.
- Very specific: line 47
Use TypedDict only when a mapping must remain a mapping.
- Very specific: line 48
Use Enum or Literal for closed value sets and Protocol for structural interfaces that have multiple real consumers.
- Distinctive: line 50
Do not pass raw structured dictionaries beyond the parsing boundary when a named record makes the contract clearer.
- Distinctive: line 54
Do not import another package's private internals.
- Distinctive: line 56
Keep cross-module orchestration in the owning workflow seam, not a leaf helper.
- Distinctive: line 57
Never hand-edit generated artifacts.
- Very specific: line 58
Keep CLI modules thin: accept argv, return an integer status, print diagnostics to stderr, and propagate failure through a nonzero exit.
- Distinctive: line 59
Keep validators and linters read-only.
- Very specific: line 63
Use match for genuine shape-based dispatch.
- Distinctive: line 64
Use a handler mapping for stable command-to-function dispatch.
- Distinctive: line 65
Use an assignment expression only when it removes a repeated computation or clarifies a loop condition.
- Very specific: line 66
Use any, all, comprehensions, and generator expressions for pure collection queries or transformations.
- Distinctive: line 67
Prefer generators when the result is consumed once.
- Very specific: line 68
Use enumerate, direct iteration, f-strings, context managers, and pathlib instead of manual indexing, string assembly, cleanup, or path …
- Distinctive: line 70
Keep new top-level functions at 40 lines or fewer unless one contiguous algorithm is clearer than an artificial split.
- Distinctive: line 71
Prefer one clear expression to verbose scaffolding, but split dense expressions when intermediate names explain intent.
- Distinctive: line 75
Delete narration comments and docstrings that restate the code.
- Distinctive: line 76
Remove abstractions with one concrete consumer unless the current task requires the seam.
- Very specific: line 83
Run just build after a Python change.
- Very specific: line 85
Keep typeCheckingMode = "recommended" and failOnWarnings = true.
- Very specific: line 89
Use --outputjson when a tool needs machine-readable diagnostics.
- Distinctive: line 96
Treat findings as potential dead code.
- Distinctive: line 103
Test observable behavior and the reason it matters.
- Very specific: line 104
Keep filesystem tests inside tmp_path or an equivalent temporary directory.
- Very specific: line 105
Run the most focused affected tests first, then run just build as the canonical full gate.
- Distinctive: line 116
No silent failures, speculative abstractions, narration comments, unnecessary local annotations, or unrelated cleanup remain.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Authoring Python
Produce the smallest readable Python change that satisfies the request and matches the project.
This is a repository-local skill for skillz-that-grillz. It lives under .agents/skills/python-authoring/, with a .claude/skills/ symlink for Claude Code. metadata.internal: true hides it from npx skills add, and gh skill install skips hidden directories. Do not move it into the published skills/ tree.
Work in this order
- Read the root configuration (
pyproject.toml, lockfile, task runner), the target exports, immediate callers, and nearby conventions. - Keep every changed line traceable to the request. Do not invent orchestration, compatibility layers, abstractions, dependencies, or future flexibility.
- Put code in the owning package and preserve existing module and package boundaries.
- Validate untrusted input once at the boundary, then work with typed trusted data.
- Choose the clearest succinct Python construct; do not compress code until it becomes harder to read.
- Remove only slop introduced by the change and code that the change orphaned.
- Run targeted tests, regenerate generated artifacts, then run
just build. It includes root basedpyright and Vulture checks.
Done when every item in the completion check holds.
Keep runtime code stdlib-first
- Target the Python version the project declares in
requires-python. Use its language and typing features directly; do not add compatibility code for older versions. - Treat the standard library as the default dependency budget. Add a third-party runtime dependency only when the project already uses it or the user approves it, and declare it where the project declares dependencies.
- Reuse existing parsing and I/O boundaries instead of importing a second library for the same job.
- Keep test-only and tooling-only dependencies out of runtime modules.
- Prefer
argparse,json,pathlib,tempfile,shutil,zipfile,collections,itertools, andcontextlibover hand-written equivalents.
Model and validate data explicitly
- Parse untrusted text with the appropriate stdlib parser, require the expected container shape, check required keys and value types, and raise a specific error at the boundary.
- Convert validated mappings into frozen dataclasses or domain value types when named fields and invariants make the contract clearer.
- Use
TypedDictonly when a mapping must remain a mapping. It documents a static shape; it does not validate runtime input. - Use
EnumorLiteralfor closed value sets andProtocolfor structural interfaces that have multiple real consumers. - Fully annotate function and public-method boundaries. Omit obvious local annotations when inference is clear.
- Do not pass raw structured dictionaries beyond the parsing boundary when a named record makes the contract clearer.
Preserve module boundaries
- Do not import another package's private internals. Consume its public interface.
- Move code to a shared module only when multiple existing consumers need the same behavior.
- Keep cross-module orchestration in the owning workflow seam, not a leaf helper. Avoid reverse dependencies and import cycles.
- Never hand-edit generated artifacts. Change their sources and run the project's generator.
- Keep CLI modules thin: accept
argv, return an integer status, print diagnostics to stderr, and propagate failure through a nonzero exit. - Keep validators and linters read-only. They inspect and report; they do not mutate the workspace.
Prefer succinct, readable Python
- Use
matchfor genuine shape-based dispatch; keep a simpleiffor a binary decision. - Use a handler mapping for stable command-to-function dispatch; do not create a registry for one or two branches.
- Use an assignment expression only when it removes a repeated computation or clarifies a loop condition.
- Use
any,all, comprehensions, and generator expressions for pure collection queries or transformations. Keep a loop when it carries state, side effects, or clearer early exits. - Prefer generators when the result is consumed once.
- Use
enumerate, direct iteration, f-strings, context managers, andpathlibinstead of manual indexing, string assembly, cleanup, or path manipulation. - Ignore only named, intentional failures. Never use a bare
except, swallowException, return an empty default on failure, or usecontextlib.suppress(Exception). - Keep new top-level functions at 40 lines or fewer unless one contiguous algorithm is clearer than an artificial split.
- Prefer one clear expression to verbose scaffolding, but split dense expressions when intermediate names explain intent.
De-slop before finishing
- Delete narration comments and docstrings that restate the code. Keep non-obvious rationale and public API documentation.
- Remove abstractions with one concrete consumer unless the current task requires the seam.
- Name values after domain concepts, not containers or implementation types.
- Consolidate repetitive tests by behavior; do not add shallow input-variation tests.
- Fix the underlying lint issue instead of adding a suppression.
Type-check with basedpyright
- Run
just buildafter a Python change. Its root basedpyright check covers authored Python in.github/scripts,packages, andskills. - Root configuration in
pyproject.tomluses Python 3.11, the root.venv, and execution environments for local packages. - Keep
typeCheckingMode = "recommended"andfailOnWarnings = true. Fix all errors and warnings without a baseline. - Preserve the independent fromargs type check and its package configuration.
- basedpyright is stricter than stock pyright. Assign deliberately ignored call results to
_(reportUnusedCallResult), collapse implicit string concatenations, andcastuntrusted boundary reads to their validated type. - Fix the type at its source. When a suppression is genuinely unavoidable, use a rule-scoped
# pyright: ignore[ruleName], never a bare# type: ignoreor a file-wide switch.reportIgnoreCommentWithoutRuleflags unscoped ignores. - Use
--outputjsonwhen a tool needs machine-readable diagnostics. In GitHub Actions the CLI detects CI and emits inline PR annotations with no extra flags. - Read exit codes precisely: 0 no errors, 1 errors reported, 2 fatal internal error, 3 unreadable config, 4 bad CLI arguments. Warnings exit 1 only when
failOnWarningsis on; when it is off, read the warning count in the output, because exit 0 does not prove zero warnings. Treat 2–4 as tooling breakage to fix or report, never as type findings. - Pin basedpyright to an exact version for reproducible results.
Check unused code with Vulture
just buildruns Vulture at 60% minimum confidence across authored Python, including tests and examples.- Treat findings as potential dead code. Trace dynamic callers before deletion.
- Exempt only proven framework callbacks with narrow decorator or name rules. Do not add a broad whitelist or a baseline.
- The repo gate (
.github/scripts/check_dead_code.py) exempts the fields of all module-levelTypedDictclasses, including subclasses. This is a structural rule, not a name list.UnpackandTypedDictkeys are read by string, so Vulture cannot see the reads. Function-localTypedDictclasses are not exempt. Do not add global name ignores for field names. - Vulture exit 3 means unused code was found. Resolve each real finding before completion.
Test and finish
- Test observable behavior and the reason it matters; do not add assertions that can pass when the implementation is broken.
- Keep filesystem tests inside
tmp_pathor an equivalent temporary directory. Do not depend on user paths, repository-external state, network access, or auto-loaded pytest plugins. - Run the most focused affected tests first, then run
just buildas the canonical full gate.
Completion check
Confirm:
- Runtime imports obey the stdlib-first dependency policy.
- Boundary input is validated once and converted into an appropriate trusted representation.
- Code lives in the owning module or a justified shared module.
- Generated artifacts match their sources when applicable.
- CLI and validator failures remain loud, read-only validators remain read-only, and tests are hermetic.
- No silent failures, speculative abstractions, narration comments, unnecessary local annotations, or unrelated cleanup remain.
- Root basedpyright reports zero errors and warnings. Vulture reports no unused code at 60% confidence.
- A fresh
just buildrun passed.
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.

