Agent skill
react-classlist
Organize long or disorganized className attributes in React components into semantic groups using cn() or className
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/react-classlist
SKILL.md
React ClassName Organizer
Organize className attributes in React components for readability and maintainability.
When to trigger
Refactor className when:
- Single-line className exceeds 80-100 characters
- Disorganized
cn()orclassList()calls exist - User explicitly requests className organization
Instructions
-
Choose utility function:
- Use
cn()if already imported in the file - Otherwise, use standard
className
- Use
-
Break into multiple lines:
- Each line should be semantically grouped
- Lines should not exceed ~80 characters
- Keep responsive modifiers with their base class
-
Group classes in this order:
- Layout (flex, grid, position type)
- Spacing (gap, padding, margin)
- Sizing (width, height, min/max)
- Display & visibility
- Typography (font, text-*)
- Colors & backgrounds
- Borders & effects
- Positioning values (top, left, z-index)
- Transitions & animations
- Responsive variants (keep with base class)
-
Format:
jsx// Before: className="overflow-y-auto max-h-[50vh] md:max-h-auto flex-col gap-4 md:gap-2 pt-2 w-full md:w-auto" // After: className=cn( 'flex-col gap-4 md:gap-2 pt-2', 'w-full md:w-auto max-h-[50vh] md:max-h-auto', 'overflow-y-auto scrollbar-hide' ) -
Keep together:
- Responsive modifiers with base:
'w-full md:w-auto' - Related utilities:
'flex items-center justify-between'
- Responsive modifiers with base:
Tool access
allowed-tools:
- Read
- Edit
- Grep
Notes
- Preserve all existing classes
- Maintain semantic grouping over strict alphabetical order
- Each line should be readable and cohesive
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?