nuxtjs-vue-typescript-development-rules — правило для Claude Code
Правило nuxtjs-vue-typescript-development-rules задаёт стандарты фронтенд-разработки на Nuxt 3, Vue 3 и TypeScript: от структуры папок и компонентов с Tailwind до типизации без enum.
MIT ★ 571 обновлён 2026-07-03
.claude/rules/NuxtJS-Vue-TypeScript-Development-Rules.mdЧто делает nuxtjs-vue-typescript-development-rules
Инструкция настраивает Claude Code на генерацию чистого кода для Nuxt 3, Vue 3, TypeScript, Pinia, VueUse и Tailwind CSS. Модель использует только Composition API с синтаксисом <script setup>, полностью исключая Options API. Компоненты оформляются через Shadcn Vue и Radix Vue с версткой mobile-first.
В кодовой базе действует строгий запрет на enum: вместо них используются константные объекты const, а псевдонимы type предпочитаются интерфейсам. Файлы структурируются по чёткой схеме: сначала экспортируемый компонент, затем композаблы, вспомогательные функции, статические данные и типы. Запросы к серверу пишутся только через Nuxt-методы useFetch и useAsyncData.
Следование правилу исключает разнобой в именовании. Директории именуются через дефис, компоненты пишутся в PascalCase, а композаблы — в camelCase.
Какие задачи решает
- Настроить генерацию кода на Nuxt 3 и Vue 3 в едином стиле
- Перевести работу с состоянием и запросами на Pinia и useFetch
- Унифицировать именование компонентов, папок и композаблов
- Внедрить стилизацию через Tailwind CSS и Shadcn Vue
Примеры запросов агенту
- Создай форму авторизации
AuthWizard.vueс валидацией через VueUse и стилями Tailwind. - Напиши композабл
useAuthState.tsдля управления профилем с сохранением в Pinia. - Сделай страницу с получением данных через
useFetchи оптимизацией SEO.
Как установить nuxtjs-vue-typescript-development-rules
Вручную: положить файлы
.claude/rules/NuxtJS-Vue-TypeScript-Development-Rules.mdПоле paths во frontmatter ограничивает файлы
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.cursor/rules/NuxtJS-Vue-TypeScript-Development-Rules.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.github/instructions/NuxtJS-Vue-TypeScript-Development-Rules.instructions.mdПоле applyTo задаёт, к каким файлам применять
Вручную: положить файлы
.devin/rules/NuxtJS-Vue-TypeScript-Development-Rules.mdВручную: положить файлы
.clinerules/NuxtJS-Vue-TypeScript-Development-Rules.mdПо шагам, с командами для каждой платформы: AGENTS.md и CLAUDE.md: что это, кто читает и какой выбрать
Вопросы о nuxtjs-vue-typescript-development-rules
Как установить nuxtjs-vue-typescript-development-rules в Claude Code?
Сохраните файл правила по пути .claude/rules/NuxtJS-Vue-TypeScript-Development-Rules.md в корне вашего проекта.
Что делает nuxtjs-vue-typescript-development-rules?
Правило обязывает модель писать код для Nuxt 3 с использованием Composition API, синтаксиса <script setup>, типов вместо enum и компонентов Shadcn Vue.
Какие библиотеки для состояния и запросов предписывает правило?
Для хранения состояния правило требует использовать Pinia, а для сетевых запросов — встроенные методы useFetch и useAsyncData.
Исходный текст
NuxtJS-Vue-TypeScript-Development-Rules.md · MIT
# NuxtJS Vue TypeScript Development Rules
```json
You are an expert in TypeScript, Node.js, NuxtJS, Vue 3, Shadcn Vue, Radix Vue, VueUse, and Tailwind.
Code Style and Structure
- Write concise, technical TypeScript code with accurate examples.
- Use composition API and declarative programming patterns; avoid options API.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, composables, helpers, static content, types.
Naming Conventions
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Use PascalCase for component names (e.g., AuthWizard.vue).
- Use camelCase for composables (e.g., useAuthState.ts).
TypeScript Usage
- Use TypeScript for all code; prefer types over interfaces.
- Avoid enums; use const objects instead.
- Use Vue 3 with TypeScript, leveraging defineComponent and PropType.
Syntax and Formatting
- Use arrow functions for methods and computed properties.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use template syntax for declarative rendering.
UI and Styling
- Use Shadcn Vue, Radix Vue, and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.
Performance Optimization
- Leverage Nuxt's built-in performance optimizations.
- Use Suspense for asynchronous components.
- Implement lazy loading for routes and components.
- Optimize images: use WebP format, include size data, implement lazy loading.
Key Conventions
- Use VueUse for common composables and utility functions.
- Use Pinia for state management.
- Optimize Web Vitals (LCP, CLS, FID).
- Utilize Nuxt's auto-imports feature for components and composables.
Nuxt-specific Guidelines
- Follow Nuxt 3 directory structure (e.g., pages/, components/, composables/).
- Use Nuxt's built-in features:
- Auto-imports for components and composables.
- File-based routing in the pages/ directory.
- Server routes in the server/ directory.
- Leverage Nuxt plugins for global functionality.
- Use useFetch and useAsyncData for data fetching.
- Implement SEO best practices using Nuxt's useHead and useSeoMeta.
Vue 3 and Composition API Best Practices
- Use <script setup> syntax for concise component definitions.
- Leverage ref, reactive, and computed for reactive state management.
- Use provide/inject for dependency injection when appropriate.
- Implement custom composables for reusable logic.
Follow the official Nuxt.js and Vue.js documentation for up-to-date best practices on Data Fetching, Rendering, and Routing.
```
© qdleader · MIT · qdleader/Awesome-AI-Pedia