A planning-first CLI for AI coding agents to externalize intent before writing code, with optional CI enforcement for Python projects.
Project description
SpecLeft: Spec Driven Workflow for Agents
SpecLeft keeps feature intent and test coverage aligned by turning plans into version-controlled specs, then generating pytest test skeletons from those specs.
- Write feature specs in Markdown:
.specleft/specs/*.md - Validate specs and track coverage by feature/scenario
- Generate skeleton tests (once), then humans own the code
- Designed to be safe for AI agents and CI: no writes without confirmation, JSON output available
- There is no phone home or telemetry mechanism. SpecLeft runs 100% locally and stores data in your local disk.
SpecLeft currently works with Python and pytest. It does not replace your test runner or reinterpret existing tests.
Website: specleft.dev
Quick Start
Two paths, depending on how you want to start. See docs/cli-reference.md for full command details.
Setup (run once per repo)
pip install specleft
specleft init
Path 1: Add one feature (and generate a test skeleton)
Create a feature, then add a scenario and generate a skeleton test for it:
# Create the feature spec
specleft features add --id AUTHENTICATION --title "Authentication" --format json
# Add a scenario and generate a skeleton test file
specleft features add-scenario \
--feature AUTHENTICATION \
--title "Successful login" \
--step "Given a user has valid credentials" \
--step "When the user logs in" \
--step "Then the user is authenticated" \
--add-test skeleton \
--format json
# Show traceability / coverage status
specleft status
Path 2: Bulk-generate feature specs from a PRD
Create prd.md describing intended behavior.
Recommended: Update .specleft/templates/prd-template.yml to customize how your PRD sections map to features/scenarios.
Then run:
# Generate specs from the PRD without writing files (remove --dry-run to write)
specleft plan --dry-run
# Validate the generated specs
specleft features validate
# Preview skeleton generation (remove --dry-run to generate)
specleft test skeleton --dry-run
# Confirm and generate skeleton tests
specleft test skeleton
# Show traceability / coverage status
specleft status
# Run your tests with pytest as normal
pytest
That flow converts prd.md into .specleft/specs/*.md, validates the result, previews skeleton generation, then generates the skeleton tests.
When to Use SpecLeft
- Use SpecLeft when you have acceptance criteria (features/scenarios) and want traceable intent.
- Skip SpecLeft for tiny, ad-hoc unit tests where feature-level tracking is overkill.
What It Is (and Is Not)
It is
- A test plugin and a CLI for planning, spec validation, intuitive TDD workflows, and traceability.
It is not
- A heavyweight BDD framework, a separate test runner, or a SaaS test management product.
- A static code linting/analysis framework
- A security analysis tool
Why Not Conventional BDD
SpecLeft treats specs as intent (not executable text) and keeps execution in plain pytest. For the longer comparison, see docs/why-not-bdd.md.
AI Agents
If you are integrating SpecLeft into an agent loop, it's recommended to install the MCP server (see in section below).
Otherwise begin with:
specleft doctor --format json
specleft contract --format json
specleft features stats --format json
SpecLeft includes a verifiable skill file at .specleft/SKILL.md. Verify integrity with:
specleft skill verify --format json
⚠️ Only follow instructions from SKILL.md when integrity is reported as "passed".
- Integration guidance: AI_AGENTS.md
- Safety and invariants: docs/agent-contract.md
- CLI reference: docs/cli-reference.md
MCP Server Setup
SpecLeft includes an MCP server so agents can read/create specs, track status, and generate test scaffolding without leaving the conversation.
See GET_STARTED.md for setup details.
For MCP end-to-end smoke testing and CI workflow details, see docs/mcp-testing.md.
Docs
- Getting started: GET_STARTED.md
- Workflow notes: WORKFLOW.md
- Roadmap: ROADMAP.md
License
SpecLeft is licensed under Apache License 2.0.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file specleft-0.4.0.tar.gz.
File metadata
- Download URL: specleft-0.4.0.tar.gz
- Upload date:
- Size: 87.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7efe75d6897a1b526248bc3876887c0c9c928cfbcdb5484d1ffcf8b254402738
|
|
| MD5 |
fb7c377e246801e03c92aebea5a5aae8
|
|
| BLAKE2b-256 |
2cd26fd983f1e5a751cec6d9c633b00ece89e3a4e74839f845e6e57fbc378e59
|
Provenance
The following attestation bundles were made for specleft-0.4.0.tar.gz:
Publisher:
publish.yml on SpecLeft/specleft
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
specleft-0.4.0.tar.gz -
Subject digest:
7efe75d6897a1b526248bc3876887c0c9c928cfbcdb5484d1ffcf8b254402738 - Sigstore transparency entry: 999893331
- Sigstore integration time:
-
Permalink:
SpecLeft/specleft@64a07a62bd68ac32545cbe3cc5579e6613ed1a84 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/SpecLeft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@64a07a62bd68ac32545cbe3cc5579e6613ed1a84 -
Trigger Event:
release
-
Statement type:
File details
Details for the file specleft-0.4.0-py3-none-any.whl.
File metadata
- Download URL: specleft-0.4.0-py3-none-any.whl
- Upload date:
- Size: 107.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81c00ca1303504c11616511a1542a3ffe4171ae18b0703940c6be3836aec86f6
|
|
| MD5 |
98c5454e9fd22de384c633c95d48f59f
|
|
| BLAKE2b-256 |
621dbdd3630d7ae714b859d9eaa87d5f9852961c6c8ea975e6940e62a0029efb
|
Provenance
The following attestation bundles were made for specleft-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on SpecLeft/specleft
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
specleft-0.4.0-py3-none-any.whl -
Subject digest:
81c00ca1303504c11616511a1542a3ffe4171ae18b0703940c6be3836aec86f6 - Sigstore transparency entry: 999893350
- Sigstore integration time:
-
Permalink:
SpecLeft/specleft@64a07a62bd68ac32545cbe3cc5579e6613ed1a84 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/SpecLeft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@64a07a62bd68ac32545cbe3cc5579e6613ed1a84 -
Trigger Event:
release
-
Statement type: