smart-testlisted
Install: claude install-skill espensev/ai-skills
# Smart Test - Targeted Test Selector
Given a set of changed files, determines and runs the minimal test subset
instead of the full test suite. Reads module definitions from project.toml
and builds source-to-test mappings dynamically.
**All commands run to completion autonomously.**
**Config:** `.codex/skills/project.toml` - modules, test commands, conflict zones
---
## Commands
| Command | Usage | Purpose |
|---------|-------|---------|
| `run` | `$smart-test file1.py file2.ts` | Run tests for specific changed files |
| `diff` | `$smart-test` or `$smart-test --diff` | Auto-detect changed files from git diff, run their tests |
| `map` | `$smart-test --map` | Show the full source-to-test mapping without running anything |
Default to `diff` if no arguments given.
---
## Setup: Load Config
Before any command:
1. Read `.codex/skills/project.toml`
2. Extract `[modules]` - maps module names to source file lists
3. Extract `[commands].test` - the test runner command
4. Extract `[smart-test]` section if present (optional overrides)
### Optional config
```toml
[smart-test]
# Explicit source-to-test mappings that override auto-discovery.
# Each key is a source glob, value is a list of test files/globs.
# Use when auto-discovery can't resolve the relationship.
[smart-test.mappings]
"src/schema.sql" = ["tests/test_data_contract.py", "tests/test_schema.py"]
"src/routes/*.ts" = ["tests/api/*.test.ts"]
"*.proto" = ["tests/"] # protobuf changes = full suite
[sm