vue-component-patterns
/vue-component-patterns
Apply when writing, typing, naming, or refactoring an individual Vue component. Esposter's Vue 3 component authoring — how one component is written, typed and named.
- Author
- Esposter ↗
- Repository
- Esposter ↗
- Licence
- Apache-2.0
- Last repository change
- 26.10.2026
Assessment and security
- Files in this package
- 9
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
Apply when writing, typing, naming, or refactoring an individual Vue component. Esposter's Vue 3 component authoring — how one component is written, typed and named.
Original author description
Apply when writing, typing, naming, or refactoring an individual Vue component. Esposter's Vue 3 component authoring — how one component is written, typed and named.
How it works
- Deep dives
- Shared Shell / Design-System Primitives — references/shared-shell.md
- Same Level of Abstraction
- Selection State: Read the Store, Don't Thread Props
- Async Data: Wrapper + Pure Child Pattern
- A Registry of Heavy Components Loads on Demand — references/async-components.md
- Boolean Props — is Prefix + Default-Aware Literal Typing
- Emits — Present-Tense Event Names
- Component Folder Naming — references/component-naming.md
- File Length
SKILL.md preview
---
name: vue-component-patterns
description: Apply when writing, typing, naming, or refactoring an individual Vue component. Esposter's Vue 3 component authoring — how one component is written, typed and named.
---
# Vue Component Patterns (Esposter)
How an individual component is written, typed and named. Assembling a page or list _from_ components — decomposition, `v-for` items, action items, singleton dialogs — is the `vue-page-composition` skill's.
## Deep dives
- `references/props-and-generics.md` — when a prop or model type depends on an enum/discriminant key, when one component is absorbing several data variants, or when a boolean prop has a default.
- `references/component-naming.md` — when creating, renaming or moving a component file, when a directory of components gets crowded, or when a tag renders empty with no error.
- `references/shared-shell.md` — when a page needs chrome, or a new product or editor is added.
- `references/async-components.md` — when a map dispatches a heavy component, or a component awaits in setup behind a `v-if`.
- `references/slots.md` — when a component declares a slot, forwards an optional slot into a library component, or a named slot's content has grown non-trivial.
- `references/abstraction-levels.md` — when a script setup mixes a composable with a hand-built block for one concept.
- `references/selection-and-keys.md` — when a child reads the selection, initialises state from a prop, or a `:key` would be bumped.
- `references/wrapper-and-child.md` — when a component initialises editable state from data that may not have arrived.
## Shared Shell / Design-System Primitives — `references/shared-shell.md`
Cross-product chrome is a small set of shared components in `apps/web/app/components/Ui/` (the UI library) and `apps/web/app/components/App/` (app-chrome) — **reuse them, never re-roll a bare toolbar per editor.** Their design and rationale live in `openspec/specs/resource/shell-cohesion/design.md`.
The `resource` layout's page header, `UiEmptyState`, `UiSkeleton` and `AppBreadcrumbs` are the set; what each is for, and what a new product or editor wires up (its page's header, a launcher entry), is that page. A search of its own is a scope of the one command palette (the `ui-library` skill, `references/keys-and-commands.md`).
## Same Level of Abstraction
Every statement in `<script setup>` sits at one conceptual level — a lower-level block moves to the store or composable that owns its concept (`references/abstraction-levels.md`).
## Selection State: Read the Store, Don't Thread Props
A child reads the selection from the store rather than a threaded prop; local state initialised from a prop resets through `:key`, which names the thing rendered and is never a counter (`references/selection-and-keys.md`).
## Async Data: Wrapper + Pure Child Pattern
Data that may arrive after mount splits into an `Index.vue` wrapper owning the lookup and `v-if`, and a pure child taking it as a required prop (`references/wrapper-and-child.md`).
## A Registry of Heavy Components Loads on Demand — `references/async-components.md`
A map dispatching a component by type puts every entry in its importer's chunk, so a registry whose entries carry heavy vendors holds `defineAsyncComponent(() => import(...))` loaders, and every render site of it puts the `<component :is>` inside a `<Suspense>` whose fallback is a `UiSkeleton` sized to the region. A registry of small components stays static, and a component that `await`s in setup behind a `v-if` owes the same boundary.
## Boolean Props — `is` Prefix + Default-Aware Literal Typing
- **`is` prefix.** Boolean props read as a question: `isDense`, `isInteractive`, `isOpen` — never bare `dense` / `interactive` / `open`, and never `can*` / `should*` (prefer `is`, fall back to `has` — the `naming` skill, "Booleans"). The same applies to `defineModel` / emit payloads.
- **Type as the non-default literal, not `boolean`**, so passing the default is impossible: defaults-false → `?: true` (caller opts in with the bare attribute), defaults-true → `?: false` with a destructure default `= true`. Derived values, and the genuinely two-way boolean, are in `references/props-and-generics.md`.
## Emits — Present-Tense Event Names
Emit names are **present-tense verbs**: `delete`, `update`, `create`, `save`, `submit` — never past tense (`deleted`, `updated`, `copied`). The event names the action the parent should handle, not a completed fact; past-tense names also drift from Vue/DOM convention (`click`, `submit`, `change`).
For state-sync emits, use the `update:x` form where `x` is the state name (`"update:copied": [boolean]`) — the verb stays present tense; the state name may be any shape.
## Component Folder Naming — `references/component-naming.md`
A component that gains a folder moves into it as `Index.vue`, never beside the folder; the folder path is the prefix and is never repeated in the filename, since Nuxt builds the auto-import name from both.
## File Length
The line-count target, the exceptions and what a `.vue` over it is split into are the `file-organization` skill's, "File Length". How an extracted slot is named and where it lives is `references/slots.md`.
## Slots
**Every component that renders a `<slot>` declares `defineSlots`** — typed slot contracts, same as props (`defineSlots<{ default: () => VNode }>()`; `?:` when the consumer may omit it). Forwarding an _optional_ slot into a library component that falls back to a prop needs `#default` + `v-if` on the same template, and extracting a non-trivial slot's content into its own component follows a naming convention — both in `references/slots.md`.
Files in this package (9)
- SKILL.md 6 KB
- references/abstraction-levels.md 1 KB
- references/async-components.md 3 KB
- references/component-naming.md 3 KB
- references/props-and-generics.md 3 KB
- references/selection-and-keys.md 2 KB
- references/shared-shell.md 2 KB
- references/slots.md 4 KB
- references/wrapper-and-child.md 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · Esposter/Esposter | 90 | Apache-2.0 |
| TheBushidoCollective/han | 91 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 8d5f98ff8843 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90vue
Apply when writing or reviewing .vue files, or rendering a date or time. Esposter's Vue 3 single-file-component conventions. - 95frontend-component
Create React/Vue component with TypeScript, tests, and styles. Auto-invoke when user says "create component", "add component", "new component", or "build component". - 100vue-component-generator
Generate vue component generator operations. Auto-activating skill for Frontend Development. Triggers on: vue component generator, vue component generator Part of the Frontend Development skill category. Use when working with vue component generator functionality. Trigger with… - 90vue-composable-patterns
Apply when writing or reviewing a composable, a form dialog, browser-aware reactive code, or any state that spans an await, a tick or a mount. Esposter's Vue 3 composable and form-dialog patterns, built on the primitives that already own async sequencing, persistence and teardown. - 90vue-best-practices
Vue 3 and Vue.js best practices for TypeScript, vue-tsc, and Volar. This skill should be used when writing, reviewing, or refactoring Vue components to ensure correct typing patterns. Triggers on tasks involving Vue components, props extraction, wrapper components, template type… - 100vue
Vue 3 conventions, Composition API patterns, SFC structure, reactivity, composables, and TypeScript integration. Invoke whenever task involves any interaction with Vue code — writing, reviewing, refactoring, debugging, or understanding .vue files, composables, and Vue component architecture.