SpecGen
Ahmedmk11/spec-gen
Gerador automático de testes pytest com análise e refinamento via multi-agentes
Ver no GitHubSistema multi-agente que gera, analisa e refina suites de testes pytest para código Python automaticamente. Integra-se ao VS Code oferecendo geração de testes com um clique, usando pipeline de múltiplos agentes LLM para garantir qualidade e cobertura.
Instalação
npx convez-ai Ahmedmk11/spec-gen1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Gerar suites de testes para funções e classes Python existentes
- Aumentar cobertura de testes em projetos legados
- Validar qualidade de testes através de análise automática
Veredito

Ferramenta prática que reduz boilerplate de testes através de automação inteligente. A abordagem multi-agente (gerar → analisar → refinar) é robusta, mas depende da qualidade da API Anthropic e requer VS Code para máximo proveito.
README
A tradução para o português deste README ainda está na fila.
SpecGen
An AI-powered test generation tool for Python. Point it at any Python file and get a complete pytest test suite — generated, analyzed, and refined automatically.
Table of Contents
Screenshots
CodeLens Button on Functions and Classes
Output Test File
Prerequisites
- Python 3.13+
- An Anthropic API key
- VS Code with the SpecGen extension installed
Installation
Backend
# macOS / Linux
git clone https://github.com/Ahmedmk11/spec-gen.git
cd spec-gen
python -m venv .venv
source .venv/bin/activate
pip install -e .
# Windows (PowerShell)
git clone https://github.com/Ahmedmk11/spec-gen.git
cd spec-gen
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -e .
VS Code Extension
Clone the extension repo and run:
git clone https://github.com/Ahmedmk11/spec-gen-vscode.git
cd spec-gen-vscode
npm install
npm run compile
code --extensionDevelopmentPath=$(pwd)
Configuration
Create a .env file in the project root:
ANTHROPIC_API_KEY=your_api_key_here
ANTHROPIC_MODEL=claude-sonnet-4-6
Usage
- Start the backend server:
cd spec-gen
uv run uvicorn src.main:app --reload
- Open any Python project in VS Code
- Click the
⚡ Generate Testsbutton above any function or class, or right-click a.pyfile and select Generate Tests with SpecGen - Enter the path where the test file should be saved
- Wait for the tests to be generated and written to your project
How It Works
SpecGen uses a multi-agent pipeline to produce high-quality tests:
- Generate — an LLM generates a pytest test suite for the provided code
- Analyze — a second LLM reviews the tests for correctness, coverage, and meaningful assertions
- Refine — if the tests are lacking, a third LLM fixes the specific issues identified
- The analyze → refine loop runs up to 3 times until the tests are accepted