vue-patterns
यह क्या करती है
यह गाइड Vue.js 3, Nuxt और Pinia के साथ ऐप बनाने के अच्छे तरीके सिखाती है। इसमें कोड व्यवस्थित करना, दोबारा इस्तेमाल होने वाले components बनाना, और ऐप की state मैनेज करना शामिल है।
कब इस्तेमाल करें
- ✓जब नया Vue.js या Nuxt प्रोजेक्ट शुरू कर रहे हों।
- ✓जब प्रोजेक्ट का कोड बेहतर व्यवस्थित करना हो।
- ✓जब दोबारा इस्तेमाल होने वाले components बनाने हों या ग्लोबल डेटा मैनेज करना हो।
Skill का लिंक
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/vue-patterns/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“Vue.js प्रोजेक्ट में फ़ाइलें किस तरह व्यवस्थित करनी चाहिए?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI इन दिशानिर्देशों का इस्तेमाल करके फ़ोल्डर की संरचना, नामकरण के नियम, और `.vue` फ़ाइलों में elements का सही क्रम सुझाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Vue.js Patterns and Best Practices
Comprehensive guide for Vue.js 3 development using Composition API (<script setup>), covering component design, reactivity, state management, routing, testing, and SSR patterns. Nuxt-specific guidance is included where it differs from vanilla Vue.
When to Activate
Activate this skill when:
- The project uses Vue.js (any version), Nuxt, Vite + Vue, or Pinia.
- The user asks about Vue component architecture, composables, reactivity, or state management.
- Reviewing Vue Single-File Components (
.vuefiles). - Setting up Vue Router, Pinia stores, or Vite/Vitest configuration.
- Discussing Vue-specific performance, security, or SSR patterns.
1. Project Structure
Recommended Layout (Feature-First)
src/
├── api/ # API client and endpoint definitions
├── assets/ # Static assets (images, fonts, icons)
├── components/ # Shared/reusable components
│ ├── base/ # Base UI primitives (Button, Input, Modal)
│ └── features/ # Feature-specific shared components
├── composables/ # Reusable Composition API logic
├── layouts/ # Page layouts (optional)
├── pages/ # Route-level page components
├── router/ # Vue Router configuration
├── stores/ # Pinia stores
├── types/ # TypeScript type definitions
├── utils/ # Pure utility functions
└── App.vue # Root component
File Naming
| Convention | When to Use |
|---|---|
PascalCase.vue |
All components (enforced by vue/multi-word-component-names) |
useCamelCase.ts |
Composables |
camelCase.ts |
Utilities, API clients, types |
kebab-case directories |
Route segments, feature folders |
2. Component Architecture
Single-File Component Order
<script setup lang="ts">
// 1. Imports (vue → ecosystem → absolute → relative)
// 2. Props & Emits & Slots
// 3. Composables
// 4. Local state (ref/reactive)
// 5. Computed properties
// 6. Methods
// 7. Watchers
// 8. Lifecycle hooks
</script>
<template>
<!-- Template content -->
</template>
<style scoped>
/* Scoped styles */
</style>
Presentational vs Container
- Container components: Own data fetching, state, and side effects. Render presentational components.
- Presentational components: Receive props, emit events. No API calls, no store access. Pure rendering.
Props Best Practices
// Type-based props with defaults
interface Props {
label: string;
variant?: "primary" | "secondary";
disabled?: boolean;
items: Item[];
}
const props = withDefaults(defineProps<Props>(), {
variant: "primary",
disabled: false,
});
- Always provide
type, andrequired/defaultwhere appropriate. - Boolean props:
isXxx,hasXxx,canXxx. - Never mutate props — emit events instead.
- For v-model binding, use
defineModel()(Vue 3.4+) ormodelValue+update:modelValue.
Events
const emit = defineEmits<{
submit: [];
"update:modelValue": [value: string];
select: [id: string, index: number];
}>();
- Use kebab-case in templates (
@update:model-value). - Use camelCase in script (
emit("update:modelValue", val)).
3. Composables (Reusable Logic)
Structure
// composables/useDebounce.ts
export function useDebounce<T>(value: MaybeRef<T>, delay: number): Ref<T> {
const debounced = ref(toValue(value)) as Ref<T>;
let timer: ReturnType<typeof setTimeout>;
watch(
() => toValue(value),
(newVal) => {
clearTimeout(timer);
timer = setTimeout(() => { debounced.value = newVal; }, delay);
}
);
onUnmounted(() => clearTimeout(timer));
return readonly(debounced);
}
Rules
- Must start with
useprefix. - Return reactive values (
ref,computed,reactive), never plain primitives. - Accept reactive inputs via
MaybeRef/toRef()/toValue(). - Clean up side effects in
onUnmountedor watcheronCleanup. - No module-scope side effects.
vs Mixins
Composables replace Vue 2 mixins entirely:
- Mixins: Opaque data flow, source-of-truth collisions, name conflicts.
- Composables: Explicit imports, clear return values, composable and tree-shakable.
4. State Management
When to Use What
| Pattern | Use Case |
|---|---|
ref() / reactive() |
Local component state |
| Props + Emits | Parent-child communication |
| Provide / Inject | Theme, config, plugin API |
…
अक्सर पूछे जाने वाले सवाल
Composition API क्या है?
यह Vue.js में कोड का लॉजिक व्यवस्थित करने का ज़्यादा लचीला तरीका है, जिसमें `ref`, `reactive` और `watch` जैसे functions इस्तेमाल होते हैं।
Presentational और Container components में क्या अंतर है?
Container components डेटा और लॉजिक संभालते हैं, जबकि Presentational components सिर्फ़ जानकारी दिखाते हैं और निर्देश लेते हैं।
Pinia कब इस्तेमाल करें, `ref` या `reactive` की जगह?
Pinia उस डेटा के लिए इस्तेमाल करें जो आपके ऐप के कई हिस्सों में साझा होना चाहिए, जबकि `ref` और `reactive` किसी component के अपने local डेटा के लिए हैं।
जानकारी
लेखक का मूल विवरण
Vue.js 3 Composition API patterns, component architecture, reactivity best practices, Pinia state management, Vue Router navigation, and Nuxt SSR patterns. Activates for Vue, Nuxt, Vite, or Pinia projects. Use when building or reviewing Vue 3, Nuxt, or Pinia code — Composition API, reactivity, or router navigation.
repo: affaan-m/ECC
लोकप्रियता
- GitHub स्टार
- 280k
- रैंकिंग में स्थान
- #257
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
accessibility
280kयह आपके एजेंट को ऐसे इंटरफ़ेस बनाने में मदद करता है जिन्हें हर कोई इस्तेमाल कर सके। यह पक्का करता है कि वेबसाइट और ऐप दिव्यांग लोगों के लिए भी अच्छे से काम करें, जैसे नेत्रहीन या जिन्हें चलने-फिरने में दिक्कत होती है।
agent-architecture-audit
280kयह आपके एजेंट को जाँचने देता है कि सब कुछ सही से चल रहा है। यह AI सिस्टम में समस्याएँ ढूँढकर ठीक करता है, ताकि वे उम्मीद के मुताबिक काम करें।
agent-eval
280kयह आपके एजेंट को अलग-अलग AI coding tools की तुलना करने में मदद करता है। यह मापता है कि किसी खास काम के लिए कौन सा टूल ज़्यादा तेज़, सस्ता और भरोसेमंद है।
agent-harness-construction
280kयह आपके एजेंट को काम कैसे करना है, यह बेहतर समझने में मदद करता है। यह उन tools और instructions को बेहतर बनाता है जिनका एजेंट इस्तेमाल करता है, ताकि उसकी सफलता की संभावना बढ़े।
मिलती-जुलती skills
dream-loop
260kआपके एजेंट को 3D दृश्य या विज़ुअल ऐप के स्क्रीनशॉट को कॉन्सेप्ट आर्ट से मिलाकर बार-बार सुधारते हुए उच्च ग्राफ़िकल गुणवत्ता की ओर ले जाने देती है।
pretext
260kब्राउज़र के ऐसे खेल-भरे डेमो बनाती है जहां टेक्स्ट चलती आकृतियों के चारों ओर बहता है, गेम लेवल बनाता है, या कणों में टूट जाता है।
page-agent
260kआपके एजेंट को वेब ऐप में अंतर्निहित AI सहायक जोड़ने में मदद करती है, ताकि उपयोगकर्ता सादी भाषा में आदेश दे सकें, जिन्हें पेज पूरा करे।