Skills

Widget Generator

Generate WidgetKit widgets for iOS/macOS home screen and lock screen with timeline...

Install

npx skills add rshankras/claude-code-apple-skills --skill widget-generator -g -a claude-code -y
Category
Mobile
Updated
3mo ago
License
MIT
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

Generate WidgetKit widgets for iOS/macOS home screen and lock screen with timeline providers, interactive elements, and App Intent configuration. Use when adding widgets to an app.

Widget Generator

Generate a complete WidgetKit widget implementation with timeline providers, size-specific views, lock screen accessory widgets, interactive elements (iOS 17+), and App Intent configuration.

When This Skill Activates

Use this skill when the user:

  • Asks to "add widgets" or "add a widget" to their app
  • Mentions "WidgetKit" or "home screen widgets"
  • Wants "lock screen widgets" or "accessory widgets"
  • Asks about "widget timelines" or "timeline providers"
  • Wants "interactive widgets" with buttons or toggles
  • Mentions "widget configuration" or "configurable widgets"
  • Asks about "App Intent widgets" or "AppIntentConfiguration"
  • Wants to show data on the home screen or lock screen

Pre-Generation Checks

1. Project Context Detection

  • Check for existing widget extension target
  • Check for an existing WidgetBundle
  • Verify deployment target (iOS 17+ recommended for interactive widgets)
  • Identify source file locations and project structure

2. Conflict Detection

Search for existing widget code:

Glob: **/*Widget*.swift, **/*TimelineProvider*.swift
Grep: "WidgetKit" or "TimelineProvider" or "WidgetBundle" or "WidgetConfiguration"

If an existing widget extension is found:

  • Ask if the new widget should be added to the existing widget extension
  • Check for an existing WidgetBundle to extend

If a WidgetBundle already exists:

  • Add the new widget to the existing bundle instead of creating a new one
  • Do NOT create a second @main entry point

If widget code with the same name exists:

  • Ask user whether to replace or rename

3. Required Capabilities

Widgets require:

  • A widget extension target (File > New > Target > Widget Extension)
  • App Groups capability if sharing data between the main app and widget
  • iOS 14+ for basic widgets, iOS 16+ for lock screen, iOS 17+ for interactive widgets

Configuration Questions

Ask user via AskUserQuestion:

Read the whole SKILL.md on GitHub

More in Mobile