functional-design

functional-design is a skill for Claude Code from atretyak1985/swarmery. It costs 49 tokens per session (902 once invoked), scanned A, original, Apache-2.0.

A TypeScript refactoring workflow that changes business logic into pure functions, immutable data, and array pipelines.

In plain words
What is it for?
It is for rewriting functions in TypeScript application services while keeping input data unchanged.
Why use it?
It reduces accidental changes to shared data and makes logic easier to type-check and reason about.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the core plugin — 37 skills, 8 commands, 13 agents shipped together

Good fit It is for rewriting functions in TypeScript application services while keeping input data unchanged.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/atretyak1985/swarmery/functional-design
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add atretyak1985/swarmery --skill functional-design
Clone the repo
git clone --depth 1 https://github.com/atretyak1985/swarmery

Made for: Claude Code.

Or install core, the plugin that ships this one along with the rest of its 37 skills, 8 commands, 13 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for functional-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/atretyak1985/swarmery/functional-design/github.svg)](https://agentmods.dev/skills/atretyak1985/swarmery/functional-design)
Your own site
<a href="https://agentmods.dev/skills/atretyak1985/swarmery/functional-design"><img src="https://agentmods.dev/badge/skills/atretyak1985/swarmery/functional-design/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for functional-design

Your own site · 80×15
<a href="https://agentmods.dev/skills/atretyak1985/swarmery/functional-design"><img src="https://agentmods.dev/badge/skills/atretyak1985/swarmery/functional-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 902 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.00902
Opus 5.5 $0.00020 $0.00361
Sonnet 5.5 $0.00010 $0.00180
Haiku 4.5 $0.00005 $0.00090

Measured 1mo ago against content hash 2e9e7cd48585, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

functional-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/core/skills/functional-design/SKILL.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 principle behind it and a short before/after snippet.

When to use it

  • A src/lib/ service function mutates the object handed to it.
  • A for loop with nested conditionals would read better as named predicates.
  • A route handler tangles calculation with I/O and the calculation should move out.
  • A class holds mutable state that could be plain data plus functions.

Not for: a plan without edits (refactor-plan); Python, naming, or framework conventions (code-standards); a handler's own I/O, an ORM fluent builder, or React useState/useReducer — each has its own contract; or hot per-tick telemetry paths, where spread copies cost more than they buy.

Read the full file on GitHub · 90 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 90 lines · 49 tokens per session scan A 2e9e7cd48585

Subscribe to this mod's changes

functional-design is a skill published in the GitHub repository atretyak1985/swarmery (7 stars, last pushed today), licensed Apache-2.0. It adds 49 tokens to every session and 902 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

effect-v4

Write, review, or upgrade Effect v4 code in the Composio CLI, cli-keyring, and json-schema-to-effect-schema packages, all pinned exactly to [email protected] — Context.Service and explicit layers, Schema.TaggedError and typed recovery, the effect/cli command surface, and the vendored effect source oracle. Use when writing…

ComposioHQ/composio · 157 tokens

azure-identity-ts

Authenticate to Azure services using Azure Identity library for JavaScript (@azure/identity). Use when configuring authentication with DefaultAzureCredential, managed identity, service principals, or interactive browser login.

microsoft/skills · 41 tokens

typescript

TypeScript coding conventions, best practices, and patterns for writing clean, maintainable code.

genkit-ai/genkit · 20 tokens

agents-sdk-typescript-debugging

Use when troubleshooting an agent built with the Microsoft Agents SDK (@microsoft/agents-hosting and related packages). Trigger on any of these symptoms: build or TypeScript errors, crashes on startup, 401 or auth errors on incoming requests, the bot not responding to messages, .env configuration problems, Azure AD…

microsoft/Agents · 125 tokens

chat-sdk

Build multi-platform chat bots with Chat SDK (chat npm package). Use when developers want to (1) Build a Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, or WhatsApp bot, (2) Use Chat SDK to handle mentions, direct messages, subscribed threads, reactions, slash commands, cards, modals, files, or AI…

vercel-labs/open-agents · 191 tokens

better-auth

Skill for integrating Better Auth - comprehensive TypeScript authentication framework for Cloudflare D1, Next.js, Nuxt, and 15+ frameworks. Use when adding auth, encountering D1 adapter errors, or implementing OAuth/2FA/RBAC features.

secondsky/claude-skills · 53 tokens