web-design-methodology by jezweb/claude-skills
npx skills add https://github.com/jezweb/claude-skills --skill web-design-methodology构建生产级 HTML/CSS 的通用模式。本技能涵盖实现方法论——搭配 web-design-patterns 以获取具体的组件设计。
具备以下特性的生产就绪 HTML/CSS 原型:
prototype/
├── index.html
├── about.html
├── services.html
├── contact.html
├── favicon.svg
├── css/
│ ├── variables.css # 设计令牌:颜色、排版、间距
│ ├── styles.css # 所有组件样式 (BEM)
│ └── mobile-nav.css # 移动端菜单样式
├── js/
│ ├── theme.js # 深色模式切换(仅在要求时添加)
│ └── mobile-menu.js # 汉堡菜单
└── media/
└── images/
构建顺序:
variables.css — 设计令牌优先favicon.svg — 使用品牌色的简单 SVGstyles.css — 所有 BEM 组件广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
mobile-nav.css — 响应式导航assets/ 模板index.html — 首页优先使用 Block-Element-Modifier 命名法。没有例外。
/* 块 */
.hero { }
.card { }
.nav { }
/* 元素(块的子元素) */
.hero__title { }
.hero__subtitle { }
.hero__cta { }
.card__image { }
.card__content { }
/* 修饰符(变体) */
.hero--split { }
.hero--minimal { }
.card--featured { }
.btn--primary { }
.btn--lg { }
规则:
__ 连接-- 连接.hero__content__title 是错误的.card__image 只能在 .card 内部使用使用语义化设计令牌。切勿硬编码颜色、间距或排版值。
完整的令牌模板请参见 references/css-variables-template.md。
/* 总是这样写 */
.card {
background: var(--card);
color: var(--card-foreground);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-sm);
padding: var(--space-6);
}
/* 永远不要这样写 */
.card {
background: #ffffff;
color: #333333;
border: 1px solid #e5e5e5;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 24px;
}
深色模式是可选的——仅在需求说明中明确要求时添加。大多数商业网站仅发布浅色模式可以更快上线。
何时包含:
何时跳过:
使用基于类的切换,切勿使用 CSS 媒体查询。
/* 浅色模式(默认) */
:root {
--background: #F9FAFB;
--foreground: #0F172A;
--card: #FFFFFF;
--card-foreground: #1E293B;
}
/* 深色模式(通过 html 上的 .dark 类实现) */
.dark {
--background: #0F172A;
--foreground: #F1F5F9;
--card: #1E293B;
--card-foreground: #F1F5F9;
}
规则:
<html> 元素上切换 .dark 类@media (prefers-color-scheme: dark) — 系统偏好由 JavaScript 处理#0F172A 到 #1E293B(非纯黑)三态切换的实现请使用 assets/theme-toggle.js。
移动优先。为 375px 设计,向上增强。
/* 基础:375px(移动端)— 无需媒体查询 */
@media (min-width: 640px) { /* sm — 大屏手机 */ }
@media (min-width: 768px) { /* md — 平板 */ }
@media (min-width: 1024px) { /* lg — 小桌面 */ }
@media (min-width: 1440px) { /* xl — 标准桌面 */ }
.prose { max-width: 65ch; }
.hero__content { max-width: min(640px, 45vw); }
.container {
max-width: 1280px;
margin-inline: auto;
padding-inline: var(--space-4);
}
.section { padding: clamp(3rem, 6vw, 6rem) 0; }
汉堡菜单的实现请使用 assets/mobile-nav.js。
clamp(2.5rem, 6vw, 5rem)。letter-spacing: 0.05em。80/20 法则:
如果主要品牌色出现在每个标题、边框、图标上——就没有任何东西能脱颖而出。
不是统一的填充。不同区块的呼吸感不同:
/* 紧凑区块(服务列表、常见问题) */
.section--compact { padding: clamp(2rem, 4vw, 4rem) 0; }
/* 标准区块 */
.section { padding: clamp(3rem, 6vw, 6rem) 0; }
/* 呼吸空间(编辑性分隔、推荐语) */
.section--spacious { padding: clamp(4rem, 8vw, 10rem) 0; }
| 元素 | 阴影 |
|---|---|
| 静止状态的卡片 | --shadow-sm |
| 悬停状态的卡片 | --shadow-md |
| 下拉菜单 | --shadow-lg |
| 模态框 | --shadow-xl |
并非所有东西都需要阴影。请谨慎使用。
通过内联 SVG 使用 Lucide 图标:
currentColor(继承文字颜色)不容妥协:
<header>, <nav>, <main>, <section>, <footer>aria-expanded,需要时使用 aria-labelloading="lazy"loading="eager"<link rel="preconnect" href="https://fonts.googleapis.com">这些模式会暴露“这是 AI 生成的”——请避免:
在标记为完成前检查:
每周安装数
311
仓库
GitHub 星标数
643
首次出现
2026年2月18日
安全审计
安装于
opencode272
codex269
gemini-cli267
github-copilot266
kimi-cli255
cursor255
Universal patterns for building production-grade HTML/CSS. This skill covers implementation methodology — pair with web-design-patterns for specific component designs.
Production-ready HTML/CSS prototypes with:
prototype/
├── index.html
├── about.html
├── services.html
├── contact.html
├── favicon.svg
├── css/
│ ├── variables.css # Tokens: colours, typography, spacing
│ ├── styles.css # All component styles (BEM)
│ └── mobile-nav.css # Mobile menu styles
├── js/
│ ├── theme.js # Dark mode toggle (only if requested)
│ └── mobile-menu.js # Hamburger menu
└── media/
└── images/
Build order:
variables.css — tokens firstfavicon.svg — simple SVG from brand colourstyles.css — all BEM componentsmobile-nav.css — responsive navigationassets/ templatesindex.html — homepage firstUse Block-Element-Modifier naming. No exceptions.
/* Block */
.hero { }
.card { }
.nav { }
/* Element (child of block) */
.hero__title { }
.hero__subtitle { }
.hero__cta { }
.card__image { }
.card__content { }
/* Modifier (variation) */
.hero--split { }
.hero--minimal { }
.card--featured { }
.btn--primary { }
.btn--lg { }
Rules:
__--.hero__content__title is wrong.card__image only inside .cardUse semantic tokens. Never hardcode colours, spacing, or typography values.
See references/css-variables-template.md for the complete token template.
/* Always this */
.card {
background: var(--card);
color: var(--card-foreground);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-sm);
padding: var(--space-6);
}
/* Never this */
.card {
background: #ffffff;
color: #333333;
border: 1px solid #e5e5e5;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 24px;
}
Dark mode is optional — only add if the brief requests it. Most business sites ship faster as light-only.
When to include:
When to skip:
Use class-based toggle, never CSS media queries.
/* Light mode (default) */
:root {
--background: #F9FAFB;
--foreground: #0F172A;
--card: #FFFFFF;
--card-foreground: #1E293B;
}
/* Dark mode (via .dark class on html) */
.dark {
--background: #0F172A;
--foreground: #F1F5F9;
--card: #1E293B;
--card-foreground: #F1F5F9;
}
Rules:
.dark class on <html>, toggled via JavaScript@media (prefers-color-scheme: dark) — JS handles system preference#0F172A to #1E293B range (not pure black)Use assets/theme-toggle.js for the three-state toggle implementation.
Mobile-first. Design for 375px, enhance upward.
/* Base: 375px (mobile) — no media query needed */
@media (min-width: 640px) { /* sm — large phone */ }
@media (min-width: 768px) { /* md — tablet */ }
@media (min-width: 1024px) { /* lg — small desktop */ }
@media (min-width: 1440px) { /* xl — standard desktop */ }
.prose { max-width: 65ch; }
.hero__content { max-width: min(640px, 45vw); }
.container {
max-width: 1280px;
margin-inline: auto;
padding-inline: var(--space-4);
}
.section { padding: clamp(3rem, 6vw, 6rem) 0; }
Use assets/mobile-nav.js for the hamburger menu implementation.
clamp(2.5rem, 6vw, 5rem) for hero titles.letter-spacing: 0.05em minimum.The 80/20 rule:
If primary is on every heading, border, icon — nothing stands out.
Not uniform padding. Sections breathe differently:
/* Tight section (service list, FAQ) */
.section--compact { padding: clamp(2rem, 4vw, 4rem) 0; }
/* Standard section */
.section { padding: clamp(3rem, 6vw, 6rem) 0; }
/* Breathing room (editorial break, testimonial) */
.section--spacious { padding: clamp(4rem, 8vw, 10rem) 0; }
| Element | Shadow |
|---|---|
| Cards at rest | --shadow-sm |
| Cards on hover | --shadow-md |
| Dropdowns | --shadow-lg |
| Modals | --shadow-xl |
Not everything needs shadow. Use sparingly.
Use Lucide icons via inline SVG:
currentColor (inherits text colour)Non-negotiable:
<header>, <nav>, <main>, <section>, <footer>aria-expanded on toggles, aria-label where neededloading="lazy" on images below the foldloading="eager" on hero image<link rel="preconnect" href="https://fonts.googleapis.com"> in headThese patterns signal "AI generated this" — avoid:
Before marking complete:
Weekly Installs
311
Repository
GitHub Stars
643
First Seen
Feb 18, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode272
codex269
gemini-cli267
github-copilot266
kimi-cli255
cursor255
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
105,000 周安装