|
| 1 | +--- |
| 2 | +name: infographic-icon |
| 3 | +description: Search and retrieve icon SVG strings from icon library. Returns up to 5 matching icons by default, customizable via topK parameter. |
| 4 | +dependency: |
| 5 | + python: python>=3.6 |
| 6 | +--- |
| 7 | + |
| 8 | +# Icon Search |
| 9 | + |
| 10 | +This skill provides icon search and SVG string retrieval capabilities. It helps users find appropriate icons for various use cases including infographics, web development, design, and more. |
| 11 | + |
| 12 | +## Purpose |
| 13 | + |
| 14 | +This skill helps discover available icons by: |
| 15 | +- Searching the icon library by keywords |
| 16 | +- Retrieving SVG strings directly for use in your projects |
| 17 | +- Providing icon metadata including names and URLs |
| 18 | + |
| 19 | +## How to Use |
| 20 | + |
| 21 | +### Search for Icons |
| 22 | + |
| 23 | +To search for icons, use the search script with a keyword or phrase: |
| 24 | + |
| 25 | +```bash |
| 26 | +python ./scripts/search.py '<search_query>' [topK] |
| 27 | +``` |
| 28 | + |
| 29 | +**Parameters:** |
| 30 | +- `search_query` (required): The keyword or phrase to search for |
| 31 | +- `topK` (optional): Maximum number of results to return (default: 5) |
| 32 | + |
| 33 | +**Examples:** |
| 34 | +```bash |
| 35 | +# Search for document icons (default 5 results) |
| 36 | +python ./scripts/search.py 'document' |
| 37 | + |
| 38 | +# Search for security icons with top 10 results |
| 39 | +python ./scripts/search.py 'security' 10 |
| 40 | + |
| 41 | +# Search for technology icons with top 20 results |
| 42 | +python ./scripts/search.py 'tech' 20 |
| 43 | +``` |
| 44 | + |
| 45 | +### Understanding Results |
| 46 | + |
| 47 | +The script returns a JSON object containing: |
| 48 | +- `query`: The search query used |
| 49 | +- `topK`: Maximum number of results requested |
| 50 | +- `count`: Actual number of results returned (may be less than topK) |
| 51 | +- `results`: Array of icon objects, each containing: |
| 52 | + - `url`: The source URL of the icon |
| 53 | + - `svg`: The complete SVG string content |
| 54 | + |
| 55 | +## Workflow |
| 56 | + |
| 57 | +1. **Identify the Icon Need**: Determine what concept you want to represent with an icon (e.g., "security", "speed", "data") |
| 58 | + |
| 59 | +2. **Search for Icons**: Run the search script with relevant keywords |
| 60 | + ```bash |
| 61 | + # Default search (returns up to 5 results) |
| 62 | + python ./scripts/search.py 'security' |
| 63 | + |
| 64 | + # Or specify a custom topK value |
| 65 | + python ./scripts/search.py 'security' 10 |
| 66 | + ``` |
| 67 | + |
| 68 | +3. **Review Results**: The script returns the requested number of matching icons with: |
| 69 | + - Icon source URLs |
| 70 | + - SVG content for preview or direct use |
| 71 | + |
| 72 | +4. **Use the Icon**: Use the SVG content directly in your project (web pages, designs, infographics, etc.) |
| 73 | + |
| 74 | +## Important Notes |
| 75 | + |
| 76 | +- **Default Result Count**: By default, the search returns up to 5 icons. You can customize this by providing the `topK` parameter |
| 77 | +- **Customizable Results**: Use the optional `topK` parameter to get more or fewer results (e.g., `python ./scripts/search.py 'icon' 20`) |
| 78 | +- **SVG Strings**: The script returns complete SVG strings fetched from the icon service |
| 79 | +- **Multiple Use Cases**: Icons can be used in infographics, web development, design projects, and more |
| 80 | + |
| 81 | +## Output Format |
| 82 | + |
| 83 | +```json |
| 84 | +{ |
| 85 | + "query": "document", |
| 86 | + "topK": 5, |
| 87 | + "count": 2, |
| 88 | + "results": [ |
| 89 | + { |
| 90 | + "url": "https://example.com/icon1.svg", |
| 91 | + "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">...</svg>" |
| 92 | + }, |
| 93 | + { |
| 94 | + "url": "https://example.com/icon2.svg", |
| 95 | + "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">...</svg>" |
| 96 | + } |
| 97 | + ] |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +## Error Handling |
| 102 | + |
| 103 | +The script handles various error scenarios: |
| 104 | + |
| 105 | +- **Missing Query**: If no search query is provided, returns usage instructions |
| 106 | +- **Network Errors**: If the icon service is unavailable, returns an error message |
| 107 | +- **Empty Results**: If no icons match the query, returns an empty results array with a warning |
| 108 | +- **Invalid Response**: If the API returns invalid data, returns an error message |
| 109 | + |
| 110 | +## Tips |
| 111 | + |
| 112 | +- Use descriptive, single-word queries for best results |
| 113 | +- Try variations of keywords (e.g., "security", "secure", "shield") |
| 114 | +- Review the results to find the most appropriate icon for your needs |
| 115 | +- Icons can be used across various scenarios: infographics, web development, design, and more |
0 commit comments