# Preflight

> Run local quality gates before creating a PR

- Skill: `sap/preflight` (Agent Skill)
- Install (CLI): `npx skillmds@latest add sap/preflight`
- Raw SKILL.md: https://api.skillmd.com/api/skills/sap/preflight/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: sap (https://skillmd.com/u/sap)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/sap/preflight

---


# Preflight Check

Run all local quality gates for the affected library. If no argument provided, detect the library from changed files via `git diff --name-only`.

## Steps

### 1. Identify scope

```bash
# If $ARGUMENTS provided, use it. Otherwise detect from changed files:
git diff --name-only HEAD~1
```

Map changed file paths to library names (`libs/core/` → `core`, `libs/platform/` → `platform`, etc.).

### 2. Format

```bash
yarn format
```

Ensure all code is formatted before running quality gates.

### 3. Build

```bash
nx run <library>:build
```

Report: PASS or FAIL with error summary.

### 4. Lint

```bash
nx run <library>:lint
```

Report: PASS or FAIL with violation count and top issues.

### 5. Unit tests

```bash
nx run <library>:test --skip-nx-cache
```

Report: PASS or FAIL with failing test names and error messages.

### 6. Export check

For each changed component file, verify it is exported from the library's `public_api.ts` or `index.ts`. Flag any new public classes missing from exports.

### 7. Breaking change check

Run `git diff` on changed files. Flag:

- Removed `input()`, `output()`, or `model()` declarations
- Renamed exported classes, functions, or types
- Changed input/output names
- Changed default values

If breaking changes found, verify the commit message contains `BREAKING CHANGE:` footer.

## Output

```
## Preflight Report

| Gate              | Status | Details          |
|-------------------|--------|------------------|
| Format            | PASS   |                  |
| Build             | PASS   |                  |
| Lint              | FAIL   | 3 violations     |
| Unit Tests        | PASS   | 42 tests passed  |
| Exports           | PASS   |                  |
| Breaking Changes  | WARN   | 1 input removed  |

### Failures
[details for each failed gate]

### Action Required
[what needs fixing before PR]
```

