css-scss-human-made
Human Made CSS/SCSS Standards
Naming Conventions
Use BEM-like naming:
- Block:
.user-card - Element:
.user-card__title - Modifier:
.user-card--featured
.user-card {
padding: 1rem;
&__title {
font-size: 1.25rem;
}
&__content {
margin-top: 0.5rem;
}
&--featured {
border: 2px solid var(--wp--preset--color--primary);
}
}
CSS Custom Properties
- Use CSS custom properties via
theme.jsontokens where possible - Reference WordPress preset values:
var(--wp--preset--color--primary) - Define component-specific properties at the component level
.component {
--component-spacing: 1rem;
padding: var(--component-spacing);
}
theme.json Integration
For WordPress themes, prefer theme.json for:
- Color palettes
- Typography scales
- Spacing presets
- Layout settings
Reference in CSS:
.element {
color: var(--wp--preset--color--contrast);
font-size: var(--wp--preset--font-size--medium);
padding: var(--wp--preset--spacing--40);
}
SCSS Guidelines
- Use nesting sparingly (max 3 levels deep)
- Extract repeated values into variables
- Use mixins for repeated patterns
- Prefer
@useover@importfor module loading
Class Naming
- Use kebab-case:
.my-component-name - Avoid IDs for styling
- Avoid overly generic names: prefer
.article-cardover.card - Prefix utility classes if used:
.u-visually-hidden
Linting
Projects use Stylelint:
- Config file:
.stylelintrc.jsor.stylelintrc.json - Run with:
npm run lint:cssornpx stylelint "**/*.scss"
More from humanmade/claude-code-standards
react-human-made
Human Made React component standards. Apply when writing React components, reviewing React code, or building WordPress block editor interfaces. Covers functional components, hooks, PropTypes, and component organization.
1php-human-made
Human Made PHP coding standards for WordPress development. Apply when writing PHP, reviewing PHP code, or working on WordPress plugins and themes. Covers PHPCS HM-Minimum ruleset, namespacing conventions, bootstrap patterns, type hints, and file organization.
1run-linters
Discover and run code linters for the current project. Use when asked to lint code, check code quality, run static analysis, or after completing a feature. Detects PHPCS, PHPStan, ESLint, and Stylelint configurations and runs appropriate checks.
1javascript-human-made
Human Made JavaScript coding standards. Apply when writing JavaScript or TypeScript, reviewing JS code, or working on frontend features. Covers ES6+ conventions, modern patterns, and ESLint configuration.
1hm-coding-philosophy
Human Made engineering principles and code quality standards. Apply when writing code, reviewing code, planning implementations, or discussing architecture. Covers code quality priorities, simplicity over complexity, and avoiding over-engineering.
1