with one click
gen-test
Generate pytest unit tests for a given source module or function
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Generate pytest unit tests for a given source module or function
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
对 GitHub Pull Request 进行批量/调度式代码审查(一次性短会话,非监听模式), Claude Code 端。多 Agent 并行检查 CLAUDE.md / AGENTS.md 合规性、bug 和逻辑安全问题, 通过 issue 验证机制过滤误报。状态通过 PR 评论的 metadata 持久化, 供外部调度器(如 zima daemon)交替调度 CR/fix agent。 Use when: 用户要求对指定 PR 进行一次性批量审查或调度式审查, 且不希望启动后台监听进程。 触发词: "batch review pr", "review pr batch", "scheduled review pr"
Release a new version of zima-blue-cli. Bumps version, generates CHANGELOG, creates PR and GitHub Release. Triggers on "发版", "release", "bump version", "发布版本".
Scaffold a new configuration entity type (model, commands, manager integration, CLI registration)
| name | gen-test |
| description | Generate pytest unit tests for a given source module or function |
Generate pytest unit tests for a target Python module or function.
/gen-test zima/models/agent.py — generate tests for the agent model/gen-test zima/config/manager.py::ConfigManager.save_config — generate tests for a specific methodRead the target source file to understand its public API, classes, and functions.
Determine the test file path using the project convention:
zima/foo/bar.py -> Test: tests/unit/test_foo_bar.py (flattened with underscores)zima/models/agent.py -> tests/unit/test_models_agent.pyGenerate tests following these conventions:
TestIsolator (from tests/base.py) when filesystem/config isolation is neededmonkeypatch for ZIMA_HOME isolation (handled by TestIsolator)tests/conftest.py (config_manager, cli_runner, unique_code, isolated_zima_home)pytest.raises for expected exceptionstmp_path or TestIsolator.get_test_path() for temp filesExample test structure:
"""Tests for <module description>."""
import pytest
from zima.<module> import <TargetClass>
from tests.base import TestIsolator
class Test<TargetClass>(TestIsolator):
"""Tests for <TargetClass>."""
def test_<behavior>_success(self):
"""Test <behavior> with valid input."""
# arrange
...
# act
result = ...
# assert
assert result == expected
def test_<behavior>_invalid_input(self):
"""Test <behavior> raises on invalid input."""
with pytest.raises(ValueError):
...
After generating, run the test to verify it passes:
pytest <test_file> -v
Report the test file path, number of tests generated, and pass/fail status.