css-best-practices
Skill0 starsChanged 5 months agoMITView on GitHub
Skills for CSS3 best practices
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ZHOUKAILIAN/skillstheir own version, first seen Jun 18, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ZHOUKAILIAN/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 9 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use this skill when writing CSS files if the user defines it for the project
- Distinctive: line 13
Instead of putting all the styles in one file, it is better to create a "styles" folder, and then create a CSS file for every …
- Distinctive: line 14
Use CSS variables when defining the design system and later use them in its corresponding selector/classes using var(<variable>).
- Distinctive: line 16
When defining light and dark mode, use the light-dark() function.
- Distinctive: line 17
When using selectors or children/brother nodes, use native CSS nesting, putting the "&" following the selector inside the parent …
- Distinctive: line 21
When defining background and foreground colors, make sure that the colors have AAA contrast color to fulfill accesibility requirements.
- Distinctive: line 22
When writing responsive media queries, use the clamp() function to adapt the text size in tablets and mobile devices.
- Distinctive: line 23
If a project has presence of modals, make the background blurry, darker and unscrollable when the modal is on.
- Distinctive: line 24
If the project uses a variable font, use the "font-variation-settings" to define the font weight depending on the contrast setting.
- Very specific: line 27
If you use the grid on a component or part of the page which has cards/posters/etc..., use the auto-fill thing to make the grid adapt …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
css-best-practices
This skill consists in writing CSS styles using the latest CSS3 features
When to use
Use this skill when writing CSS files if the user defines it for the project
Instructions
- Instead of putting all the styles in one file, it is better to create a "styles" folder, and then create a CSS file for every component/part of the project
- Use CSS variables when defining the design system and later use them in its corresponding selector/classes using var(
<variable>). - Take into consideration good UX/UI practices when defining styles to avoid later issues.
- When defining light and dark mode, use the light-dark() function. For example: light-dark(
<light color>,<dark color>). - When using selectors or children/brother nodes, use native CSS nesting, putting the "&" following the selector inside the parent class/selector.
- Take as a high priority to make the responsive thing: mobile, tablet and desktop. Always use the "@media (width <
<width in px>)". - In the global style file, write a "reset CSS" to bypass the browser default styles to avoid styling problems.
- Also, in the same file, divide every set of styles with layers usign "@layer
<layer name>", and inside put the classes corresponding that set. - When defining background and foreground colors, make sure that the colors have AAA contrast color to fulfill accesibility requirements.
- When writing responsive media queries, use the clamp() function to adapt the text size in tablets and mobile devices.
- If a project has presence of modals, make the background blurry, darker and unscrollable when the modal is on. It would be better if the modal has open/exit animations.
- If the project uses a variable font, use the "font-variation-settings" to define the font weight depending on the contrast setting. Use the "@media (prefers-contrast)" queries when defining those settings.
- Try to use the rem/vw/vh units instead of px when possible.
- Control the size of the elements when defining the responsive styles, with the purpose of looking fine in responsive media queries and with user experience.
- If you use the grid on a component or part of the page which has cards/posters/etc..., use the auto-fill thing to make the grid adapt itself in every device.
About CSS Nestings
You have to write the CSS nesting like this example:
.class {
&:hover {
...
}
&::after {
...
}
& > descendent child {
...
}
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

