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★ 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
anyunless absolutely unavoidable - Use
date-fnsfor all date formatting and manipulation. Never use rawDatemethods 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/1checks, 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/orcomponents/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.vuefor the narrow layout and the cards for wide. - Elsewhere: one markup with container variants, e.g.
flex items-baseline justify-between @md/section:blockon each cell andgrid-cols-1 @md/section:grid-cols-4on the grid (see the header strip inpages/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 inpackages/frontend/src/styles/global.css - If no existing color fits, tell the user about it and suggest adding it to
global.cssrather than using raw color values - Use
cn()utility from@/lib/utilsfor 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
Установить frontend-rules в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobFAQ
Что делает скилл 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), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic