widget-generator
БесплатноБез исполняемых скриптовНе проверенGenerate WidgetKit widgets for iOS/macOS home screen and lock screen with timeline providers, interactive elements, and App Intent configuration. Use when…
от rshankras★ 922 звезды на GitHubОб этом скилле
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
WidgetBundleto 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
@mainentry 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:
What is this widget for? (freeform)
- Examples: weather forecast, task list, fitness stats, quick actions, countdown timer
- This determines the data model and timeline update strategy
Which widget sizes should be supported?
- Home screen: systemSmall, systemMedium, systemLarge, systemExtraLarge (iPad only)
- Lock screen: accessoryCircular, accessoryRectangular, accessoryInline
- All home screen sizes
- All home screen + lock screen sizes (recommended)
What type of widget?
- Static (
StaticConfiguration) -- content updated on a schedule, no user configuration - Configurable (
AppIntentConfiguration, iOS 17+) -- user can choose what the widget displays via long-press edit - Interactive (
AppIntentConfiguration+Button/Toggle, iOS 17+) -- user can tap buttons or toggles directly on the widget
- Static (
What is the data source?
- Local data (UserDefaults, SwiftData, Core Data)
- Shared data via App Groups (main app writes, widget reads)
- Network API (fetched during timeline refresh)
- Combination of local and network
How often should the widget update?
- Every 15 minutes (minimum practical interval)
- Every 30 minutes
- Every hour (recommended default)
- A few times per day
- Based on specific times (e.g., calendar events)
- On-demand from the main app via
WidgetCenter.shared.reloadTimelines(ofKind:)
Generation Process
Step 1: Determine File Locations
Check project structure:
- If a widget extension target directory exists, add view and provider files there
- Otherwise, instruct user to create a Widget Extension target first
For widget extension files:
- Place inside the existing widget extension directory (e.g.,
MyAppWidgets/)
For shared data models (if using App Groups):
- If
Sources/orShared/exists --> place there - Otherwise --> create alongside existing models
Step 2: Create Core Files
Generate these files based on configuration answers:
{Name}Widget.swift-- Widget definition with configurationWidgetstruct withStaticConfigurationorAppIntentConfiguration- Supported families declaration
- Display name and description
{Name}TimelineProvider.swift-- Timeline logicTimelineProvider(static) orAppIntentTimelineProvider(configurable)- Placeholder, snapshot, and timeline methods
{Name}Entry.swift-- Timeline entry modelTimelineEntrystruct with date and display data
{Name}WidgetViews.swift-- Size-specific views- Separate view struct for each supported family
- Uses
containerBackgroundfor iOS 17+ removable backgrounds
{Name}AppIntent.swift(if interactive or configurable)WidgetConfigurationIntentfor configurable widgetsAppIntentfor interactive widget buttons/toggles
- WidgetBundle update -- Register the new widget
- Add to existing bundle or create new one
Step 3: Generate Code from Templates
Use the templates in templates.md and
Установить widget-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditGlobGrepBashAskUserQuestionВложенные файлы
FAQ
Что делает скилл widget-generator?
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?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл widget-generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic