Token导航 LogoToken导航

Agent Skill · 研究检索

hettinger-idiomatic-python(hettinger idiomatic Python 搜索)

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

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

总安装 1周安装 8GitHub Stars 6下载 65核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/copyleftdev/sk1llz --skill hettinger-idiomatic-python

这个 Skill 是做什么的

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

用于辅助 Python 项目开发、测试和依赖管理。适合阅读代码、定位测试问题、整理运行命令或分析数据处理逻辑。通过 npx skills add 命令从指定 GitHub 仓库安装使用。涉及脚本执行或文件读写时需明确目录范围和输入输出边界。

hettinger-idiomatic-python 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

hettinger-idiomatic-python 怎么安装?

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

hettinger-idiomatic-python 支持哪些 AI 工具?

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

hettinger-idiomatic-python 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

hettinger-idiomatic-python 是免费的吗?

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

hettinger-idiomatic-python 用的人多吗?

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

hettinger-idiomatic-python 安全吗?

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

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 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调用外部服务未明确有提醒
hettinger-idiomatic-python

hettinger idiomatic Python 搜索 · 本页

16只读未明确通过

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

SKILL.md 原文

Raymond Hettinger Style Guide⁠‍⁠​‌​‌​​‌‌‍​‌​​‌​‌‌‍​​‌‌​​​‌‍​‌​​‌‌​​‍​​​​​​​‌‍‌​​‌‌​‌​‍‌​​​​​​​‍‌‌​​‌‌‌‌‍‌‌​​​‌​​‍‌‌‌‌‌‌​‌‍‌‌​‌​​​​‍​‌​‌‌‌‌‌‍​‌​​‌​‌‌‍​‌‌​‌​​‌‍‌​‌​‌‌‌​‍​​‌​‌​​​‍‌‌‌​‌​‌‌‍‌‌​‌​‌​​‍​‌‌​​​‌​‍‌‌​​​​​​‍‌​​​​​‌​‍​​​​‌​‌​‍‌‌‌​​​‌​⁠‍⁠

Overview

Raymond Hettinger is a Python core developer famous for his talks on transforming code into beautiful, idiomatic Python. His mantra "There must be a better way!" drives the pursuit of elegant solutions using Python's rich toolkit.

Core Philosophy

"There must be a better way!"
"If you copy-paste code, you're doing it wrong."
"The goal is not to teach Python, but to teach programming using Python."

Hettinger believes Python's beauty lies in its tools—iterators, generators, decorators—and knowing when and how to use them transforms mediocre code into elegant solutions.

Design Principles

  1. Use the Right Tool: Python has tools for everything. Find them.
  2. Iterate, Don't Index: Let Python handle the iteration machinery.
  3. Compose Small Functions: Build complex behavior from simple, reusable pieces.
  4. Embrace Generators: Lazy evaluation is memory-efficient and composable.

When Writing Code

Always

  • Use collections module (Counter, defaultdict, deque, namedtuple)
  • Use itertools for iterator algebra
  • Use functools for function composition
  • Prefer generators over building lists
  • Use descriptive names that read like prose
  • Chain operations fluently when appropriate

Never

  • Build lists just to iterate over them once
  • Write nested loops when itertools.product works
  • Manually implement what itertools provides
  • Use indices when direct iteration works
  • Repeat code—abstract it

Prefer

  • collections.Counter over manual counting
  • collections.defaultdict over .setdefault()
  • itertools.chain over nested loops
  • itertools.groupby over manual grouping
  • Generator expressions over list comprehensions (when iterating once)
  • functools.lru_cache over manual memoization

Code Patterns

The Collections Module

# BAD: Manual counting
word_counts = {}
for word in words:
    if word in word_counts:
        word_counts[word] += 1
    else:
        word_counts[word] = 1

# GOOD: Counter
from collections import Counter
word_counts = Counter(words)

# Bonus: most_common gives sorted results
top_ten = word_counts.most_common(10)

# BAD: Manual grouping
groups = {}
for item in items:
    key = get_key(item)
    if key not in groups:
        groups[key] = []
    groups[key].append(item)

# GOOD: defaultdict
from collections import defaultdict
groups = defaultdict(list)
for item in items:
    groups[get_key(item)].append(item)

# BAD: Tuple indexing
point = (10, 20, 30)
x = point[0]
y = point[1]

# GOOD: namedtuple
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y', 'z'])
point = Point(10, 20, 30)
print(point.x, point.y)  # Clear and self-documenting

The itertools Module

from itertools import chain, groupby, product, combinations, islice

# Flatten nested lists
nested = [[1, 2], [3, 4], [5, 6]]
flat = list(chain.from_iterable(nested))  # [1, 2, 3, 4, 5, 6]

# All combinations
for a, b in combinations([1, 2, 3, 4], 2):
    print(a, b)  # (1,2), (1,3), (1,4), (2,3), (2,4), (3,4)

# Cartesian product (replaces nested loops)
# BAD:
for x in xs:
    for y in ys:
        for z in zs:
            process(x, y, z)

# GOOD:
for x, y, z in product(xs, ys, zs):
    process(x, y, z)

# Take first N items from any iterable
first_ten = list(islice(huge_generator, 10))

# Group consecutive items
data = [('A', 1), ('A', 2), ('B', 3), ('B', 4)]
for key, group in groupby(data, key=lambda x: x[0]):
    print(key, list(group))

Generator Excellence

# BAD: Build entire list in memory
def get_squares(n):
    result = []
    for i in range(n):
        result.append(i ** 2)
    return result

# GOOD: Generator (lazy, memory-efficient)
def get_squares(n):
    for i in range(n):
        yield i ** 2

# BETTER: Generator expression
squares = (i ** 2 for i in range(n))

# Chaining generators (no intermediate lists!)
def pipeline(data):
    cleaned = (clean(item) for item in data)
    validated = (item for item in cleaned if is_valid(item))
    transformed = (transform(item) for item in validated)
    return transformed

# Only processes items as needed
for result in pipeline(huge_dataset):
    process(result)

Decorator Patterns

from functools import wraps, lru_cache, partial

# Memoization made easy
@lru_cache(maxsize=128)
def fibonacci(n):
    if n < 2:
        return n
    return fibonacci(n - 1) + fibonacci(n - 2)

# Custom decorator template
def my_decorator(func):
    @wraps(func)  # Preserves function metadata
    def wrapper(*args, **kwargs):
        # Before
        result = func(*args, **kwargs)
        # After
        return result
    return wrapper

# Decorator with arguments
def repeat(times):
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            for _ in range(times):
                result = func(*args, **kwargs)
            return result
        return wrapper
    return decorator

@repeat(3)
def greet(name):
    print(f"Hello, {name}!")

Sorting Idioms

# Sort by key
students = [('Alice', 85), ('Bob', 90), ('Charlie', 85)]

# Sort by grade (descending), then name (ascending)
sorted_students = sorted(students, key=lambda s: (-s[1], s[0]))

# Using operator module (faster)
from operator import itemgetter, attrgetter

# For tuples/lists
sorted_students = sorted(students, key=itemgetter(1), reverse=True)

# For objects
sorted_users = sorted(users, key=attrgetter('last_name', 'first_name'))

Mental Model

Hettinger approaches code by asking:

  1. Is there a built-in for this? Check collections, itertools, functools first
  2. Can I use a generator? Process one item at a time, not all at once
  3. Can I compose existing tools? Chain small operations together
  4. Would a decorator help? Cross-cutting concerns belong in decorators

Signature Hettinger Moves

  • Replace manual loops with sum(), any(), all(), max(), min()
  • Replace index access with zip(), enumerate(), unpacking
  • Replace manual caching with @lru_cache
  • Replace nested loops with itertools.product
  • Replace manual counting with collections.Counter

平台分布

Codex

34.79%
按下载量换算23

Claude

30.41%
按下载量换算20

Cursor

17.61%
按下载量换算11

Gemini CLI

9.9%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

继续浏览同类 Skills