mobile-widgets
Use when the user asks about home screen widgets, WidgetKit, timelines, Live Activities, Dynamic Island, App Intents widgets, Android App Widgets or Jetpack…
от j4flmao★ 47 звёзд на GitHub
Установить mobile-widgets в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Mobile Widgets Skill
Purpose
Build glanceable, performant widget experiences across iOS and Android with proper timeline management, refresh strategies, and platform-specific best practices.
Agent Protocol
Trigger
User mentions widgets, iOS WidgetKit, Android App Widgets, Live Activities, complications, watchOS complications, Wear OS tiles, widget timeline, widget families, widget configuration, widget deep linking, widget refresh, or widget testing.
Input Context
- Platform target (iOS, Android, or both)
- Widget types (static, dynamic, configurable, Live Activity, complication)
- Widget families/sizes needed (small, medium, large, extra large)
- Data sources and update frequency
- Deep linking targets
- Refresh strategy (timeline-based, push, periodic)
- Configuration/ customization needs
Output Artifact
SKILL.md adherence document plus implemented widget extensions, timeline providers, configuration UI, deep link handling, and refresh logic.
Response Format
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.
Completion Criteria
- Widget extension created for target platform(s)
- Timeline provider implemented with proper reload strategy
- All widget families (small, medium, large) supported with appropriate layouts
- Widget configuration/intent handling implemented
- Deep linking from widget taps to app content
- Refresh strategy optimized for battery life (minimal background fetches)
- Widget previews/snapshots for gallery
- Live Activity (iOS) or complication (watchOS/Wear OS) if required
- Widget testing with different data states (empty, loading, error, populated)
- Accessibility support (VoiceOver, TalkBack, dynamic type)
Max Response Length
4096 tokens
Workflow
- iOS WidgetKit Timeline Provider: Define how your widget provides content over time.
import WidgetKit
import SwiftUI
struct TaskProvider: TimelineProvider {
typealias Entry = TaskEntry
func placeholder(in context: Context) -> TaskEntry {
TaskEntry(date: Date(), items: TaskItem.previewData)
}
func getSnapshot(in context: Context, completion: @escaping (TaskEntry) -> Void) {
let entry = TaskEntry(date: Date(), items: loadCurrentItems())
completion(entry)
}
func getTimeline(in context: Context, completion: @escaping (Timeline<TaskEntry>) -> Void) {
let entries: [TaskEntry] = generateEntries()
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 15, to: Date())!
let timeline = Timeline(entries: entries, policy: .after(nextUpdate))
completion(timeline)
}
private func generateEntries() -> [TaskEntry] {
let now = Date()
let items = loadCurrentItems()
var entries: [TaskEntry] = []
for minuteOffset in stride(from: 0, to: 60, by: 15) {
let entryDate = Calendar.current.date(byAdding: .minute, value: minuteOffset, to: now)!
entries.append(TaskEntry(date: entryDate, items: items))
}
return entries
}
}
- Widget View & Entry: SwiftUI views adapted to widget families.
struct TaskEntry: TimelineEntry {
let date: Date
let items: [TaskItem]
}
struct TaskWidgetEntryView: View {
var entry: TaskProvider.Entry
@Environment(\.widgetFamily) var family
var body: some View {
switch family {
case .systemSmall:
SmallTaskView(items: entry.items)
case .systemMedium:
MediumTaskView(items: entry.items)
case .systemLarge:
LargeTaskView(items: entry.items)
default:
MediumTaskView(items: entry.items)
}
}
}
struct SmallTaskView: View {
let items: [TaskItem]
var body: some View {
VStack(alignment: .leading, spacing: 4) {
Text("To-Do").font(.headline).foregroundColor(.secondary)
ForEach(items.prefix(3)) { item in
HStack(spacing: 4) {
Image(systemName: item.isCompleted ? "checkmark.circle.fill" : "circle")
.foregroundColor(item.isCompleted ? .green : .gray)
.font(.caption)
Text(item.title).font(.caption).lineLimit(1)
}
}
if items.count > 3 {
Text("+\(items.count - 3) more").font(.caption2).foregroundColor(.secondary)
}
}
.padding()
.widgetURL(URL(string: "myapp://tasks"))
}
}
- Widget Configuration with App Intents: User-configurable widgets via
AppIntentConfigurationandWidgetConfigurationIntent(iOS 17+; the older SiriKit.intentdefinitionpath is legacy).
import AppIntents
struct SelectListIntent: WidgetConfigurationIntent {
static let title: LocalizedStringResource = "Select List"
static let description = IntentDescription("Choose which to-do list to display.")
@Parameter(title: "List")
var list: ListEntity?
static var parameterSummary: some ParameterSummary {
Summary("Show items from \(\.$list)")
}
}
struct ListEntity: AppEntity {
let id: String
let n
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/android-app-widgets.md
- references/complications.md
- references/ios-widgetkit.md
- references/mobile-widgets-advanced.md
- references/mobile-widgets-fundamentals.md
- references/widget-refresh.md
FAQ
Что делает скилл mobile-widgets?
Use when the user asks about home screen widgets, WidgetKit, timelines, Live Activities, Dynamic Island, App Intents widgets, Android App Widgets or Jetpack Glance. Produces widget extensions, refresh strategy and deep links into the app. Not for in-app UI components (use ios or android).
Как установить скилл mobile-widgets?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mobile-widgets запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…