App icon generator

From gustavscirulis/snapgrid · View interactive version

App icon generator is an AI agent skill from the GitHub repository gustavscirulis/snapgrid. Generates app icons programmatically using CoreGraphics following Apple HIG. Use when user wants to create, generate, or design an app icon for macOS or iOS.

How to use this skill

Skill file

App Icon Generator

Generate production-quality app icons programmatically using a CoreGraphics Swift script. Produces all required sizes and installs into the Xcode asset catalog.

When This Skill Activates

Use this skill when the user:

Pre-Generation Checks

1. Project Context Detection

Glob: **/Assets.xcassets/AppIcon.appiconset/Contents.json

2. App Context Detection

Gather app information to customize the icon:

Read: .planning/APP.md          (if exists — app definition)
Read: .planning/CODEBASE.md     (if exists — app description)
Grep: "CFBundleName" or app name in project files

If no planning files exist, ask the user.

Configuration Questions

Ask via AskUserQuestion:

Question 1: App Category

"What category best describes your app?"

Question 2: Visual Style

"What visual style do you prefer?"

Question 3: Color Palette

"What color palette fits your app?"

Question 4: Accent Color

"What accent color for the focal element?"

Apple HIG Icon Guidelines

Read apple-hig-icons.md before generating. Key rules:

  1. No text in the icon — must be universally recognizable
  2. Single focal point — one clear element the eye is drawn to
  3. Simple shapes — must be legible at 16x16 (macOS menu bar)
  4. Fill the canvas — macOS/iOS apply the rounded rect mask automatically
  5. Front-facing perspective — no 3D tilts or dramatic angles
  6. Use gradients sparingly — subtle depth, not rainbow
  7. Ensure contrast — the focal element must stand out from background
  8. Platform-appropriate:

Generation Process

Step 1: Determine Icon Design

Based on the user's answers (or app context), select:

Step 2: Generate Swift Script

Create a self-contained Swift script at scripts/generate-icon.swift that:

Script structure:

#!/usr/bin/env swift
import AppKit
import CoreGraphics

let size: CGFloat = 1024
// ... helper functions (gradients, glows, shapes)
// ... variant generation functions
// ... save and output

Design building blocks (combine these based on category/style):

| Building Block | Function | Use For |

|---------------|----------|---------|

| drawGradientBackground | Linear gradient fill | All icons |

| drawRadialGlow | Soft colored glow behind focal element | Adding depth |

| drawCircle | Filled/stroked circle | Record buttons, dots, orbs |

| drawRoundedRect | Rounded rectangle | Screens, cards, containers |

| drawRing | Circle outline | Borders, focus rings |

| drawBrackets | Corner bracket marks | Viewfinders, capture |

| drawMonitor | Screen + stand shape | Screen/display apps |

| drawShield | Shield outline | Security/privacy apps |

| drawGear | Gear/cog shape | Settings/utility apps |

| drawWaveform | Audio waveform bars | Audio/music apps |

| drawDocument | Page with fold corner | Document/writing apps |

| drawShine | Elliptical specular highlight | Adding polish |

| drawShadow | Drop shadow beneath element | Adding depth |

Step 3: Run Script and Present Variants

swift scripts/generate-icon.swift

Show all 3 variants to the user using the Read tool (Claude can view images).

Ask the user to pick one, or request adjustments.

Step 4: Resize and Install

Once the user picks a variant:

  1. Resize using sips (built into macOS):

For macOS (10 sizes):

sips -z 16 16     master.png --out icon_16x16.png
sips -z 32 32     master.png --out icon_16x16@2x.png
sips -z 32 32     master.png --out icon_32x32.png
sips -z 64 64     master.png --out icon_32x32@2x.png
sips -z 128 128   master.png --out icon_128x128.png
sips -z 256 256   master.png --out icon_128x128@2x.png
sips -z 256 256   master.png --out icon_256x256.png
sips -z 512 512   master.png --out icon_256x256@2x.png
sips -z 512 512   master.png --out icon_512x512.png
sips -z 1024 1024 master.png --out icon_512x512@2x.png

For iOS (single 1024x1024):

cp master.png icon_1024x1024.png
  1. Write Contents.json for the asset catalog

For macOS:

{
  "images": [
    { "filename": "icon_16x16.png", "idiom": "mac", "scale": "1x", "size": "16x16" },
    { "filename": "icon_16x16@2x.png", "idiom": "mac", "scale": "2x", "size": "16x16" },
    { "filename": "icon_32x32.png", "idiom": "mac", "scale": "1x", "size": "32x32" },
    { "filename": "icon_32x32@2x.png", "idiom": "mac", "scale": "2x", "size": "32x32" },
    { "filename": "icon_128x128.png", "idiom": "mac", "scale": "1x", "size": "128x128" },
    { "filename": "icon_128x128@2x.png", "idiom": "mac", "scale": "2x", "size": "128x128" },
    { "filename": "icon_256x256.png", "idiom": "mac", "scale": "1x", "size": "256x256" },
    { "filename": "icon_256x256@2x.png", "idiom": "mac", "scale": "2x", "size": "256x256" },
    { "filename": "icon_512x512.png", "idiom": "mac", "scale": "1x", "size": "512x512" },
    { "filename": "icon_512x512@2x.png", "idiom": "mac", "scale": "2x", "size": "512x512" }
  ],
  "info": { "author": "xcode", "version": 1 }
}

For iOS (single size, system generates others):

{
  "images": [
    { "filename": "icon_1024x1024.png", "idiom": "universal", "platform": "ios", "size": "1024x1024" }
  ],
  "info": { "author": "xcode", "version": 1 }
}
  1. Copy files into the asset catalog directory
  2. Build to verify: xcodebuild build -scheme <scheme> -destination 'platform=<platform>' -quiet

Step 5: Cleanup

Category-Specific Design Recipes

Productivity Apps

Creative/Media Apps

Developer Tools

Communication Apps

Utility Apps

Finance Apps

Health/Fitness Apps

Education Apps

Output Summary

After completion, report:

Icon installed successfully!

Master: scripts/generate-icon.swift (re-run to regenerate)
Sizes:  [list of sizes generated]
Location: [path to AppIcon.appiconset]

Build and run to see the icon in:
- Menu bar (macOS)
- Home screen (iOS)
- Finder / Spotlight
- About view

Iteration

If the user wants changes:

  1. Modify the Swift script parameters (colors, shapes, sizes)
  2. Re-run: swift scripts/generate-icon.swift
  3. Show the updated variants
  4. Resize and reinstall once approved

Common adjustment requests:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.