# Nuxt Composables

> Creating custom Vue composables with proper patterns. Use when building reusable stateful logic, shared state management, or encapsulating feature-specific behavior.

- **Type:** Skill
- **Install:** `agentstack add skill-leeovery-agentic-skills-nuxt-composables`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [leeovery](https://agentstack.voostack.com/s/leeovery)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [leeovery](https://github.com/leeovery)
- **Source:** https://github.com/leeovery/agentic-skills/tree/main/nuxt/skills/nuxt-composables

## Install

```sh
agentstack add skill-leeovery-agentic-skills-nuxt-composables
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Nuxt Composables

Creating reusable stateful logic via Vue Composition API.

## Core Concepts

**[composables.md](references/composables.md)** - Patterns, naming, state management, best practices

**[multi-step-state.md](references/multi-step-state.md)** - SSR-safe shared state across routes via `useState`, deriving step from `route.path`, submit-with-side-effects, why caller owns `loading`

## Singleton Pattern (Shared State)

State defined outside function persists across all callers:

```typescript
// app/composables/useUser.ts
let user = ref()  // Singleton - shared across app

export default function useUser() {
  const setUser = (data: BaseEntity) => {
    user.value = User.hydrate(data)
  }
  const clearUser = () => { user.value = undefined }

  return { user, setUser, clearUser }
}
```

## Factory Pattern (Fresh State)

State defined inside function - new instance per call:

```typescript
// app/composables/useCounter.ts
export default function useCounter(initial = 0) {
  const count = ref(initial)  // Fresh per call
  const increment = () => count.value++
  const decrement = () => count.value--

  return { count, increment, decrement }
}
```

## Naming & File Conventions

| Convention | Example |
|------------|---------|
| File name | `useUser.ts`, `useCategories.ts` |
| Function | `export default function useUser()` |
| Return | Always object `{ state, methods }` |
| Refs | Reactive: `user`, not `userRef` |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [leeovery](https://github.com/leeovery)
- **Source:** [leeovery/agentic-skills](https://github.com/leeovery/agentic-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-leeovery-agentic-skills-nuxt-composables
- Seller: https://agentstack.voostack.com/s/leeovery
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
