Habilidades test-generator
🧪

test-generator

Seguro 🌐 Acesso à rede📁 Acesso ao sistema de arquivos⚙️ Comandos externos

生成 pytest 测试样板代码

Também disponível em: CuriousLearner

从头编写测试需要时间且需要遵循项目约定。此技能会自动生成符合项目标准的完整测试模板,包括规范的 AAA 模式、类型提示和参数化测试用例。

Suporta: Claude Codex Code(CC)
📊 69 Adequado
1

Baixar o ZIP da skill

2

Upload no Claude

Vá em Configurações → Capacidades → Skills → Upload skill

3

Ative e comece a usar

Testar

A utilizar "test-generator". generate tests for src/utils.py - function format_name(first: str, last: str) -> str

Resultado esperado:

  • Created: tests/test_utils.py
  • Test class: TestFormatName
  • Test cases: basic, valid input, invalid input, edge cases
  • All tests follow AAA pattern with type hints
  • Review TODO comments and add actual test data

A utilizar "test-generator". generate pytest fixture for database connection

Resultado esperado:

  • Created: conftest.py entry
  • Fixture name: db_connection
  • Provides Generator[Database, None, None] with proper setup and teardown
  • Add initialization parameters and cleanup logic

Auditoria de Segurança

Seguro
v5 • 1/16/2026

This is a pure documentation skill containing only SKILL.md with usage instructions and 5 Jinja2-style templates for pytest test generation. No executable scripts, network calls, or file writes exist. All static findings are false positives: template variables like {module_name} were misidentified as cryptographic algorithms, markdown code block backticks were misidentified as shell execution, and documentation instructions like 'Read the source file' were misidentified as system reconnaissance.

7
Arquivos analisados
976
Linhas analisadas
3
achados
5
Total de auditorias
Auditado por: claude Ver Histórico de Auditoria →

Pontuação de qualidade

38
Arquitetura
100
Manutenibilidade
85
Conteúdo
21
Comunidade
100
Segurança
87
Conformidade com especificações

O Que Você Pode Construir

启动新的 TDD 项目

在实现新函数或类之前生成测试模板

强制执行测试标准

在团队仓库中创建一致的测试模式

构建测试覆盖率

使用参数化和边界情况模板快速搭建测试文件

Tente Estes Prompts

基础函数测试
generate tests for src/my_project/utils.py - function calculate_total(items: list[float]) -> float
带方法的类
generate tests for UserManager class with create_user and delete_user methods
异步 API 函数
generate async tests for fetch_user_data(user_id: str) -> dict function
参数化验证器
generate parametrized tests for validate_email function with various valid and invalid email formats

Melhores Práticas

  • 立即运行生成的测试以确认它们失败(TDD 红色阶段)
  • 在实现之前,将所有 TODO 注释替换为实际的测试数据
  • 对多个输入组合使用参数化测试以最大化覆盖率

Evitar

  • 避免模拟内部函数或验证器——尽可能使用真实代码
  • 不要在一个函数中测试多个不相关的行为
  • 避免过度模拟:仅模拟 HTTP、数据库、文件 I/O、时间和随机值

Perguntas Frequentes

支持哪些 Python 版本?
此技能生成兼容 Python 3.9+ 的测试,使用现代类型提示和注解。
测试框架与模板兼容吗?
模板专为 pytest 设计,异步测试使用 pytest-asyncio,并与 pytest-cov 兼容以进行覆盖率统计。
如何与现有测试套件集成?
模板遵循标准的 pytest 约定,可以添加到任何 tests/ 目录结构中。
是否有数据被存储或发送到外部?
不会。此技能是基于提示的技能,没有网络访问、文件写入或外部数据传输。
为什么生成的测试最初会失败?
测试遵循 TDD 方法论。它们会失败,直到您实现被测试的实际代码。这是预期行为。
这与其他测试生成器相比如何?
与其他测试生成器不同,这些模板遵循严格的项目约定,包括 AAA 模式、类型提示和文档字符串。

Detalhes do Desenvolvedor