# Pattern Enforcement

> Audits and enforces the TypeScript pattern stack (fn(args, deps), Result, validation boundaries, observability) across a codebase. Use this skill when reviewing PRs or modules for pattern compliance or remediating violations systematically. Do not use when/for teaching a single pattern in depth (use that pattern's skill) or visual UI review.

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

---


# Pattern Enforcement

## Critical rules

- Patterns survive only as `'error'` lint/type/CI failures — not README suggestions.
- Enforce layer boundaries (domain must not import infra), object params, and server/client separation.
- Compiler-level `any`/`as` bans belong in `strict-typescript`; this skill enforces structure.
- Adopt incrementally if needed, but keep rules on so new violations cannot land.
- Before editing ESLint config, read [references/eslint-config.md](references/eslint-config.md).

## Workflow

1. Map layers (`domain` / `infra` / `api`) and client vs server globs.
2. Add `boundaries` (or `no-restricted-imports`), `prefer-object-params`, and `no-server-imports` / `no-nodejs-modules`.
3. Set every architectural rule to `'error'`. Wire ESLint into CI so failures block merge.
4. For existing debt, follow [references/migration.md](references/migration.md) (warn → fix → error, or codemod).
5. Verify agents and humans get deterministic failures on pattern drift.

## Resources

- [references/eslint-config.md](references/eslint-config.md) — boundary/object-param/server rules and starter config. Read when configuring.
- [references/migration.md](references/migration.md) — incremental adoption, AI rationale, rationalizations. Read when remediating.

## Validation

- [ ] Directional boundary rules defined and enforced
- [ ] `prefer-object-params` on (off only in tests)
- [ ] Server/client separation enforced on client globs
- [ ] Architectural rules are `'error'`; CI fails on ESLint errors
- [ ] Existing violations have a tracked migration plan

## Constraints

- Does not replace teaching a single pattern in depth — load that skill. Does not enforce runtime values (use `validation-boundary`).
- Related: `strict-typescript`, `fn-args-deps`, `config-management`, `api-design`.

