add-composable

add-composable is a command for Claude Code from go4cas/quiver. It costs 0 tokens per session (563 once invoked), scanned A, original, MIT.

A command that creates a reusable composable, a function for sharing stateful logic between pages or components, in a Quiver project.

In plain words
What is it for?
Use it to create files under src/composables with normalized camelCase names, getter functions for reactive values, actions, and cleanup for watchers or other side effects.
Why use it?
It removes the need to repeatedly set up the same reactive state and actions, while enforcing the project’s rules for keeping values reactive and cleaning up side effects.

Command for Claude Code

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 commands/go4cas/quiver/add-composable
Clone the repo
git clone --depth 1 https://github.com/go4cas/quiver

Made for: Claude Code.

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 add-composable

README.md
[![agentmods](https://agentmods.dev/badge/commands/go4cas/quiver/add-composable.svg)](https://agentmods.dev/commands/go4cas/quiver/add-composable)
Your own site
<a href="https://agentmods.dev/commands/go4cas/quiver/add-composable"><img src="https://agentmods.dev/badge/commands/go4cas/quiver/add-composable.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 563 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.00000 $0.00563
Opus 5 $0.00000 $0.00282
Sonnet 5 $0.00000 $0.00113
Haiku 4.5 $0.00000 $0.00056

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

Security

Grade A, and why

add-composable 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 5d 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.

.claude/commands/add-composable.md · 64 lines

What it actually says

Create a new Quiver composable named: $ARGUMENTS

The argument is a composable name in any form (e.g. useTheme, theme, pagination). Normalise to camelCase with a use prefix (e.g. useTheme, usePagination).

Follow these steps exactly:

  1. Create src/composables/<name>.js:
import { routerState } from '../state/routerState.js'  // only if route access needed
// import other state/framework dependencies as needed

export function <name>() {
  // encapsulate logic here

  return {
    // return reactive accessors as arrow functions
    value: () => someState.value,

    // return actions as plain functions
    doSomething() { /* mutate state */ },
  }
}

Rules:

  • Must be called inside a page or component function — never at module scope. State initialised at module scope resets on re-render. Document this constraint with a one-line comment above the export if it's not obvious from the name.
  • Return reactive state values as getter functions (() => state.value), not raw values, so callers stay reactive
  • Return actions as plain functions (no () => wrapper needed)
  • If the composable sets up watchers or side effects, clean them up with onCleanup from @arrow-js/core to prevent leaks across navigations
  • Apply Arrow.js rules: no <!-- --> comments inside any template literals used internally
  • Annotate the exported function with JSDoc @param/@returns — strict checkJs is enforced and untyped params fail npm run typecheck
  1. Create a unit test at tests/composables/<name>.test.js:
import { describe, it, expect, beforeEach } from 'vitest'
import { <name> } from '../../src/composables/<name>.js'

describe('<name>', () => {
  it('returns expected initial state', () => {
    const result = <name>()
    expect(result.value()).toBe(expectedInitialValue)
  })

  it('action updates state', () => {
    const result = <name>()
    result.doSomething()
    expect(result.value()).toBe(expectedNewValue)
  })
})
  1. Verify — run and fix any failures:
npm run typecheck && npm test && npm run test:e2e
  1. Report:
    • The file created and its test file
    • The exported function name
    • A one-line usage example inside a page function
    • Any state modules or framework APIs it depends on
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. 5d ago First seen · 64 lines · 0 tokens per session scan A 820a89f7b1fa

Subscribe to this mod's changes

add-composable is a command published in the GitHub repository go4cas/quiver (5 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 563 tokens. 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-31.