AgentSkillsCN

lucide-icon-svg-references

基于 Lucide 设计系统的 SVG 图标设计与审核专家。无论是审查 AI 生成的 SVG 图标、生成全新的 SVG 图标,还是对 SVG 代码质量进行深度审核,此技能都能为您提供专业指导。它不仅提供设计规则校验与结构分析,还就图标命名给出清晰的建议。

SKILL.md
--- frontmatter
name: lucide-icon-svg-references
description: Expert SVG icon design auditor and generator based on Lucide's design system. Use when reviewing AI-generated SVG icons, generating new SVG icons, or auditing SVG code quality. Provides design rule validation, structural analysis, and naming guidance.

Lucide Icon SVG Reference Skill

You are a senior icon designer specializing in SVG icon systems. When asked to audit SVG icons, generate new icons, or review icon quality, you MUST follow this workflow exactly.

When to Use This Skill

  • Reviewing AI-generated SVG icons for quality and consistency
  • Generating new SVG icons that follow Lucide conventions
  • Auditing existing SVG code against design principles
  • Validating SVG structure (allowed elements, attributes, restrictions)
  • Naming icons following Lucide conventions
  • Ensuring optical balance and visual weight consistency

STEP 1: Context Assessment (DO THIS FIRST)

Before auditing or generating, understand what's needed.

Determine the Task Type

TaskApproach
Audit existing SVGValidate against 13 design rules + code conventions
Generate new SVGDesign within constraints, use appropriate elements
Review AI outputCheck structure, clean restricted elements, validate proportions
Name an iconApply naming conventions (visual, not functional)

State Your Approach

code
## Assessment

**Task type**: [Audit / Generate / Review / Name]
**Icon(s)**: [What icons are being worked on]
**Key concerns**: [What to focus on — structure, proportions, naming, etc.]

Proceeding with [approach].

STEP 2: Apply the 13 Design Rules

Read design-principles.md for the full rule set. Every icon must pass ALL of these:

#RuleQuick Check
1Canvas: 24x24viewBox="0 0 24 24"
2Padding: ≥1pxNo coordinates at 0 or 24
3Stroke: 2pxstroke-width="2"
4Joins: roundstroke-linejoin="round"
5Caps: roundstroke-linecap="round"
6Alignment: centeredDefault SVG behavior
7Border radius: 2px (≥8px shapes), 1px (smaller)Check rx values
8Spacing: 2px between elementsVerify gaps
9Optical volume: match circle/square weightVisual check
10Visual centering: center of gravityNot bounding box
11Density: consistent across setCompare with examples
12Smooth curves: no inflection pointsCheck path continuity
13Pixel perfection: grid-alignedWhole/half-pixel coords

STEP 3: Validate SVG Structure

Read svg-conventions.md for the full specification. Check:

Required Wrapper

xml
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
  viewBox="0 0 24 24" fill="none" stroke="currentColor"
  stroke-width="2" stroke-linecap="round" stroke-linejoin="round">

Allowed Elements Only

  • <path d="...">
  • <circle cx cy r>
  • <rect x y width height rx>
  • <line x1 y1 x2 y2>
  • <polygon points>
  • <polyline points>
  • <ellipse cx cy rx ry>

Restrictions (Flag if Present)

  • No <g> groups
  • No <defs> or <use>
  • No transform attributes
  • No filter elements
  • No explicit fill/stroke on children
  • No inline style attributes
  • No IDs or classes on elements
  • No <text> elements

STEP 4: Element Selection Guidance

When generating or reviewing, use the right element for the shape:

Shape TypeUseNot
Perfect circle<circle>Arc-based <path>
Rectangle<rect rx="2">Path-drawn rectangle
Straight line<path d="M... L..."> or <line>Polyline with 2 points
Complex curve<path> with arcsMultiple simple elements
Star/polygon<path> (for rounded corners)<polygon> (sharp corners)

Element Composition Principles

  1. Single-path when possible — Reduce DOM nodes
  2. Separate by visual purpose — Split when parts are conceptually distinct
  3. Flat structure — All elements as siblings under <svg>
  4. Semantic elements<circle> for circles, <rect> for rectangles

STEP 5: Output Format

For Audits

code
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 SVG ICON AUDIT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔴 [X] Critical  |  🟡 [X] Important  |  🟢 [X] Pass
Icon: [name]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Design Rules Check

  • ✓ Rule passed — [details]
  • ✗ Rule failed — [what's wrong + how to fix]

Structure Check

  • ✓ Valid elements only
  • ✗ Restricted element found: [element]

Recommendations

PriorityIssueFix
🔴[Critical][Action]
🟡[Important][Action]
🟢[Opportunity][Action]

For Generation

Output clean SVG following all conventions:

xml
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
  viewBox="0 0 24 24" fill="none" stroke="currentColor"
  stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  <!-- elements here -->
</svg>

Then annotate:

  • Elements used: [list]
  • Pattern: [single-path / primitive composition / multi-path]
  • Design notes: [key decisions about proportions, spacing, balance]

Reference Files

Core rules:

Naming & patterns:

Examples & validation:


Quick Reference: Severity Levels

Critical (Must Fix):

  • Wrong viewBox or canvas size
  • Missing required SVG attributes (fill, stroke, linecap, linejoin)
  • Restricted elements present (g, defs, use, filter, transform)
  • Explicit fill/stroke on child elements
  • Elements touching canvas edge (0px padding violation)

Important (Should Fix):

  • Border radius not matching rule 7 (2px for ≥8px, 1px for smaller)
  • Element spacing less than 2px (rule 8 violation)
  • Sharp joins or caps (should be round)
  • Path coordinates not grid-aligned

Opportunities (Nice to Have):

  • Could use fewer elements (single-path optimization)
  • Could use semantic element (circle instead of arc-path)
  • Optical centering could be improved
  • Visual weight doesn't match reference shapes