benjaminsehl/liquid-skills/liquid-theme-standards
Claude Code and agent skill by benjaminsehl/liquid-skills
- community
Checking that the SKILL.md file is still in the repository.
CSS, JavaScript, and HTML coding standards for Shopify Liquid themes. Covers BEM naming inside stylesheet tags, design tokens, CSS custom properties, Web Components for themes, defensive CSS, and progressive enhancement. Use when writing CSS/JS/HTML in .liquid files or theme asset files.
Install
npx vskill@latest install benjaminsehl/liquid-skills/liquid-theme-standardsSKILL.md
CSS, JS & HTML Standards for Shopify Liquid Themes
Core Principles
- Progressive enhancement — semantic HTML first, CSS second, JS third
- No external dependencies — native browser APIs only for JavaScript
- Design tokens — never hardcode colors, spacing, or fonts
- BEM naming — consistent class naming throughout
- Defensive CSS — handle edge cases gracefully
CSS in Liquid Themes
Where CSS Lives
| Location | Liquid? | Use For | |
|---|---|---|---|
{% stylesheet %} | No | Component-scoped styles (one per file) | |
{% style %} | Yes | Dynamic values needing Liquid (e.g., color settings) | |
assets/*.css | No | Shared/global styles |
Critical: {% stylesheet %} does NOT process Liquid. Use inline style attributes for dynamic values:
BEM Naming Convention
Rules:
- Hyphens separate words:
.product-card, not.productCard - Single element level only:
.block__element, never.block__el1__el2 - Modifier always paired with base class:
class="btn btn--primary", neverclass="btn--primary"alone - Start new BEM scope when a child could be standalone
Specificity
- Target
0 1 0(single class) wherever possible - Maximum
0 4 0for complex parent-child cases - Never use IDs as selectors
- Never use
!important(comment why if absolutely forced to) - Avoid element selectors — use classes
CSS Nesting
Design Tokens
Use CSS custom properties for all values — never hardcode colors, spacing, or fonts. Define a consistent scale and reference it everywhere.
Example scale (adapt to your theme's needs):
Key principles:
- Use
remfor spacing and typography (respects user font size preferences) - Name tokens semantically:
--space-smnot--space-16 - Define in
:rootfor global tokens, on component root for scoped tokens
CSS Variable Scoping
Global — in :root for theme-wide values Component-scoped — on component root, namespaced:
Override via inline style for section/block settings:
CSS Property Order
- Layout —
position,display,flex-direction,grid-template-columns - Box model —
width,margin,padding,border - Typography —
font-family,font-size,line-height,color - Visual —
background,opacity,border-radius - Animation —
transition,animation
Logical Properties (RTL Support)
Defensive CSS
Modern CSS Features
Performance
- Animate only
transformandopacity(never layout properties) - Use
will-changesparingly — remove after animation - Use
contain: contentfor isolated rendering - Use
dvhinstead ofvhon mobile
Reduced Motion
JavaScript in Liquid Themes
Where JS Lives
| Location | Liquid? | Use For | |
|---|---|---|---|
{% javascript %} | No | Component-specific scripts (one per file) | |
assets/*.js | No | Shared utilities, Web Components |
Web Component Pattern
JavaScript Rules
| Rule | Do | Don't | |
|---|---|---|---|
| Loops | for (const item of items) | items.forEach() | |
| Async | async/await | .then() chains | |
| Variables | const by default | let unless reassigning | |
| Conditionals | Early returns | Nested if/else | |
| URLs | new URL() + URLSearchParams | String concatenation | |
| Dependencies | Native browser APIs | External libraries | |
| Private methods | #methodName() | _methodName() | |
| Types | JSDoc @typedef, @param, @returns | Untyped |
AbortController for Fetch
Component Communication
Parent → Child: Call public methods
Child → Parent: Dispatch custom events
HTML Standards
Native Elements First
| Need | Use | Not | |
|---|---|---|---|
| Expandable | <details>/<summary> | Custom accordion with JS | |
| Dialog/modal | <dialog> | Custom overlay div | |
| Tooltip/popup | popover attribute | Custom positioned div | |
| Search form | <search> | <div class="search"> | |
| Form results | <output> | <span class="result"> |
Progressive Enhancement
Images
loading="lazy"on all below-fold images- Always set
widthandheightto prevent layout shift - Descriptive
alttext; emptyalt=""for decorative images
JSON Template & Config Files
Theme templates (templates/*.json), section groups (sections/*.json), and config files (config/settings_data.json) are all JSON. Use jq via the bash tool to make surgical edits — it's safer and more reliable than string-based find-and-replace for structured data.
Common patterns
Prefer `jq` over `edit` for any .json file modification — it validates structure, handles escaping, and avoids whitespace/formatting issues.
References
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/liquid-theme-standards/SKILL.md
Popularity
- Repository stars
- 102
- Repository forks
- 11
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/benjaminsehl/liquid-skills/liquid-theme-standards)