stand-py
Skill1 starsChanged 10 days agoMITView on GitHub
Python >= 3.11 coding standards. Use when writing Python code. Requires type hints, return types, Google-style docstrings, trailing commas, explicit kwargs, StrEnum with auto(), dataclasses, pytest-style tests.
In this repository41 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- analyze-codeSkill
- analyze-projectSkill
- analyze-testsSkill
- audit-mergesSkill
- babysit-prSkill
- backlogSkill
- branchSkill
- coderabbitSkill
- commitSkill
- greptileSkill
- implement-issuesSkill
- issueSkill
- jiraSkill
- lintro-addSkill
- lintro-reviewSkill
- lintro-verifySkill
- lintSkill
- properizeSkill
- pr-raycastSkill
- prSkill
- raycastSkill
- rebaseSkill
- reconcileSkill
- scorecardSkill
- stand-ciSkill
- stand-generalSkill
- stand-odinSkill
- stand-rustSkill
- stand-tsSkill
- sweep-prsSkill
- test-apiSkill
- test-shellSkill
- testSkill
- test-ui-qsfSkill
- test-uiSkill
- turbo-addSkill
- turbo-testSkill
- turbo-verifySkill
- which-prSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 4 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
All Python code should be run with uv
- Very specific: line 53
Use dataclasses for structured records with fixed fields and named attributes
- Very specific: line 54
Use collections.defaultdict for dynamic key-value aggregation with automatic defaults
- Very specific: line 60
Use auto() with all Enums where it makes sense
- Distinctive: line 64
Prefer Python-native constructs over verbose cross-language patterns.
- Very specific: line 173
Follow the lint skill for linting and formatting workflow.
- Very specific: line 177
Follow the lint skill ignore policy (Rules section): fix the root cause first.
- Distinctive: line 200
NEVER use unittest style or test classes
- Distinctive: line 201
Use pytest-style test functions only
- Distinctive: line 203
Use fixtures for reusable setup/teardown
- Very specific: line 204
Use @pytest.mark.parametrize to reduce duplication
- Very specific: line 205
ALWAYS use assertpy for assertions — never bare assert statements.
- Very specific: line 206
Keep pytest.raises for exception contexts (assertpy does not replace it)
≈ “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
Python Code Standards
Standards for Python code (>= 3.11).
Runtime
- All Python code should be run with
uv
PEP Compliance
- PEP 604: Use union types as
X | Y(notUnion[X, Y]) - PEP 673: Use
Selftype for self-referential types
Required Elements
- Type hints on ALL function parameters
- Return types on ALL functions
- Docstrings in Google Style Guide format for:
- Modules
- Classes
- Functions/methods
Docstring Format (Google Style)
def function_with_docstring(
param1: str,
param2: int,
) -> bool:
"""Short description of function.
Longer description if needed.
Args:
param1: Description of param1.
param2: Description of param2.
Returns:
Description of return value.
Raises:
ValueError: When something is wrong.
"""Design Patterns
- Use
dataclassesfor structured records with fixed fields and named attributes - Use
collections.defaultdictfor dynamic key-value aggregation with automatic defaults - Choose based on the use case: typed record-like object (
dataclass) vs map with default values (defaultdict) - Each dataclass should be in a separate file
- String Enums should use
StrEnumwithauto() - Use
auto()with all Enums where it makes sense
Idioms
Prefer Python-native constructs over verbose cross-language patterns.
any()/all()over flag-and-break loops:# Don't found = False for p in paths: if p.exists(): found = True break # Do found = any(p.exists() for p in paths)dict.get()over key-in checks:# Don't if name in registry: return registry[name] return None # Do return registry.get(name)pathliboveros.path— never mix the two in one codebase:# Don't root = os.path.dirname(os.path.dirname(os.path.dirname(path))) # Do root = Path(path).parents[2]Truthiness over length checks:
# Don't if len(items) == 0: ... # Do if not items: ...Comprehensions over loop-append for simple transforms:
# Don't names = [] for user in users: names.append(user.name) # Do names = [user.name for user in users]Direct boolean returns:
# Don't if count > limit: return True return False # Do return count > limitcontextlib.suppress(SomeError)over atry/except SomeError: passblock- Reach for
itertools/functools(chain,pairwise,cache,reduce) when they replace hand-rolled loop logic
Formatting Rules
More than 1 arg/param requires a trailing comma:
# Good def foo(bar: str, baz: int,) -> None: # Bad def foo(bar: str, baz: int) -> None:Be explicit with function calls when more than 1 arg:
# Good foo(bar=bar, baz=baz) # Bad foo(bar, baz)Single arg can be positional:
# OK foo(bar)
Linting
Follow the lint skill for linting and formatting workflow.
Ignoring Issues
Follow the lint skill ignore policy (Rules section): fix the root cause
first; if suppression is genuinely required, use the narrowest possible ignore
(specific rule code, single line) with an inline justification; blanket or
file-level ignores require a documented exception.
Python-specific: Bandit requires an inline # nosec or # nosec BXXX - reason
on the same line as the flagged statement (preceding-line # nosec is silently
ignored by Bandit). See the lint skill for other tool ignore configurations (e.g. mypy
may use a preceding-line comment plus inline # type: ignore):
# Don't - blanket, unjustified ignore
subprocess.run(["validate.sh"]) # nosec
# Do - narrowest code, inline justification
subprocess.run(["validate.sh"]) # nosec B603 - fixed argv list; no shellAdditional Python-specific note: docstrings are required even for tests — no exceptions.
Testing (Pytest)
- NEVER use unittest style or test classes
- Use pytest-style test functions only
- Leverage
conftest.pyfor shared fixtures - Use fixtures for reusable setup/teardown
- Use
@pytest.mark.parametrizeto reduce duplication - ALWAYS use
assertpyfor assertions — never bareassertstatements. Keeppytest.raisesfor exception contexts (assertpy does not replace it)
# Don't
assert result.count == 3
assert "drift" in output
# Do
from assertpy import assert_that
assert_that(result.count).is_equal_to(3)
assert_that(output).contains("drift")# WRONG
class TestFoo(unittest.TestCase):
def test_bar(self):
...
# CORRECT
def test_foo_bar() -> None:
"""Verify foo handles bar correctly."""
...Wiring vs. Behavior
A test that asserts field == "literal" where "literal" is also defined in source
code is duplication, and produces silent drift the moment either side changes.
- Wiring tests (does X read from canonical Y) — source from the constant. Better still, ask whether the test is just restating the constant's value; if so, delete it. The codegen / source-of-truth machinery is what guarantees that wiring, not a per-consumer assertion.
- Behavior tests (does X meet a fixed external contract — protocol versions, public API shapes, business rules) — hardcode the literal. The literal is the contract.
- Fixture data and parser inputs are not wiring — keep those literal. They represent the world being modeled, not internal state.
Parametrize IDs should describe the case under test (attr=min_version), never encode
mutable data values (min_version_is_0.43.0) — IDs that change with every dependency
bump are a smell.
Parametrize ID Hygiene
# WRONG — id encodes the data, churns on every bump
ids=["min_version_is_0.43.0"]
# CORRECT — id names the case
ids=["attr=min_version"]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.

