python
Use when writing, reviewing, or debugging Python code and the task calls for idiomatic language patterns, concurrency, testing, or type-safety guidance.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- python
- license
- MIT
- metadata
- { "owner": "Harley Bartles", "status": "active", "use_when": [ "writing or reviewing Python code.", "choosing between async and sync patterns.", "diagnosing test, type, or performance issues in Python." ], "source-id": "python", "source-path": "skills/python/SKILL.md", "related_skills": [ "python-frameworks", "typescript", "database-engines" ], "do_not_use_when": [ "another language-specific or framework-specific skill owns the task." ], "provenance-name": "Python first-party skill", "source-category": "first_party" }
- description
- Use when writing, reviewing, or debugging Python code and the task calls for idiomatic language patterns, concurrency, testing, or type-safety guidance.
02 资源文件 5
- 参考文档agents/openai.yaml309 B
- 资产文件assets/authority/authority.yaml846 B
- 资产文件assets/authority/CITATIONS.md1.1 KB
- 资产文件assets/authority/source-map.yaml395 B
- 参考文档references/operational-guidance.md1.3 KB
03 SKILL.md 正文
Python
Use this skill for idiomatic Python guidance across language patterns, concurrency, testing, and type safety.
When to Use
- Writing or reviewing Python code.
- Choosing between async/await, threading, or synchronous execution.
- Writing tests, handling type annotations, or profiling a hot path.
Core Pattern
- Prefer explicit over implicit: write readable code, avoid surprise imports, and document public APIs.
- Use
asynciofor I/O-bound concurrency; useconcurrent.futuresor multiprocessing for CPU-bound work. - Structure tests with
pytest, fixtures for shared state, and parametrization for data-driven cases. - Add type hints where they clarify contracts; run
mypyor a type checker in CI. - Profile before optimizing;
cProfileandline_profileridentify real bottlenecks.
Common Mistakes
- Mixing
asyncand sync I/O in the same loop. → Await async libraries or run blocking calls in executors. - Overusing mocks and testing implementation instead of behavior. → Mock boundaries, not internals.
- Ignoring type checker errors. → Treat
mypyfailures like test failures.
Load references/operational-guidance.md for deeper coverage of asyncio, pytest, and typing patterns.
04 同仓库更多 Skills
writing
Use when drafting, revising, or reviewing prose for human readers and clarity, an authorised voice, or reader-fatigue concerns may interact.
writing-with-clarity
Use when drafting, revising, or reviewing prose intended for human readers, including documentation, README files, reports, explanations, UI copy, errors, comments, commit messages, and pull request text.
writing-style
Use when revising or reviewing human-facing prose against an authorised voice card or a contextual reader-fatigue profile.
skill
暂无简介
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment.
writing-roadmaps
Use when a goal is too large for one writing-plans plan and requires a sequenced roadmap of consecutive plans.