agentleFS
medy-gribkovmedy-gribkov/arcana/skills/frontend-code-review/SKILL.md

frontend-code-review

Skill1 starsChanged 9 months agoApache-2.0View on GitHub

Review React/TypeScript frontend code against code quality, performance, and business logic rules. Provides structured findings with file paths, line numbers, and suggested fixes.

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use cache-components, pr-creator and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • mm-mazharSkill

    cache-components

    Expert guidance for Next.js Cache Components and Partial Prerendering (PPR).

    Also in 4 projects that use this

  • GoogleSkill

    pr-creator

    Also in 4 projects that use this

  • Google CloudSkill

    fix

    Plan a remediation strategy after a test failure.

    Also in 3 projects that use this

  • JetBrainsSkill

    webapp-testing

    Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

    Also in 4 projects that use this

  • VercelSkill

    find-skills

    Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

    Also in 4 projects that use this

  • StrayDragonSkill

    ui-ux-pro-max

    UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Requirement: Use cn() utility for all conditional CSS, not ternaries or string concatenation.

    line 24
  2. Very specific:

    Requirement: Prefer Tailwind utilities over .module.css files unless Tailwind cannot achieve the effect.

    line 58
  3. Very specific:

    Requirement: Place incoming className prop AFTER component's own classes.

    line 88
  4. Very specific:

    Requirement: Use useNodes/useEdges for UI rendering.

    line 121
  5. Distinctive:

    Use this skill: Before committing frontend changes, during PR reviews, or when diagnosing rendering performance issues.

    line 387

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend Code Review

Review Process

This skill reviews .tsx, .ts, and .js files against three categories:

  1. Code Quality - Consistent patterns, maintainability
  2. Performance - React rendering optimization
  3. Business Logic - Domain-specific rules

Two review modes:

  • Pending-change review - Scan staged/modified files before commit
  • File-targeted review - Review specific files the user names

Code Quality Rules

Rule 1: Conditional Classnames (URGENT)

Requirement: Use cn() utility for all conditional CSS, not ternaries or string concatenation.

BAD:

// Manual ternary
<div className={isActive ? 'text-primary-600' : 'text-gray-500'}>

// String concatenation
<div className={'bg-white ' + (isError ? 'border-red-500' : '')}>

// Template literal
<div className={`text-base ${highlighted && 'font-bold'}`}>

GOOD:

import { cn } from '@/utils/classnames';

<div className={cn(
  'text-base',
  isActive && 'text-primary-600',
  !isActive && 'text-gray-500'
)}>

<div className={cn(
  'bg-white',
  isError && 'border-red-500'
)}>

Why urgent: Inconsistent patterns make global style changes difficult.

Rule 2: Tailwind-First Styling (URGENT)

Requirement: Prefer Tailwind utilities over .module.css files unless Tailwind cannot achieve the effect.

BAD:

// styles.module.css
.button {
  padding: 0.75rem 1.5rem;
  background-color: #3b82f6;
  border-radius: 0.5rem;
}

// Component.tsx
import styles from './styles.module.css';
<button className={styles.button}>Click</button>

GOOD:

<button className="px-6 py-3 bg-blue-500 rounded-lg hover:bg-blue-600">
  Click
</button>

When CSS modules are acceptable:

  • Complex animations requiring @keyframes
  • Browser-specific hacks
  • Third-party library style overrides

Rule 3: ClassName Ordering for Overrides

Requirement: Place incoming className prop AFTER component's own classes.

BAD:

const Button = ({ className }: { className?: string }) => {
  return (
    <div className={cn(className, 'bg-primary-600 text-white px-4 py-2')}>
      {/* Consumer can't override bg-primary-600 */}
    </div>
  );
};

// Consumer tries to change background
<Button className="bg-red-500" /> {/* Won't work */}

GOOD:

const Button = ({ className }: { className?: string }) => {
  return (
    <div className={cn('bg-primary-600 text-white px-4 py-2', className)}>
      {/* className comes LAST, can override */}
    </div>
  );
};

<Button className="bg-red-500" /> {/* Works */}

Performance Rules

Rule 1: React Flow Data Access (URGENT)

Requirement: Use useNodes/useEdges for UI rendering. Use useStoreApi inside callbacks that mutate state.

BAD:

import useNodes from '@/app/components/workflow/store/workflow/use-nodes';

const NodeComponent = () => {
  const nodes = useNodes(); // Wrong hook
  // ...
};

GOOD:

import { useNodes, useStoreApi } from 'reactflow';

const NodeComponent = () => {
  const nodes = useNodes(); // Correct React Flow hook
  const store = useStoreApi();

  const handleUpdate = () => {
    const { getNodes, setNodes } = store.getState();
    // Mutate via store API
  };

  return <div>{nodes.length} nodes</div>;
};

Why urgent: Using wrong hooks causes blank screens when no workflowStore provider exists.

Rule 2: Complex Prop Memoization (URGENT)

Requirement: Wrap objects, arrays, and functions passed as props in useMemo or useCallback.

BAD:

function ParentComponent() {
  return (
    <HeavyChild
      config={{
        apiKey: 'abc',
        endpoint: '/api/data'
      }}
      filters={['active', 'recent']}
      onUpdate={() => console.log('update')}
    />
  );
  // Every render creates NEW objects/arrays/functions
  // Child re-renders even if nothing changed
}

GOOD:

function ParentComponent() {
  const config = useMemo(() => ({
    apiKey: 'abc',
    endpoint: '/api/data'
  }), []);

  const filters = useMemo(() => ['active', 'recent'], []);

  const handleUpdate = useCallback(() => {
    console.log('update');
  }, []);

  return (
    <HeavyChild
      config={config}
      filters={filters}
      onUpdate={handleUpdate}
    />
  );
  // Stable references, child only re-renders when props actually change
}

Why urgent: Causes unnecessary re-renders, degrades performance with complex components.

Business Logic Rules

Rule 1: No workflowStore in Node Components (URGENT)

Applies to: Files matching web/app/components/workflow/nodes/[nodeName]/node.tsx

Requirement: Node components cannot import workflowStore because they're used in contexts without the provider.

BAD:

// web/app/components/workflow/nodes/TextNode/node.tsx
import useNodes from '@/app/components/workflow/store/workflow/use-nodes';

export const TextNode = () => {
  const nodes = useNodes(); // Breaks when no provider
  // ...
};

GOOD:

// web/app/components/workflow/nodes/TextNode/node.tsx
import { useNodes } from 'reactflow';

export const TextNode = () => {
  const nodes = useNodes(); // Works in all contexts
  // ...
};

Why urgent: Causes blank screens when creating RAG Pipes from templates (no workflowStore provider in that flow).

Review Output Format

Template A: Issues Found

# Code review
Found <N> urgent issues that need to be fixed:

## 1. Using manual ternary instead of cn() utility
FilePath: src\components\Button.tsx line 12
<div className={isActive ? 'text-primary-600' : 'text-gray-500'}>

### Suggested fix
Replace with cn() utility:
import { cn } from '@/utils/classnames';
<div className={cn(isActive ? 'text-primary-600' : 'text-gray-500')}>

---

## 2. Object prop not memoized
FilePath: src\pages\Dashboard.tsx line 45
<HeavyComponent config={{ apiKey: key, url: endpoint }} />

### Suggested fix
Wrap in useMemo:
const config = useMemo(() => ({ apiKey: key, url: endpoint }), [key, endpoint]);
<HeavyComponent config={config} />

---

Found <M> suggestions for improvement:

## 1. Consider using Tailwind instead of CSS module
FilePath: src\components\Card.tsx line 5
import styles from './Card.module.css';

### Suggested fix
Replace CSS module with Tailwind utilities if possible.

---

If >= 10 issues: Show first 10, summarize as "10+ urgent issues".

If any issue requires code changes: End with "Would you like me to apply the suggested fixes?"

Template B: No Issues

## Code review
No issues found.

Example Review Workflow

Step 1: Scan File

// src/components/UserCard.tsx
import { useNodes } from 'reactflow';
import styles from './UserCard.module.css';

export const UserCard = ({ user, className }) => {
  const nodes = useNodes();

  return (
    <div className={className + ' ' + styles.card}>
      <img src={user.avatar} className={user.isOnline ? 'border-green' : 'border-gray'} />
      <ExpensiveChild data={{ id: user.id, name: user.name }} />
    </div>
  );
};

Step 2: Identify Violations

  1. Line 2: Using CSS module (Code Quality, suggestion)
  2. Line 7: Manual string concatenation instead of cn() (Code Quality, URGENT)
  3. Line 8: Manual ternary instead of cn() (Code Quality, URGENT)
  4. Line 9: Object prop not memoized (Performance, URGENT)

Step 3: Generate Report

# Code review
Found 3 urgent issues that need to be fixed:

## 1. Manual string concatenation for classnames
FilePath: src\components\UserCard.tsx line 7
<div className={className + ' ' + styles.card}>

### Suggested fix
Replace with cn() utility:
import { cn } from '@/utils/classnames';
<div className={cn(styles.card, className)}>

---

## 2. Manual ternary for conditional classname
FilePath: src\components\UserCard.tsx line 8
<img className={user.isOnline ? 'border-green' : 'border-gray'} />

### Suggested fix
import { cn } from '@/utils/classnames';
<img className={cn(user.isOnline ? 'border-green' : 'border-gray')} />

---

## 3. Object prop not memoized
FilePath: src\components\UserCard.tsx line 9
<ExpensiveChild data={{ id: user.id, name: user.name }} />

### Suggested fix
const data = useMemo(() => ({ id: user.id, name: user.name }), [user.id, user.name]);
<ExpensiveChild data={data} />

---

Found 1 suggestion for improvement:

## 1. Consider Tailwind instead of CSS module
FilePath: src\components\UserCard.tsx line 2
import styles from './UserCard.module.css';

### Suggested fix
Evaluate if CSS module is necessary or if Tailwind utilities can replace it.

---

Would you like me to apply the suggested fixes?

Quick Reference

Urgency Levels:

URGENT:     Code Quality violations, Performance issues, Business Logic bugs
SUGGESTION: Best practices, minor improvements

Common Patterns to Flag:

BAD: className={a ? 'x' : 'y'}
GOOD: className={cn(a ? 'x' : 'y')}

BAD: <Child config={{...}} />
GOOD: const config = useMemo(() => ({...}), [deps]);

BAD: import useNodes from '@/store/workflow/use-nodes'
GOOD: import { useNodes } from 'reactflow'

Use this skill: Before committing frontend changes, during PR reviews, or when diagnosing rendering performance issues.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.