|
| 1 | +--- |
| 2 | +name: icons8 |
| 3 | +description: "Fetch icons, illustrations, and photos from Icons8. Search 1.5M+ icons across 116 styles, vector illustrations, and 500K+ stock photos. Supports API (with key) and free CDN fallback (no key needed)." |
| 4 | +argument-hint: "[type:] [query] e.g. 'icon: shopping cart', 'illustration: teamwork', 'photo: office'" |
| 5 | +disable-model-invocation: true |
| 6 | +allowed-tools: Bash, Read, Write, Glob, Grep, WebSearch, WebFetch, AskUserQuestion |
| 7 | +--- |
| 8 | + |
| 9 | +# Icons8 Fetcher |
| 10 | + |
| 11 | +Fetch icons, illustrations, and photos from Icons8's library of 1.5M+ assets. |
| 12 | + |
| 13 | +## Config |
| 14 | + |
| 15 | +Read config from `~/.claude/skills/icons8/config.json`: |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + "api_key": "", |
| 20 | + "default_count": 10, |
| 21 | + "default_style": "color", |
| 22 | + "default_format": "png", |
| 23 | + "default_size": 128, |
| 24 | + "output_dir": "assets/icons" |
| 25 | +} |
| 26 | +``` |
| 27 | + |
| 28 | +All fields are optional. The skill works without an API key via the CDN for icons. |
| 29 | + |
| 30 | +Load config silently at the start of every invocation: |
| 31 | + |
| 32 | +```bash |
| 33 | +cat ~/.claude/skills/icons8/config.json 2>/dev/null || echo '{}' |
| 34 | +``` |
| 35 | + |
| 36 | +## Available Styles (116 total, most popular listed) |
| 37 | + |
| 38 | +| Style Code | Description | |
| 39 | +|------------|-------------| |
| 40 | +| `color` | Colorful flat icons (most popular) | |
| 41 | +| `ios` / `ios-filled` | Apple iOS style, outline and filled | |
| 42 | +| `material` / `material-outlined` | Google Material Design | |
| 43 | +| `fluency` | Microsoft Fluency 3D-like | |
| 44 | +| `3d-fluency` | Full 3D rendered icons | |
| 45 | +| `flat-round` | Flat with rounded shapes | |
| 46 | +| `dusk` | Gradient duotone icons | |
| 47 | +| `plumpy` | Thick-lined colorful icons | |
| 48 | +| `doodle` | Hand-drawn sketch style | |
| 49 | +| `stickers` | Sticker/emoji style | |
| 50 | +| `emoji` | Platform emoji style | |
| 51 | +| `tiny-color` | Small colorful pixel icons | |
| 52 | +| `pastel-glyph` | Soft pastel colored | |
| 53 | +| `cotton` | Soft rounded style | |
| 54 | +| `office` | Microsoft Office style | |
| 55 | + |
| 56 | +Use WebFetch to see the full list: `https://api-icons.icons8.com/api/publicApi/platforms` |
| 57 | + |
| 58 | +## Phase 1: Parse Input |
| 59 | + |
| 60 | +### Determine asset type and query from user input |
| 61 | + |
| 62 | +**Format:** `[type:] query` where type is optional. |
| 63 | + |
| 64 | +| Prefix | Asset Type | Example | |
| 65 | +|--------|-----------|---------| |
| 66 | +| `icon:` or `icons:` | Icons | `icon: shopping cart` | |
| 67 | +| `illustration:` or `illus:` | Illustrations | `illustration: teamwork` | |
| 68 | +| `photo:` or `photos:` | Photos | `photo: modern office` | |
| 69 | +| (no prefix) | Icons (default) | `rocket ship` | |
| 70 | + |
| 71 | +Also detect style overrides in the input: |
| 72 | +- `"shopping cart in material style"` -> query: "shopping cart", style: "material" |
| 73 | +- `"3d rocket icon"` -> query: "rocket", style: "3d-fluency" |
| 74 | + |
| 75 | +**If no input was provided**, scan the current directory for context (same as image-fetcher): |
| 76 | + |
| 77 | +| Source | What to extract | |
| 78 | +|--------|----------------| |
| 79 | +| `README.md` | Project name, description, purpose | |
| 80 | +| `package.json` / `pyproject.toml` | Name, description, keywords | |
| 81 | +| HTML/JSX/TSX files (first 3) | What UI elements exist, what icons might be needed | |
| 82 | +| Existing icons in `assets/`, `public/`, `static/`, `icons/` | What already exists | |
| 83 | + |
| 84 | +Then use AskUserQuestion: |
| 85 | + |
| 86 | +``` |
| 87 | +What kind of assets do you need from Icons8? |
| 88 | +Options: |
| 89 | +- Icons (1.5M+ across 116 styles) |
| 90 | +- Illustrations (vector SVG/PNG, multiple artistic styles) |
| 91 | +- Photos (500K+ stock photos) |
| 92 | +``` |
| 93 | + |
| 94 | +Follow up with: subject/query, preferred style, quantity needed. |
| 95 | + |
| 96 | +## Phase 2: Fetch Assets |
| 97 | + |
| 98 | +### Route A: Icons (API or CDN) |
| 99 | + |
| 100 | +#### If API key is configured: |
| 101 | + |
| 102 | +**Search endpoint:** |
| 103 | +```bash |
| 104 | +curl -s "https://api-icons.icons8.com/api/publicApi/icons?term=QUERY&amount=COUNT&platform=STYLE&language=en-US" \ |
| 105 | + -H "Api-Key: API_KEY" |
| 106 | +``` |
| 107 | + |
| 108 | +Response fields to extract: |
| 109 | +- `docs[].id` - icon ID |
| 110 | +- `docs[].name` - icon name |
| 111 | +- `docs[].commonName` - display name |
| 112 | +- `docs[].platform` - style code |
| 113 | +- `docs[].isFree` - boolean, whether free to use |
| 114 | +- `docs[].category` - category name |
| 115 | +- `docs[].tags[]` - related tags |
| 116 | + |
| 117 | +**Download endpoint** (for SVG source): |
| 118 | +```bash |
| 119 | +curl -s "https://api-icons.icons8.com/api/publicApi/icons/ICON_ID" \ |
| 120 | + -H "Api-Key: API_KEY" |
| 121 | +``` |
| 122 | + |
| 123 | +Response includes `icon.svg` field with the full SVG source. |
| 124 | + |
| 125 | +#### If NO API key (CDN fallback, always works): |
| 126 | + |
| 127 | +Icons8 provides a free CDN at `img.icons8.com`. Use this pattern: |
| 128 | + |
| 129 | +``` |
| 130 | +https://img.icons8.com/{style}/{size}/{icon-name}.png |
| 131 | +``` |
| 132 | + |
| 133 | +**Examples:** |
| 134 | +- `https://img.icons8.com/color/128/shopping-cart.png` |
| 135 | +- `https://img.icons8.com/ios-filled/96/home.png` |
| 136 | +- `https://img.icons8.com/3d-fluency/128/rocket.png` |
| 137 | +- `https://img.icons8.com/material-filled/64/search.png` |
| 138 | + |
| 139 | +**CDN rules:** |
| 140 | +- Max free size: 100px (with link attribution) or 512px (with API key) |
| 141 | +- Supported sizes: 16, 24, 32, 48, 64, 96, 128, 256, 512 |
| 142 | +- Icon names use lowercase-hyphenated format: "shopping cart" -> "shopping-cart" |
| 143 | +- Format is always PNG via CDN |
| 144 | +- Color customization: append color hex to style: `https://img.icons8.com/color/128/FF5733/shopping-cart.png` |
| 145 | + |
| 146 | +**CDN quirks (important):** |
| 147 | +- Not all icon names match what you'd expect. "notifications" doesn't exist but "bell" does. "heart" exists in "color" but not in "plumpy". |
| 148 | +- `material-filled` is NOT a valid style. Use `material` or `material-outlined` instead. |
| 149 | +- A failed CDN request returns either: |
| 150 | + - JSON with `{"success":false,"error":"...","code":"ICON_NAME_NOT_FOUND"}` (wrong icon name) |
| 151 | + - JSON with `{"success":false,"error":"...","code":"PLATFORM_ICON_NOT_FOUND"}` (icon exists but not in that style) |
| 152 | + - HTML error page from CDN77 (style path doesn't exist at all) |
| 153 | +- **Always verify** downloads with `file` command. If it's not `PNG image data`, the download failed. |
| 154 | + |
| 155 | +**CDN search strategy** (no API key): |
| 156 | +1. Convert the user's query to hyphenated format: "shopping cart" -> "shopping-cart" |
| 157 | +2. Try the direct CDN URL first with the default style |
| 158 | +3. Verify with `file` command that the result is a valid PNG (not JSON or HTML) |
| 159 | +4. If the download failed (JSON error or HTML), use WebSearch to find the correct icon name: |
| 160 | + ``` |
| 161 | + WebSearch: "site:icons8.com/icon {QUERY}" |
| 162 | + ``` |
| 163 | +5. Extract icon slugs from search results (URL pattern: `/icon/{id}/{slug}`) |
| 164 | +6. Use those slugs with the CDN pattern |
| 165 | +7. If a specific style fails with `PLATFORM_ICON_NOT_FOUND`, try "color" (most complete style) or suggest alternatives |
| 166 | + |
| 167 | +**For multiple icons** (when user wants a set), search for variations: |
| 168 | +``` |
| 169 | +WebSearch: "site:icons8.com/icons/set/{QUERY}/{STYLE}" |
| 170 | +``` |
| 171 | +Then WebFetch that URL to extract icon names from the page. |
| 172 | + |
| 173 | +### Route B: Illustrations |
| 174 | + |
| 175 | +Icons8 illustrations don't have a public CDN. Use WebSearch + WebFetch: |
| 176 | + |
| 177 | +``` |
| 178 | +WebSearch: "site:icons8.com/illustrations/illustration/{QUERY}" |
| 179 | +``` |
| 180 | + |
| 181 | +Or fetch the illustrations search page: |
| 182 | +``` |
| 183 | +WebFetch: "https://icons8.com/illustrations/s/{QUERY}" |
| 184 | +``` |
| 185 | + |
| 186 | +Extract illustration URLs and metadata from the page. Illustrations are available as SVG and PNG. |
| 187 | + |
| 188 | +If the user has an API key, also try: |
| 189 | +```bash |
| 190 | +curl -s "https://api-icons.icons8.com/api/publicApi/illustrations?term=QUERY&amount=COUNT" \ |
| 191 | + -H "Api-Key: API_KEY" |
| 192 | +``` |
| 193 | + |
| 194 | +### Route C: Photos |
| 195 | + |
| 196 | +Use WebSearch to find Icons8 stock photos: |
| 197 | + |
| 198 | +``` |
| 199 | +WebSearch: "site:icons8.com/photos {QUERY}" |
| 200 | +``` |
| 201 | + |
| 202 | +Or fetch the search page: |
| 203 | +``` |
| 204 | +WebFetch: "https://icons8.com/photos/s/{QUERY}" |
| 205 | +``` |
| 206 | + |
| 207 | +Extract photo URLs and metadata. |
| 208 | + |
| 209 | +## Phase 3: Present Candidates |
| 210 | + |
| 211 | +### For Icons: |
| 212 | + |
| 213 | +``` |
| 214 | +Found 10 icons for "shopping cart" in Color style: |
| 215 | +
|
| 216 | +| # | Name | Style | Free | Preview URL | |
| 217 | +|---|------|-------|------|-------------| |
| 218 | +| 1 | Shopping Cart | color | Yes | img.icons8.com/color/128/shopping-cart.png | |
| 219 | +| 2 | Add Shopping Cart | color | Yes | img.icons8.com/color/128/add-shopping-cart.png | |
| 220 | +| 3 | Shopping Cart Loaded | color | Yes | img.icons8.com/color/128/shopping-cart-loaded.png | |
| 221 | +... |
| 222 | +
|
| 223 | +Want to: |
| 224 | +- Download specific ones? (enter numbers: 1, 3, 5) |
| 225 | +- Download all? |
| 226 | +- See these in a different style? (ios, material, 3d-fluency, etc.) |
| 227 | +- Search for something else? |
| 228 | +``` |
| 229 | + |
| 230 | +### For Illustrations: |
| 231 | + |
| 232 | +``` |
| 233 | +Found 5 illustrations for "teamwork": |
| 234 | +
|
| 235 | +| # | Title | Style | Format | |
| 236 | +|---|-------|-------|--------| |
| 237 | +| 1 | Team collaboration | Corporate | SVG, PNG | |
| 238 | +| 2 | Remote teamwork | 3D | SVG, PNG | |
| 239 | +... |
| 240 | +``` |
| 241 | + |
| 242 | +### For Photos: |
| 243 | + |
| 244 | +``` |
| 245 | +Found 5 photos for "modern office": |
| 246 | +
|
| 247 | +| # | Description | Size | Category | |
| 248 | +|---|-------------|------|----------| |
| 249 | +| 1 | Open plan office with natural light | 1920x1280 | Business | |
| 250 | +... |
| 251 | +``` |
| 252 | + |
| 253 | +Then ask via AskUserQuestion which to download. |
| 254 | + |
| 255 | +## Phase 4: Download & Save |
| 256 | + |
| 257 | +1. Determine output directory based on asset type: |
| 258 | + - Icons: `{output_dir}/` (default: `assets/icons/`) |
| 259 | + - Illustrations: `assets/illustrations/` |
| 260 | + - Photos: `assets/photos/` |
| 261 | + |
| 262 | +2. Create the output directory: |
| 263 | +```bash |
| 264 | +mkdir -p ./OUTPUT_DIR |
| 265 | +``` |
| 266 | + |
| 267 | +3. Generate filenames: |
| 268 | + - Format: `{icon-name}-{style}.{ext}` for icons |
| 269 | + - Format: `{title-slug}.{ext}` for illustrations/photos |
| 270 | + - Lowercase, hyphenated, max 60 chars |
| 271 | + |
| 272 | +4. Download: |
| 273 | + |
| 274 | +**Icons via CDN:** |
| 275 | +```bash |
| 276 | +curl -sL "https://img.icons8.com/{style}/{size}/{icon-name}.png" -o "./OUTPUT_DIR/{icon-name}-{style}.png" |
| 277 | +``` |
| 278 | + |
| 279 | +**Icons via API (SVG):** |
| 280 | +Extract the SVG content from the API response and write it directly: |
| 281 | +```bash |
| 282 | +# SVG content from API response |
| 283 | +echo 'SVG_CONTENT' > "./OUTPUT_DIR/{icon-name}-{style}.svg" |
| 284 | +``` |
| 285 | + |
| 286 | +**Illustrations/Photos:** |
| 287 | +```bash |
| 288 | +curl -sL "ASSET_URL" -o "./OUTPUT_DIR/FILENAME" |
| 289 | +``` |
| 290 | + |
| 291 | +5. Verify each download: |
| 292 | +```bash |
| 293 | +file "./OUTPUT_DIR/FILENAME" |
| 294 | +``` |
| 295 | +Confirm it's a valid image file (PNG, SVG, JPEG), not an HTML error page. |
| 296 | + |
| 297 | +6. If a CDN download returns a placeholder/error (< 1KB or HTML content), note it and try alternate icon name spellings. |
| 298 | + |
| 299 | +## Phase 5: Summary |
| 300 | + |
| 301 | +``` |
| 302 | +Downloaded 5 icons to ./assets/icons/: |
| 303 | +
|
| 304 | + 1. shopping-cart-color.png (128x128, 4.2 KB) |
| 305 | + CDN: img.icons8.com/color/128/shopping-cart.png |
| 306 | + 2. add-shopping-cart-color.png (128x128, 3.8 KB) |
| 307 | + CDN: img.icons8.com/color/128/add-shopping-cart.png |
| 308 | + 3. shopping-cart-ios-filled.png (128x128, 2.1 KB) |
| 309 | + CDN: img.icons8.com/ios-filled/128/shopping-cart.png |
| 310 | +
|
| 311 | +Style: Color, iOS Filled | Format: PNG | Size: 128px |
| 312 | +
|
| 313 | +License: Free with link attribution to Icons8 (icons8.com). |
| 314 | +For attribution-free use, get an API key at https://icons8.com/pricing |
| 315 | +``` |
| 316 | + |
| 317 | +## Phase 6: Generate Usage Snippets (Optional) |
| 318 | + |
| 319 | +If the project context suggests web/app development, offer ready-to-use code: |
| 320 | + |
| 321 | +**HTML:** |
| 322 | +```html |
| 323 | +<!-- Option 1: Local file --> |
| 324 | +<img src="assets/icons/shopping-cart-color.png" alt="Shopping Cart" width="32" height="32"> |
| 325 | + |
| 326 | +<!-- Option 2: CDN embed (requires attribution link) --> |
| 327 | +<img src="https://img.icons8.com/color/32/shopping-cart.png" alt="Shopping Cart"> |
| 328 | +<a href="https://icons8.com">Icons by Icons8</a> |
| 329 | +``` |
| 330 | + |
| 331 | +**React/JSX:** |
| 332 | +```jsx |
| 333 | +<img src="/assets/icons/shopping-cart-color.png" alt="Shopping Cart" width={32} height={32} /> |
| 334 | +``` |
| 335 | + |
| 336 | +**CSS:** |
| 337 | +```css |
| 338 | +.cart-icon { |
| 339 | + background-image: url('assets/icons/shopping-cart-color.png'); |
| 340 | + width: 32px; |
| 341 | + height: 32px; |
| 342 | + background-size: contain; |
| 343 | +} |
| 344 | +``` |
| 345 | + |
| 346 | +**Markdown:** |
| 347 | +```markdown |
| 348 | + |
| 349 | +``` |
| 350 | + |
| 351 | +Only show snippets relevant to the detected project type (check for `.html`, `.jsx`, `.tsx`, `.vue`, `.css` files). |
| 352 | + |
| 353 | +## Batch Mode |
| 354 | + |
| 355 | +If the user requests multiple icons at once (e.g., "I need icons for: home, settings, user, search, notifications"), handle them all in a single run: |
| 356 | + |
| 357 | +1. Parse the list of icon names |
| 358 | +2. Fetch all icons in the same style for consistency |
| 359 | +3. Download all at once |
| 360 | +4. Present a single summary table |
| 361 | + |
| 362 | +```bash |
| 363 | +# Batch CDN download example |
| 364 | +for icon in home settings user search notifications; do |
| 365 | + curl -sL "https://img.icons8.com/color/128/${icon}.png" -o "./assets/icons/${icon}-color.png" |
| 366 | +done |
| 367 | +``` |
| 368 | + |
| 369 | +## Style Consistency Helper |
| 370 | + |
| 371 | +When fetching multiple icons for the same project, always use the same style across all icons. If the user has already downloaded icons in a specific style, detect that: |
| 372 | + |
| 373 | +```bash |
| 374 | +ls ./assets/icons/ 2>/dev/null | head -20 |
| 375 | +``` |
| 376 | + |
| 377 | +If existing icons follow a pattern (e.g., all `*-material.png`), default to that style for new downloads. |
| 378 | + |
| 379 | +## Error Handling |
| 380 | + |
| 381 | +- **CDN returns 404/placeholder**: Try alternate hyphenation or use WebSearch to find the correct slug |
| 382 | +- **API rate limit** (1000 req/hr): Note the limit and suggest spacing out requests |
| 383 | +- **Icon not found in requested style**: Suggest available styles for that icon |
| 384 | +- **Download produces HTML instead of image**: The CDN returned an error page. Check filename was correct, try without special characters |
| 385 | +- **No results for query**: Broaden the search terms, suggest related keywords |
| 386 | + |
| 387 | +## Licensing Notes |
| 388 | + |
| 389 | +- **Free tier (CDN, no API key)**: Icons are free to use with a link to Icons8 (`<a href="https://icons8.com">Icons by Icons8</a>`) |
| 390 | +- **Paid tier (API key)**: No attribution required. SVG downloads available. $15/month. |
| 391 | +- **Illustrations**: Free with attribution |
| 392 | +- **Photos**: Free with attribution (similar to Pexels/Unsplash model) |
| 393 | +- Always mention the license requirement in the download summary |
0 commit comments