functional-designlisted
Install: claude install-skill atretyak1985/swarmery
# Purpose
Refactor business logic to follow functional programming principles -- immutability, pure functions, composition, and data-flow pipelines. Targets TypeScript code in the main app's `src/lib/` services where pure transformations live (see `.claude/project.json` → `mainApp`). This skill writes to files via Edit; every change produces a before/after diff shown to the caller. This skill targets TypeScript only; it does not apply to Python code in the device/edge repo.
Success criteria: every refactored function is a pure function (no side effects, same input produces same output), all interface properties use `readonly` where immutability was applied, and `npm run typecheck` passes after changes.
# When to use
- Refactoring a service function in `src/lib/` that mutates its input parameters
- Replacing imperative loops with `.filter()/.map()/.reduce()` chains in business logic
- Extracting pure calculation functions from route handlers (Read the handler, Edit only in `src/lib/`)
- Converting a class with mutable state into functions and data interfaces
# When NOT to use
- Route handlers and server actions themselves -- keep them thin, put pure logic in `src/lib/` (use `code-standards` instead)
- Any Python code in the device/edge repo (use `api-integration` for hardware code or `code-standards` for Python refactoring -- this skill targets TypeScript only)
- Prisma query builders -- they use a fluent mutable API by design
- React component state management with `use