Recover from TrailStep architecture gate violations. Use when `pnpm arch:check --check` or `pnpm arch:check --changed` reports a violation, when a diagnostic names a G, S, V, N, M, or T rule, or before declaring architecture-affecting work done.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Trailstep Architecture?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/chily-john-trailstep-architecture)
---
name: trailstep-architecture
description: Recover from TrailStep architecture gate violations. Use when `pnpm arch:check --check` or `pnpm arch:check --changed` reports a violation, when a diagnostic names a G, S, V, N, M, or T rule, or before declaring architecture-affecting work done.
---
# TrailStep architecture gate
<!-- GENERATED by factory/arch/src/arch/skill.ts from factory/arch/src/arch/manifest.ts.
Do not edit this file: change the manifest, then regenerate with
`pnpm arch:check --emit-skill <path>`. The drift test fails otherwise. -->
## Commands
- `pnpm arch:check --changed` — the fast gate. Checks only the files this change touches
against the strict set; exits 1 with one diagnostic per violation, each carrying its fix
recipe.
- `pnpm arch:check --check` — the full-tree gate. Writes the scorecard, prints every
diagnostic, and exits 1 when the tree is red.
- `pnpm arch:check` — the full-tree scorecard. Always exits 0: a red scorecard is the
migration backlog, never a pass/fail answer.
- `pnpm arch:explain <rule>` — one rule: severity, doc anchor, fix recipe, and a
fixture-derived good/bad example.
- `pnpm verify:quick` — the fast loop: full-tree lint plus `arch:check --changed`.
It is not a typecheck substitute.
- `pnpm verify` — the full gate: lint, typecheck, `arch:check --report`, `test:fast`.
Run `pnpm verify` before declaring done.
## State contract
- `--changed` blocks on touched files; `--check` blocks on the full tree; bare
`arch:check`/`--report` only reports. The verify lanes keep composing the reporting and
changed scopes.
- Report-only rules never block; review-set rules have no checker at all.
- Severity lives in the manifest, never in a flag: there is no `--skip <rule>`.
- A diagnostic's `Fix:` line is the remediation; the rule anchor explains why.
## Strict rules (these block)
- `G1` — Break the cycle: remove the edge that closes the loop, or move the shared shape to the lower-ranked group or nearest common ancestor.
- `G2` — Remove the upward edge; if a lower rank needs the shape, it belongs at rank 0 (`json` or `contracts`).
- `G4` — Move the shared behavior to the parent as its own capability, or expose it through the owner's front door; G4 applies only to folders below a group root (top-level groups are G2/G3/G8 cases), and a parent barrel is not a remedy.
- `G5` — Split the folder by flow until it has at most 8 direct children (the migration gate is 12).
- `G8` — Import the owner's front door (`<owner>.ts`, or `<owner>.types.ts` for a declared type-only family), not a private sibling.
- `S-5` — Rename the folder for its capability, adapter, dependency layer, or store; `utils`/`helpers`/`common`/`misc`/`lib` are banned.
- `S-6` — Move the shared shape into `internal/`; `api/` may import `internal/`, never the reverse.
- `S-9` — Fold the single-child folder up unless its name carries a real distinction.
- `V-4` — Create the missing folder and move the three same-prefix files into it.
- `V-6` — Add `<folder>/<folder>.ts` (or a declared `<folder>.types.ts`) as the folder's front door.
- `N-1` — Rename the file to kebab-case and replace `types.ts`/`helpers.ts`/`constants.ts`/`utils.ts`/`index.ts` with an owner-named front door.
- `M-6` — Pass the filesystem, clock, cwd, env, spawn, exit, or stdio in as a parameter instead of reading it ambiently.
- `T-1` — Move the test beside its unit as `foo.test.ts`, or move a cross-cutting test to `packages/<pkg>/test/` per T-2.
- `T-2` — Move CLI/MCP/end-to-end tests to `packages/<pkg>/test/`; there is no third location.
Report-only (visible, never blocking): `G3`, `G6`.
Review set (no checker): `S-3`, `M-2`, `M-7`.
Budgets: folder width gate 12 / target 8 direct children;
file lines 600 (style/noExcessiveLinesPerFile, biome-owned).
## Recovering from one diagnostic
1. Apply the diagnostic's `Fix:` to the file it names — that recipe is the whole change.
2. `pnpm arch:explain <rule>` when you need the anchor and a good/bad example.
3. Iterate with `pnpm verify:quick`; run `pnpm verify` before declaring done.
4. Normative source, single home: viking://resources/trailstep/docs/architecture/codebase-architecture.md — read it; never restate it.