К основному содержанию
скилл CX Codex

components — скилл для Claude Code: что делает и как установить

Скилл components для Claude Code помогает собирать Vue-интерфейсы из однофайловых компонентов, связывая шаблон, логику и стили. Помогает структурировать экран и повторно использовать его части.

MIT 212 установок ★ 259 обновлён 2026-04-15

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add PatternsDev/skills --skill components -a claude-code
Открыть на GitHub

Что делает components

Скилл задаёт основы Vue-компонентов: предлагает размещать разметку в <template>, логику в <script setup>, а стили в <style> внутри .vue-файлов. Для реактивных значений он различает ref() для примитивов и reactive() для объектов. Данные идут от родителя к дочернему компоненту через props, события — обратно.

На примере компонента публикации скилл показывает, как вынести аватар, сведения об авторе и детали в отдельные части. Кандидаты на выделение — повторно используемые элементы вроде Button и Avatar, а также самостоятельные сложные блоки. Для компиляции .vue-файлов нужны инструменты сборки вроде Vite, поэтому в проекте без сборки этот подход не заработает без настройки.

Скилл применяется к файлам **/*.vue. Он пригодится при создании компонентов и разбиении перегруженного шаблона на дочерние части.

Какие задачи решает

  • разделить большой Vue-компонент на дочерние
  • передать данные от родителя через props
  • отправить событие из дочернего компонента
  • настроить реактивное состояние для примитивов и объектов
  • собрать разметку, логику и стили в .vue-файле

Примеры запросов агенту

  • Разбей компонент Tweet на переиспользуемые дочерние компоненты.
  • Создай Vue-компонент с <template>, <script setup> и <style>.
  • Покажи, как передать данные через props и отправить событие родителю.

Как установить components

1Через Skills CLI (Vercel)

npx skills add PatternsDev/skills --skill components -a claude-code

2Вручную: положить файлы

~/.claude/skills/components/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/components/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о components

Как установить components в Claude Code?

Выполните npx skills add PatternsDev/skills --skill components -a claude-code. Файл скилла находится по пути ~/.claude/skills/components/SKILL.md.

Что делает скилл components?

Он объясняет структуру Vue-компонентов, реактивное состояние, передачу props и событий, а также разбиение крупных компонентов на повторно используемые части.

Нужен ли инструмент сборки для компонентов .vue?

Для компиляции .vue-файлов нужны инструменты сборки вроде Vite. В скилле также описан вариант компонента как обычного JavaScript-объекта для приложения без сборки.

Исходный текст

SKILL.md · MIT
---
name: components
description: Teaches Vue component fundamentals including markup, logic, and styles. Use when building or structuring Vue single-file components as the foundational building blocks of your application.
paths:
  - "**/*.vue"
license: MIT
metadata:
  author: patterns.dev
  version: "1.1"
related_skills:
  - "composables"
  - "script-setup"
---

# Components

## Table of Contents

- [When to Use](#when-to-use)
- [Instructions](#instructions)
- [Details](#details)
- [Source](#source)

Vue components are the building blocks of Vue apps by allowing us to couple markup (HTML), logic (JS), and styles (CSS) within them.

When working within a Vue application, it's important to understand that almost every element displayed in the UI is oftentimes part of a Vue component. This is because a Vue application is often composed of components nested within components, forming a hierarchical structure.

## When to Use

- Use this as foundational knowledge for building any Vue application
- This is helpful for understanding how to structure, compose, and reuse UI elements in Vue

## Instructions

- Use single-file components (`.vue` files) with `<template>`, `<script setup>`, and `<style>` sections
- Extract reusable parts of large components into smaller child components
- Use `ref()` for reactive primitive values and `reactive()` for reactive objects
- Pass data from parent to child using props; emit events from child to parent

## Details

Reusability and maintainability are some of the main reasons why building an application with well-structured components are especially important.

To get a better understanding of components, we'll go ahead and create one. The simplest way to create a Vue component in an application that doesn't contain a build process (e.g. Webpack) is to create a plain JavaScript object that contains Vue specific options.

```js
export default {
  props: ["name"],
  template: `<h1>Hello, my name is {{ name }}</h1>`,
};
```

The component has a `props` property defined, which accepts a single prop named `name`. Props are a way to pass data into a component from its parent component.

The `template` property defines the HTML template for the component. In this case, it contains an `<h1>` heading tag that displays the text `"Hello, my name is"` followed by the value of the `name` prop, which is rendered using Vue's double curly braces syntax `{{ }}`.

Aside from defining components as plain JavaScript objects, the most common way of creating components in Vue are with single-file components (SFCs). Single-file components are components that allow us to define the HTML, CSS, and JS of a component all within a special `.vue` file, as shown below:

```html
<template>
  <h1>Hello, my name is {{ name }}</h1>
</template>

<script setup>
  const { name } = defineProps(["name"]);
</script>
```

> Note: Single-file components in Vue are made possible due to build tools like [Vite](https://vitejs.dev/). These tools help compile `.vue` components to plain JavaScript modules that can be understood in browsers.

### Components = building blocks

We'll go through a simple exercise to illustrate how components can be split into smaller components. Consider a fictional `Tweet` component.

The component can be implemented with something as follows:

```html
<template>
  <div class="Tweet">
    <image class="Tweet-image" :src="image.imageUrl" :alt="image.description" />
    <div class="User">
      <image class="Avatar" :src="author.avatarUrl" :alt="author.name" />
      <div class="User-name">{{ author.name }}</div>
    </div>
    <div class="Details">
      <div class="Tweet-text">{{ text }}</div>
      <div class="Tweet-date">{{ formatDate(date) }}</div>
      <!-- ... -->
    </div>
  </div>
</template>

<script setup>
  // ...
</script>
```

One can look at the above component and consider it difficult to manipulate because of how clustered it is, and reusing individual parts of it may also prove difficult. To make things more composable, we can extract a few components from this one component.

We can have the main `Tweet` component be the parent to the `TweetUser` and `TweetDetails` components. `TweetUser` will display the user's information and be a parent to a `TweetAvatar` component that displays the user's avatar. `TweetDetails` will simply display additional information in the tweet such as the tweet text and the date of submission.

We can first create the child `TweetAvatar` component to contain the avatar image element.

```html
<template>
  <image class="Avatar" :src="author.avatarUrl" :alt="author.name" />
</template>

<script setup>
  // ...
</script>
```

We can then create the `TweetUser` component that renders the `TweetAvatar` component and relevant user information.

```html
<template>
  <div class="User">
    <TweetAvatar />
    <div class="User-name">{{ author.name }}</div>
  </div>
</template>

<script setup>
  import { TweetAvatar } from "./TweetAvatar.vue";
</script>
```

We can create the `TweetDetails` component to render the remaining information in the tweet.

```html
<template>
  <div class="Details">
    <div class="Tweet-text">{{ text }}</div>
    <div class="Tweet-date">{{ formatDate(date) }}</div>
    <!-- ... -->
  </div>
</template>

<script setup>
  // ...
</script>
```

Finally, we can use these newly created child components to simplify the template of the parent `Tweet` component.

```html
<template>
  <div class="Tweet">
    <image class="Tweet-image" :src="image.imageUrl" :alt="image.description" />
    <TweetUser :author="author" />
    <TweetDetails :text="text" :date="date" />
  </div>
</template>

<script setup>
  // ...
</script>
```

Extracting components seems like a tedious job, but having reusable components makes things easier when coding for larger apps. A good criterion to consider when simplifying components is this — if a part of your UI is used several times (`Button`, `Panel`, `Avatar`), or is complex enough on its own (`App`, `FeedStory`, `Comment`), it is a good candidate to be extracted into a separate component.

### Reactive state

Reactive state is a fundamental concept in Vue components that enables dynamic and responsive user interfaces. It allows components to **update and reflect changes in their data automatically**.

In Vue, we can define reactive data properties with the `ref()` function (for standalone primitive values) and the `reactive()` function (for objects). Let's consider a simple example of a counter component:

```html
<template>
  <div>
    <h2>Counter: {{ count }}</h2>
    <button @click="increment">Increment</button>
    <button @click="decrement">Decrement</button>
  </div>
</template>

<script setup>
  import { ref } from "vue";

  const count = ref(0);

  const increment = () => {
    count.value++;
  };

  const decrement = () => {
    count.value--;
  };
</script>
```

In the above example, we define a reactive property `count` and initialize it with a value of 0. The template then uses double curly braces `{{ }}` to display the current value of `count`.

The template also includes two buttons: `"Increment"` and `"Decrement"`, which are bound to the corresponding `increment()` and `decrement()` methods using the `@click` directive. Inside these methods, we access and modify the value of the reactive `count` property. **Vue detects the changes and automatically updates the component's rendering to reflect the new value.**

Reactive state in Vue components provides a seamless way to manage and track data changes, making it easier to build interactive and dynamic user interfaces.

### Conclusion

This article aims to be a simple introduction to the concept of components. In the other articles and guides, we'll be taking a deeper dive into understanding common and important patterns when working with Vue and Vue components. This includes but is not limited to:

- [Using the `<script setup>` syntax](/vue/script-setup)
- [Creating composables to reuse stateful logic](/vue/composables)
- [Passing data down multiple components with provide/inject](/vue/provide-inject)
- [Understanding application-wide state management](/vue/state-management)
- [Using dynamic components to dynamically switch between components](/vue/dynamic-components)
- [Rendering component templates with JSX](/vue/render-functions)
- and a lot more.

## Source

- [patterns.dev/vue/components](https://patterns.dev/vue/components)

### References

- [Components Basics | Vue Documentation](https://vuejs.org/guide/essentials/component-basics.html#components-basics)
- [Reactivity Fundamentals | Vue Documentation](https://vuejs.org/guide/essentials/reactivity-fundamentals.html)

© patterns.dev · MIT · PatternsDev/skills

Похожие скиллы

Все скиллы по теме «Фронтенд и UI» →
vueuse-components-skilld skilld-dev Скилл vueuse-components-skilld помогает писать и отлаживать Vue 3-шаблоны с компонентами и директивами @vueuse/components. Пригодится и при переходе от composable к компонентной или директивной форме. CX Codex +1 168установок interaction-patterns-components hueyexe Скилл interaction-patterns-components помогает агенту выбирать и критиковать UI-паттерны и переиспользуемые компоненты: навигация, таблицы, модалки, формы, состояния. CX Codex +1 622установок Open Components uxfront-com MCP-сервер Open Components отдаёт агенту контракты и правила UI-компонентов по разделам, чтобы код соответствовал стандарту UX, DX и AX. Подключается без входа в аккаунт. CX Codex +1 ★ 16звёзд репо vuetify0 vuetifyjs Скилл vuetify0 подсказывает агенту, какие компоненты и composables из @vuetify/v0 взять вместо самописной логики — от кнопки до виртуального списка. CX Codex +1 742установок vuejs-development manutej Скилл vuejs-development для Claude Code и других ИИ-агентов: покрывает реактивность, Composition API, однофайловые компоненты и директивы Vue 3. Помогает писать SPA и переходить с Options API. CX Codex +1 512установок vue-expert 0xfurai Субагент vue-expert для Claude Code, заточенный под разработку на Vue.js. Помогает писать однофайловые компоненты, настраивать Vue Router и проектировать хранилище Vuex. CX Codex ★ 1 029звёзд репо

Из того же набора58

Весь набор →
prototype-pattern Скилл prototype-pattern обучает ИИ-агента паттерну Prototype для JavaScript и TypeScript. Помогает экономить память через цепочку прототипов и общие методы объектов. CX Codex +1 636установок proxy-pattern Скилл proxy-pattern для Claude Code объясняет паттерн Proxy в JavaScript: перехват чтения и записи свойств объекта, валидация и логирование при изменении данных. CX Codex +1 635установок flyweight-pattern Скилл flyweight-pattern учит агента применять паттерн приспособленец для экономии памяти при создании множества похожих объектов. CX Codex +1 634установок mediator-pattern Скилл mediator-pattern для Claude Code объясняет паттерн «посредник»: компоненты общаются через одну точку, а не напрямую. Снижает число прямых связей между объектами. CX Codex +1 631установок composables Скилл composables для Claude Code учит писать Vue-композаблы — переиспользуемую логику на Composition API. Выносит реактивное состояние, вычисления и побочные эффекты в функции для нескольких компонентов. CX Codex +1 211установок async-components Скилл async-components учит агента загружать Vue-компоненты асинхронно через defineAsyncComponent(), чтобы не тянуть тяжёлые модалки и диалоги при старте. CX Codex +1 207установок container-presentational Скилл container-presentational учит разделять Vue-компоненты на контейнеры (логика, запросы) и презентационные (вёрстка). Презентационный компонент получает данные через props и не трогает состояние. CX Codex +1 205установок data-provider Объясняет паттерн data provider во Vue: логика загрузки и состояния передаётся дочерним компонентам через scoped slots. CX Codex +1 204установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой