claude官方教程通过 Skills 提升前端设计质量:完整实战教程
claude官方教程通过 Skills 提升前端设计质量:完整实战教程
claude官方教程通过 Skills 提升前端设计质量:完整实战教程 claude官方教程通过 Skills 提升前端设计质量:完整实战教程 Modified February 17 • ✅ 完全符合你的设计系统 • ✅ 包含你的常用组件 • ✅ 团队共享,保证一致性 7.2 如何创建适合你的 Skill? 步骤 1:分析你的设计系统 提取这些信息: Code block YAML Copy 品牌: 主色调 辅助色 字体(标题、正文、代码) 组件: 按钮风格(圆角、阴影、hover 效果) 卡片样式 表单输入框样式 模式: 布局结构 间距系统 动画偏好 步骤 2:编写 Skill 创建 company design system.md: Code block XML Copy <company design system Brand Colors: Use CSS variables: xml <ecommerce ui Focus on: High quality product imagery(高质量产品图片) Clear pricing hierarchy(清晰价格层级) Trust badges and social proof(信任徽章和社交证明) Prominent CTAs(突出的行动按钮) Mobile first product cards(移动优先的产品卡片) Avoid: Cluttered layouts(杂乱布局) Hidden shipping costs(隐藏运费) Small checkout buttons(过小的结账按钮) </ecommerce ui SaaS Dashboard Skill Code block XML Copy <saas dashboard Focus on: Clean data visualization(清晰数据可视化) Sidebar navigation(侧边栏导航) Card based metrics(卡片式指标) Action oriented interface(行动导向界面) Dark mode support(暗色模式支持) Components to include: Metric cards with sparklines Data tables with sorting/filtering Charts (bar, line, pie) Date range pickers Export buttons </saas dashboard 8. 常见问题解答 Q1:Skill 文件应该放在哪里? A: Code block Bash Copy Claude Code 默认位置 /.config/claude code/skills/ 你可以通过以下命令检查 claude code config Q2:一个 Skill 文件可以多大? A: • 推荐大小:300 1000 tokens • 太小:不够详细 • 太大:加载慢,可能超出上下文 原则:包含必要信息,去除冗余内容。 Q3:如何让 Claude 自动使用 Skill? A: • Claude Code:可以配置自动触发规则 • Claude.ai:目前需要手动指定 "使用 X skill" Q4:可以使用多个 Skill 吗? A:可以!例如: Code block Plain Text Copy "使用 frontend design 和 rpg theme skill 创建一个游戏网站" • ✅ 完全符合你的设计系统 • ✅ 包含你的常用组件 • ✅ 团队共享,保证一致性 7.2 如何创建适合你的 Skill? 步骤 1:分析你的设计系统 提取这些信息: 步骤 2:编写 Skill 创建 company design system.md: css :root { primary: 2563eb; / 品牌蓝 / primary dark: 1e40af; secondary: 10b981; / 成功绿 / danger: ef4444; / 错误红 / bg main: ffffff; bg alt: f8fafc; text main: 0f172a; text muted: 64748b; } Code block HTML Copy <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700&family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" Code block CSS Copy .btn { padding: 0.75rem 1.5rem; border radius: 8px; font weight: 600; transition: all 0.2s ease; } .btn primary { background: var( primary); color: white; } .btn primary:hover { background: var( primary dark); transform: translateY( 2px); box shadow: 0 4px 12px rgba(37, 99, 235, 0.3); } Code block CSS Copy .card { background: white; border radius: 12px; padding: 1.5rem; box shadow: 0 1px 3px rgba(0,0,0,0.1); border: 1px solid e2e8f0; } Code block CSS Copy .input { width: 100%; padding: 0.75rem 1rem; border: 1px solid cbd5e1; border radius: 8px; font size: 1rem; transition: border color 0.2s, box shadow 0.2s; } .input:focus { outline: none; border color: var( primary); box shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); } Code block Plain Text Copy 7.3 行业特定 Skill 电商 UI Skill SaaS Dashboard Skill 8. 常见问题解答 Q1:Skill 文件应该放在哪里? A: Q2:一个 Skill 文件可以多大? A: • 推荐大小:300 1000 tokens • 太小:不够详细 • 太大:加载慢,可能超出上下文 原则:包含必要信息,去除冗余内容。 Q3:如何让 Claude 自动使用 Skill? A: • Claude Code:可以配置自动触发规则 • Claude.ai:目前需要手动指定 "使用 X skill" Q4:可以使用多个 Skill 吗? A:可以!例如: Q7:可以分享 Skill 吗? A:可以! • 团队内:复制到共享目录 • 公开:发布到 GitHub • Claude 提供了 skill creator 工具 Q8:Skill 支持代码示例吗? A:强烈推荐! css / 这是你应该使用的代码 / .button { background: var( primary); } Code block CSS Copy / 不要这样写 / .button { background: blue; } Code block Plain Text Copy 9. 快速参考清单 9.1 Skills 设置清单 [ ] 找到或创建 skills 目录 [ ] 创建 [ ] 复制通用提示词模板(第 3.2 节) [ ] (可选)创建特定维度 skill(字体、主题、动画等) [ ] (可选)创建自定义设计系统 skill [ ] 测试:让 Claude 生成一个简单页面 9.2 使用 Skills 清单 每次生成前端时: [ ] 告诉 Claude "使用 X skill" [ ] 检查生成的代码是否符合规范 [ ] 如有问题,调整 skill 内容 [ ] 保存好的配置供后续使用 9.3 常用 Skills 快速索引 | Skill 文件 | 用途 | 适用场景 | | | | | | | 通用前端设计提升 | 所有前端项目 | | | 字体专项优化 | 注重排版的项目 | | | RPG 游戏风格 | 游戏网站、奇幻主题 | | | 动画优化 | 交互丰富的应用 | | | 背景设计 | 视觉要求高的页面 | | | 企业设计系统 | 生产环境项目 | | | 电商界面 | 电商网站 | | | SaaS 后台 | 数据密集应用 | 9.4 Prompt 模板 基础使用 Code block Plain Text Copy 组合使用 Code block Plain Text Copy 指定技术栈 Code block Plain Text Copy 指定具体需求 Code block Plain Text Copy 10. 总结 核心要点回顾 1. AI 默认生成"安全但无聊"的设计 这是分布收敛的自然结果 需要主动引导才能突破 2. Skills 提供"按需加载"的专家指导 不污染其他任务的上下文 节省 tokens,提高性能 3. 提示词要"适度具体" 不要太死板(指定 hex 色号) 不要太模糊("做好看点") 给出方向和原则 4. 可复用性是关键 一次创建,多次使用 团队共享,保证一致性 持续迭代优化 方法论扩展 这个方法不仅适用于前端设计,任何 AI 输出"通用但平庸"的领域都可以应用: Code block Plain Text Copy 可应用的领域 : 后端架构设计 API 设计规范 文档写作风格 测试用例生成 数据分析报告 下一步行动 1. 立即开始 :创建你的第一个 frontend design skill 2. 实验对比 :生成两个版本,对比使用 skill 前后的效果 3. 持续优化 :根据实际需求调整 skill 内容 4. 团队分享 :让同事也使用,建立统一标准 5. 扩展应用 :尝试将 skill 方法应用到其他领域 附录:资源链接 原文 :Improving frontend design through Skills Claude Skills 文档 :Claude Skills Documentation 前端设计指南 :Frontend Design Cookbook Skill Creator 工具 :skill creator 版本信息 文档版本:v1.0 创建日期:2026 02 16 基于 Claude Blog 文章整理 贡献 如果你有任何改进建议或创建了有用的 skill,欢迎分享! 祝你创建出令人惊艳的前端设计! 🎨✨ Code block Plain Text Copy 训练数据中的主流设计 → 高概率模式 → AI 采样输出 ↓ "安全"的设计选择 (通用、不会出错、但缺乏特色) Code block Plain Text Copy 系统提示 = 常驻内存(始终加载) Skills = 按需插件(需要时才加载) Code block YAML Copy 优点: 指令始终生效 不需要手动激活 缺点: 每个请求都携带设计指导(浪费 tokens) 调试 Python 时也带着前端设计规范(干扰) 上下文窗口臃肿 → 可能影响性能 Code block YAML Copy 优点: 按需加载,精准投放 不影响其他任务的上下文 可复用、可共享 节省 tokens Code block Plain Text Copy ┌─────────────┐ │ 用户请求 │ "帮我创建一个登录页面" └──────┬──────┘ │ ▼ ┌─────────────────────────┐ │ Claude 识别任务类型 │ → 前端设计任务 └──────┬──────────────────┘ │ ▼ ┌─────────────────────────┐ │ 加载 frontend design │ ← 动态读取 skill 文件 │ skill │ └──────┬──────────────────┘ │ ▼ ┌─────────────────────────┐ │ 应用设计规范 │ 字体、配色、动画等 └──────┬──────────────────┘ │ ▼ ┌─────────────────────────┐ │ 生成高质量代码 │ └─────────────────────────┘ Code block Bash Copy macOS/Linux /.config/claude code/skills/ 或者检查你的配置 claude code config Code block Bash Copy mkdir p /.config/claude code/skills/ Code block Bash Copy cd /.config/claude code/skills/ touch frontend design.md Code block XML Copy <frontend aesthetics You tend to converge toward generic, "on distribution" outputs. In frontend design, this creates what users call the "AI slop" aesthetic. Avoid this: make creative, distinctive frontends that surprise and delight. Focus on: Typography: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics. Color & Theme: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly distributed palettes. Draw from IDE themes and cultural aesthetics for inspiration. Motion: Use animations for effects and micro interactions. Prioritize CSS only solutions for HTML. Use Motion library for React when available. Focus on high impact moments: one well orchestrated page load with staggered reveals (animation delay) creates more delight than scattered micro interactions. Backgrounds: Create atmosphere and depth rather than defaulting to solid colors. Layer CSS gradients, use geometric patterns, or add contextual effects that match the overall aesthetic. Avoid generic AI generated aesthetics: Overused font families (Inter, Roboto, Arial, system fonts) Clichéd color schemes (particularly purple gradients on white backgrounds) Predictable layouts and component patterns Cookie cutter design that lacks context specific character Interpret creatively and make unexpected choices that feel genuinely designed for the context. Vary between light and dark themes, different fonts, different aesthetics. You still tend to converge on common choices (Space Grotesk, for example) across generations. Avoid this: it is critical that you think outside the box! </frontend aesthetics Code block XML Copy You tend to converge toward generic, "on distribution" outputs. In frontend design, this creates what users call the "AI slop" aesthetic. Avoid this: make creative, distinctive frontends that surprise and delight. Code block XML Copy Focus on: Typography: ... Color & Theme: ... Motion: ... Backgrounds: ... Code block XML Copy Avoid generic AI generated aesthetics: Overused font families (Inter, Roboto, Arial, system fonts) Clichéd color schemes (particularly purple gradients on white backgrounds) ... Code block XML Copy You still tend to converge on common choices (Space Grotesk, for example). Avoid this: it is critical that you think outside the box! Code block Plain Text Copy 你:"使用 frontend design skill,帮我创建一个 SaaS 产品的登录页面" Claude 会自动: 1. 读取 frontend design.md 2. 应用其中的设计原则 3. 生成更高质量的代码 Code block XML Copy <use interesting fonts Typography instantly signals quality. Avoid using boring, generic fonts. Never use: Inter, Roboto, Open Sans, Lato, default system fonts Here are some examples of good, impactful choices: Code aesthetic: JetBrains Mono, Fira Code, Space Grotesk Editorial: Playfair Display, Crimson Pro Technical: IBM Plex family, Source Sans 3 Distinctive: Bricolage Grotesque, Newsreader Retro: VT323, Press Start 2P(用于像素风格) Elegant: Cormorant Garamond, Yeseva One Pairing principle: High contrast = interesting. Display + monospace(标题 + 等宽代码) Serif + geometric sans(衬线 + 几何无衬线) Variable font across weights(可变字体跨字重) Use extremes: Weight: 100/200 vs 800/900(不要用 400 vs 600) Size: 3x+ jumps(不要用 1.5x) Line height: Tight for headlines (1.1 1.2), Loose for body (1.6 1.8) Pick one distinctive font, use it decisively. Load from Google Fonts. Always include: @import url('https://fonts.googleapis.com/css2?family=[FONT NAME]&display=swap'); </use interesting fonts Code block XML Copy <always use rpg theme Always design with RPG aesthetic: Color Palette: Rich, dramatic tones(丰富、戏剧性的色调) Deep burgundy, forest green, gold accents Parchment/aged paper backgrounds ( f4e4bc, e8d5a9) Shadowy corners and dramatic lighting Textures & Materials: Parchment textures(羊皮纸纹理) Leather bound styling(皮质装订风格) Weathered materials(风化材质) Code block XML Copy Code block Plain Text Copy 4.4 背景设计 Skill 创建 : css background: linear gradient(135deg, rgba(76, 29, 149, 0.1) 0%, transparent 50%), linear gradient(225deg, rgba(236, 72, 153, 0.1) 0%, transparent 50%), radial gradient(circle at 20% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 40%); Code block CSS Copy background image: Code block Plain Text Copy 5. 高级应用:使用现代技术栈构建复杂应用 5.1 为什么需要更强大的工具? 限制 :在 claude.ai 中,Claude 默认只能生成单个 HTML 文件(包含 CSS 和 JS) 问题 : ❌ 无法使用 React 组件化开发 ❌ 无法利用 Tailwind CSS 的实用类 ❌ 无法使用 shadcn/ui 等组件库 ❌ 代码难以维护和扩展 5.2 解决方案:web artifacts builder Skill 这个 skill 允许 Claude: 使用 React + Tailwind CSS + shadcn/ui 创建多文件项目结构 最后打包成单个 HTML 文件 5.3 使用方法 步骤 1:启用 web artifacts builder skill 在 Claude.ai 中: 1. 进入设置 → Skills 2. 启用 步骤 2:在对话中使用 Code block Plain Text Copy 5.4 实际效果对比 案例 1:白板应用 不使用 skill : 使用 web artifacts builder: 案例 2:任务管理应用 不使用 skill: 使用 web artifacts builder: 6. 实战案例:效果对比分析 6.1 案例 1:SaaS 落地页 不使用 Skill 特征: • Inter 字体 • 紫色渐变 hero section • 标准三栏布局 • 白色背景 • 最小动画 代码示例: 使用 frontend design Skill 特征: • Space Grotesk 或其他特色字体 • 深色主题 + 鲜明强调色 • 层次丰富的背景 • CSS 变量管理颜色 • 页面加载动画 代码示例: 6.2 案例 2:博客布局 不使用 Skill 问题: • 系统默认字体 • 平坦白色背景 • 缺少视觉层级 • 无动画 使用 frontend design Skill 改进: • 编辑风格字体(Playfair Display + Source Sans 3) • 温暖的纸质色调背景 • 清晰的视觉层级 • 淡入动画 6.3 案例 3:管理后台 不使用 Skill 问题: • 标准组件,无特色 • 视觉层级不清晰 • 最小动画 使用 frontend design Skill 改进: • 粗体标题(IBM Plex Sans) • 深色主题 + 鲜明数据可视化 • 页面加载动画 • 微交互反馈 7. 自定义 Skill:构建团队知识资产 7.1 为什么自定义? 通用 skill: • ✅ 适合快速上手 • ❌ 不符合你的品牌规范 • ❌ 不包含你的组件模式 自定义 skill: Q5:Skill 之间会冲突吗? A:可能。建议: • 避免重复指令 • 使用清晰、独立的 skill • 测试组合使用效果 Q6:如何更新 Skill? A: