**TL;DR**: `/test-coverage` - Analyze coverage gaps and generate tests for uncovered code.

---

## Usage

```bash
/test-coverage              # Full coverage analysis
/test-coverage src/api/     # Analyze specific directory
/test-coverage --generate   # Generate tests for gaps
```

## Coverage Analysis

### Current Coverage Report
```
Name                    Stmts   Miss  Cover   Missing
-----------------------------------------------------
src/api/users.py           50      5    90%   42-46
src/api/auth.py            30     12    60%   15-26
src/services/user.py       40      2    95%   38, 45
-----------------------------------------------------
TOTAL                     120     19    84%
```

### Coverage by Category
```
Category        Coverage    Target    Status
-------------------------------------------
Unit Tests      87%         80%       ✅
Integration     72%         70%       ✅
E2E             45%         50%       ⚠️
```

## Gap Analysis

### Uncovered Code

```markdown
## Coverage Gaps

### src/api/auth.py (60% coverage)

Uncovered lines: 15-26 (login error handling)
```python
# Not covered:
if not user:
    raise UnauthorizedError("Invalid credentials")
if user.is_locked:
    raise UnauthorizedError("Account locked")
```

**Suggested test:**
```python
def test_login_fails_for_invalid_credentials():
    response = client.post("/login", json={
        "email": "wrong@example.com",
        "password": "wrong"
    })
    assert response.status_code == 401

def test_login_fails_for_locked_account():
    # Create locked user
    user = create_user(is_locked=True)
    response = client.post("/login", json={...})
    assert response.status_code == 401
```
```

## Generate Tests

```bash
$ /test-coverage --generate

Generating tests for coverage gaps...

Created:
  tests/unit/test_auth_errors.py (3 tests)
  tests/unit/test_user_edge_cases.py (2 tests)

Coverage improvement: 84% → 91%
```

## Integration

This command:
- Analyzes pytest/jest coverage reports
- Identifies meaningful gaps
- Generates test suggestions
- Can auto-create test files
