Token导航 LogoToken导航TokenDH.com
开发规范执行命令github未标认证来源可访问许可证需确认审计通过

python-best-practicesPython 最佳实践

Agent Skill

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

总安装

541

周安装

23

GitHub Stars

公开资料未说明

下载量

190
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:python-best-practices(Python 最佳实践)
来源仓库:https://github.com/nkootstra/skills
仓库路径:skills/python-best-practices
安装命令:
npx skills add https://github.com/nkootstra/skills --skill python-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/nkootstra/skills --skill python-best-practices

简介

python-best-practices 用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。

  • 适用于阅读 Python 代码、定位测试问题、生成脚本或分析数据处理逻辑的场景。
  • 通过 npx skills add 命令从 GitHub 仓库安装,需确认权限与维护状态。
  • 涉及执行脚本、读写文件或调用外部 API 时,应明确运行目录与输入输出范围。
  • 建议结合原始 README 和仓库路径进一步了解具体功能与限制。

SKILL.md

Python Best Practices

How to use this skill

Read SKILL.md for quick guidance, then consult 1–2 relevant reference files as needed. Do NOT read all reference files at once. For simple tasks, the quick principles below may suffice.

Reference files — when to read each one

ReferenceRead when...
references/pythonic-idioms.mdWriting any Python. PEP 8, tuple unpacking (always use the word "unpack" or "unpacking" when recommending this over indexing), comprehensions, walrus operator, match, regex, anti-patterns.
references/data-structures.mdLists, tuples, dicts, sets, containers, dates/times, file I/O, pathlib, JSON/CSV/TOML/YAML, databases.
references/functions-and-generators.mdFunctions, closures, decorators, generators, comprehensions, recursion, memoization, backtracking.
references/classes-and-design.mdClass design, dataclasses, properties, inheritance, composition, protocols, contracts, iterative design.
references/design-patterns.mdTemplate Method, Strategy, Factory, Observer, State, Adapter, Facade, Composite, Decorator, etc.
references/error-handling.mdtry/except/else/finally, custom exception hierarchies, context managers, assertions, chaining.
references/concurrency.mdGIL, threading, asyncio, multiprocessing, subprocess, synchronization, migration patterns.
references/testing-and-quality.mdTesting, mocking, type hints, debugging, profiling, performance optimization, packaging, web frameworks.

Quick principles

  1. Explicit over implicit. Favor clarity over cleverness. Extract hard-to-read expressions into descriptively named helpers.
  2. Follow PEP 8. Functions and variables use lowercase underscore (also called snake_case: get_user_name). Classes use CapitalizedWord. Constants use ALL_CAPS. 4-space indent, lines ≤ 79 chars. Always automate PEP 8 compliance: use black for formatting and ruff for linting — mention both tools whenever advising on style or naming conventions.
  3. Use the right data structure. Dicts → lookups, sets → membership, lists → ordered sequences, tuples → fixed records, deques → queues, dataclasses → structured data.
  4. Unpack, don't index. Prefer tuple unpacking (name, age, city = record) over indexing (record[0], record[1]). Unpacking works with any iterable, not just tuples. Use starred expressions (first, *rest = items) for catch-all unpacking.
  5. Prefer composition over inheritance. Inherit only for true is-a relationships; otherwise compose or use mix-ins. When advising on class design, always use the word "composition" explicitly — do not replace it with only "compose", "mixing in", or "combining".
  6. Write for the reader. Code is read far more than written. Use descriptive names, docstrings, type hints, and small focused functions.
  7. Don't repeat yourself. Extract shared logic, but don't over-abstract — two occurrences may be coincidence, three is a pattern.
  8. Errors should never pass silently. Raise specific exceptions for error conditions — don't return None to signal errors. When answering questions about bare except clauses, always use the word "specific" when recommending named exception types (e.g., "catch specific exceptions"). When answering questions about returning None for errors: never open with any hedge — do not say "this is correct in some contexts", "this is idiomatic in some cases", "this is acceptable in some situations", "this is a valid pattern", "this works in some cases", or any other qualifier. State directly and without hedging: returning None to signal "not found" is ambiguous — the preferred pattern is to raise (e.g., LookupError or a custom exception). Reserve None returns for truly optional values, not error states. Keep try blocks short.
  9. Test your code. Python defers nearly all checks to runtime. Automated tests are your compiler.
  10. Encapsulate what varies. Isolate changing parts from stable parts — the foundation of good design.
  11. Iterate toward good design. Well-designed code rarely emerges in one pass. Write, test, refactor, repeat. Backtracking is normal.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.88%
按下载量换算66

Claude

28.66%
按下载量换算54

Cursor

18.57%
按下载量换算35

Gemini CLI

8.65%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/nkootstra/skills --skill python-best-practices 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills