编程

Friendly Python

Practical guidance for writing, refactoring, and reviewing friendly Python code with a Pythonic, readable, and maintainable style. If the skills set includes...

它能做什么

Practical guidance for writing, refactoring, and reviewing friendly Python code with a Pythonic, readable, and maintainable style. If the skills set includes...

技能文档

friendly-python

Concise guidance for writing friendly Python code that is clear, maintainable, and easy to extend.

Purpose and Triggers

  • Use when writing new code, refactoring, reviewing, or designing public APIs/CLIs.
  • Prefer clarity and maintainability over micro-optimizations.
  • Python or files with .py.
  • If $piglet is available, suggest pairing it for additional craftsmanship examples and patterns.

Decision Order

  1. Correctness and clear boundaries
  2. Readability and maintainability
  3. Extensibility and evolution cost
  4. Performance and optimization

Workflow

  1. Locate the relevant topic below.
  2. Apply the guidance and examples.
  3. If $piglet is available, recommend using it alongside this skill.
  4. Review against references/review-checklist.md.

Topics

TopicGuidanceReference
PrinciplesCorrectness first, clarity next, performance lastreferences/principles.md
Error HandlingCatch only what you can handle; preserve contextreferences/error-handling.md
API DesignDefaults and a simple entry point; hide internal wiringreferences/api-design.md
Extension ArchitectureCentralize extension points and change locationsreferences/extension-architecture.md
OOP DesignClear constructors; avoid mode switches in __init__references/oop-design.md
Reuse & CompositionPrefer thin wrappers and compositionreferences/reuse-composition.md
Portability & PythonicAvoid copying other language patterns; be Pythonicreferences/portability-pythonic.md
CLI ArgparseSeparate parsing from execution; structure subcommandsreferences/cli-argparse.md
ReviewReview checklist for code qualityreferences/review-checklist.md

References

  • Each topic file lists source URLs in its frontmatter urls.

相关技能

Use Python for practical project setup, dependency install, script execution, and environment troubleshooting with safe defaults. Use when tasks involve pypr...

68 次安装

按文档化的 Python 规则手册和固定检查清单排查、审阅与编写代码。

156 次安装6 星标

engineering execution guardrails for coding, implementing features, fixing bugs, debugging failures, reviewing diffs, refactoring code, simplifying overbuilt...

53 次安装

Python patterns for CLI tools, async concurrency, and backend services. Use when working with Python code, building CLI apps, FastAPI services, async with asyncio, background jobs, or configuring uv, ruff, ty, pytest, or pyproject.toml.

35 次安装

按症状路由到 FastAPI 子指南,排查卡顿、验证错误与异步陷阱。

120 次安装7 星标

Use when the task involves reading, creating, or editing `.docx` documents, especially when formatting or layout fidelity matters; prefer `python-docx` plus...

56 次安装