Python Guidelines

VerifiedSafe

Best practices for creating, reading, updating, and deleting Python code. Covers imports, formatting, __init__.py files, and function parameters.

Sby Skills Guide Bot
DevelopmentBeginner
206/2/2026
Claude CodeCursorWindsurfCopilotCodex
#python#coding-standards#code-style#best-practices

Recommended for

Our review

This skill provides guidelines for writing clean, consistent Python code in terms of imports, formatting, and function parameter style.

Strengths

  • Enforces clear import conventions (all imports at top, no unnecessary local imports).
  • Improves readability of large numbers with underscore separators.
  • Promotes keyword-only arguments for functions with multiple parameters.
  • Restricts default parameter values to only the most sensible defaults.

Limitations

  • Does not cover naming conventions or documentation.
  • May be overly strict for quick scripts or notebooks.
  • Does not address typing or exception handling best practices.
When to use it

Use this skill when writing Python code intended for long-term maintenance or collaboration, especially in shared projects.

When not to use it

Avoid this skill for rapid prototyping or one-off scripts where flexibility is more important than consistency.

Security analysis

Safe
Quality score80/100

This skill provides only Python coding style guidelines and does not involve any execution of commands, network access, or dangerous operations.

No concerns found

Examples

Fix imports and number formatting
I have a Python script with local imports and numbers like 1000000. Please fix the imports to be at the top and use underscores for large numbers.
Enforce keyword arguments
Refactor the following function to require keyword arguments: def calculate(a, b, c): pass

name: python description: Guidelines when creating, reading, updating, or deleting Python code

Python Guidelines

Instructions

imports

Imports should ALWAYS be at the top of the file. NEVER have local imports unless it is 100% necessary.

formatting

For big numbers, use _ to make numbers more clear BAD: foo = 1000 GOOD: foo = 1_000

init.py files

Do not add anything inside of __init__.py files unless it is absolutely necessary or you are explicitly asked to. This includes adding __all__; NEVER add that.

function parameters

Functions with more than 1 parameter should ALWAYS use * to enforce keyword arguments. BAD: def foo(a, b, c): ... GOOD: def foo(*, a, b, c): ... Functions should always use required parameters unless making a parameter optional is absolutely necessary. Functions should not set defaults for parameters unless it is an EXTREMELY sane default.

Related skills