QA Setup
Ensure a project has standardized QA commands that work regardless of the underlying tools. This enables polyglot projects to have consistent developer experience.
Variables
MODE: $ARGUMENTS # audit (default) | setup PREFERRED_RUNNER: just # just | npm | uv | make
Standard Commands
Every project should expose these commands via the chosen runner:
| Command | Purpose | Required |
|---|---|---|
lint | Run linter (check mode) | ✅ |
format | Run formatter (check mode) | ✅ |
format:fix | Run formatter (fix mode) | ✅ |
typecheck | Run type checker | ✅ |
test | Run test suite | ✅ |
test:watch | Run tests in watch mode | ⚪ |
build | Build/compile project | ✅ |
check | Run all checks (lint+format+typecheck+test) | ✅ |
check:fix | Run all checks with auto-fix | ⚪ |
clean | Clean build artifacts | ⚪ |
Workflow
Phase 1: Detect Runner & Stack
bash
echo "=== Runner Detection ==="
# Check for existing runners
RUNNER=""
if [ -f "justfile" ] || [ -f "Justfile" ]; then
echo "✓ Justfile found"
RUNNER="just"
fi
if [ -f "package.json" ]; then
echo "✓ package.json found"
if [ -z "$RUNNER" ]; then RUNNER="npm"; fi
fi
if [ -f "pyproject.toml" ]; then
echo "✓ pyproject.toml found"
if [ -z "$RUNNER" ]; then RUNNER="uv"; fi
fi
if [ -f "Makefile" ]; then
echo "✓ Makefile found (legacy)"
fi
echo ""
echo "Selected runner: ${RUNNER:-none}"
Phase 2: Audit Existing Commands
For Justfile:
bash
if [ -f "justfile" ] || [ -f "Justfile" ]; then echo "=== Justfile Commands ===" just --list 2>/dev/null || echo "Could not list commands" fi
For package.json:
bash
if [ -f "package.json" ]; then echo "=== npm scripts ===" cat package.json | grep -A 50 '"scripts"' | grep -E '^\s+"' | head -20 fi
For pyproject.toml (uv scripts or poe):
bash
if [ -f "pyproject.toml" ]; then echo "=== Python scripts ===" grep -A 30 "\[tool.poe.tasks\]" pyproject.toml 2>/dev/null || \ grep -A 30 "\[project.scripts\]" pyproject.toml 2>/dev/null || \ echo "No scripts section found" fi
Phase 3: Check Required Commands
For each required command, verify it exists:
code
Required commands: - [ ] lint - [ ] format - [ ] format:fix (or format-fix) - [ ] typecheck - [ ] test - [ ] build - [ ] check
Phase 4: Setup (if MODE=setup)
If commands are missing and MODE=setup, create them.
Justfile Template:
just
# QA Commands - Standardized interface for polyglot projects
# Generated by /qa-setup
# Run all checks
check: lint format typecheck test
@echo "✓ All checks passed"
# Run all checks with auto-fix
check-fix: format-fix lint-fix
@echo "✓ Auto-fixes applied"
# === Linting ===
# Check for lint errors
lint:
# TODO: Add your linter command
# Python: ruff check .
# Rust: cargo clippy --all-targets -- -D warnings
# Node: eslint .
@echo "lint: not configured"
# Fix lint errors
lint-fix:
# TODO: Add your linter fix command
@echo "lint-fix: not configured"
# === Formatting ===
# Check formatting
format:
# TODO: Add your formatter check command
# Python: ruff format --check .
# Rust: cargo fmt --check
# Node: prettier --check .
@echo "format: not configured"
# Fix formatting
format-fix:
# TODO: Add your formatter fix command
@echo "format-fix: not configured"
# === Type Checking ===
# Run type checker
typecheck:
# TODO: Add your type checker command
# Python: pyright or mypy .
# Rust: cargo check
# Node: tsc --noEmit
@echo "typecheck: not configured"
# === Testing ===
# Run tests
test:
# TODO: Add your test command
# Python: pytest
# Rust: cargo test
# Node: npm test or jest
@echo "test: not configured"
# Run tests in watch mode
test-watch:
# TODO: Add your test watch command
@echo "test-watch: not configured"
# === Building ===
# Build the project
build:
# TODO: Add your build command
@echo "build: not configured"
# === Cleanup ===
# Clean build artifacts
clean:
rm -rf build/ dist/ target/ node_modules/.cache/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
@echo "✓ Cleaned"
package.json scripts template:
json
{
"scripts": {
"lint": "echo 'lint: not configured'",
"format": "echo 'format: not configured'",
"format:fix": "echo 'format:fix: not configured'",
"typecheck": "echo 'typecheck: not configured'",
"test": "echo 'test: not configured'",
"test:watch": "echo 'test:watch: not configured'",
"build": "echo 'build: not configured'",
"check": "npm run lint && npm run format && npm run typecheck && npm run test",
"check:fix": "npm run format:fix && npm run lint:fix"
}
}
pyproject.toml (poethepoet) template:
toml
[tool.poe.tasks] lint = "echo 'lint: not configured'" format = "echo 'format: not configured'" format-fix = "echo 'format-fix: not configured'" typecheck = "echo 'typecheck: not configured'" test = "echo 'test: not configured'" build = "echo 'build: not configured'" check = ["lint", "format", "typecheck", "test"] check-fix = ["format-fix", "lint"]
Report
markdown
## QA Setup Audit **Project:** <name> **Runner:** <just|npm|uv|make|none> **Mode:** <audit|setup> --- ### Command Status | Command | Status | Implementation | |---------|--------|----------------| | `lint` | ✅/❌ | <actual command or "missing"> | | `format` | ✅/❌ | <actual command> | | `format:fix` | ✅/❌ | <actual command> | | `typecheck` | ✅/❌ | <actual command> | | `test` | ✅/❌ | <actual command> | | `build` | ✅/❌ | <actual command> | | `check` | ✅/❌ | <actual command> | --- ### Verdict **Status:** ✅ QA READY / ⚠️ PARTIAL / ❌ NOT CONFIGURED <If not ready> **Missing Commands:** - <list> **To Fix:** Run `/qa-setup setup` to generate missing commands, or manually add them to your runner. </If> <If ready> **Next Steps:** - Run `/pre-commit-qa` to execute all checks - Add `just check` to your CI/CD pipeline </If>
Examples
Example 1: Audit current project
code
/qa-setup
Example 2: Setup with justfile
code
/qa-setup setup --runner=just
Example 3: Audit and suggest fixes
code
/qa-setup audit