---
name: audit-dev-customised
description: >
  Detects @customised page drift from the regenerated service/hook contract
  (DRIFT-001/002). A page marked `@customised` is preserved across regeneration,
  so it can silently drift when the generated contract changes. Runs in
  /ba-develop Phase 3e (especially after a `--force` regeneration).
allowed-tools: [Bash]
---

# audit-dev-customised — `@customised` contract-drift audit

## Why

`scaffold-component` never overwrites a page whose first line is `@customised`
(architecture C bespoke seam). That is correct for bespoke layout, but it means
the page can drift from the CURRENT generated contract when a regeneration
changes the service/hook signatures or a route. The two drifts observed in the
field:

- a `@customised` page imports `EchangeDetailDto` / a hook that the regenerated
  module renamed or now types differently (→ TS2322/TS2305 at build);
- a `@customised` dashboard page still calls the retired
  `/dashboard/consolidated` route (the contract now serves the dashboard on the
  screen stratum, `/api/screens/{plural}/dashboard`, via `getDashboard()`).

The raw `tsc` build gate catches the type breaks, but late and cryptically. This
audit surfaces them deterministically, EARLIER and pointed at the exact seam.

## Rules

| Code | Severity | What |
|------|----------|------|
| `DRIFT-001` | `err` | A `@customised` page imports a name from a generated `…/hooks/use…` or `…/services/…Service` module that the (regenerated) module no longer exports. |
| `DRIFT-002` | `err` | A `@customised` page still references the retired `/dashboard/consolidated` route. |

Only `@customised` pages are scanned — generated pages are always in sync by
construction. Package imports and unresolved modules are skipped (no false
positives).

## Invocation

```bash
npx --prefer-offline tsx \
  skills/development/audit-dev-customised/cli/audit-dev-customised/index.ts \
  --web-path "<web-root>" --module-code "<MODULE>" --app-code "<APP>" --mode audit
```

Writes `<web-root>/_audit/dev-customised-<MODULE>.md` and prints the standard
execute envelope. Exit 1 when any `DRIFT-*` error is found. Pass condition:
`report.counts.errors == 0`.

## Where it runs

Phase 3e of `/ba-develop`, alongside `audit-dev-wire` — and especially relevant
right after a `--force` full regeneration, when preserved `@customised` pages are
most likely to have drifted. A persistent `DRIFT-*` error is **deferred as a
blocker** (never a stop): re-align the page with the current export / route (see
`report.findings[].solution`) or drop the stale import.
