Skip to main content
rule

vue-claude-stack — Cursor rule: what it does and how to install

This rule guides code generation for Vue 3 and Nuxt 3, covering Composition API, TypeScript, and Pinia. Use it to give an agent consistent project conventions.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/vue-claude-stack.mdc
Open on GitHub

What vue-claude-stack does

The rule targets files matching **/* and sets conventions for Vue and Nuxt. It directs the agent to use Composition API with <script setup lang="ts">, typed props and events, and composables for reactive logic. Options API, any, and v-html with user input are disallowed. These rules shape both new components and code changes.

For Pinia, it calls for setup stores and storeToRefs() when unpacking state. Nuxt guidance covers useFetch or useAsyncData, file-based routes, and server handlers under server/api/. Tests use Vitest and @vue/test-utils, with test files beside their source. Check your Vue version: the defineModel() guidance is for Vue 3.4+.

The metadata sets globs: **/* and alwaysApply: false. In Cursor, place the rule at .cursor/rules/vue-claude-stack.mdc.

What it helps with

  • guide component generation toward Composition API
  • add types to props, events, and Pinia state
  • structure Nuxt data fetching for SSR
  • set conventions for Vue component tests
  • avoid v-html with user-provided content

Example prompts for the agent

  • Create a Vue component with <script setup lang="ts"> and typed props.
  • Add a Pinia setup store and use storeToRefs() for its state.
  • Write a colocated test with Vitest and @vue/test-utils.

How to install vue-claude-stack

Manually: put the files in place

.cursor/rules/vue-claude-stack.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about vue-claude-stack

How do I install vue-claude-stack in Cursor?

Place the rule file at .cursor/rules/vue-claude-stack.mdc.

What does vue-claude-stack do?

It sets coding conventions for Vue 3 and Nuxt 3, including Composition API, TypeScript, Pinia, routing, and tests.

Which Vue version is needed for defineModel()?

The rule uses defineModel() for Vue 3.4 and later.

Source text

vue-claude-stack.mdc · CC0-1.0
---
description: "Complete AI coding setup for Vue 3 & Nuxt 3 — .cursorrules + CLAUDE.md + Copilot instructions + generation skills."
globs: **/*
alwaysApply: false
---
You are an expert Vue 3 and Nuxt 3 developer with deep knowledge of TypeScript, Pinia, VueUse, Tailwind CSS, and the Vue ecosystem.

## Core Principles
- Always use Vue 3 Composition API with `<script setup lang="ts">`
- Never use Options API, mixins, or `this` keyword in setup
- Write TypeScript with strict mode — no `any`
- Follow Vue style guide priority A and B rules
- Prefer composables over utility functions for reactive logic

## Component Rules
- Use `defineProps<T>()` with TypeScript generics for props
- Use `defineEmits<T>()` with typed events
- Use `defineModel()` for v-model bindings (Vue 3.4+)
- Keep templates clean — extract complex logic to computed or composables
- One component per file, filename matches component name in PascalCase

## State Management (Pinia)
- Use setup stores with `defineStore('name', () => { ... })`
- Use `storeToRefs()` when destructuring store state
- Keep stores small and focused — one domain per store
- Never access store state directly in templates, use computed

## Composables
- Prefix with `use` (useAuth, useCart, useSearch)
- Accept `MaybeRef<T>` for flexible inputs
- Return `{ data, error, loading }` pattern for async composables
- Place in `composables/` directory for Nuxt auto-import

## Nuxt Specifics
- Use `useFetch` / `useAsyncData` for data fetching (SSR-compatible)
- Use file-based routing in `pages/`
- Use `definePageMeta()` for route metadata
- Server routes go in `server/api/`
- Use `createError()` for error handling

## TypeScript
- Define interfaces in `types/` directory
- Use `type` over `interface` unless extending
- Use `satisfies` operator for type checking
- No type assertions (`as`) unless absolutely necessary

## Testing
- Vitest + @vue/test-utils
- Test files next to source: `*.test.ts`
- Test behavior, not implementation
- Use `mount()` over `shallowMount()`

## Tailwind CSS
- Use utility classes directly in templates
- Extract repeated patterns to components, not CSS classes
- Use `@apply` sparingly — only in base styles
- Dark mode: use `dark:` variant

## Do NOT
- Generate Options API code
- Use `any` type — use `unknown` and narrow
- Put business logic in components
- Skip TypeScript on any file
- Use `v-html` with user input
- Mutate props
- Use `var` — always `const` or `let`

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set210

xray-test-case-cursorrules-prompt-file A Cursor rule that turns feature descriptions and automated tests into structured Xray test cases for Jira. Useful when QA writes manual scenarios by hand. ★ 41,024repo stars wordpress-claude-stack This Cursor rule guides WordPress theme, plugin, and block work. It suits projects that use PHP alongside WooCommerce or ACF. ★ 41,024repo stars webassembly-z80-cellular-automata-cursorrules-prom A Cursor rule that walks the agent through adding a region grid to a Z80 cellular automata simulation built on WebAssembly. ★ 41,024repo stars vue A Cursor rule that tells the agent how to write Vue: Composition API, Pinia, typing and routing. Useful when the project already has .vue and .ts files. ★ 41,024repo stars vue-3-nuxt-3-typescript-cursorrules-prompt-file A Cursor rule that tells the agent how to write Vue 3 and Nuxt 3 code: Composition API, TypeScript interfaces, Nuxt conventions. Useful when the project already runs this stack. ★ 41,024repo stars vscode-extension-dev-typescript-cursorrules-prompt-file Guides Cursor through TypeScript-based VS Code extension work, from project layout and manifests to API use and tests. ★ 41,024repo stars vitest-unit-testing-cursorrules-prompt-file A Cursor rule that turns the agent into a Vitest and TypeScript test writer: it targets business logic and utilities, mocking dependencies with vi.mock. ★ 41,024repo stars vercel-deployment-cursorrules-prompt-file This rule guides an agent through Vercel deployment choices, from environment variables and serverless functions to caching and CI/CD. Use it when preparing a project for deployment. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor