スキル一覧に戻る
ProfPowell

icons

by ProfPowell

A layered HTML component system. Build with native HTML elements, enhance progressively with CSS custom elements and JavaScript web components.

0🍴 0📅 2026年1月25日
GitHubで見るManusで実行

SKILL.md


name: icons description: Use consistent Lucide icons with the component. Use when adding icons to pages, buttons, or UI elements. allowed-tools: Read, Write, Edit, Bash

Icons Skill

Use the Lucide icon library with local SVG files and the <icon-wc> Web Component for consistent, accessible icons.

CRITICAL: When to Use This Skill

ALWAYS use the <icon-wc> component. NEVER use inline SVGs.

You Are Adding...USE THIS SKILL
Icon button (close, menu, etc.)YES
Navigation iconsYES
Status indicators (success, error, warning)YES
Toggle switches with icons (theme, settings)YES
Action buttons (save, delete, edit)YES
Social sharing iconsYES
ANY visual indicator or iconYES

Bad (Do NOT do this):

<!-- WRONG: Inline SVG -->
<button>
  <svg viewBox="0 0 24 24"><path d="M12 3v1m0 16v1..."/></svg>
</button>

Good (Do this instead):

<!-- CORRECT: icon-wc component -->
<button>
  <icon-wc name="sun" label="Light theme"></icon-wc>
</button>

Why? The <icon-wc> component:

  • Ensures consistent sizing across the app
  • Handles accessibility automatically
  • Uses optimized, cached SVG loading
  • Inherits color from CSS (no hardcoded colors)
  • Works with any icon set (Lucide, custom, etc.)

Quick Start

<!-- Basic usage -->
<icon-wc name="menu"></icon-wc>
<icon-wc name="arrow-right"></icon-wc>
<icon-wc name="check"></icon-wc>

<!-- With size -->
<icon-wc name="home" size="lg"></icon-wc>

<!-- With accessible label (for functional icons) -->
<button>
  <icon-wc name="x" label="Close"></icon-wc>
</button>

<!-- Custom icon set -->
<icon-wc name="logo" set="custom"></icon-wc>

Directory Structure

.assets/
├── js/
│   └── components/
│       └── x-icon/          # Icon Web Component
│           ├── icon-wc.js
│           └── x-icon-styles.js
└── icons/
    ├── lucide/              # Lucide icons (synced from npm)
    │   ├── index.json       # Icon manifest
    │   ├── menu.svg
    │   ├── x.svg
    │   └── ...              # ~1900 icons
    └── custom/              # Project-specific icons
        └── logo.svg

Setup

Run /scaffold-icons to set up icons in a project, or manually:

# 1. Install lucide-static
npm install lucide-static --save-dev

# 2. Sync icons
npm run icons:sync

# 3. Copy icon-wc component
mkdir -p .assets/js/components/icon-wc
cp .claude/skills/icons/templates/icon-wc/*.js .assets/js/components/icon-wc/

# 4. Include in HTML
<script type="module" src="/.assets/js/components/icon-wc/icon-wc.js"></script>

The <icon-wc> Component

Attributes

AttributeDescriptionDefault
nameIcon name (filename without .svg)Required
setIcon set directory"lucide"
sizeSize preset: xs, sm, md, lg, xl, 2xl"md"
labelAccessible label for functional iconsNone
base-pathOverride default icon path/.assets/icons

Size Reference

SizeDimensions
xs1em (16px at base)
sm1.25em (20px)
md1.5em (24px)
lg2em (32px)
xl2.5em (40px)
2xl3em (48px)

Styling

Icons inherit currentColor for stroke color:

/* Change icon color */
.danger icon-wc {
  color: var(--color-error);
}

/* Custom sizing */
icon-wc.hero-icon {
  width: 4rem;
  height: 4rem;
}

Syncing Icons

Icons are sourced from the lucide-static npm package:

# Install package (one-time)
npm install lucide-static --save-dev

# Sync icons to .assets/icons/lucide/
npm run icons:sync

Run icons:sync after:

  • Initial project setup
  • Updating lucide-static version
  • Fresh npm install

Accessibility

Decorative Icons (default)

Icons without a label are hidden from screen readers:

<!-- Decorative - hidden from screen readers -->
<button>
  <icon-wc name="save"></icon-wc>
  Save Document
</button>

Functional Icons

Add label for icon-only buttons or links:

<!-- Functional - announced to screen readers -->
<button aria-label="Close dialog">
  <icon-wc name="x" label="Close"></icon-wc>
</button>

Guidelines

ContextPattern
Icon + visible textNo label needed (decorative)
Icon-only buttonAdd label attribute
Status indicatorAdd label describing status
Purely decorativeNo label needed

Adding Custom Icons

  1. Create SVG file in .assets/icons/custom/:
<!-- .assets/icons/custom/logo.svg -->
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  <path d="M12 2L2 7l10 5 10-5-10-5z"/>
</svg>
  1. Use with set="custom":
<icon-wc name="logo" set="custom"></icon-wc>

Custom Icon Requirements

  • SVG format with viewBox attribute
  • No fixed width/height (component handles sizing)
  • Use currentColor for strokes/fills to inherit color
  • Keep file size small (optimize with SVGO)

Replacing the Icon Set

To use a different icon library:

  1. Remove lucide-static: npm uninstall lucide-static
  2. Install alternative: npm install [other-library]
  3. Update .claude/scripts/sync-icons.js source path
  4. Run npm run icons:sync
  5. Or manually copy SVGs to .assets/icons/[set-name]/

The <icon-wc> component works with any SVG icon library.

Finding Icons

Browse available icons:

# Search for icons locally
grep -l "arrow" .assets/icons/lucide/*.svg | head -10

Common Icons

PurposeIcon Name
Navigationmenu, x, arrow-left, arrow-right
Actionsplus, minus, edit, trash, save
Statuscheck, x, alert-circle, info
Mediaplay, pause, volume-2, image
Useruser, users, settings, log-out
Filesfile, folder, download, upload
Socialshare, heart, star, message-circle

Checklist

When using icons:

  • Icon name matches file in .assets/icons/[set]/
  • Functional icons have label attribute
  • Icon size appropriate for context
  • Color inherits from parent (uses currentColor)
  • Custom icons saved to .assets/icons/custom/
  • xhtml-author - Write valid XHTML-strict HTML5 markup
  • accessibility-checker - Ensure WCAG2AA accessibility compliance
  • css-author - Modern CSS organization with native @import, @layer casca...
  • performance - Write performance-friendly HTML pages

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です