functional-designlisted
Install: claude install-skill atretyak1985/swarmery
# Purpose
Rewrite TypeScript business logic so it stops mutating its inputs: mutating
functions become functions that return new values, hand-written loops become
`.filter()`/`.map()`/`.reduce()` chains over named predicates, and interface
properties gain `readonly`. Targets the main app's `src/lib/` services. This
skill **edits files** and shows a before/after snippet per change.
Done means: every refactored function is pure, immutable shapes carry `readonly`,
and `npm run typecheck` passes.
# Rules (never violate)
1. TypeScript only — never apply this to Python.
2. Edit only under `src/lib/`; a route handler gets at most one import-only Edit,
never a refactor of its I/O.
3. Never wrap async I/O in a synchronous composition chain — `await`, then pipe
the result through pure code.
4. Never introduce a new dependency (immer, ramda, lodash-fp) or an undeclared
`pipe()`; chain methods or use sequential `const` assignments.
5. Verify every type by reading it — never guess a parameter shape.
6. Maximum 3 Edits per invocation, one per function, each with a shown diff.
# Resources
- Read `resources/refactor-procedure.md` before editing: the 7-step procedure,
the route-handler boundary rule, the self-check, common mistakes, escalation
triggers, two worked examples, and the failure-mode table.
# How to use
## What it does
Turns mutating, imperative business logic into pure functions over immutable
data, applies the edits itself, and reports each change with the p