Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

frontend-rules

БесплатноБез исполняемых скриптовНе проверен

Frontend conventions and component usage rules. Read before writing any frontend code. Covers styling, component library, data flow, and UI patterns. Trigger…

letehahaот letehaha★ 280 звёзд на GitHub

Об этом скилле

Frontend Rules & Conventions

Reference guide for all frontend code in packages/frontend/. Read this before writing or modifying frontend components.


General

  • All file names use kebab-case (e.g., reminder-form-dialog.vue, use-submit-transaction.ts)
  • All components use <script setup lang="ts">
  • Use TypeScript — no any unless absolutely unavoidable
  • Use date-fns for all date formatting and manipulation. Never use raw Date methods or other date libraries
  • Magic numbers: when a numeric literal's meaning isn't obvious from context, extract it into a descriptive constant (e.g., const MAX_VISIBLE_TAGS = 5). Simple, self-evident values (array indices, 0/1 checks, common multipliers, etc.) are fine inline — use your judgement

Project Structure

API layer

All API call functions live in src/api/. Components and composables must import from there — never inline fetch or axios calls directly in components.

Component placement

  • Shared / reusable components go in components/common/ or components/lib/
  • Page-specific components go in pages/<feature>/components/

Route constants

Route paths are defined as constants in routes/constants.ts. Always use those constants for router.push() and <RouterLink :to="...">. Never hardcode path strings.

Responsive breakpoints

The project defines CUSTOM_BREAKPOINTS and provides the useWindowBreakpoints composable. Use those for JS-based responsive logic — never use custom media queries or magic pixel values.

Container queries for content-area layout

The app has a ~300px sidebar visible on screens wider than 768px, so the content area is significantly narrower than the viewport (e.g., 900px screen = ~600px content). Viewport breakpoints (md:, lg:) don't account for this and can produce wrong results for content layout.

Prefer CSS container queries (@container) when the layout depends on the available content width — multi-column grids, card arrangements, etc. Use Tailwind's named container syntax:

<!-- Parent: define the container -->
<Card class="@container/my-section max-w-4xl">
  <!-- Child: query the container width, NOT the viewport -->
  <div class="grid grid-cols-1 @sm/my-section:grid-cols-2">
    ...
  </div>
</Card>

Container queries aren't needed everywhere — use judgement:

  • Container queries (@container): multi-column grids, card layouts, anything where the sidebar makes viewport breakpoints inaccurate
  • Viewport breakpoints (md:, lg:): showing/hiding the sidebar, header layout, simple show/hide toggles that genuinely depend on screen size
  • useWindowBreakpoints: JS-based responsive logic — toggling components, conditional rendering based on device class

KPI / summary cards collapse into rows when narrow

A grid of stat cards (label on top, big value below) wastes vertical space on phones and small tablets. When the container is narrower than @md, render the same items as rows: label on the left, value (plus hint) right-aligned, one item per line, divided by hairlines. Switch to cards only from @md of the section's container up.

  • Analytics pages: use pages/analytics/components/summary-rows.vue for the narrow layout and the cards for wide.
  • Elsewhere: one markup with container variants, e.g. flex items-baseline justify-between @md/section:block on each cell and grid-cols-1 @md/section:grid-cols-4 on the grid (see the header strip in pages/trackers/trackers-info/tracker-details.vue).
  • Never use a 2-column card grid as the phone fallback — it is the layout this rule replaces.

Testing

All computation functions, services, utils, and helpers must have unit tests to verify their logic. If you create or modify a pure function (formatting, calculation, transformation, validation), write or update a corresponding unit test.


Styling

  • Use Tailwind CSS for all styling — avoid custom CSS unless absolutely necessary
  • Never use default Tailwind colors directly (e.g., text-red-500, bg-blue-200). Always use the project's color variables defined in packages/frontend/src/styles/global.css
  • If no existing color fits, tell the user about it and suggest adding it to global.css rather than using raw color values
  • Use cn() utility from @/lib/utils for conditional class composition. Never use manual string concatenation for dynamic classes

Amount colors

Purpose Class
Income / positive text-app-income-color
Expense / negative text-app-expense-color
Transfer text-app-transfer-color

Text/icon color vs. fill color

Semantic colors come in pairs: the base token is a fill (button/badge backgrounds, with *-foreground for the label on top), and the *-text token is the tint tuned for text and icons sitting directly on th

Полный SKILL.md на GitHub

Установить frontend-rules в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob

FAQ

Что делает скилл frontend-rules?

Frontend conventions and component usage rules. Read before writing any frontend code. Covers styling, component library, data flow, and UI patterns. Trigger on "/frontend-rules" or when starting frontend work.

Как установить скилл frontend-rules?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл frontend-rules запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить frontend-rules с