--- name: dev-vue-component description: Create, modify, and maintain Vue 3 components with TypeScript and SCSS. Use when building Vue components, modifying .vue files, defining component props/emits, styling with SCSS, or documenting component APIs. Handles component architecture, type safety, styling patterns, and documentation. license: Apache-2.0 compatibility: Requires Vue 3, TypeScript, SCSS, UnoCSS. metadata: author: xiaoland version: "1.0" related-skills: "vue-story" --- # Developing Vue Components ## When to use this skill Use this skill when you need to: - Create new Vue 3 components from scratch - Modify existing Vue components (template, logic, or styles) - Define or update component props, emits, and TypeScript types - Write or update component SCSS styles - Document component APIs and usage - Refactor components for better type safety or structure - Review components for best practices compliance ## Component File Structure - `compName.vue`: Template and component logic , read more in[vue-guide.md](references/vue-guide.md) - `compName.ts`: Props, emits, types, constants (public API) read more in [typescript-guide.md](references/typescript-guide.md) - `compName.scss`: Component styles, read more in [scss-guide.md](references/scss-guide.md) - `compName.md`: Component documentation, read more in [documentation-guide.md](references/documentation-guide.md) ## Instructions ### Creating a New Component Follow these steps to create a new Vue component: 1. **Create component folder**: `compName/` 2. **Document the component** (spec-first): - Create `compName.story.md` if using Histoire, otherwise create `compName.md` - Document intended props, emits, slots, and usage - Define component behavior and user interaction patterns - See [documentation-guide.md](references/documentation-guide.md) for format 3. **Define types and API** (`compName.ts`): - Define props interface with JSDoc comments - Define emits interface - Export types, constants, and utilities - See [typescript-guide.md](references/typescript-guide.md) for patterns 4. **Implement component logic** (`compName.vue`): - Import types from `compName.ts` - Use `