composition-patterns

A guide for designing reusable React component interfaces through composition. Composition means combining small components instead of adding many mode-setting switches to one component.

In plain words
What is it for?
Use it when building component libraries, reviewing component architecture, or simplifying components with many mode or feature flags.
Why use it?
It prevents boolean props and conditional branches from multiplying into difficult-to-maintain combinations.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/clubpay/ronykit/composition-patterns
Any agent
npx skills add clubpay/ronykit --skill composition-patterns
Clone the repo
git clone --depth 1 https://github.com/clubpay/ronykit

Made for: Claude Code, Codex.

Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,766 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00058 $0.01766
Opus 5 $0.00029 $0.00883
Sonnet 5 $0.00012 $0.00353
Haiku 4.5 $0.00006 $0.00177

Measured 2d ago against content hash 6d0919cf78fa, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

composition-patterns 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 2d 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.

ronyup/internal/skeleton/skills/composition-patterns/SKILL.md · 225 lines

How it starts

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

React Composition Patterns

Build components by composition, not configuration. As a component grows, the temptation is to add another boolean prop. Each one doubles the possible states and breeds conditional logic until the component is unmaintainable. Compose small pieces instead — explicit, self-documenting, and easy for both humans and agents to extend. Adapted from Vercel Engineering's composition-patterns (MIT).

When to use

  • A component is accumulating boolean/mode props (isThread, isEditing, isDM, showFooter…) or deeply nested conditional rendering.
  • Designing a reusable component or a component library API.
  • Reviewing component architecture for flexibility and maintainability.

This governs how you design your own components; shadcn governs using its components, and react-performance governs runtime speed. They don't overlap.

1. Avoid boolean-prop proliferation (the core rule)

Don't customize behavior with boolean flags — each flag multiplies states and creates impossible combinations. Split into composed pieces instead.

// Avoid: every new mode adds a flag and a branch
<Composer isThread isEditing={false} channelId="abc" showFormatting />

// Prefer: explicit composition, no conditionals to reason about
<Composer.Frame>
  <Composer.Input />
  <AlsoSendToChannelField id={channelId} />
  <Composer.Footer>
    <Composer.Formatting />
    <Composer.Submit />
  </Composer.Footer>
</Composer.Frame>

2. Compound components with a shared context

Structure a complex component as a set of subcomponents that read shared state from context — not from props drilled through a monolithic parent. Consumers compose only the pieces they need.

const ComposerContext = createContext<ComposerContextValue | null>(null);

function ComposerInput() {
  const { state, actions, meta } = use(ComposerContext);
  return (
    <TextInput
      ref={meta.inputRef}
      value={state.input}
      onChangeText={(t) => actions.update((s) => ({ ...s, input: t }))}
    />
  );
}

// Export the pieces as one namespaced object
const Composer = {
  Provider: ComposerProvider,
  Frame: ComposerFrame,
  Input: ComposerInput,
  Footer: ComposerFooter,
  Submit: ComposerSubmit,
};

Read the full file on GitHub · 225 lines

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. 2d ago First seen · 225 lines · 58 tokens per session scan A 6d0919cf78fa

Subscribe to this mod's changes

composition-patterns is a skill published in the GitHub repository clubpay/ronykit (38 stars, last pushed 4d ago), licensed BSD-3-Clause. It adds 58 tokens to every session and 1,766 once invoked, about $0.0003 per session on Opus 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-08-30.

Related

Other skills, from other repositories

procedure

Vovk.ts procedures — atomic unit of server-side logic in Vovk project. Use whenever user asks to build ANYTHING producing or consuming data on server — page loading data ("users page", "dashboard", "product list"), endpoint, API handler, server action, form submission, controller, validation with Zod / Valibot /…

finom/vovk · 342 tokens

rpc

Vovk.ts RPC client — how vovk generate turns controllers into type-safe client modules, composed vovk-client vs segmented clients, call shape (apiRoot, params, body, query, meta, init, disableClientValidation, validateOnClient, interpretAs, transform, fetcher), customizing generation via outputConfig.imports.fetcher +…

finom/vovk · 354 tokens

tools

Building LLM tools with Vovk.ts — deriveTools() (procedures → tools), createTool() (standalone tools, no controller/procedure needed), @operation.tool({ name, title, description, hidden }) decorator, x-tool metadata, ToModelOutput.DEFAULT vs ToModelOutput.MCP formatters, the tools + toolsByName return shape, the meta…

finom/vovk · 261 tokens

mixins

Vovk.ts OpenAPI mixins — importing third-party OpenAPI 3.x schemas as typed client modules that share the same call signature as native Vovk RPC modules. Use whenever the user asks to "call a third-party API from my Vovk app", "mixin an OpenAPI schema", "import an OpenAPI spec as a client", "wrap an external service…

finom/vovk · 275 tokens

bundle

Vovk.ts vovk bundle CLI — packages composed TypeScript client as zero-dep publishable npm package. Covers bundle.build async fn, [email protected] recipe, outputConfig.origin / package / reExports / imports.validateOnClient: null, prebundleOutDir / outDir / keepPrebundleDir, --include/--exclude segments, --openapi- mixin…

finom/vovk · 250 tokens

decorators

Vovk.ts decorators — built-in (@prefix, @operation, @get/@post/@put/@patch/@del, .auto()) and custom via createDecorator. Covers authorization / auth decorators, middleware-style wrapping (pre-handler + post-handler logic), req.vovk.meta() for cross-decorator state, stacking order, the decorate() alternative for…

finom/vovk · 228 tokens