Skip to content
Back to skills

Client Components

ASecurity

Enforces project client component conventions for interactive React components with hooks, event handlers, Radix UI integration, and server action consumption. Extends react-coding-conventions with client-specific patterns.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
developmentreactapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill client-components --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Client Components?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Client Components
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-client-components/badge)](https://www.skillsdirectory.com/skills/majiayu000-client-components)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: client-components
description: Enforces project client component conventions for interactive React components with hooks, event handlers, Radix UI integration, and server action consumption. Extends react-coding-conventions with client-specific patterns.
---

# Client Components Skill

## Purpose

This skill provides client-specific React conventions that extend the base react-coding-conventions skill. It covers patterns unique to client components: hooks, interactivity, event handling, and server action consumption.

## When to Use This Skill

Use this skill in the following scenarios:

- Creating components with 'use client' directive
- Implementing useState, useEffect, or other hooks
- Adding event handlers (onClick, onChange, etc.)
- Consuming server actions via useServerAction
- Building interactive UI with Radix primitives
- Creating forms with TanStack Form

**Important**: This skill should activate automatically when client component work is detected.

## Prerequisite Skills

This skill REQUIRES loading these skills FIRST:

1. **react-coding-conventions** - Base React patterns
2. **ui-components** - UI component patterns

## How to Use This Skill

### 1. Load Prerequisites and Reference

Before creating or modifying client components:

```
1. Read .claude/skills/react-coding-conventions/references/React-Coding-Conventions.md
2. Read .claude/skills/ui-components/references/UI-Components-Conventions.md
3. Read .claude/skills/client-components/references/Client-Components-Conventions.md
```

### 2. Apply Client Component Patterns

**'use client' Directive**:

- Must be the first line of the file
- Required when using hooks, event handlers, or browser APIs

**Hook Organization**:

- Follow the 7-step internal organization order
- Use useCallback for memoized event handlers
- Use useMemo for expensive calculations

**Event Handling**:

- Prefix handlers with `handle`: handleClick, handleSubmit
- Include e.preventDefault() and e.stopPropagation() where needed
- Support keyboard accessibility

**Server Action Consumption**:

- Use `useServerAction` hook from `@/hooks/use-server-action`
- Use `executeAsync` with `toastMessages` for mutations
- Access results via `data.data` in callbacks

### 3. Automatic Convention Enforcement

After generating code:

1. **Scan for violations** against client component patterns
2. **Fix automatically** without asking permission
3. **Verify completeness** before presenting to user

### 4. Reporting

Provide a brief summary of conventions applied:

```
Client component conventions enforced:
  - Added 'use client' directive
  - Organized hooks in correct order
  - Used useCallback for event handlers
  - Added keyboard accessibility handlers
  - Used useServerAction for server action
```

## File Patterns

This skill handles:

- `src/components/ui/**/*.tsx`
- `src/components/feature/**/*.tsx` (with 'use client')
- `src/app/**/components/*-client.tsx`
- Any .tsx with hooks or event handlers
- NOT page.tsx, layout.tsx, loading.tsx

## Workflow Summary

```
1. Detect client component work (hooks, events, 'use client')
2. Load prerequisites: react-coding-conventions, ui-components
3. Load references/Client-Components-Conventions.md
4. Generate/modify code following ALL conventions
5. Scan for violations
6. Auto-fix violations
7. Report fixes applied
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.