Token导航 LogoToken导航

Agent Skill · 研究检索

effective-python(effective Python 搜索)

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

effective-python 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 64,698。

总安装 294周安装 12GitHub Stars 25下载 94核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/booklib-ai/skills --skill effective-python

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。

使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

安装方式:github,安装命令:npx skills add https://github.com/booklib-ai/skills --skill effective-python。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/effective-python

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/booklib-ai/skills --skill effective-python;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

effective-python 怎么安装?

在终端执行 npx skills add https://github.com/booklib-ai/skills --skill effective-python。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

effective-python 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

effective-python 需要什么权限?

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

effective-python 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

effective-python 用的人多吗?

公开数据是累计安装 294 次,近一周安装 12 次,下载 94 次,GitHub 25 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

effective-python 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
effective-python

effective Python 搜索 · 本页

29425执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Effective Python Skill

Apply the 90 items from Brett Slatkin's "Effective Python" (2nd Edition) to review existing code and write new Python code. This skill operates in two modes: Review Mode (analyze code for violations) and Write Mode (produce idiomatic Python from scratch).

Reference Files

This skill includes categorized reference files with all 90 items:

  • ref-01-pythonic-thinking.md — Items 1-10: PEP 8, f-strings, bytes/str, walrus operator, unpacking, enumerate, zip, slicing
  • ref-02-lists-and-dicts.md — Items 11-18: Slicing, sorting, dict ordering, defaultdict, missing
  • ref-03-functions.md — Items 19-26: Exceptions vs None, closures, *args/**kwargs, keyword-only args, decorators
  • ref-04-comprehensions-generators.md — Items 27-36: Comprehensions, generators, yield from, itertools
  • ref-05-classes-interfaces.md — Items 37-43: Composition, @classmethod, super(), mix-ins, public attrs
  • ref-06-metaclasses-attributes.md — Items 44-51: @property, descriptors, getattr, init_subclass, class decorators
  • ref-07-concurrency.md — Items 52-64: subprocess, threads, Lock, Queue, coroutines, asyncio
  • ref-08-robustness-performance.md — Items 65-76: try/except, contextlib, datetime, decimal, profiling, data structures
  • ref-09-testing-debugging.md — Items 77-85: TestCase, mocks, dependency injection, pdb, tracemalloc
  • ref-10-collaboration.md — Items 86-90: Docstrings, packages, root exceptions, virtual environments

How to Use This Skill

Before responding, read the relevant reference files based on the code's topic. For a general review, read all files. For targeted work (e.g., writing async code), read the specific reference (e.g., ref-07-concurrency.md).


Mode 1: Code Review

When the user asks you to review existing Python code, follow this process:

Step 1: Read Relevant References

Determine which chapters apply to the code under review and read those reference files. If unsure, read all of them.

Step 2: Calibrate Your Response

If the code is already well-written and idiomatic:

  • Say so explicitly and upfront. Do not manufacture issues to appear thorough.
  • Praise the good patterns you see (see "Praising Good Patterns" below).
  • Any suggestions must be framed as minor optional improvements, not as violations or issues.

If the code has real problems:

  • Identify and report them clearly with item references.

Step 3: Praise Good Patterns (when present)

When the code uses these patterns correctly, explicitly praise them:

<strengths_to_praise>

  • @contextmanager for resource management: "Good use of @contextmanager (Item 66) — avoids boilerplate try/finally and makes the cleanup intent clear."
  • Generator functions (yield) for memory efficiency: "Good use of a generator (Item 30) — avoids loading the entire sequence into memory."
  • Type annotations on public functions: "Good use of type annotations (Item 84) — improves readability and enables static analysis."
  • Docstrings on all public APIs: "Good docstrings (Item 84) — clearly communicates purpose and parameters."
  • @dataclass for plain data holders: "Good use of @dataclass (Items 37–43) — reduces boilerplate and provides automatic __repr__, __eq__."
  • List/dict/set comprehensions instead of manual loops: "Good use of comprehensions (Item 27) — more readable and Pythonic."
  • enumerate instead of range(len(...)): "Good use of enumerate (Item 7)." </strengths_to_praise>

Step 4: Analyze the Code for Issues

For each relevant item from the book, check whether the code follows or violates the guideline. Focus on:

<core_principles>

  1. Style and Idiom (Items 1-10): Is it Pythonic? Does it use f-strings, unpacking, enumerate, zip properly?
  2. Data Structures (Items 11-18): Are lists and dicts used correctly? Is sorting done with key functions?
  3. Function Design (Items 19-26): Do functions raise exceptions instead of returning None? Are args well-structured?
  4. Comprehensions & Generators (Items 27-36): Are comprehensions preferred over map/filter? Are generators used for large sequences?
  5. Class Design (Items 37-43): Is composition preferred over deep nesting? Are mix-ins used correctly? Is @dataclass used for plain data holders?
  6. Metaclasses & Attributes (Items 44-51): Are plain attributes used instead of getter/setter methods? Is @property used appropriately?
  7. Concurrency (Items 52-64): Are threads used only for I/O? Is asyncio structured correctly?
  8. Robustness (Items 65-76): Is error handling structured with try/except/else/finally? Are the right data structures chosen?
  9. Testing (Items 77-85): Are tests well-structured? Are mocks used appropriately?
  10. Collaboration (Items 86-90): Are docstrings present? Are APIs stable?

Key Anti-Patterns to Always Check

<anti_patterns>

  • Mutable default arguments (Item 24): def f(items=[]) is a critical bug — the list is shared across all calls. Always use None and initialize inside the function body. # WRONG — shared mutable default def process(results=[]): results.append(...) # RIGHT — use None sentinel def process(results=None): if results is None: results = [] results.append(...)
  • Bare except: clause (Item 65): except: without a type catches KeyboardInterrupt, SystemExit, and GeneratorExit, silently killing the program. Always catch specific exception types: except (ValueError, KeyError): or at minimum except Exception:.
  • for i in range(len(seq)) (Item 7): Use for item in seq directly, or for i, item in enumerate(seq) when you need the index.
  • Manual list-building loops (Item 27): Any loop that creates an empty list and appends inside the loop body should be a list comprehension. # WRONG result = [] for x in items: if x > 0: result.append(x * 2) # RIGHT result = [x * 2 for x in items if x > 0]
  • Java-style getter/setter methods (Item 44): get_name(), set_price(), get_value() are non-Pythonic. Access attributes directly or use @property when validation is required.
  • == True / == False comparisons (Item 2 / PEP 8): if x == True: should be if x:. return self.in_stock == True should be return self.in_stock.
  • Double-underscore name mangling (Item 42): self.__items makes the attribute inaccessible to subclasses and creates maintenance friction. Use single underscore self._items to signal "internal use" without enforced hiding.
  • Plain data-holder class without @dataclass (Items 37–43): Any class whose __init__ only assigns parameters to self.attr with no logic should be a @dataclass. Dataclasses automatically generate __repr__, __eq__, and __init__, and signal the data-holder intent. Crucially: @dataclass and @property can coexist. If one field needs validation, make it a @property with a setter inside the @dataclass. This is the correct Pythonic pattern — do NOT abandon @dataclass just because one field has a validator. from dataclasses import dataclass, field @dataclass class Product: name: str category: str in_stock: bool = True _price: float = field(default=0.0, repr=False) @property def price(self) -> float: return self._price @price.setter def price(self, value: float) -> None: if value < 0: raise ValueError('Price cannot be negative') self._price = value
  • Missing __repr__ (Items 37–43): Any class that is not a @dataclass should define __repr__ to aid debugging. Without it, repr(obj) shows only the class name and memory address.
  • Returning None for failure (Item 20): Functions should raise exceptions for error conditions, not return None. Returning None forces callers to check for None every time and doesn't carry error information.
  • else block after for/while (Item 9): The loop-else clause fires when the loop completes without a break, which is rarely the intended semantics and confuses readers. Avoid it. </anti_patterns> </core_principles>

Step 5: Report Findings

For each issue found, report:

  • Item number and name (e.g., "Item 4: Prefer Interpolated F-Strings")
  • Location in the code
  • What's wrong (the anti-pattern)
  • How to fix it (the Pythonic way)
  • Priority: Critical (bugs/correctness), Important (maintainability), Suggestion (style)

Step 6: Provide Fixed Code

Offer a corrected version of the code with all issues addressed, with comments explaining each change.


Mode 2: Writing New Code

When the user asks you to write new Python code, follow these principles:

Always Apply These Core Practices

  1. Use f-strings for string formatting (Item 4). Never use % or.format() for simple cases.
  2. Use unpacking instead of indexing (Item 6). Prefer first, second = my_list over my_list[0].
  3. Use enumerate instead of range(len(...)) (Item 7).
  4. Use zip to iterate over multiple lists in parallel (Item 8). Use zip_longest from itertools when lengths differ.
  5. Avoid else blocks after for/while loops (Item 9).
  6. Use assignment expressions (:= walrus operator) to reduce repetition when appropriate (Item 10).
  7. Raise exceptions instead of returning None for failure cases (Item 20).
  8. Use None as the default for mutable default arguments (Item 24). Never use [], {}, or any other mutable object as a default argument value; initialize inside the function body.
  9. Use keyword-only arguments for clarity (Item 25). Use positional-only args to separate API from implementation (Item 25).
  10. Use functools.wraps on all decorators (Item 26).
  11. Prefer comprehensions over map/filter (Item 27). Keep them simple — no more than two expressions (Item 28).
  12. Use generators for large sequences instead of returning lists (Item 30).
  13. Use @dataclass for plain data-holder classes (Items 37–43). A @dataclass automatically provides __init__, __repr__, and __eq__, and makes the data-holder intent explicit. Only write a manual __init__ when you need real logic that a dataclass can't handle. Add __repr__ to any class that doesn't use @dataclass, to make debugging easier.
  14. Prefer composition over deeply nested classes (Item 37).
  15. Use @classmethod for polymorphic constructors (Item 39).
  16. Always call super().init**** (Item 40).
  17. Use plain attributes instead of getter/setter methods. Use @property for special behavior (Item 44).
  18. Use try/except/else/finally structure correctly (Item 65). Always catch specific exception types, never bare except:.
  19. Write docstrings for every module, class, and function (Item 84).

Code Structure Template

When writing new modules or classes, follow this structure:

"""Module docstring describing purpose."""

# Standard library imports
# Third-party imports
# Local imports

# Module-level constants

class MyClass:
    """Class docstring describing purpose and usage.

    Attributes:
        attr_name: Description of attribute.
    """

    def __init__(self, param: type) -> None:
        """Initialize with description of params."""
        self.param = param  # Use public attributes (Item 42)

    @classmethod
    def from_alternative(cls, data):
        """Alternative constructor (Item 39)."""
        return cls(processed_data)

    def method(self, arg: type) -> return_type:
        """Method docstring.

        Args:
            arg: Description.

        Returns:
            Description of return value.

        Raises:
            ValueError: When arg is invalid (Item 20).
        """
        pass
# WRONG — mutable default causes shared state across all calls
def append_to(element, to=[]):
    to.append(element)
    return to

# RIGHT — use None sentinel, initialize inside
def append_to(element, to=None):
    if to is None:
        to = []
    to.append(element)
    return to
# WRONG — manual __init__ boilerplate for data holder
class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

# RIGHT — @dataclass provides __init__, __repr__, __eq__ for free
from dataclasses import dataclass

@dataclass
class Point:
    x: float
    y: float

Important: @dataclass and @property are compatible. When one field needs validation, use both — the @dataclass handles the boilerplate and the @property handles validation. Do NOT fall back to a plain class just because one field has a setter.

# WRONG — abandoning @dataclass because price needs validation
class Product:
    def __init__(self, name, price, category):
        self.name = name
        self.price = price   # validation via set_price()
        self.category = category

    def set_price(self, value):
        if value < 0:
            raise ValueError("Price cannot be negative")
        self.price = value

# RIGHT — @dataclass + @property work together
from dataclasses import dataclass, field

@dataclass
class Product:
    name: str
    category: str
    in_stock: bool = True
    _price: float = field(default=0.0, repr=False)

    @property
    def price(self) -> float:
        return self._price

    @price.setter
    def price(self, value: float) -> None:
        if value < 0:
            raise ValueError("Price cannot be negative")
        self._price = value
# WRONG — Java-style getter/setter
class Temperature:
    def get_celsius(self):
        return self._celsius

    def set_celsius(self, value):
        if value < -273.15:
            raise ValueError("Temperature below absolute zero")
        self._celsius = value

# RIGHT — use @property for validation, direct access otherwise
class Temperature:
    def __init__(self, celsius: float) -> None:
        self.celsius = celsius  # triggers setter on construction

    @property
    def celsius(self) -> float:
        return self._celsius

    @celsius.setter
    def celsius(self, value: float) -> None:
        if value < -273.15:
            raise ValueError("Temperature below absolute zero")
        self._celsius = value
# WRONG — manual loop to build list
result = []
for order in orders:
    if order['total'] > threshold:
        result.append(order)

# RIGHT — list comprehension
result = [order for order in orders if order['total'] > threshold]

Concurrency Guidelines

  • Use subprocess for managing child processes (Item 52)
  • Use threads only for blocking I/O, never for parallelism (Item 53)
  • Use threading.Lock to prevent data races (Item 54)
  • Use Queue for coordinating work between threads (Item 55)
  • Use asyncio for highly concurrent I/O (Item 60)
  • Never mix blocking calls in async code (Item 62)

Testing Guidelines

  • Subclass TestCase and use setUp/tearDown (Item 78)
  • Use unittest.mock for complex dependencies (Item 78)
  • Encapsulate dependencies to make code testable (Item 79)
  • Use pdb.set_trace() or breakpoint() for debugging (Item 80)
  • Use tracemalloc for memory debugging (Item 81)

Priority of Items by Impact

When time is limited, focus on these highest-impact items first:

Critical (Correctness & Bugs)

  • Item 20: Raise exceptions instead of returning None
  • Item 24: Use None as default for mutable arguments (never [] or {})
  • Item 53: Use threads for I/O only, not parallelism
  • Item 54: Use Lock to prevent data races
  • Item 40: Initialize parent classes with super()
  • Item 65: Use try/except/else/finally correctly; always catch specific exception types
  • Item 73: Use datetime instead of time module for timezone handling

Important (Maintainability)

  • Item 1: Follow PEP 8 style
  • Item 4: Use f-strings
  • Item 7: Use for item in seq or enumerate; never range(len(seq))
  • Item 19: Never unpack more than 3 variables
  • Item 25: Use keyword-only and positional-only arguments
  • Item 26: Use functools.wraps for decorators
  • Items 37–43: Use @dataclass for plain data holders; add __repr__ to any class without it
  • Item 42: Prefer public attributes over private; use single underscore for internal
  • Item 44: Use plain attributes over getter/setter; use @property for validation
  • Item 66: Use @contextmanager for reusable resource management patterns
  • Item 84: Write docstrings for all public APIs

Suggestions (Polish & Optimization)

  • Item 8: Use zip for parallel iteration
  • Item 10: Use walrus operator to reduce repetition
  • Item 27: Use comprehensions over map/filter and manual loops
  • Item 30: Use generators for large sequences
  • Item 70: Profile before optimizing (cProfile)

Reviewing Already-Good Code

When the submitted code is already idiomatic and well-structured, the review must:

  1. Lead with affirmative praise — say explicitly that the code is idiomatic / well-written.
  2. Call out each strong pattern by name and item, e.g.:

- @contextmanager usage → praise as Item 66 - Generator functions (yield) → praise as Item 30 - Type annotations on public functions → praise as Item 84 - Docstrings on public APIs → praise as Item 84 - @dataclass for data holders → praise as Items 37–43 - List/dict/set comprehensions → praise as Item 27

  1. Do not invent problems. If something is genuinely fine, do not flag it as an issue.
  2. Clearly label any suggestion as optional — use language like "minor suggestion", "stylistic alternative", or "optional improvement", never "issue" or "problem".
  3. Keep the tone positive — the goal is to affirm and explain why the patterns are good, not to find fault.

平台分布

Codex

33.54%
按下载量换算32

Claude

31.12%
按下载量换算29

Cursor

21.18%
按下载量换算20

Gemini CLI

9.03%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

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

安装前确认

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

继续浏览同类 Skills