Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

axiom-extensions-widgets

БесплатноБез исполняемых скриптовНе проверен

Use when implementing widgets, Live Activities, or Control Center controls - enforces correct patterns for timeline management, data sharing, and extension…

ComeOnOliverот ComeOnOliver★ 67 звёзд на GitHub

Об этом скилле

Extensions & Widgets — Discipline

Core Philosophy

"Widgets are not mini apps. They're glanceable views into your app's data, rendered at strategic moments and displayed by the system. Extensions run in sandboxed environments with limited memory and execution time."

Mental model: Think of widgets as archived snapshots on a timeline, not live views. Your widget doesn't "run" continuously — it renders, gets archived, and the system displays the snapshot.

Extension sandboxing: Extensions have:

  • Limited memory (~30MB)
  • No network access in widget views (fetch in TimelineProvider only)
  • Separate bundle container from main app
  • Require App Groups for data sharing

When to Use This Skill

✅ Use this skill when:

  • Implementing any widget (Home Screen, Lock Screen, StandBy, Control Center)
  • Creating Live Activities
  • Debugging why widgets show stale data
  • Widget not appearing in gallery
  • Interactive buttons not responding
  • Live Activity fails to start
  • Control Center control is unresponsive
  • Sharing data between app and widget/extension

❌ Do NOT use this skill for:

  • Pure App Intents implementation (use app-intents-ref)
  • SwiftUI layout questions (use swiftui-layout)
  • Performance profiling (use swiftui-performance)
  • General debugging (use xcode-debugging)

Related Skills

  • extensions-widgets-ref — Comprehensive API reference
  • app-intents-ref — App Intents for interactive widgets
  • swift-concurrency — Async patterns for data fetching
  • swiftdata — Using SwiftData with App Groups

Example Prompts

1. "My widget isn't updating"

→ This skill covers timeline policies, refresh budgets, manual reload, and App Groups configuration

2. "How do I share data between app and widget?"

→ This skill explains App Groups entitlement, shared UserDefaults, and container URLs

3. "Widget shows old data even after I update the app"

→ This skill covers container paths, UserDefaults suite names, and WidgetCenter reload

4. "Live Activity fails to start"

→ This skill covers 4KB data limit, ActivityAttributes constraints, authorization checks

5. "Control Center control takes forever to respond"

→ This skill covers async ValueProvider patterns and optimistic UI

6. "Interactive widget button does nothing"

→ This skill covers App Intent perform() implementation and WidgetCenter reload


Red Flags / Anti-Patterns

Pattern 1: Network Calls in Widget View

Time cost: 2-4 hours debugging why widgets are blank or show errors

Symptom

  • Widget renders but shows no data
  • Console errors: "NSURLSession not available in widget extension"
  • Widget appears blank intermittently

❌ BAD Code

struct MyWidgetView: View {
    @State private var data: String?

    var body: some View {
        VStack {
            if let data = data {
                Text(data)
            }
        }
        .onAppear {
            // ❌ WRONG — Network in widget view
            Task {
                let (data, _) = try await URLSession.shared.data(from: apiURL)
                self.data = String(data: data, encoding: .utf8)
            }
        }
    }
}

Why it fails: Widget views are rendered, archived, and reused. Network calls in views are unreliable and may not execute.

✅ GOOD Code

// Main app — prefetch and save
func updateWidgetData() async {
    let data = try await fetchFromAPI()
    let shared = UserDefaults(suiteName: "group.com.myapp")!
    shared.set(data, forKey: "widgetData")

    WidgetCenter.shared.reloadAllTimelines()
}

// Widget TimelineProvider — read from shared storage
struct Provider: TimelineProvider {
    func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
        let shared = UserDefaults(suiteName: "group.com.myapp")!
        let data = shared.string(forKey: "widgetData") ?? "No data"

        let entry = SimpleEntry(date: Date(), data: data)
        let timeline = Timeline(entries: [entry], policy: .atEnd)
        completion(timeline)
    }
}

Pattern: Fetch data in main app, save to shared storage, read in widget.

Can TimelineProvider make network requests?

Yes, but with important caveats:

struct Provider: TimelineProvider {
    func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
        Task {
            // ✅ Network requests ARE allowed here
            let data = try await fetchFromAPI()
            let entry = SimpleEntry(date: Date(), data: data)
            completion(Timeline(entries: [entry], policy: .atEnd))
        }
    }
}

Constraints:

  • 30-second timeout - System kills extension if getTimeline() doesn't complete
  • No background sessions - Can't download large files
  • Battery cost - Every timeline reload uses battery
  • Not guaranteed - May fail on poor connections

Best practice: Prefetch in main app (faster, more reliable), use TimelineProvi

Полный SKILL.md на GitHub

Установить axiom-extensions-widgets в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл axiom-extensions-widgets?

Use when implementing widgets, Live Activities, or Control Center controls - enforces correct patterns for timeline management, data sharing, and extension lifecycle to prevent common crashes and memory issues

Как установить скилл axiom-extensions-widgets?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл axiom-extensions-widgets запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить axiom-extensions-widgets с