360 Secure SkillHub
360 安全技能中心

Friendly Python

该 Skill 提供编写、重构和审查 Python 代码的实用指导,强调正确性、可读性与可维护性,并涵盖错误处理、API 设计、扩展架构、OOP、复用组合、可移植性、CLI argparse 及代码审查清单。

psiace
psiace
热度 87.82
最近更新 2026-05-11 17:34:20
分类:开发依赖:纯提示词应用场景:代码生成 / 代码审查

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add friendly-python
Metadata
name
friendly-python
description
Practical guidance for writing, refactoring, and reviewing friendly Python code with a Pythonic, readable, and maintainable style. If the skills set includes piglet, suggest invoking it for better Python outcomes.

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

Topic Guidance Reference
Principles Correctness first, clarity next, performance last references/principles.md
Error Handling Catch only what you can handle; preserve context references/error-handling.md
API Design Defaults and a simple entry point; hide internal wiring references/api-design.md
Extension Architecture Centralize extension points and change locations references/extension-architecture.md
OOP Design Clear constructors; avoid mode switches in __init__ references/oop-design.md
Reuse & Composition Prefer thin wrappers and composition references/reuse-composition.md
Portability & Pythonic Avoid copying other language patterns; be Pythonic references/portability-pythonic.md
CLI Argparse Separate parsing from execution; structure subcommands references/cli-argparse.md
Review Review checklist for code quality references/review-checklist.md

References

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