Skip to content

Commit 2fa6362

Browse files
feat(skills): Add icon-finder skill (#12)
### Summary This skill closes the loop on icon discovery by allowing your AI agent to search the [@rhds/icons](https://github.com/RedHat-UX/red-hat-icons) ui set (~542 icons) by described use case. It interprets natural-language prompts like "find me an icon for cloud deployment," derives search terms, fetches the live icon list from the Red Hat Icons demo site, and returns matched icons in both a markdown table and a visual HTML preview styled with PatternFly 6. Each card in the preview displays outline and fill variants side-by-side with individually clickable links to the source SVGs on GitHub, along with software-UI-specific context hints to help users evaluate which icon best fits their use case. If the initial results aren't sufficient, a deep search fallback expands to synonyms, related concepts, and domain-specific terminology to surface icons the user may not have thought to search for. - Adds new icon-finder skill with SKILL.md containing the full search workflow (use case interpretation, demo site fetch, keyword matching, fill variant detection, HTML preview generation, and deep search expansion) - Includes PatternFly 6 CDN-based HTML preview template with responsive gallery layout, clickable icon variant links, and "UI context:" hints per card - Includes footer linking to a custom icon request form for cases where no existing icon fits - Includes .gitignore to exclude generated icon-finder-preview.html preview artifacts - Works in both Cursor and Claude Code with no dependencies beyond a browser <img width="1337" height="549" alt="image" src="https://github.com/user-attachments/assets/ee762bce-ce30-4678-95ab-462d7c9475e3" /> ### Test plan - [ ] Verify SKILL.md renders correctly in a markdown viewer - [ ] Confirm skill triggers on expected user prompts (e.g. "find an icon", "search for an icon", "pick an icon for", "icon options for") - [ ] Run a search (e.g. "find an icon for cloud") and verify the HTML preview opens with PatternFly-styled cards, correct outline/fill variant links, and "UI context:" hints - [ ] Verify cards link to the correct SVGs on GitHub (/blob/main/src/ui/ for browsing, /raw/.../src/ui/ for rendering) - [ ] Trigger a deep search and confirm expanded results appear in a separate section below the originals with no duplicates - [ ] Verify the custom icon request link in the footer opens the correct Google Form
1 parent 864934f commit 2fa6362

1 file changed

Lines changed: 192 additions & 0 deletions

File tree

  • plugins/pf-react/skills/icon-finder
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
---
2+
name: icon-finder
3+
description: Find icons from the Red Hat Design System (@rhds/icons) by use case. Searches the Red Hat Icons demo site by keyword, returns matching icon names with a visual HTML preview for comparison. Use when the user asks to find an icon, search for an icon by purpose, pick an icon for a UI, or get icon options for a use case.
4+
---
5+
6+
# Icon Finder (Red Hat Icons)
7+
8+
Find UI icons from [@rhds/icons](https://github.com/RedHat-UX/red-hat-icons) based on a described use case.
9+
10+
## Workflow
11+
12+
1. **Interpret use case** – Derive 1–3 search terms from the user's message (e.g. "merge" → merge, combine, branch; "export" → export, download, share).
13+
2. **Get icon list** – Fetch the demo site: `https://red-hat-icons.netlify.app/`. Extract **only** icon names from lines containing `set="ui"` — look for the pattern `set="ui" icon="<name>"`. Ignore icons from any other set.
14+
3. **Match** – Filter the `ui` icon names by your search terms. Prefer exact or prefix match. When an icon has a `-fill` counterpart, treat them as **one result** (they share a card in the preview). Return **5–8** unique icon concepts.
15+
4. **Generate preview** – Build an HTML file using the template below. Each icon is loaded via an `<img>` tag pointing to the raw GitHub URL — no API calls or base64 decoding needed. Write to `icon-finder-preview.html` in the user's workspace or home directory.
16+
5. **Open preview** – Open the HTML file in the user's default browser (see "Opening the preview" section).
17+
6. **Respond** – Show the match table. Then ask: *"Do any of these work, or would you like me to do a deeper search? I can cast a wider net using related concepts and synonyms you might not have thought of."*
18+
7. **Deep search (only if the user asks for it)** – See "Deep search fallback" section below.
19+
20+
## Icon set
21+
22+
This skill uses **only** the `ui` set (interface actions, status, navigation — ~542 icons). Do not search or return icons from any other set (`standard`, `microns`, `social`).
23+
24+
## Response format
25+
26+
```markdown
27+
### Matches for "[use case]"
28+
29+
| Icon | Fill | Use when |
30+
|------|------|----------|
31+
| `hybrid-cloud` | yes | Multi-provider dashboards, infrastructure overview pages. |
32+
| `multi-cloud` | no | Provider comparison views, cloud strategy settings. |
33+
...
34+
35+
**Usage:**
36+
\`\`\`html
37+
<rh-icon set="ui" icon="hybrid-cloud"></rh-icon>
38+
\`\`\`
39+
40+
Install: `npm install @rhds/icons`
41+
42+
Do any of these work, or would you like me to do a deeper search? I can cast a wider net using related concepts and synonyms you might not have thought of.
43+
```
44+
45+
## Raw SVG URL pattern
46+
47+
Each icon's SVG is available at:
48+
49+
```
50+
https://raw.githubusercontent.com/RedHat-UX/red-hat-icons/main/src/ui/<icon-name>.svg
51+
```
52+
53+
For example: `https://raw.githubusercontent.com/RedHat-UX/red-hat-icons/main/src/ui/cluster.svg`
54+
55+
## HTML preview template
56+
57+
Use this exact template. It loads PatternFly 6 CSS from a CDN — no build step required. Replace `<!-- ICONS -->` with one card per match. Icons are loaded as `<img>` tags — the user's browser fetches them directly from GitHub.
58+
59+
```html
60+
<!DOCTYPE html>
61+
<html lang="en">
62+
<head>
63+
<meta charset="UTF-8">
64+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
65+
<title>Icon Finder – Results</title>
66+
<link rel="stylesheet" href="https://unpkg.com/@patternfly/patternfly@6/patternfly.min.css">
67+
<style>
68+
.icon-finder-page { padding: var(--pf-t--global--spacer--xl); }
69+
.icon-finder-header { margin-bottom: var(--pf-t--global--spacer--lg); }
70+
.icon-card { text-align: center; }
71+
.icon-variants { display: flex; justify-content: center; gap: var(--pf-t--global--spacer--md); margin-bottom: var(--pf-t--global--spacer--sm); }
72+
.icon-variant { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: inherit; cursor: pointer; }
73+
.icon-variant img { width: 40px; height: 40px; }
74+
.icon-variant span { font-size: var(--pf-t--global--font--size--xs); color: var(--pf-t--global--text--color--link--default); text-decoration: underline; margin-top: var(--pf-t--global--spacer--xs); }
75+
.icon-variant:hover img { transform: scale(1.15); }
76+
.icon-variant:hover span { color: var(--pf-t--global--text--color--link--hover); }
77+
.icon-name { font-weight: var(--pf-t--global--font--weight--body--bold); font-size: var(--pf-t--global--font--size--sm); word-break: break-word; }
78+
.icon-hint { font-size: var(--pf-t--global--font--size--xs); margin-top: var(--pf-t--global--spacer--xs); }
79+
.icon-finder-footer { margin-top: var(--pf-t--global--spacer--xl); }
80+
</style>
81+
</head>
82+
<body>
83+
<div class="icon-finder-page">
84+
<div class="icon-finder-header pf-v6-c-content">
85+
<h1>Icon Finder Results</h1>
86+
<p>From <a href="https://github.com/RedHat-UX/red-hat-icons">@rhds/icons</a> (set: UI)</p>
87+
<p><strong>Prompt:</strong> <!-- PROMPT --></p>
88+
<p><strong>Search terms:</strong> <!-- TERMS --></p>
89+
</div>
90+
<div class="pf-v6-l-gallery pf-m-gutter" style="--pf-v6-l-gallery--GridTemplateColumns--min: 160px;">
91+
<!-- ICONS -->
92+
</div>
93+
<div class="icon-finder-footer pf-v6-c-content">
94+
<p>Don't see what you need? <a href="https://docs.google.com/forms/d/e/1FAIpQLSfXbS0o6oeMA86CpmuTKIoZrrKVhbjKboBrHl2jIPJDfkt_MQ/viewform" target="_blank">Submit a custom icon request</a>.</p>
95+
</div>
96+
</div>
97+
</body>
98+
</html>
99+
```
100+
101+
Each card replaces `<!-- ICONS -->`. All cards use the same structure — a `<div>` card with one or two icon variants inside. Each variant is an independently clickable `<a>`.
102+
103+
**Card with fill variant** (two variants side-by-side):
104+
105+
```html
106+
<div class="pf-v6-c-card icon-card">
107+
<div class="pf-v6-c-card__body">
108+
<div class="icon-variants">
109+
<a class="icon-variant" href="https://github.com/RedHat-UX/red-hat-icons/blob/main/src/ui/ICON-NAME.svg" target="_blank">
110+
<img src="https://raw.githubusercontent.com/RedHat-UX/red-hat-icons/main/src/ui/ICON-NAME.svg" alt="ICON-NAME">
111+
<span>outline</span>
112+
</a>
113+
<a class="icon-variant" href="https://github.com/RedHat-UX/red-hat-icons/blob/main/src/ui/ICON-NAME-fill.svg" target="_blank">
114+
<img src="https://raw.githubusercontent.com/RedHat-UX/red-hat-icons/main/src/ui/ICON-NAME-fill.svg" alt="ICON-NAME-fill">
115+
<span>fill</span>
116+
</a>
117+
</div>
118+
<div class="icon-name">icon-name</div>
119+
<div class="icon-hint">UI context: <em>where in a software UI this icon fits</em></div>
120+
</div>
121+
</div>
122+
```
123+
124+
**Card without fill variant** (single variant):
125+
126+
```html
127+
<div class="pf-v6-c-card icon-card">
128+
<div class="pf-v6-c-card__body">
129+
<div class="icon-variants">
130+
<a class="icon-variant" href="https://github.com/RedHat-UX/red-hat-icons/blob/main/src/ui/ICON-NAME.svg" target="_blank">
131+
<img src="https://raw.githubusercontent.com/RedHat-UX/red-hat-icons/main/src/ui/ICON-NAME.svg" alt="ICON-NAME">
132+
<span>outline</span>
133+
</a>
134+
</div>
135+
<div class="icon-name">icon-name</div>
136+
<div class="icon-hint">UI context: <em>where in a software UI this icon fits</em></div>
137+
</div>
138+
</div>
139+
```
140+
141+
Replace `<!-- PROMPT -->` with the user's original message and `<!-- TERMS -->` with a comma-separated list of the search terms derived in step 1 of the workflow.
142+
143+
## Opening the preview
144+
145+
After writing `icon-finder-preview.html`, open it in the user's default browser. The page loads PatternFly CSS from a CDN and icon SVGs from GitHub, so it works fine as a local file — no server needed.
146+
147+
## Deep search fallback
148+
149+
The initial search matches on direct keywords only. If the user isn't satisfied, the deep search expands to synonyms, related concepts, and adjacent terminology they may not have thought of.
150+
151+
### How it works
152+
153+
1. **Expand the search terms** — Starting from the user's original use case, brainstorm 10–20 related terms across these categories:
154+
- **Synonyms:** direct alternatives (e.g. "merge" → combine, join, unite, fuse)
155+
- **Related concepts:** things in the same domain (e.g. "cloud cluster" → topology, network, hub, infrastructure, region)
156+
- **Abstract/metaphorical:** shapes or ideas that could represent the concept (e.g. "cluster" → nodes, grid, constellation, beehive, atom)
157+
- **Technical terms:** domain-specific jargon (e.g. "cloud environments" → tenant, orchestration, federation, interoperability)
158+
2. **Re-scan the full icon list** — Using the already-fetched demo site content (step 2 of the main workflow), match all `ui` set icon names against the expanded term list.
159+
3. **Deduplicate** — Remove any icons already shown in the initial results.
160+
4. **Generate expanded preview** — Build a new `icon-finder-preview.html` with two sections:
161+
- "Original matches" — the initial results (kept for reference)
162+
- "Additional finds" — the new icons from the expanded search
163+
Use the same HTML template but add a section label before each gallery using PatternFly content styling:
164+
```html
165+
<div class="pf-v6-c-content" style="margin: var(--pf-t--global--spacer--lg) 0 var(--pf-t--global--spacer--sm);"><h3>Section title</h3></div>
166+
```
167+
5. **Open and respond** — Follow steps 5–6 of the main workflow. Present the new icons in a separate table below the originals.
168+
169+
### Example expansion
170+
171+
For "cluster of different cloud environments":
172+
173+
| Category | Initial terms | Expanded terms |
174+
|----------|--------------|----------------|
175+
| Synonyms | cluster, cloud | group, collection, aggregate, pool |
176+
| Related concepts | hybrid-cloud, multi-cloud, edge | topology, network, hub, infrastructure, region, zone, federation |
177+
| Abstract || nodes, constellation, atom, venn-diagram, interconnect |
178+
| Technical || tenant, orchestration, interoperability, data-connections, distribute |
179+
180+
### Guidelines
181+
182+
- Aim for **8–15 additional icons** in the expanded results — enough to be useful, not so many as to overwhelm.
183+
- Don't repeat icons from the initial results. Each icon and its `-fill` variant count as a single result (shown side-by-side on one card).
184+
- The deep search reuses the demo site content already fetched in step 2 — no additional network requests needed beyond what the main workflow already did.
185+
- Works identically in Cursor and Claude Code — no browser or special tools required.
186+
187+
## Notes
188+
189+
- Icon names are the only metadata; there are no descriptions in the source. The agent infers meaning from the name. Card hints use the format `UI context: <em>description</em>` and should describe **where in a software UI the icon would be used** — not just reword the name. Think about specific pages, features, buttons, or dashboard elements where the icon fits. For example, prefer `UI context: <em>power status indicators, energy consumption dashboards</em>` over `UI context: <em>zappy energy</em>` for `electricity`. The same software-UI framing applies to the "Use when" column in the markdown response table.
190+
- Many icons have outline and `-fill` variants. Show both side-by-side on a single card rather than using two separate cards.
191+
- Do not clone the repo. Use the demo site for listing icons and raw GitHub URLs for rendering.
192+
- Do NOT fetch individual SVG content from the GitHub API. The `<img>` tags in the HTML let the user's browser load them directly — this is much faster.

0 commit comments

Comments
 (0)