CSS and styling workflow guidelines. Activate when working with CSS files (.css), Tailwind CSS, Stylelint, or styling-related tasks.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
| Task | Tool | Command |
|------|------|---------|
| Lint | Stylelint | npx stylelint "**/*.css" |
| Format | Prettier | npx prettier --write "**/*.css" |
| Dead code | PurgeCSS | npx purgecss --css *.css --content *.html |
RECOMMENDED over custom CSS for consistency and maintainability.
tailwind.config.js for project design tokens@apply sparingly - prefer utilities in markup[123px]) when design token existsClass order: Layout > Sizing > Spacing > Typography > Colors > Effects > Interactivity
SHOULD prefer native CSS over Sass/preprocessors.
/* CSS Variables */
:root { --color-primary: #3b82f6; }
.component { color: var(--color-primary, #3b82f6); }
/* Native Nesting */
.card {
& .title { font-weight: bold; }
&:hover { box-shadow: 0 4px 6px rgb(0 0 0 / 0.1); }
}
/* Container Queries */
.card-container { container-type: inline-size; }
@container (min-width: 400px) { .card { display: grid; } }
SHOULD use BEM for custom CSS:
.card { } /* Block */
.card__title { } /* Element */
.card--featured { } /* Modifier */
kebab-casebtn-primary not btn-blue)u-, JS hooks with js-Property order: Positioning > Display/Box Model > Typography > Visual > Misc
Mobile-first: MUST use min-width media queries.
.component {
padding: 1rem;
@media (min-width: 768px) { padding: 2rem; }
}
/* Grid - 2D layouts */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
/* Flexbox - 1D layouts */
.flex { display: flex; align-items: center; gap: 1rem; }
/* Logical properties - i18n support */
.component { margin-inline: auto; padding-block: 1rem; }
MUST support via prefers-color-scheme:
:root { --color-bg: #fff; --color-text: #1a1a1a; }
@media (prefers-color-scheme: dark) {
:root { --color-bg: #1a1a1a; --color-text: #fff; }
}
Optional class toggle: [data-theme="dark"] { --color-bg: #1a1a1a; }
@import in production (blocks parallel downloads)!important except for utilities:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
.visually-hidden {
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer