progressive-enhancement
About
This Claude Skill promotes a CSS-first approach to web development, prioritizing CSS solutions over JavaScript for layout, styling, animations, and responsive design. It guides developers to create simple, maintainable, and performant implementations by defaulting to CSS-only solutions whenever possible. Use it when working with CSS Grid, Flexbox, toggles, or show/hide functionality to apply YAGNI and "the best code is no code" principles.
Documentation
Progressive Enhancement - CSS-First Development
๐ฏ Core Philosophy
"The best code is no code" - If CSS can solve it, JavaScript is unnecessary
Priority
- HTML - Structure and semantics
- CSS - Visual presentation and layout
- JavaScript - Only when truly necessary
๐จ CSS-First Solutions
Layout
Grid
/* โ
CSS Grid overlay */
.container {
display: grid;
}
.background, .foreground {
grid-column: 1 / -1;
grid-row: 1 / -1;
}
/* โ No JavaScript needed: avoid position: absolute */
Use cases:
- Modal overlays
- Badge positioning on cards
- Layering background images with foreground content
Flexbox
/* โ
Center alignment */
.center {
display: flex;
justify-content: center;
align-items: center;
}
/* โ No JavaScript needed: manual calculation and position setting */
Position
/* โ
Transform - no reflow */
.move-up {
transform: translateY(-10px);
transition: transform 0.3s;
}
/* โ Avoid top/left (causes reflow) */
.move-up-bad {
position: relative;
top: -10px; /* Triggers reflow */
}
Performance:
transform: GPU accelerated, no reflowtop/left/margin: CPU rendering, causes reflow
Show/Hide
/* โ
visibility/opacity for animations */
.hidden {
visibility: hidden;
opacity: 0;
transition: opacity 0.3s, visibility 0s 0.3s;
}
.visible {
visibility: visible;
opacity: 1;
transition: opacity 0.3s;
}
/* โ display: none disappears instantly, no animation */
Responsive
Media Queries
/* โ
Mobile-first */
.component {
/* Mobile default styles */
flex-direction: column;
}
@media (min-width: 768px) {
.component {
flex-direction: row;
}
}
/* โ No JavaScript needed: window.innerWidth detection */
Container Queries
/* โ
Based on component's own size */
.card-container {
container-type: inline-size;
}
@container (min-width: 400px) {
.card {
grid-template-columns: 1fr 1fr;
}
}
/* โ ResizeObserver not needed */
State Management
:target
/* โ
URL hash-based state management */
.modal {
display: none;
}
.modal:target {
display: flex;
}
/* HTML: <a href="#modal">Open</a> */
/* โ No JavaScript needed: showModal(), hideModal() */
:checked
/* โ
Checkbox state management */
.toggle:checked ~ .content {
max-height: 500px;
opacity: 1;
}
.toggle:not(:checked) ~ .content {
max-height: 0;
opacity: 0;
overflow: hidden;
}
/* โ No JavaScript needed: toggleClass() */
:has()
/* โ
Parent element styling */
.form:has(input:invalid) .submit-button {
opacity: 0.5;
cursor: not-allowed;
}
/* โ No JavaScript needed: input.addEventListener('invalid') */
๐ Common Patterns
Accordion
<details>
<summary>Click to expand</summary>
<p>Expanded content</p>
</details>
details {
border: 1px solid #ddd;
}
summary {
cursor: pointer;
padding: 1rem;
}
summary::marker {
content: 'โถ ';
}
details[open] summary::marker {
content: 'โผ ';
}
/* โ No JavaScript needed: onClick, setState, CSS class toggle */
Benefits:
- Browser native
- Accessibility built-in
- Keyboard navigation supported
Tooltip
.tooltip {
position: relative;
}
.tooltip::after {
content: attr(data-tooltip);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
/* Hidden by default */
opacity: 0;
visibility: hidden;
transition: opacity 0.3s, visibility 0s 0.3s;
}
.tooltip:hover::after,
.tooltip:focus::after {
opacity: 1;
visibility: visible;
transition: opacity 0.3s;
}
/* HTML: <button class="tooltip" data-tooltip="Hint">Button</button> */
/* โ No JavaScript needed: position calculation, show/hide control */
Modal
.modal {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
display: none;
place-items: center;
}
.modal:target {
display: grid;
}
/* HTML: <a href="#myModal">Open</a> */
/* HTML: <div id="myModal" class="modal">...</div> */
/* โ No JavaScript needed: openModal(), closeModal() */
โ๏ธ When JavaScript is Needed
CSS is Sufficient For
- โ Static animations
- โ Hover, focus, checkbox state changes
- โ Simple show/hide toggles
- โ Responsive layouts
- โ URL-based state management
JavaScript is Required For
- โ API data fetching
- โ Form submission and validation
- โ Complex state management (multiple interactions)
- โ Dynamic content generation
- โ Browser API usage (localStorage, WebSocket, etc.)
๐ Decision Framework
Before implementation, ask yourself:
1. "Can this be done with CSS alone?"
Layout โ Grid/Flexbox
Position โ Transform
Display control โ visibility/opacity
State management โ :target, :checked, :has()
Animation โ transition/animation
2. "Is this really needed now?" (YAGNI)
โ Is there an actual problem occurring?
โ Have users requested this?
โ Is there measurable evidence?
All No โ Don't implement yet
3. "What's the simplest solution?" (Occam's Razor)
Option A: 3 lines of CSS
Option B: 50 lines of JavaScript + 10 lines of CSS
โ Choose Option A
๐ก Practical Application
Auto-Trigger Example
User: "I want cards to scale up on hover"
Skill auto-triggers โ
"From a Progressive Enhancement perspective, this can be achieved with CSS transform:
```css
.card {
transition: transform 0.3s;
}
.card:hover {
transform: scale(1.05);
}
```
No JavaScript needed."
Common Suggestion Patterns
-
Layout questions
- "Let's consider if Grid/Flexbox can solve this"
-
Animation questions
- "Would CSS transition be sufficient?"
-
State management questions
- "We can manage state with :checked or :has()"
-
Responsive questions
- "Let's start with Media Queries"
๐ Related Principles
- Occam's Razor: Prioritize simple solutions
- YAGNI: Don't implement until truly needed
- Outcome-First: Prioritize outcomes over architecture
โจ Key Takeaways
- CSS-First: Consider CSS solutions first
- JavaScript-Last: Only when truly necessary
- Native-First: Leverage browser native features (
<details>,:has(), etc.) - Progressive: Start simple, enhance as needed
Remember: "The best code is code that doesn't need to exist"
Quick Install
/plugin add https://github.com/thkt/claude-config/tree/main/progressive-enhancementCopy and paste this command in Claude Code to install this skill
GitHub ไปๅบ
Related Skills
sglang
MetaSGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.
evaluating-llms-harness
TestingThis Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.
llamaguard
OtherLlamaGuard is Meta's 7-8B parameter model for moderating LLM inputs and outputs across six safety categories like violence and hate speech. It offers 94-95% accuracy and can be deployed using vLLM, Hugging Face, or Amazon SageMaker. Use this skill to easily integrate content filtering and safety guardrails into your AI applications.
langchain
MetaLangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.
