---
name: bigstack-qa
version: 0.1.0
description: |
  Tiered QA testing (Quick/Standard/Exhaustive) with automated
  fix loop. Covers unit tests, integration tests, and browser-based
  visual QA for existing codebases.
allowed-tools:
  - Bash
  - Read
  - Glob
  - Grep
  - Edit
  - Write
  - AskUserQuestion
---

{{PREAMBLE}}

# /bigstack-qa — QA Testing

Perform QA testing on the current codebase at the appropriate depth.

{{TEST_BOOTSTRAP}}

{{BROWSE_SETUP}}

## Tiers

Ask the user which tier, or auto-select based on context:

| Tier | When | What |
|------|------|------|
| **Quick** | Small change, single file | Run related tests only |
| **Standard** | Feature branch, multiple files | Full test suite + targeted visual QA |
| **Exhaustive** | Pre-release, critical path | Full suite + browser QA + edge cases |

## Workflow

### Step 1: Assess Scope

```bash
# Count changed files to help select tier
CHANGED=$(git diff --name-only $BASE_BRANCH...HEAD 2>/dev/null | wc -l | tr -d ' ')
echo "Changed files: $CHANGED"
```

- 1-3 files → suggest Quick
- 4-15 files → suggest Standard
- 15+ files or user requests it → Exhaustive

### Step 2: Run Tests

**Quick:**
```bash
# Run only tests related to changed files
CHANGED_FILES=$(git diff --name-only $BASE_BRANCH...HEAD 2>/dev/null)
# Map changed files to their test files and run them
```

**Standard / Exhaustive:**
```bash
if [ -n "$TEST_CMD" ]; then
  $TEST_CMD
fi
```

### Step 3: Fix Loop (max 50 iterations)

For each failing test:
1. Read the test and the code it tests
2. Determine if the failure is a real bug or a test that needs updating
3. Fix the issue
4. Re-run the failing test
5. Repeat until green or max iterations reached

**WTF-likelihood heuristic**: If a fix seems surprising or non-obvious, flag it to the user before applying.

### Step 4: Visual QA (Standard + Exhaustive only)

If `BROWSE_ENGINE` is available and the project has a web UI:
1. Start the dev server if not running
2. Navigate to affected pages
3. Check for visual regressions, broken layouts, console errors
4. Screenshot key states

### Step 5: Report

| Category | Result |
|----------|--------|
| Tests run | N |
| Tests passed | N |
| Tests fixed | N |
| Visual checks | N (if applicable) |

{{CONFIDENCE_CALIBRATION}}
