skills/organizing-classnames/SKILL.md
Enforces classNames package usage patterns and Tailwind CSS class ordering conventions in React components. Use this skill whenever writing or reviewing component className props, applying Tailwind classes, using the classnames package, organizing breakpoint-specific styles, writing conditional class expressions, or when the user asks about CSS class ordering, mobile-first responsive patterns, or how to handle className props in components.
npx skillsauth add ilya-valasiuk/agent-skills organizing-classnamesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
classNames from 'classnames' alongside other third-party importsclassName prop must be optional: className?: stringclassName last so it can override defaults:className={classNames('default-classes', className)}
Order classes from smallest to largest screen size — always:
base (no prefix) → xs: → s: → sm: → md: → m: → lg: → xl: → 2xl:
Check the project's
tailwind.configfor the actual breakpoint names — they may differ.
classNames argumentclassName={classNames(
'base-style-1 base-style-2',
'xs:xs-style-1 xs:xs-style-2',
'sm:sm-style-1 sm:sm-style-2',
'md:md-style-1 md:md-style-2',
'lg:lg-style-1 lg:lg-style-2',
'xl:xl-style-1 xl:xl-style-2',
'2xl:2xl-style-1 2xl:2xl-style-2'
)}
className Proptype Props = {
size?: ButtonSize;
variant?: ButtonVariant;
className?: string;
};
export const Button: React.FC<Props> = ({
children,
size = ButtonSize.MEDIUM,
variant = ButtonVariant.PRIMARY,
className,
...props
}) => (
<button
className={classNames(
"block rounded-lg text-center transition",
"disabled:opacity-50",
{ "px-3 py-2 text-sm-medium": size === ButtonSize.SMALL },
{ "px-4 py-3 text-md-medium": size === ButtonSize.MEDIUM },
{
"bg-orange-500 text-white hover:bg-orange-700":
variant === ButtonVariant.PRIMARY,
},
{
"outline outline-gray-500 hover:text-orange-500":
variant === ButtonVariant.SECONDARY,
},
{ "pointer-events-none": Boolean(props?.disabled) },
className,
)}
type="button"
{...props}
>
{children}
</button>
);
className Props for Sub-elementsExpose separate className props for each styleable sub-element:
type Props = {
title: ReactNode;
children: ReactNode;
className?: string;
headerClassName?: string;
contentClassName?: string;
};
export const Card: React.FC<Props> = ({
title,
children,
className,
headerClassName,
contentClassName,
}) => (
<div className={classNames("rounded-lg border", className)}>
<div className={classNames("border-b p-4", headerClassName)}>{title}</div>
<div className={classNames("p-4", contentClassName)}>{children}</div>
</div>
);
Extract class sets into a variable only when they are reused by multiple elements in the same component or when the repeated class list clearly hurts readability. Do not extract one-off class sets that are used only once.
When multiple elements share the same base classes, extract to a variable:
const Buttons = () => {
const buttonClassName = classNames(
"flex w-full shrink-0 items-center justify-center transition-colors",
"lg:cursor-pointer",
);
return (
<div className="flex flex-col gap-3">
<button className={classNames(buttonClassName, "button-primary")}>
{/* Content */}
</button>
<button className={classNames(buttonClassName, "button-secondary")}>
{/* Content */}
</button>
</div>
);
};
classNames imported from 'classnames'className?: string prop is optionalclassName merged at the endtools
Standardize and preserve Next.js App Router project structure across `src/`, including route files, page composition, API modules, server actions, hooks, providers, helpers, and shared utilities. Use this skill whenever the user asks to add, move, rename, refactor, or review files in a Next.js App Router codebase, especially if the task affects file placement, page architecture, or folder naming.
testing
Prepare and open pull requests using the team's PR template, including a short PR title, diff-based classification into Features and Fixes, and an approval checkpoint before any push or PR creation. Use when the user asks to create, draft, preview, or open a pull request.
testing
Explains how to create and review TypeORM migrations. Use this skill whenever the user wants to change an entity, add or update schema-related database objects, generate a migration, or decide whether a database change should be handled through TypeORM metadata or a custom migration.
development
Builds, restructures, and standardizes React components according to project conventions (placement, folder/file naming, exports, props patterns). Use when adding components or when reorganizing existing components during refactors, migrations, or component moves.