stack-python
Python development guidelines — style, patterns, virtual environments, and testing with pytest, fixtures, and mocking
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-15
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- stack-python
- license
- Apache-2.0
- metadata
- { "author": "manuel-retamozo-garcia", "version": "1.0" }
- description
- Python development guidelines — style, patterns, virtual environments, and testing with pytest, fixtures, and mocking
- capabilities
- [ "python" ]
02 资源文件 2
- 参考文档references/patterns.md16.1 KB
- 参考文档references/testing.md18.3 KB
03 SKILL.md 正文
Python Development Patterns
Idiomatic Python patterns and best practices for building robust, efficient, and maintainable applications.
When to Activate
- Writing new Python code
- Reviewing Python code
- Refactoring existing Python code
- Designing Python packages/modules
- Writing or reviewing pytest tests, fixtures, or mocks
Core Rules
- Readability Counts: Prioritize clarity over cleverness. Write explicit code and use f-strings and type hints.
- EAFP Style: Prefer catching exceptions (
try-except) rather than checking pre-conditions (LBYL), but always target specific exceptions and chain them correctly (raise ... from e). - Resource Management: Use context managers (
withstatement) for managing files, database connections, and locks. - Data Classes: Use
@dataclassfor data containers, implementing__post_init__for field validations. - Memory and Iterators: Use generators and generator expressions for lazy evaluation of large datasets. Avoid string concatenation inside loops.
- Testing (
references/testing.md): pytest with fixtures inconftest.pyand@pytest.mark.parametrizefor cases;patch(..., autospec=True)at external boundaries;tmp_pathfor files; 80%+ coverage, 100% on critical paths.
References
Load on demand, only the file the task needs:
- Python Coding Patterns & Examples
- Python Testing — pytest fundamentals, fixtures and scopes, parametrization, markers, mocking, async tests
04 同仓库更多 Skills
work-unit-commits
Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.
stack-webmcp
Trigger: WebMCP, document.modelContext, web tools, AI browser agent. Web Model Context Protocol client-side tool standard.
stack-vite
Vite frontend build tool — configuration, plugins, asset loading
stack-starlight
Astro Starlight documentation framework — setup, sidebar navigation, frontmatter, built-in components, asides, theming, i18n, search
stack-sqlserver
Microsoft SQL Server database — indexing, RCSI, set-based operations, SARGable queries, transaction scopes
stack-springboot
Spring Boot architecture patterns — REST API design, layered services, JPA, caching, Spring Security, TDD with MockMvc and Testcontainers, and pre-release verification