Token导航 LogoToken导航TokenDH.com
开发external-serviceclawhub未标认证来源可访问clear审计通过

shadows-python-senseishadows Python sensei 测试

Agent Skill

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

总安装

8,641

周安装

353

GitHub Stars

公开资料未说明

下载量

2,796
OpenClaw

安装说明

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

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

ClawHubOpenClaw
openclaw skills install shadows-python-sensei

简介

Python 最佳实践执行者——干净的代码、正确的模式、性能、测试、类型提示。在编写或审查 Python 代码时使用。

SKILL.md

name
python-sensei
description
Python best practices enforcer — clean code, proper patterns, performance, testing, type hints. Use when writing or reviewing Python code.
metadata
{ "openclaw": { "emoji": "🐍", "homepage": "https://clawhub.ai/NakedoShadow", "requires": { "anyBins": ["python", "python3"] }, "os": ["darwin", "linux", "win32"] } }

Python Sensei — Best Practices Enforcer

Version: 1.1.0 | Author: Shadows Company | License: MIT


WHEN TO TRIGGER

  • Writing new Python code
  • Reviewing existing Python code
  • User says "python review", "best practices", "clean up this python"
  • Refactoring Python modules
  • Setting up a new Python project

WHEN NOT TO TRIGGER

  • Quick scripts where quality doesn't matter
  • User explicitly says "just make it work"
  • Non-Python code

PREREQUISITES

Requires python or python3 on PATH for syntax checking (python -m py_compile) and test execution (python -m pytest).

Optional tools (auto-detected, recommendations adapt accordingly):

  • pytest — test execution (pip install pytest)
  • mypy or pyright — static type checking
  • ruff — fast linting and formatting (pip install ruff)

The skill checks which tools are available and tailors its recommendations to the user's installed toolchain.


CODE STANDARDS

1. Module Structure

"""Module docstring — one line describing purpose."""

# Standard library imports
import os
from pathlib import Path

# Third-party imports
import httpx
from pydantic import BaseModel

# Local imports
from .config import Settings

# Constants
MAX_RETRIES = 3
DEFAULT_TIMEOUT = 30

# Module code...

Rules:

  • Max 500 lines per module — split if larger
  • Imports grouped: stdlib → third-party → local (blank line between each group)
  • Constants at top, ALL_CAPS naming
  • One class per file for complex classes

2. Functions

async def fetch_user(user_id: str, *, include_profile: bool = False) -> User | None:
    """Fetch a user by ID.

    Args:
        user_id: The unique user identifier.
        include_profile: Whether to include full profile data.

    Returns:
        User object if found, None otherwise.

    Raises:
        ConnectionError: If the API is unreachable.
    """

Rules:

  • Type hints on all public functions (params + return)
  • Keyword-only args after * for clarity
  • None return type when failure is normal (not exceptions)
  • Docstrings on public functions only
  • Max 30 lines per function — extract helpers if larger

3. Data Models

from dataclasses import dataclass, field
from enum import StrEnum

class Status(StrEnum):
    ACTIVE = "active"
    INACTIVE = "inactive"
    PENDING = "pending"

@dataclass
class User:
    id: str
    name: str
    status: Status = Status.ACTIVE
    tags: list[str] = field(default_factory=list)

    def to_dict(self) -> dict:
        return {
            "id": self.id,
            "name": self.name,
            "status": self.status.value,
            "tags": self.tags,
        }

Rules:

  • @dataclass for simple models, Pydantic for validation-heavy models
  • StrEnum for states (JSON-serializable)
  • Always include to_dict() for serialization
  • Immutable by default (frozen=True when appropriate)

4. Error Handling

# GOOD: Specific exceptions, minimal try blocks
try:
    response = await client.get(url)
    response.raise_for_status()
except httpx.TimeoutException:
    logger.warning("Request timed out: %s", url)
    return None
except httpx.HTTPStatusError as e:
    logger.error("HTTP %d: %s", e.response.status_code, url)
    raise

# BAD: Catching everything
try:
    do_everything()
except Exception:
    pass  # Never do this

Rules:

  • Catch specific exceptions, never bare except:
  • Only validate at system boundaries (user input, external APIs)
  • Trust internal code — do not add defensive checks everywhere
  • Use logging module, not print() for errors

5. Async Patterns

import asyncio
import httpx

async def fetch_all(urls: list[str]) -> list[dict]:
    async with httpx.AsyncClient() as client:
        tasks = [client.get(url) for url in urls]
        responses = await asyncio.gather(*tasks, return_exceptions=True)
        return [r.json() for r in responses if not isinstance(r, Exception)]

Rules:

  • async with for resource management
  • asyncio.gather() for parallel I/O
  • return_exceptions=True to handle partial failures
  • Never mix sync and async I/O in the same function

6. Testing

import pytest

class TestUserService:
    def test_create_user_with_valid_data(self):
        user = create_user(name="Alice", email="alice@example.com")
        assert user.name == "Alice"
        assert user.status == Status.ACTIVE

    def test_create_user_rejects_empty_name(self):
        with pytest.raises(ValueError, match="name cannot be empty"):
            create_user(name="", email="alice@example.com")

    @pytest.mark.asyncio
    async def test_fetch_user_returns_none_for_missing(self):
        result = await fetch_user("nonexistent-id")
        assert result is None

Rules:

  • Test file: tests/test_{module}.py
  • Test names describe the scenario: test_[action]_[condition]_[expected]
  • One assertion per test (prefer)
  • Use pytest.raises for expected exceptions
  • Use fixtures for shared setup

7. Project Setup

project/
  src/
    project_name/
      __init__.py
      main.py
      config.py
      models.py
  tests/
    test_main.py
    test_models.py
  pyproject.toml
  requirements.txt
  .gitignore

pyproject.toml over setup.py. Pin major versions in requirements.txt.


ANTI-PATTERNS TO FLAG

Anti-PatternFix
import *Explicit imports
Mutable default argsfield(default_factory=list)
Global mutable stateDependency injection
Nested try/exceptExtract and flatten
String concatenation for SQLParameterized queries
type() checksisinstance()
os.pathpathlib.Path
requests (sync)httpx (async-ready)

SECURITY CONSIDERATIONS

This skill reads and writes Python source files within the working directory. It does not access files outside the project scope.

  • Commands executed: python -m py_compile <file> for syntax checking, python -m pytest <test_file> for test execution. These run local project code — only use on trusted repositories or in sandboxed environments.
  • Data read: Source files in the working directory only. No access to secrets, credentials, or system files.
  • Network access: None required. The skill operates entirely offline.
  • Credentials: None stored or accessed.
  • Persistence: All modifications are to source files in the working directory only. No global config changes.
  • Sandboxing: Recommended to run in a virtual environment (venv) to isolate dependencies.

OUTPUT FORMAT

Reviews and code output follow the standards defined above. Each review identifies specific anti-patterns with line references and provides corrected code blocks.


RULES

  1. Type hints everywhere — public functions must have full type annotations
  2. 500 lines max — split large modules into focused sub-modules
  3. Test every moduletests/test_{module}.py with descriptive test names
  4. Async by default — use async for any I/O operation
  5. pathlib over os.path — modern Python path handling
  6. No print debugging — use logging module with appropriate levels

Published by Shadows Company — "We work in the shadows to serve the Light."

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

OpenClaw

70.8%
按下载量换算1,980

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

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

来源信息

继续浏览同类 Skills