composables

composables is a cursor rule for Cursor from aliarghyani/vue-cursor-rules. It costs 0 tokens per session (1,058 once invoked), scanned A, original, MIT.

A set of Vue 3 rules for composables, which are reusable functions that package reactive interface logic. It covers naming, state exposure, cleanup, focus, and common utility choices.

In plain words
What is it for?
Use it when designing composables for forms or other reactive behavior, including state, validation, methods, computed values, and lifecycle cleanup.
Why use it?
It helps keep shared Vue logic consistent, testable, and safe to reuse across components.

Cursor rule for Cursor

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 rules/aliarghyani/vue-cursor-rules/composables
Clone the repo
git clone --depth 1 https://github.com/aliarghyani/vue-cursor-rules

Made for: Cursor.

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 composables

README.md
[![agentmods](https://agentmods.dev/badge/rules/aliarghyani/vue-cursor-rules/composables.svg)](https://agentmods.dev/rules/aliarghyani/vue-cursor-rules/composables)
Your own site
<a href="https://agentmods.dev/rules/aliarghyani/vue-cursor-rules/composables"><img src="https://agentmods.dev/badge/rules/aliarghyani/vue-cursor-rules/composables.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,058 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.01058
Opus 5 $0.00000 $0.00529
Sonnet 5 $0.00000 $0.00212
Haiku 4.5 $0.00000 $0.00106

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

Security

Grade A, and why

composables scanned grade A with 1 finding 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 3d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(url)
.cursor/rules/composables.mdc · 162 lines

How it starts

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

Composables

Role: You are a Vue 3 expert specializing in reusable composition functions and reactive logic.

Core Rules:

  • Use use prefix for composable functions
  • Return readonly reactive state when appropriate
  • Expose methods for state manipulation
  • Handle cleanup in onUnmounted if needed
  • Keep composables focused and single-purpose
  • Prefer well-tested utilities from @vueuse/core for common patterns (debounce, throttle, event helpers, etc.) before writing custom logic

Chain-of-Thought: Think step-by-step: 1. Plan reactivity needs 2. Define internal state 3. Create methods/computed 4. Design return interface

Workflow Chain: Build a Form Composable

Full Task: Create a reusable form composable with validation.

Step 1: Define form state and validation

// composables/useForm.ts
interface FormState<T> {
  values: T
  errors: Partial<Record<keyof T, string>>
  isValid: boolean
}

Step 2: Implement reactive logic

export function useForm<T extends Record<string, any>>(
  initialValues: T,
  validate: (values: T) => Partial<Record<keyof T, string>>
) {
  const values = ref(initialValues)
  const errors = ref<Partial<Record<keyof T, string>>>({})
  
  const isValid = computed(() => Object.keys(errors.value).length === 0)
  
  const validateForm = () => {
    errors.value = validate(values.value)
    return isValid.value
  }
  
  return {
    values,
    errors: readonly(errors),
    isValid,
    validateForm,
    reset: () => { values.value = { ...initialValues } }
  }
}

Step 3: Use in component (see form-handling.mdc for integration):

<script setup lang="ts">
const { values, errors, isValid, validateForm } = useForm(
  { email: '', password: '' },
  (vals) => ({
    email: !vals.email ? 'Required' : undefined,
    password: vals.password.length < 6 ? 'Too short' : undefined
  })
)
</script>

Basic Composable Pattern

// composables/useCounter.ts
import { ref, computed } from 'vue'

export function useCounter(initialValue = 0) {
  const count = ref(initialValue)
  
  const increment = () => count.value++
  const decrement = () => count.value--
  const reset = () => count.value = initialValue
  
  const isZero = computed(() => count.value === 0)
  const isPositive = computed(() => count.value > 0)
  
  return {
    count: readonly(count),
    increment,
    decrement,
    reset,
    isZero,
    isPositive
  }
}

Read the full file on GitHub · 162 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. 3d ago First seen · 162 lines · 0 tokens per session scan A 46aebacb6cfd

Subscribe to this mod's changes

composables is a cursor rule published in the GitHub repository aliarghyani/vue-cursor-rules (11 stars, last pushed 11mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,058 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.