Cline rules
.clinerules/frontend-rules.mdUse when: writing or modifying React components, TypeScript, CSS, or Zustand stores in src/. Covers component patterns, import order, styling, state management, and TypeScript rules.
Cline rules
Quality
81/100
Scores the file, not the repository.Length
536 words
12 headings · 8 code blocksRepository
1
— · pushed 1 days agoLast changed
yesterday
First indexed yesterday.1234567# Frontend Rules89<!-- React / TypeScript / CSS / Zustand 规范,操作 src/ 目录时自动加载 -->1011## Component Pattern1213Always use functional components with hooks. NEVER use class components or HOCs.1415Always place page-level components in `src/pages/`, one file per route.1617Always annotate component return type as `React.JSX.Element`.1819```tsx20function MyComponent({ name }: MyComponentProps): React.JSX.Element {21 return <div>{name}</div>;22}23```2425NEVER export components as anonymous default exports. Always use named functions:2627✅ `export default function BacklogPage(): React.JSX.Element { ... }`28❌ `export default () => { ... }`2930## Props & Types3132Always declare props via `interface`. Use `type` for unions and lookup types.3334```tsx35interface TaskCardProps {36 task: DownloadTask;37 onPause: (id: string) => void;38}39```4041NEVER use `any`. NEVER use `@ts-ignore` without an explanatory comment on the same line.4243✅ `// @ts-expect-error: third-party type mismatch in bangumi-api-client v2026`44❌ `// @ts-ignore`4546Use type guards with `is` predicates when validating unknown shapes at runtime.4748```tsx49function isWatchEntry(v: unknown): v is WatchEntry {50 if (typeof v !== 'object' || v === null) return false;51 const e = v as Record<string, unknown>;52 return typeof e.status === 'string' && typeof e.updatedAt === 'number';53}54```5556## Imports5758Always group imports in this order, separated by blank lines:59601. Tauri API (`@tauri-apps/api/*`)612. Third-party UI / libraries623. React and React hooks634. Internal modules (relative paths)645. CSS imports (always last)6566```tsx67import { invoke } from '@tauri-apps/api/core';6869import { Button } from 'animal-island-ui';7071import { useState, useCallback } from 'react';7273import { useDownload } from '../store/downloadStore';7475import './MyPage.css';76```7778## CSS7980Always use plain CSS. NEVER add Tailwind CSS or any CSS-in-JS library (styled-components, emotion, etc.).8182### File Responsibilities8384|File|Purpose|85|----|-------|86|`src/styles/theme.css`|The ONLY place for `--theme-*` CSS variables — colors, spacing, typography tokens. Replace this file to change themes.|87|`src/styles/fonts.css`|`@font-face` declarations only. No colors, no layout.|88|`src/App.css`|App shell layout (topbar, sidebar, page containers). All colors MUST reference `var(--theme-*)`.|89|`src/pages/*.css`|Page-level component styles. Co-located with their component. All colors MUST reference `var(--theme-*)`.|9091### Color Rule9293NEVER write raw color values (`#xxx`, `rgb()`, `hsl()`) in any CSS file except `src/styles/theme.css`. All colors MUST use CSS variables defined in `theme.css`.9495✅ `color: var(--theme-text-primary);`96❌ `color: #4a3525;`9798### Naming99100Use BEM-style naming: `.block__element--modifier`101102```text103dl-card # Block104dl-card__header # Element105dl-card--error # Modifier106dl-progress-bar--done # Modifier with state107```108109## State Management110111Always use Zustand for state management. NEVER introduce Redux, Jotai, MobX, or other state libraries.112113Place store files in `src/store/`. Name stores in camelCase:114115```text116src/store/watchStore.ts117src/store/downloadStore.tsx118```119120Encapsulate store logic in custom hooks when exposing to components:121122```tsx123// src/store/downloadStore.tsx124export function useDownload() {125 return useDownloadStore((s) => ({126 tasks: s.tasks,127 pauseTask: s.pauseTask,128 // ...129 }));130}131```132133## Pre-existing Dependencies134135NEVER suggest installing or re-installing these — already in `package.json`:136137- `@tauri-apps/api`, `@tauri-apps/plugin-dialog`, `@tauri-apps/plugin-opener`138- `animal-island-ui`, `bangumi-api-client`139- `react`, `react-dom`, `zustand`140141Always invoke Tauri commands via `invoke()` from `@tauri-apps/api/core`. NEVER use other Tauri IPC methods.142143```tsx144import { invoke } from '@tauri-apps/api/core';145146void invoke('reveal_in_folder', { path: task.saveDir });147```148149## File Naming150151|Type|Convention|Example|152|----|----------|-------|153|Page component|PascalCase|`DownloadPage.tsx`|154|Store|camelCase|`watchStore.ts`|155|Styles (global)|kebab-case|`theme.css`, `fonts.css`|156|Styles (component)|PascalCase + `.css`|`DownloadPage.css`|157158## Inline Styles159160Inline styles are permitted only for dynamic layout values (widths, visibility). NEVER use inline styles for static design — use CSS classes instead.161
Also in VaillerTeeter/HoshimiNest
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| VaillerTeeter/HoshimiNest.clinerules/backend-rules.md · 1 | Cline rules | buildlint-formatstyledo-not | 81/100 | yesterday | |
| VaillerTeeter/HoshimiNest.clinerules/git-workflow.md · 1 | Cline rules | gitsecuritydo-notagent-behaviour | 81/100 | yesterday | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0 | Cline rules | buildstylearchgit+2 | 96/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago | |
| cline/cline.clinerules/general.md · 66k | Cline rules | setupbuildstylearch+2 | 86/100 | 3 days ago |
