一键导入
gen-test
Generate pytest unit tests for a given source module or function
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate pytest unit tests for a given source module or function
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| 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.
对 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)