一键导入
python-testing
Write focused, deterministic, well-documented pytest tests for AI-authored code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Write focused, deterministic, well-documented pytest tests for AI-authored code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
ALWAYS use this skill whenever you would otherwise ask the user a question in free-form chat -- for clarifications, confirmations (especially destructive actions), missing parameters, multiple-choice decisions, or structured form input. Elicitations are routed through the Unique AI Platform UI via `unique-cli elicit create` + `elicit wait` (or `elicit ask` outside an agent harness) so the user gets a proper structured prompt and you get a structured answer back. Do NOT ask the user in plain chat when you can use this skill instead.
Read Agentic Table (magic table / due-diligence) sheets through the unique-cli agentic-table command. Use when the user or task involves inspecting an Agentic Table: a sheet's state and metadata, a specific cell's value or lock state, a cell's edit/answer history, or the sheet's generated export artifacts (reports, question exports). These are read-only (Tier 0) commands — they never modify the sheet and never require confirmation. Access to each sheet is enforced by the platform; a denial is reported as `agentic-table: permission denied`.
Call MCP (Model Context Protocol) server tools on the Unique AI Platform using the unique-cli mcp command. Use when the user asks to invoke, call, or execute an MCP tool, or when they need to send a JSON payload to an MCP server through the CLI. The JSON payload is forwarded 1:1 to the platform's MCP call-tool API.
Invoke connected Unique spaces/subagents through the unique-cli subagent command. Use when the workspace exposes connected-space tools and you need to delegate a question or task to one of those configured assistants.
Search the Unique AI Platform knowledge base using the unique-cli search command, with automatic per-turn citation tracking so cited facts render as clickable reference chips and `<sup>N</sup>` footnotes on the Unique platform. Use whenever the user asks to find, search, or query documents or content on Unique, including filtering by folder or metadata. Also covers `unique-cli read <cont_id>` for reading the full indexed text of a document when its content ID is already known. NOTE: This search uses combined vector + full-text indexing. Excel (.xlsx/.xls), CSV (.csv), and image files are NOT full-text indexed, so they will not appear in search results. To locate these file types, use the unique-cli-file-management skill instead (browse folders with `unique-cli ls` to find them by name).
Search the documents uploaded for the CURRENT task/row (e.g. an Agentic Table row's attached files) via the `unique-cli uploaded-search "<query>"` command, with the same per-turn citation tracking as `unique-cli search` so cited facts render as `<sup>N</sup>` footnotes and clickable reference chips on the Unique platform. ALWAYS use this skill when the user refers to documents they uploaded/attached to this task, or when you need facts from the task's own attached files. These uploaded files are scoped to the chat, NOT to a knowledge-base folder, so they will NEVER appear in `unique-cli search` results no matter the folder or metadata filters. Use `unique-cli search` for the knowledge base and this command for the task's uploaded documents; the two are complementary and citation numbering is shared across them within a turn.
| name | python-testing |
| description | Write focused, deterministic, well-documented pytest tests for AI-authored code. |
| license | MIT |
| compatibility | claude cursor opencode |
| metadata | {"version":"1.0.0","languages":"python","audience":"developers","workflow":"testing","since":"2025-02-24"} |
I help with three pytest workflows:
Supporting files in this skill:
assets/pytest.ini.template — ready-to-copy pytest configurationscripts/analyze_coverage.sh [path] — coverage analysis helper (whole src or specific folder/module)
./.claude/skills/python-testing/scripts/analyze_coverage.sh [path]"$(git rev-parse --show-toplevel)/.claude/skills/python-testing/scripts/analyze_coverage.sh" [path]Use when you want to:
"Write tests for the slugify function in src/utils/text.py"
"Check coverage for src/services/payment.py"
"Set up pytest for this project with coverage and async support"
test_<module_or_feature>.pytest_<unit>__<behavior>__<condition>@pytest.mark.aiThree-part format:
Purpose: What this test verifies.
Why this matters: Business or technical consequence if it breaks.
Setup summary: What's arranged and what's asserted.
<domain>_fixtures.pypytest_plugins = ["tests.fixtures"] in conftest.pymocker fixture (pytest-mock)spec=True for type safety./.claude/skills/python-testing/scripts/analyze_coverage.sh — full src coverage./.claude/skills/python-testing/scripts/analyze_coverage.sh src/services — coverage for a specific folder./.claude/skills/python-testing/scripts/analyze_coverage.sh src/utils/text.py — coverage for a single filepytest-mock's mocker or hand-rolled fixturespytest.mark.asyncio or trio)scripts/analyze_coverage.sh when changes affect multiple modulesuv add --dev pytest pytest-cov pytest-asyncio pytest-mockpip install pytest pytest-cov pytest-asyncio pytest-mockassets/pytest.ini.template → pytest.ini at the project roottests/ directory with an empty __init__.py and conftest.py