pseudo-elements
Skill2 starsChanged 4 months agoMITView on GitHub
Review CSS and JavaScript for pseudo-element best practices and View Transitions API usage.
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Read the specified files (or prompt user for files/pattern)
- Distinctive: line 20
Check against all rules below
- Distinctive: line 56
Use pseudo-elements for decorative content instead of extra DOM nodes.
- Distinctive: line 136
Use negative inset values to expand hit targets without extra markup.
- Distinctive: line 198
Remove view-transition-name after transition completes.
- Distinctive: line 219
Prefer View Transitions API over JavaScript animation libraries for page transitions.
- Distinctive: line 262
Use ::backdrop pseudo-element for dialog/popover backgrounds.
- Distinctive: line 281
Use ::placeholder for input placeholder styling, not wrapper elements.
- Distinctive: line 300
Use ::selection for text selection styling.
- Distinctive: line 312
When reviewing files, output findings as:
- Distinctive: line 324
After findings, output a summary:
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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
---name: pseudo-elements description: Audit CSS for pseudo-element best practices and View Transitions API usage. Use when reviewing hover effects, decorative layers, or page transitions. Outputs file:line findings. license: MIT metadata: author: raphael-salaja version: "2.0.0" source: /content/taking-advantage-of-pseudo-elements/index.mdx author: raphaelsalaja source: https://github.com/raphaelsalaja/skill homepage: https://github.com/raphaelsalaja/skill/blob/main/skills/pseudo-elements/SKILL.md
Pseudo Elements
Review CSS and JavaScript for pseudo-element best practices and View Transitions API usage.
How It Works
- Read the specified files (or prompt user for files/pattern)
- Check against all rules below
- Output findings in
file:lineformat
Rule Categories
| Priority | Category | Prefix |
| 1 | Before/After | pseudo- |
| 2 | View Transitions | transition- |
| 3 | Native Styling | native- |
Rules
Before/After Rules
pseudo-content-required
::before and ::after require content property to render.
Fail:
.button::before {
position: absolute;
background: var(--gray-3);
}Pass:
.button::before {
content: "";
position: absolute;
background: var(--gray-3);
}pseudo-over-dom-node
Use pseudo-elements for decorative content instead of extra DOM nodes.
Fail:
<button className={styles.button}>
<span className={styles.background} /> {/* Unnecessary DOM node */}
Click me
</button>Pass:
<button className={styles.button}>
Click me
</button>.button::before {
content: "";
/* decorative background */
}pseudo-position-relative-parent
Parent must have position: relative for absolute pseudo-elements.
Fail:
.button::before {
content: "";
position: absolute;
inset: 0;
}
/* .button has no position */Pass:
.button {
position: relative;
}
.button::before {
content: "";
position: absolute;
inset: 0;
}pseudo-z-index-layering
Pseudo-elements need z-index to layer correctly with content.
Fail:
.button::before {
content: "";
position: absolute;
inset: 0;
background: var(--gray-3);
}
/* Covers button text */Pass:
.button {
position: relative;
z-index: 1;
}
.button::before {
content: "";
position: absolute;
inset: 0;
background: var(--gray-3);
z-index: -1;
}pseudo-hit-target-expansion
Use negative inset values to expand hit targets without extra markup.
Fail:
<div className={styles.wrapper}> {/* Extra wrapper for hit target */}
<a className={styles.link}>Link</a>
</div>Pass:
.link {
position: relative;
}
.link::before {
content: "";
position: absolute;
inset: -8px -12px;
}View Transitions Rules
transition-name-required
Elements participating in view transitions need view-transition-name.
Fail:
document.startViewTransition(() => {
// No view-transition-name assigned
targetImg.src = newSrc;
});Pass:
sourceImg.style.viewTransitionName = "card";
document.startViewTransition(() => {
sourceImg.style.viewTransitionName = "";
targetImg.style.viewTransitionName = "card";
});transition-name-unique
Each view-transition-name must be unique on the page during transition.
Fail:
.card {
view-transition-name: card;
}
/* Multiple cards with same name */Pass:
// Assign unique name only to transitioning element
element.style.viewTransitionName = `card-${id}`;transition-name-cleanup
Remove view-transition-name after transition completes.
Fail:
sourceImg.style.viewTransitionName = "card";
document.startViewTransition(() => {
targetImg.style.viewTransitionName = "card";
});
// sourceImg still has name, causes conflict on next transitionPass:
sourceImg.style.viewTransitionName = "card";
document.startViewTransition(() => {
sourceImg.style.viewTransitionName = "";
targetImg.style.viewTransitionName = "card";
});transition-over-js-library
Prefer View Transitions API over JavaScript animation libraries for page transitions.
Fail:
import { motion } from "motion/react";
function ImageLightbox() {
return (
<motion.img layoutId="hero" /> // JS-based shared element transition
);
}Pass:
function openLightbox(img: HTMLImageElement) {
img.style.viewTransitionName = "hero";
document.startViewTransition(() => {
// Native browser transition
});
}transition-style-pseudo-elements
Style view transition pseudo-elements for custom animations.
Fail:
document.startViewTransition(() => { /* ... */ });
// Uses default crossfadePass:
::view-transition-group(card) {
animation-duration: 300ms;
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}Native Styling Rules
native-backdrop-styling
Use ::backdrop pseudo-element for dialog/popover backgrounds.
Fail:
<>
<div className={styles.overlay} onClick={close} />
<dialog className={styles.dialog}>{children}</dialog>
</>Pass:
dialog::backdrop {
background: var(--black-a6);
backdrop-filter: blur(4px);
}native-placeholder-styling
Use ::placeholder for input placeholder styling, not wrapper elements.
Fail:
<div className={styles.inputWrapper}>
{!value && <span className={styles.placeholder}>Enter text...</span>}
<input value={value} />
</div>Pass:
input::placeholder {
color: var(--gray-9);
opacity: 1;
}native-selection-styling
Use ::selection for text selection styling.
Pass:
::selection {
background: var(--blue-a5);
color: var(--gray-12);
}Output Format
When reviewing files, output findings as:
file:line - [rule-id] description of issue
Example:
components/button/styles.module.css:12 - [pseudo-content-required] ::before missing content property
components/lightbox/index.tsx:45 - [transition-over-js-library] Using motion layoutId instead of View Transitions APISummary Table
After findings, output a summary:
| Rule | Count | Severity |
pseudo-content-required | 2 | HIGH |
pseudo-over-dom-node | 1 | MEDIUM |
transition-name-cleanup | 1 | MEDIUM |
References
In this repository56 other files it gives its agents.
- AGENTS.mdAGENTS.md
- animate-expoSkill
- animateSkill
- animation-vocabularySkill
- apple-designSkill
- ask-sonnerSkill
- emil-design-engSkill
- find-animation-opportunitiesSkill
- improve-animationsSkill
- mobile-nativeSkill
- pick-ui-librarySkill
- prototypeSkill
- review-animationsSkill
- write-swiftSkill
- baseline-uiSkill
- create-design-mdSkill
- fixing-accessibilitySkill
- fixing-metadataSkill
- fixing-motion-performanceSkill
- improve-uiSkill
- ui-skills-rootSkill
- vocabularySkill
- transitions-devSkill
- transitions-polishSkill
- better-accessibilitySkill
- better-colorsSkill
- better-interfaceSkill
- better-layoutSkill
- better-typographySkill
- better-uiSkill
- better-writingSkill
- breakSkill
- explain-interfaceSkill
- interface-reviewSkill
- make-interfaces-feel-betterSkill
- variantSkill
- grill-meSkill
- grill-with-docsSkill
- improve-codebase-architectureSkill
- setup-matt-pocock-skillsSkill
- tddSkill
- triageSkill
- animateSkill
- critiqueSkill
- impeccableSkill
- polishSkill
- 12-principles-of-animationSkill
- generating-sounds-with-aiSkill
- mastering-animate-presenceSkill
- morphing-iconsSkill
- sounds-on-the-webSkill
- to-spring-or-not-to-springSkill
- react-doctorSkill
- ux-heuristicsSkill
- ux-principlesSkill
- good-cssSkill
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.

