untrack .cursor/
This commit is contained in:
parent
5e2b829f8a
commit
2c0fd4f86b
|
|
@ -1,172 +0,0 @@
|
|||
# Code Review Checklist
|
||||
|
||||
Review every point below carefully to ensure files follow consistent code style and best practices.
|
||||
|
||||
---
|
||||
|
||||
## Function Signatures & Parameters
|
||||
|
||||
- [ ] Every function accepts a single object parameter with destructuring in the signature (for readability and future extensibility)
|
||||
- Exception: tiny one-liner callbacks (e.g. `array.find(x => ...)`, `map`, `filter`, `sort`) do not need destructuring if it hurts readability
|
||||
|
||||
```tsx
|
||||
// ❌ wrong
|
||||
function formatTime(seconds: number, fps: number) { ... }
|
||||
|
||||
// ✅ correct
|
||||
function formatTime({ seconds, fps }: { seconds: number; fps: number }) { ... }
|
||||
```
|
||||
|
||||
## TypeScript & Type Safety
|
||||
|
||||
- [ ] No `any` references
|
||||
- [ ] General interfaces are in the `types` folder, not scattered in components
|
||||
- Example: `TimelineTrack` interface belongs in `src/types/timeline.ts`, not `src/components/timeline/index.tsx`
|
||||
|
||||
## JSX & Components
|
||||
|
||||
- [ ] JSX is clean — no comments explaining what each part does
|
||||
- [ ] Complex/reusable JSX is extracted into sub-components (placed below the main component)
|
||||
- [ ] Components shared across multiple files are in separate files
|
||||
- [ ] File order: constants specific to file (top) -> utils specific to file -> main component → sub-components (bottom)
|
||||
- [ ] Components render UI only — domain logic lives in hooks, utilities, or managers
|
||||
- Simple interaction logic (gestures, modifier keys) can stay if not complex
|
||||
|
||||
## Code Organization & File Structure
|
||||
|
||||
- [ ] Each file has one single purpose/responsibility
|
||||
- Example: `timeline/index.tsx` should not define `validateElementTrackCompatibility` — that belongs in a lib file
|
||||
- Example: `lib/timeline-utils.ts` should not declare `TRACK_COLORS` — that belongs in `constants/`
|
||||
- [ ] File name accurately reflects what the file contains — a misleading name is a bug waiting to happen
|
||||
- [ ] Business logic lives in either `src/lib`, `src/core` or `src/services` folder
|
||||
|
||||
## Comments
|
||||
|
||||
- [ ] No AI comments — only human comments that explain _why_, not _what_
|
||||
- Bad: changelog-style comments, explaining readable code, using more words than necessary
|
||||
- [ ] All comments are lowercase
|
||||
|
||||
## Naming Conventions
|
||||
|
||||
- [ ] Readability over brevity — use `element` not `el`, `event` not `e`
|
||||
- [ ] Booleans are named `isSomething`, `hasSomething`, or `shouldSomething` — not `something`
|
||||
- [ ] No title case for multi-word text/UI — use `Hello world` not `Hello World`
|
||||
|
||||
## Tailwind & Styling
|
||||
|
||||
- [ ] Always use `cn()` for `className` — never string interpolation with `${}` or ternaries inline
|
||||
```tsx
|
||||
// ❌ wrong
|
||||
className={`base-class ${isActive && "active"} ${someHelper()}`}
|
||||
|
||||
// ✅ correct
|
||||
className={cn("base-class", isActive && "active", someHelper())}
|
||||
```
|
||||
- [ ] Use `gap-*` instead of `mb-*` or `mt-*` for consistent spacing
|
||||
- [ ] Use `size-*` instead of `h-* w-*` when width and height are the same
|
||||
- [ ] When using `size-*` on icons inside `<Button>`, use `!` modifier to override default `size-4`
|
||||
```tsx
|
||||
<Button>
|
||||
<PlusIcon className="!size-6" /> {/* ✅ correct */}
|
||||
<PlusIcon className="size-6" /> {/* ❌ wrong */}
|
||||
<PlusIcon className="!size-4" /> {/* ❌ unnecessary, size-4 is default */}
|
||||
<PlusIcon className="size-4" />{" "}
|
||||
{/* ❌ completely wrong, 1) doesn't override and 2) size-4 is default */}
|
||||
</Button>
|
||||
```
|
||||
|
||||
## State Management (Zustand)
|
||||
|
||||
- [ ] React components never use `someStore.getState()` — use the `useSomeStore` hook instead
|
||||
- [ ] High-frequency stores (timeline, playback, selections) use selectors — `useStore((s) => s.value)` not `const { value } = useStore()`
|
||||
- [ ] Store/manager methods are not passed as props — sub-components access them directly
|
||||
|
||||
```tsx
|
||||
// ❌ wrong
|
||||
function Parent() {
|
||||
const { selectedElements } = useTimelineStore();
|
||||
return <Child selectedElements={selectedElements} />;
|
||||
}
|
||||
|
||||
// ✅ correct
|
||||
function Parent() {
|
||||
return <Child />;
|
||||
}
|
||||
function Child() {
|
||||
const { selectedElements } = useTimelineStore();
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] Components and hooks should use the `useEditor` hook. Only use `EditorCore.getInstance()` if you are outside of a react component/hook. Eg: in a utility function, event handler.
|
||||
|
||||
## Code Quality
|
||||
|
||||
- [ ] Code is scannable — use variables and helper functions to make intent clear at a glance
|
||||
- [ ] Complex logic is extracted into well-named variables or helpers
|
||||
- [ ] No magic numbers or magic values — extract inline literals into named constants
|
||||
- Applies to colors, durations, thresholds, sizes, config values, etc.
|
||||
- If it's domain-specific to one file, a `const` at the top of that file is fine
|
||||
- If it's generic enough, it belongs in `constants/`
|
||||
|
||||
- [ ] No redundant single/plural function variants — if a function can operate on multiple items, it should accept an array and handle both cases. Don't create `doThing()` + `doThings()`.
|
||||
|
||||
```tsx
|
||||
// ❌ wrong — redundant variants
|
||||
function updateElement({ element }: { element: Element }) { ... }
|
||||
function updateElements({ elements }: { elements: Element[] }) { ... }
|
||||
|
||||
// ✅ correct — one function, accepts array
|
||||
function updateElements({ elements }: { elements: Element[] }) { ... }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Function Keywords
|
||||
|
||||
| Context | Keyword |
|
||||
| --------------------------------- | ------------------------- |
|
||||
| Next.js page components | `export default function` |
|
||||
| Main react component | `export function` |
|
||||
| Sub-components | `function` |
|
||||
| Utility functions | `export function` |
|
||||
| Functions inside react components | `const` |
|
||||
|
||||
---
|
||||
|
||||
## Review Methodology
|
||||
|
||||
Do NOT review by reading the file top-to-bottom and noting what jumps out. Instead:
|
||||
|
||||
1. Go through each checklist section **one at a time**
|
||||
2. For each section, scan the **entire file** for violations of that specific rule
|
||||
3. Only move to the next section after you've exhausted the current one
|
||||
4. After all sections are checked, do a final pass: re-read every checklist item and confirm you didn't skip it
|
||||
|
||||
Before outputting the review, list each checklist section and confirm you checked it:
|
||||
`Signatures ✓ | TypeScript ✓ | JSX ✓ | Organization ✓ | File Names ✓ | Comments ✓ | Naming ✓ | Tailwind ✓ | State ✓ | Quality ✓ | Keywords ✓`
|
||||
|
||||
---
|
||||
|
||||
## IMPORTANT: Review Rules
|
||||
|
||||
- **ONLY** flag issues that are explicitly covered by a checklist item above.
|
||||
- Do **NOT** invent your own rules, suggestions, or "nice to haves" as primary issues.
|
||||
- The review output must be a list of issues, each one mapping to a specific checklist item.
|
||||
- If something looks off but isn't covered by the checklist, you can mention it as a brief side note at the end — but keep it clearly separate from the actual review. Always default to fixing the issues covered by the checklist above, unless the user says otherwise.
|
||||
|
||||
> You WILL miss things if you try to review the whole file in one pass. Iterate rule by rule.
|
||||
|
||||
---
|
||||
|
||||
## Think Bigger
|
||||
|
||||
After the checklist review, step back and ask the hard questions. The biggest architectural problems get solved by the biggest questions.
|
||||
|
||||
- Does this abstraction actually need to exist? Could it be deleted entirely?
|
||||
- Is this the right layer for this logic? (wrong layer = future pain)
|
||||
- Is this solving a real problem, or a problem we invented?
|
||||
- Would a simpler data model make this whole file unnecessary?
|
||||
- Are we adding complexity to work around a bad decision made earlier?
|
||||
- Could this field be derived from other existing fields? Redundant data in a model is a source of bugs.
|
||||
|
||||
Don't be shy about flagging these. A "why does this exist?" question is often worth more than 10 style fixes.
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,34 +0,0 @@
|
|||
---
|
||||
alwaysApply: false
|
||||
---
|
||||
# Comment Guidelines
|
||||
|
||||
## Good Comments (Human-style)
|
||||
- Explain WHY, not WHAT
|
||||
- Document non-obvious behavior or edge cases
|
||||
- Warn about performance implications or side effects
|
||||
- Explain business logic that isn't clear from code
|
||||
|
||||
Examples:
|
||||
```javascript
|
||||
// transfer, not copy; sender buffer detaches
|
||||
// satisfies: check shape; keep literals
|
||||
// keep multibyte across chunks
|
||||
// timingSafeEqual throws on length mismatch
|
||||
```
|
||||
|
||||
## Bad Comments (AI-style)
|
||||
- Don't explain what the code literally does
|
||||
- Don't add changelog-style comments in code
|
||||
- Don't comment every line or obvious operations
|
||||
|
||||
Avoid:
|
||||
```javascript
|
||||
// Prevent duplicate initialization
|
||||
// Check if project is already loaded
|
||||
// Mark as initializing to prevent race conditions
|
||||
// (changed from blah to blah)
|
||||
```
|
||||
|
||||
## Rule
|
||||
Only add comments when there's genuinely non-obvious behavior, performance considerations, or business logic that needs context. Code should be self-documenting through naming and structure.
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
alwaysApply: false
|
||||
---
|
||||
# Handling Uncertainty
|
||||
|
||||
## Principle
|
||||
If you can't confidently respond due to missing context, data access, or ambiguity (multiple interpretations), report it instead of guessing. Seek clarification to avoid errors.
|
||||
|
||||
Apply when: query lacks details, no access to info/tools, or unclear intent.
|
||||
|
||||
## How to Report
|
||||
1. **Description**: Why uncertain and what you need.
|
||||
2. **Questions**: 1-3 targeted ones.
|
||||
3. **Assumptions** (opt.): State if proceeding; omit otherwise.
|
||||
|
||||
Direct and concise.
|
||||
|
||||
**Assumptions**: None.
|
||||
|
||||
Builds transparency.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
alwaysApply: false
|
||||
---
|
||||
# Readability First
|
||||
|
||||
Optimize code for AI agents to understand and modify.
|
||||
|
||||
Never abbreviate. `event` not `e`, `element` not `el`. If it's easy to read, it's correct. In this case, "config" is better than "configuration" because it's shorter and is **still very readable**. "El" is not very readable.
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
---
|
||||
alwaysApply: false
|
||||
---
|
||||
# Separation of Concerns
|
||||
|
||||
## Core Principle
|
||||
|
||||
Each file should have one single purpose/responsibility. Related functionality should be grouped together, unrelated functionality should be separated.
|
||||
|
||||
## Good Separation
|
||||
|
||||
- One file per major concern (auth, validation, data transformation)
|
||||
- Group related utilities together
|
||||
- Extract shared logic into dedicated files
|
||||
- Keep API routes focused on their specific endpoint logic
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
// ✅ Good: Each file has clear responsibility
|
||||
/lib/rate-limit.ts // Rate limiting utilities
|
||||
/lib/validation.ts // Input validation schemas
|
||||
/lib/freesound-api.ts // External API integration
|
||||
/api/sounds/search/route.ts // Route handler only
|
||||
```
|
||||
|
||||
## Bad Mixing of Concerns
|
||||
|
||||
Avoid cramming multiple responsibilities into one file:
|
||||
|
||||
```javascript
|
||||
// ❌ Bad: Route file doing everything
|
||||
/api/sounds/search/route.ts
|
||||
- Rate limiting logic
|
||||
- Validation schemas
|
||||
- API transformation
|
||||
- External API calls
|
||||
- Response formatting
|
||||
- Error handling utilities
|
||||
```
|
||||
|
||||
## When to Separate
|
||||
|
||||
- File is getting long (>500 lines)
|
||||
- Multiple distinct responsibilities in one file
|
||||
- Logic could be reused elsewhere
|
||||
- Complex utilities that distract from main purpose
|
||||
|
||||
## Rule
|
||||
|
||||
One file, one responsibility. Extract shared concerns into focused utility files
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
---
|
||||
alwaysApply: false
|
||||
---
|
||||
# Project Context
|
||||
|
||||
Ultracite enforces strict type safety, accessibility standards, and consistent code quality for JavaScript/TypeScript projects using Biome's formatter.
|
||||
|
||||
## Key Principles
|
||||
|
||||
- Zero configuration required
|
||||
- Subsecond performance
|
||||
- Maximum type safety
|
||||
- AI-friendly code generation
|
||||
|
||||
## Before Writing Code
|
||||
|
||||
1. Analyze existing patterns in the codebase
|
||||
2. Consider edge cases and error scenarios
|
||||
3. Follow the rules below strictly
|
||||
4. Validate accessibility requirements
|
||||
5. Avoid code duplication
|
||||
|
||||
## Rules
|
||||
|
||||
### Accessibility (a11y)
|
||||
|
||||
- Always include a `title` element for icons unless there's text beside the icon.
|
||||
- Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`.
|
||||
- Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`.
|
||||
|
||||
### Code Complexity and Quality
|
||||
|
||||
- Don't use primitive type aliases or misleading types.
|
||||
- Don't use the comma operator.
|
||||
- Use for...of statements instead of Array.forEach.
|
||||
- Don't initialize variables to undefined.
|
||||
- Use .flatMap() instead of map().flat() when possible.
|
||||
|
||||
### React and JSX Best Practices
|
||||
|
||||
- Don't import `React` itself.
|
||||
- Don't use both `children` and `dangerouslySetInnerHTML` props on the same element.
|
||||
- Don't insert comments as text nodes.
|
||||
- Use `<>...</>` instead of `<Fragment>...</Fragment>`.
|
||||
|
||||
### Function Parameters and Props
|
||||
|
||||
- Always use destructured props objects instead of individual parameters in functions.
|
||||
- Example: `function helloWorld({ prop }: { prop: string })` instead of `function helloWorld(param: string)`.
|
||||
- This applies to all functions, not just React components.
|
||||
|
||||
### Correctness and Safety
|
||||
|
||||
- Don't assign a value to itself.
|
||||
- Avoid unused imports and variables.
|
||||
- Don't use await inside loops.
|
||||
- Don't hardcode sensitive data like API keys and tokens.
|
||||
- Don't use the TypeScript directive @ts-ignore.
|
||||
- Make sure the `preconnect` attribute is used when using Google Fonts.
|
||||
- Don't use the `delete` operator.
|
||||
- Don't use `require()` in TypeScript/ES modules - use proper `import` statements.
|
||||
|
||||
### TypeScript Best Practices
|
||||
|
||||
- Don't use TypeScript enums.
|
||||
- Use either `T[]` or `Array<T>` consistently.
|
||||
- Don't use the `any` type.
|
||||
|
||||
### Style and Consistency
|
||||
|
||||
- Don't use global `eval()`.
|
||||
- Use `String.slice()` instead of `String.substr()` and `String.substring()`.
|
||||
- Don't use `else` blocks when the `if` block breaks early.
|
||||
- Put default function parameters and optional function parameters last.
|
||||
- Use `new` when throwing an error.
|
||||
- Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.
|
||||
|
||||
### Next.js Specific Rules
|
||||
|
||||
- Don't use `<img>` elements in Next.js projects.
|
||||
- Don't use `<head>` elements in Next.js projects.
|
||||
|
||||
## Example: Error Handling
|
||||
|
||||
```typescript
|
||||
// ✅ Good: Comprehensive error handling
|
||||
try {
|
||||
const result = await fetchData();
|
||||
return { success: true, data: result };
|
||||
} catch (error) {
|
||||
console.error("API call failed:", error);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
|
||||
// ❌ Bad: Swallowing errors
|
||||
try {
|
||||
return await fetchData();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
```
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
---
|
||||
alwaysApply: false
|
||||
---
|
||||
# Scannable Code Guidelines/Separating Concerns.
|
||||
|
||||
## Core Principle
|
||||
|
||||
Code should be scannable through proper abstraction, not comments. Use variables and helper functions to make intent clear at a glance.
|
||||
|
||||
## Good Scannable Code
|
||||
|
||||
- Extract complex logic into well-named variables
|
||||
- Create helper functions for multi-step operations
|
||||
- Use descriptive names that explain intent
|
||||
|
||||
Examples:
|
||||
|
||||
```javascript
|
||||
// ✅ Scannable: Intent is clear from variable names
|
||||
const isValidUser = user.isActive && user.hasPermissions;
|
||||
const shouldProcessPayment = amount > 0 && !order.isPaid;
|
||||
|
||||
// ✅ Scannable: Complex logic extracted to helper
|
||||
const searchParams = buildFreesoundSearchParams({ query, filters, pagination });
|
||||
const transformedResults = transformFreesoundResults({ rawResults });
|
||||
```
|
||||
|
||||
## Bad Unscannable Code
|
||||
|
||||
Avoid:
|
||||
|
||||
```javascript
|
||||
// ❌ Hard to scan: What does this condition mean?
|
||||
if (type === "effects" || !type) {
|
||||
params.append("filter", "duration:[* TO 30.0]");
|
||||
params.append("filter", `avg_rating:[${min_rating} TO *]`);
|
||||
if (commercial_only) {
|
||||
params.append("filter", 'license:("Attribution" OR "Creative Commons 0")');
|
||||
}
|
||||
}
|
||||
|
||||
// ❌ Hard to scan: Complex ternary
|
||||
const sortParam = query
|
||||
? sort === "score"
|
||||
? "score"
|
||||
: `${sort}_desc`
|
||||
: `${sort}_desc`;
|
||||
```
|
||||
|
||||
## Rule
|
||||
|
||||
Make code scannable by extracting intent into variables and helper functions. If you need to think about what code does, extract it. The reader should understand the flow without diving into implementation details.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"plugins": {
|
||||
"figma": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
---
|
||||
name: frontend-design
|
||||
description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.
|
||||
|
||||
The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints.
|
||||
|
||||
## Design Thinking
|
||||
|
||||
Before coding, understand the context and commit to a BOLD aesthetic direction:
|
||||
|
||||
- **Purpose**: What problem does this interface solve? Who uses it?
|
||||
- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.
|
||||
- **Constraints**: Technical requirements (framework, performance, accessibility).
|
||||
- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
||||
|
||||
**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work - the key is intentionality, not intensity.
|
||||
|
||||
Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:
|
||||
|
||||
- Production-grade and functional
|
||||
- Visually striking and memorable
|
||||
- Cohesive with a clear aesthetic point-of-view
|
||||
- Meticulously refined in every detail
|
||||
|
||||
## Frontend Aesthetics Guidelines
|
||||
|
||||
Focus on:
|
||||
|
||||
- **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font.
|
||||
- **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
|
||||
- **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.
|
||||
- **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
|
||||
- **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays.
|
||||
|
||||
NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character.
|
||||
|
||||
Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.
|
||||
|
||||
**IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.
|
||||
|
||||
Remember: Claude is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
|
||||
Loading…
Reference in New Issue