python-development
Skill1 starsChanged 10 months agoISCView on GitHub
Best practices for writing clean, Pythonic, and maintainable Python code. Use when working with .py files, Python applications, data science projects, or backend services.
We split this skill into the rules it gives an agent
50 rules. 0 are common, 48 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
48
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use this skill when:
- Distinctive: line 20
PEP 8 Compliance: Follow PEP 8 style guide strictly (indentation, naming, line length).
- Distinctive: line 22
Type Hints: Use type hints (PEP 484) for function signatures and complex variables.
- Very specific: line 23
Snake Case: Use snake_case for functions and variables, PascalCase for classes, UPPER_CASE for constants.
- Distinctive: line 24
Docstrings: Write docstrings for all public modules, functions, classes, and methods (PEP 257).
- Very specific: line 29
Package Structure: Use __init__.py for package initialization and public API exposure.
- Distinctive: line 31
Absolute Imports: Prefer absolute imports over relative except within packages.
- Distinctive: line 36
Function Length: Keep functions focused and concise (ideally under 25 lines).
- Distinctive: line 37
Default Arguments: Use immutable defaults. Never use mutable defaults ([], {}).
- Distinctive: line 38
Keyword Arguments: Use keyword arguments for clarity, especially with multiple parameters.
- Distinctive: line 40
Return Early: Use guard clauses to reduce nesting and improve readability.
- Distinctive: line 41
Pure Functions: Prefer pure functions without side effects when possible.
- Distinctive: line 45
List Comprehensions: Use comprehensions for simple transformations.
- Distinctive: line 46
Generator Expressions: Use generators for large datasets to save memory.
- Distinctive: line 47
Dictionary Operations: Use dict.get() for safe key access.
- Distinctive: line 48
Sets for Membership: Use sets for fast membership testing and removing duplicates.
- Distinctive: line 49
Unpacking: Use tuple/list unpacking for multiple assignments and function returns.
- Distinctive: line 50
Enums: Use Enum for related constants instead of magic strings or numbers.
- Distinctive: line 54
Data Classes: Use @dataclass (Python 3.7+) for simple data containers.
- Distinctive: line 55
Properties: Use @property for getters, @setter for setters instead of direct attribute access.
- Distinctive: line 59
Method Types: Use @staticmethod for utility methods, @classmethod for alternate constructors.
- Distinctive: line 64
Custom Exceptions: Create custom exception classes for domain-specific errors.
- Distinctive: line 65
EAFP Principle: Use "Easier to Ask Forgiveness than Permission" - try/except over if checks.
- Distinctive: line 66
Context Managers: Use with statements for resource management (files, locks, connections).
- Distinctive: line 67
Finally Blocks: Use finally for cleanup that must run regardless of exceptions.
- Distinctive: line 72
Gradual Typing: Add type hints incrementally, focusing on public APIs first.
- Distinctive: line 73
Common Types: Use List, Dict, Tuple, Optional, Union from typing module.
- Distinctive: line 74
Generics: Use TypeVar for generic functions and classes.
- Distinctive: line 75
Protocol: Use Protocol for structural subtyping (duck typing with types).
- Distinctive: line 76
Type Checkers: Run mypy or pyright for static type checking.
- Distinctive: line 77
Runtime Validation: Use pydantic or similar for runtime validation of complex types.
- Distinctive: line 81
Async/Await: Use async/await for I/O-bound concurrent operations.
- Distinctive: line 83
Async Context Managers: Use async with for asynchronous resource management.
- Distinctive: line 84
Gather vs Wait: Use asyncio.gather() for concurrent tasks, wait() for conditional waiting.
- Distinctive: line 85
Sync vs Async: Don't mix synchronous and asynchronous code carelessly.
- Distinctive: line 89
Profile First: Use cProfile or line_profiler before optimizing.
- Distinctive: line 90
List vs Generator: Use generators for large datasets or streaming data.
- Distinctive: line 92
String Concatenation: Use join() for concatenating many strings, not +.
- Distinctive: line 93
Caching: Use @lru_cache for expensive pure function calls.
- Distinctive: line 94
NumPy: Use NumPy for numerical operations instead of loops when possible.
- Distinctive: line 98
pytest Over unittest: Prefer pytest for its simplicity and powerful features.
- Distinctive: line 100
Fixtures: Use pytest fixtures for setup and teardown.
- Distinctive: line 101
Parametrize: Use @pytest.mark.parametrize for testing multiple inputs.
- Distinctive: line 103
Mocking: Use unittest.mock for isolating units under test.
- Distinctive: line 107
Virtual Environments: Always use venv or virtualenv for project isolation.
- Distinctive: line 110
Poetry/Pipenv: Consider modern dependency managers for complex projects.
- Distinctive: line 128
Not closing file handles
- Distinctive: line 132
Module Docstrings: Document module purpose at the top of each file.
- Distinctive: line 133
Function Docstrings: Use Google or NumPy style for consistency.
- Distinctive: line 140
Before submitting Python code, verify:
“Common” is measured: kept by at least 6 in 10 of the 9 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.
Files
Python Development Skills
When to Use This Skill
Use this skill when:
- Writing or refactoring Python code (.py files)
- Developing backend services, APIs, or web applications
- Working on data science, machine learning, or automation projects
- Creating Python packages or libraries
- Debugging or optimizing Python code
I. Pythonic Principles (PEP 8 & Beyond)
- PEP 8 Compliance: Follow PEP 8 style guide strictly (indentation, naming, line length).
- Zen of Python: Embrace "import this" principles - explicit is better than implicit, simple is better than complex.
- Type Hints: Use type hints (PEP 484) for function signatures and complex variables.
- Snake Case: Use snake_case for functions and variables, PascalCase for classes, UPPER_CASE for constants.
- Docstrings: Write docstrings for all public modules, functions, classes, and methods (PEP 257).
II. Code Structure & Organization
- Module Organization: Structure projects with clear separation (src/, tests/, docs/).
- Package Structure: Use init.py for package initialization and public API exposure.
- Import Order: Group imports (standard library, third-party, local) with blank lines between.
- Absolute Imports: Prefer absolute imports over relative except within packages.
- Single Responsibility: Each function, class, and module should have one clear purpose.
III. Functions & Methods
- Function Length: Keep functions focused and concise (ideally under 25 lines).
- Default Arguments: Use immutable defaults. Never use mutable defaults ([], {}).
- Keyword Arguments: Use keyword arguments for clarity, especially with multiple parameters.
- ***args and kwargs: Use sparingly and document their purpose.
- Return Early: Use guard clauses to reduce nesting and improve readability.
- Pure Functions: Prefer pure functions without side effects when possible.
IV. Data Structures & Collections
- List Comprehensions: Use comprehensions for simple transformations. Avoid complex nested comprehensions.
- Generator Expressions: Use generators for large datasets to save memory.
- Dictionary Operations: Use dict.get() for safe key access. Use defaultdict or setdefault when appropriate.
- Sets for Membership: Use sets for fast membership testing and removing duplicates.
- Unpacking: Use tuple/list unpacking for multiple assignments and function returns.
- Enums: Use Enum for related constants instead of magic strings or numbers.
V. Object-Oriented Programming
- Data Classes: Use @dataclass (Python 3.7+) for simple data containers.
- Properties: Use @property for getters, @setter for setters instead of direct attribute access.
- Dunder Methods: Implement str, repr, eq for custom classes.
- Inheritance: Favor composition over inheritance. Use ABC for abstract base classes.
- Class vs Instance Attributes: Understand the difference. Be careful with mutable class attributes.
- Method Types: Use @staticmethod for utility methods, @classmethod for alternate constructors.
VI. Error Handling
- Specific Exceptions: Catch specific exceptions, not bare except.
- Custom Exceptions: Create custom exception classes for domain-specific errors.
- EAFP Principle: Use "Easier to Ask Forgiveness than Permission" - try/except over if checks.
- Context Managers: Use with statements for resource management (files, locks, connections).
- Finally Blocks: Use finally for cleanup that must run regardless of exceptions.
- Error Messages: Provide clear, actionable error messages.
VII. Type Hints & Static Analysis
- Gradual Typing: Add type hints incrementally, focusing on public APIs first.
- Common Types: Use List, Dict, Tuple, Optional, Union from typing module.
- Generics: Use TypeVar for generic functions and classes.
- Protocol: Use Protocol for structural subtyping (duck typing with types).
- Type Checkers: Run mypy or pyright for static type checking.
- Runtime Validation: Use pydantic or similar for runtime validation of complex types.
VIII. Asynchronous Programming
- Async/Await: Use async/await for I/O-bound concurrent operations.
- Event Loop: Understand asyncio event loop and avoid blocking operations.
- Async Context Managers: Use async with for asynchronous resource management.
- Gather vs Wait: Use asyncio.gather() for concurrent tasks, wait() for conditional waiting.
- Sync vs Async: Don't mix synchronous and asynchronous code carelessly.
IX. Performance & Optimization
- Profile First: Use cProfile or line_profiler before optimizing.
- List vs Generator: Use generators for large datasets or streaming data.
- Local Variables: Access local variables is faster than global or attribute access.
- String Concatenation: Use join() for concatenating many strings, not +.
- Caching: Use @lru_cache for expensive pure function calls.
- NumPy: Use NumPy for numerical operations instead of loops when possible.
X. Testing
- pytest Over unittest: Prefer pytest for its simplicity and powerful features.
- Test Organization: Mirror source structure in tests/ directory.
- Fixtures: Use pytest fixtures for setup and teardown.
- Parametrize: Use @pytest.mark.parametrize for testing multiple inputs.
- Coverage: Aim for high test coverage but focus on critical paths.
- Mocking: Use unittest.mock for isolating units under test.
XI. Dependencies & Environment
- Virtual Environments: Always use venv or virtualenv for project isolation.
- Requirements Files: Maintain requirements.txt or use pyproject.toml (PEP 518).
- Pinned Versions: Pin exact versions for reproducible builds (requirements-lock.txt).
- Poetry/Pipenv: Consider modern dependency managers for complex projects.
- Python Version: Specify minimum Python version in setup.py or pyproject.toml.
XII. Common Patterns
Good Patterns:
- Context managers for resource management
- Decorators for cross-cutting concerns
- Generators for lazy evaluation
- Factory functions for object creation
- Strategy pattern with callable objects
Anti-Patterns to Avoid:
- Mutable default arguments
- Catching Exception or BaseException
- Using global variables
- Star imports (from module import *)
- Bare except clauses
- Not closing file handles
XIII. Documentation
- Module Docstrings: Document module purpose at the top of each file.
- Function Docstrings: Use Google or NumPy style for consistency.
- Type Information: Include parameter and return types in docstrings if not using type hints.
- Examples: Provide usage examples in docstrings for complex functions.
- README: Maintain comprehensive README.md with usage examples.
XIV. Best Practices Checklist
Before submitting Python code, verify:
- PEP 8 compliant (use black or autopep8)
- Type hints on public functions
- Docstrings on all public APIs
- No mutable default arguments
- Specific exception handling
- Context managers for resources
- List comprehensions are readable
- No unused imports or variables
- Tests written and passing
- Virtual environment used
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- microsoft/agent-framework★ 14ksame name
- Community-Access/accessibility-agents★ 409same name
- sammcj/agentic-coding★ 164same name
- d-padmanabhan/agent-engineering-handbook★ 17same name
- tstapler/dotfiles★ 8same name
- HK-hub/AgentSkills★ 6same name
- ProjAnvil/MindForge★ 3same name
- CODE-SAURABH/OpenSkills★ 2same name
- pepebot-space/skills★ 2same name
- jgeorgeai11/claude_code_resources★ 1same name
1 more not listed
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.
Used alongsideProjects with it also use javascript-typescript, github and 4 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
pepebot-spaceSkilljavascript-typescript
JavaScript and TypeScript development with ES6+, Node.js, React, and modern web frameworks. Use for frontend, backend, or full-stack JavaScript/TypeScript projects.
Also in 3 projects that use this
NVIDIASkillgithub
Interact with GitHub using the gh CLI restricted to REST API only (no GraphQL). Use when the user wants to work with GitHub issues, pull requests, repos, releases, or Actions — especially in sandboxed environments where the GraphQL endpoint may be blocked. Trigger keywords - github, gh, pull request, PR, github issue, github actions, workflow, release, gh api.
Also in 3 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 3 projects that use this
JetBrainsSkillbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Also in 3 projects that use this
AnthropicSkillpdf
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
Also in 3 projects that use this
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 3 projects that use this
In this repository13 other files it gives its agents.
- ai-development-assistantSkill
- angular-developmentSkill
- bun-package-managerSkill
- css-developmentSkill
- go-developmentSkill
- html-developmentSkill
- javascript-developmentSkill
- npm-package-managerSkill
- pnpm-package-managerSkill
- react-developmentSkill
- rust-developmentSkill
- typescript-developmentSkill
- vue-developmentSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

