---
name: validate-feature
description: Validate that a scaffolded feature works end-to-end (compile, test, API smoke test)
version: 1.0.0
author: SmartStack
tags: [testing, validation, smoke-test, integration]
---

# /validate-feature

## PURPOSE

Validates that a scaffolded SmartStack feature **actually works** by running:
0. Dependency pre-flight check (restore, transitive deps, quick startup test)
1. Compilation check (`dotnet build`)
2. Unit tests (`dotnet test`)
3. Integration tests (`dotnet test --filter`)
4. API smoke test (start API, hit CRUD endpoints, verify responses)
5. DB validation (SQL Server: migrations, seed data, tenant isolation, LINQ→SQL)

## WHEN TO USE

- After running `/application` to scaffold a new feature
- After making changes to backend code (controllers, services, entities)
- Before committing to verify nothing is broken
- As a confidence check that the full stack works

## USAGE

```
/validate-feature {EntityName}
```

**Examples:**
```
/validate-feature Product
/validate-feature Order
/validate-feature UserProfile
```

## PARAMETERS

| Parameter | Required | Description |
|-----------|----------|-------------|
| `{entity_name}` | YES | PascalCase entity name to validate |

## PREREQUISITES

- The solution must compile
- Test project must exist with infrastructure (SmartStackTestFactory, IntegrationTestBase)
- Entity must have been scaffolded (controller, service, entity files exist)

## EXECUTION

This skill follows a 6-step sequential workflow:

| Step | File | Description | Blocking |
|------|------|-------------|----------|
| 0 | `steps/step-00-dependencies.md` | Pre-flight dependency check (restore, runtime assembly validation) | YES |
| 1 | `steps/step-01-compile.md` | Build the full solution | YES |
| 2 | `steps/step-02-unit-tests.md` | Run unit tests | YES |
| 3 | `steps/step-03-integration-tests.md` | Run integration tests | YES |
| 4 | `steps/step-04-api-smoke.md` | Start API and test CRUD endpoints | YES |
| 5 | `steps/step-05-db-validation.md` | SQL Server validation (migrations, seed data, tenant isolation, LINQ→SQL) | YES |

Each step must PASS before proceeding to the next.

## OUTPUT

A validation report showing pass/fail for each check:

```
## Feature Validation: {EntityName}

| Check | Result |
|-------|--------|
| Solution build | PASS |
| Unit tests (X passed) | PASS |
| Integration tests (X passed) | PASS |
| API smoke: GET /api/{entity} | PASS (200) |
| API smoke: POST /api/{entity} | PASS (201) |
| API smoke: GET /api/{entity}/{id} | PASS (200) |
| API smoke: PUT /api/{entity}/{id} | PASS (200) |
| API smoke: DELETE /api/{entity}/{id} | PASS (204) |
| DB: Migrations apply (SQL Server) | PASS |
| DB: Integration tests (SQL Server) | PASS |
| DB: Seed data accessible | PASS |

Result: ALL CHECKS PASSED
```

<success_criteria>
- Solution compiles without errors
- All unit tests pass
- All integration tests pass
- API smoke tests return expected HTTP status codes (200, 201, 204)
- Migrations apply cleanly on SQL Server LocalDB
- Integration tests pass against real SQL Server (LINQ→SQL, tenant isolation)
- Seed data is accessible via API endpoints
- Validation report displayed with per-check results
</success_criteria>
