Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问clear审计异常

tdd-pytestTDD pytest 搜索

Agent Skill

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

总安装

870

周安装

37

GitHub Stars

4

下载量

305
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/89jobrien/steve --skill tdd-pytest

简介

tdd-pytest 用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流,适合阅读代码、定位测试问题或生成脚本。

  • 适用于 Python 项目中的测试分析、运行命令整理和数据处理逻辑审查。
  • 通过 npx skills add 命令从 GitHub 仓库安装使用。
  • 使用时需确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本或访问外部资源时应明确运行目录和输入输出范围。
  • 建议结合项目实际结构和测试框架进一步验证功能适用性。

SKILL.md

TDD-Pytest Skill

Activate this skill when the user needs help with:

  • Writing tests using TDD methodology (Red-Green-Refactor)
  • Auditing existing pytest test files for quality
  • Running tests with coverage
  • Generating test reports to TESTING_REPORT.local.md
  • Setting up pytest configuration in pyproject.toml

TDD Workflow

Red-Green-Refactor Cycle

  1. RED - Write a failing test first

- Test should fail for the right reason (not import errors) - Test should be minimal and focused - Show the failing test output

  1. GREEN - Write minimal code to pass

- Only implement what's needed to pass the test - No premature optimization - Show the passing test output

  1. REFACTOR - Improve code while keeping tests green

- Clean up duplication - Improve naming - Extract functions/classes if needed - Run tests after each change

Test Organization

File Structure

project/
  src/
    module.py
  tests/
    conftest.py          # Shared fixtures
    test_module.py       # Tests for module.py
  pyproject.toml         # Pytest configuration

Naming Conventions

  • Test files: test_*.py or *_test.py
  • Test functions: test_*
  • Test classes: Test*
  • Fixtures: Descriptive names (mock_database, sample_user)

Pytest Best Practices

Fixtures

import pytest

@pytest.fixture
def sample_config():
    return {"key": "value"}

@pytest.fixture
def mock_client(mocker):
    return mocker.MagicMock()

Parametrization

@pytest.mark.parametrize("input,expected", [
    ("hello", "HELLO"),
    ("world", "WORLD"),
    ("", ""),
])
def test_uppercase(input, expected):
    assert input.upper() == expected

Async Tests

import pytest

@pytest.mark.asyncio
async def test_async_function():
    result = await async_operation()
    assert result == expected

Exception Testing

def test_raises_value_error():
    with pytest.raises(ValueError, match="invalid input"):
        process_input(None)

Running Tests

With uv

uv run pytest                              # Run all tests
uv run pytest tests/test_module.py         # Run specific file
uv run pytest -k "test_name"               # Run by name pattern
uv run pytest -v --tb=short                # Verbose with short traceback
uv run pytest --cov=src --cov-report=term  # With coverage

Common Flags

  • -v / --verbose - Detailed output
  • -x / --exitfirst - Stop on first failure
  • --tb=short - Short tracebacks
  • --tb=no - No tracebacks
  • -k EXPR - Run tests matching expression
  • -m MARKER - Run tests with marker
  • --cov=PATH - Coverage for path
  • --cov-report=term-missing - Show missing lines

pyproject.toml Configuration

Minimal Setup

[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]

Full Configuration

[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_functions = ["test_*"]
python_classes = ["Test*"]
addopts = "-v --tb=short"
markers = [
    "slow: marks tests as slow",
    "integration: marks integration tests",
]
filterwarnings = [
    "ignore::DeprecationWarning",
]

[tool.coverage.run]
source = ["src"]
branch = true
omit = ["tests/*", "*/__init__.py"]

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING:",
    "raise NotImplementedError",
]
fail_under = 80
show_missing = true

Report Generation

The TESTING_REPORT.local.md file should contain:

  1. Test execution summary (passed/failed/skipped)
  2. Coverage metrics by module
  3. Audit findings by severity
  4. Recommendations with file:line references
  5. Evidence (command outputs)

Integration with Conversation

When the user asks to write tests:

  1. Check conversation history for context about what to test
  2. Identify the code/feature being discussed
  3. If unclear, ask clarifying questions:

- "What specific behavior should I test?" - "Should I include edge cases for X?" - "Do you want unit tests, integration tests, or both?"

  1. Follow TDD: Write failing test first, then implement

Commands Available

  • /tdd-pytest:init - Initialize pytest configuration
  • /tdd-pytest:test [path] - Write tests using TDD (context-aware)
  • /tdd-pytest:test-all - Run all tests
  • /tdd-pytest:report - Generate/update TESTING_REPORT.local.md

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

Claude Code

27.78%
按下载量换算85

OpenCode

22.65%
按下载量换算69

Antigravity

18.99%
按下载量换算58

windsurf

14.99%
按下载量换算46

Codex

7.91%
按下载量换算24

Gemini CLI

3.39%
按下载量换算10

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

只读

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills