首页龙虾技能列表 › Python — 技能工具

🐍 Python — 技能工具

v1.0.1

[自动翻译] Write reliable Python avoiding mutable defaults, import traps, and common runtime surprises.

5· 3,300·14 当前·15 累计
by @ivangdavila (Iván)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/2/26
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
This is an instruction-only Python style/best-practices helper (no code or installs) that only requires python3 and otherwise behaves consistently with its stated purpose.
评估建议
This skill is documentation-only and appears coherent with its purpose. It doesn't include executable code or ask for secrets. Before installing, confirm your agent sandbox: if the agent is permitted to execute python3 or access local files, the agent could (independently of this skill) run Python code you provide — that's a general platform permission concern, not an issue with this skill. If you want extra caution, keep the agent's execution rights and file access restricted, and verify the sy...
详细分析 ▾
用途与能力
Name, description, and required binary (python3) align with a Python guidance helper. The content is documentation on common Python pitfalls and does not request unrelated credentials or tools. Minor metadata inconsistency: registry slug is 'py' while SKILL.md uses slug 'python' — likely cosmetic and not a security issue.
指令范围
SKILL.md and the included .md files are documentation-only; they do not instruct the agent to read arbitrary files, send data externally, or run network requests. There are no open-ended directives that would give the agent broad discretion to collect or exfiltrate data.
安装机制
No install spec and no code files to write or execute. This is the lowest-risk form (instruction-only).
凭证需求
The skill requests no environment variables, credentials, or config paths. Requesting only python3 is proportionate for a Python guidance skill.
持久化与权限
Defaults (always: false, model invocation allowed) are appropriate. The skill does not request permanent presence or system-wide changes.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

🖥️ OSLinux · macOS · Windows

版本

latestv1.0.12026/2/10

Initial release

● 无害

安装命令 点击复制

官方npx clawhub@latest install py
镜像加速npx clawhub@latest install py --registry https://cn.clawhub-mirror.com

技能文档

Quick Reference

TopicFile
Dynamic typing, type hints, duck typingtypes.md
List/dict/set gotchas, comprehensionscollections.md
Args/kwargs, closures, decorators, generatorsfunctions.md
Inheritance, descriptors, metaclassesclasses.md
GIL, threading, asyncio, multiprocessingconcurrency.md
Circular imports, packages, __init__.pyimports.md
Pytest, mocking, fixturestesting.md

Critical Rules

  • def f(items=[]) shares list across all calls — use items=None then items = items or []
  • is checks identity, == checks equality — "a" 100 is "a" 100 may be False
  • Modifying list while iterating skips elements — iterate over copy: for x in list(items):
  • GIL prevents true parallel Python threads — use multiprocessing for CPU-bound
  • Bare except: catches SystemExit and KeyboardInterrupt — use except Exception:
  • UnboundLocalError when assigning to outer scope variable — use nonlocal or global
  • open() without context manager leaks handles — always use with open():
  • Circular imports fail silently or partially — import inside function to break cycle
  • 0.1 + 0.2 != 0.3 — floating point, use decimal.Decimal for money
  • Generator exhausted after one iteration — can't reuse, recreate or use itertools.tee
  • Class attributes with mutables shared across instances — define in __init__ instead
  • __init__ is not constructor — __new__ creates instance, __init__ initializes
  • Default encoding is platform-dependent — always specify encoding='utf-8'
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务