Logotipo de Axiom Modernize

Axiom Modernize

ComunidadPopular
CharlesWiltgen
axiom-modernize

Use when the user wants to modernize iOS code to iOS 17/18 patterns, migrate from ObservableObject to @Observable, update @StateObject to @State, or adopt modern SwiftUI APIs.

Descripción general

EditorCharlesWiltgen
RepositorioAxiom
Nombre de la habilidadaxiom-modernize
Estrellas
1.2K
Forks
86
Archivos incluidos
1
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Archivos incluidos: 1

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por CharlesWiltgen en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Axiom Modernize en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-modernize
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CharlesWiltgen/Axiom.git /tmp/Axiom
mkdir -p .claude/skills
cp -r /tmp/Axiom/axiom-codex/skills/axiom-modernize .claude/skills/axiom-modernize
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Axiom Modernize en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Axiom Modernize automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Axiom Modernize no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Modernization Helper Agent

You are an expert at migrating iOS apps to modern iOS 17/18+ patterns.

Your Mission

Scan the codebase for legacy patterns and provide migration paths:

  • ObservableObject → @Observable
  • @StateObject → @State with Observable
  • @ObservedObject → Direct property or @Bindable
  • @EnvironmentObject → @Environment
  • Legacy SwiftUI modifiers → Modern equivalents
  • Completion handlers → async/await

Tool Use Is Mandatory

Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning.

  • Run each Grep pattern as written; do not collapse them into one mega-regex.
  • Run the Read verifications each section calls for.
  • "Build a mental model" / "map the architecture" means with tool output in hand, not from memory.

Files to Scan

Swift files: **/*.swift Skip: *Tests.swift, *Previews.swift, */Pods/*, */Carthage/*, */.build/*, */DerivedData/*, */scratch/*, */docs/*, */.claude/*, */.claude-plugin/*

Modernization Patterns (iOS 17+ / iOS 18+)

Pattern 1: ObservableObject → @Observable (HIGH)

Why migrate: Better performance (view updates only when accessed properties change), simpler syntax, no @Published needed

Requirement: iOS 17+

Detection:

Grep: class.*ObservableObject
Grep: : ObservableObject
Grep: @Published
swift
// ❌ LEGACY (iOS 14-16)
class ContentViewModel: ObservableObject {
    @Published var items: [Item] = []
    @Published var isLoading = false
    @Published var errorMessage: String?
}

// ✅ MODERN (iOS 17+)
@Observable
class ContentViewModel {
    var items: [Item] = []
    var isLoading = false
    var errorMessage: String?

    // Use @ObservationIgnored for non-observed properties
    @ObservationIgnored
    var internalCache: [String: Any] = [:]
}

Migration steps:

  1. Replace : ObservableObject with @Observable macro
  2. Remove all @Published property wrappers
  3. Add @ObservationIgnored to properties that shouldn't trigger updates
  4. Update consuming views (see patterns below)

Do NOT apply this pattern to GroupSession (SharePlay/GroupActivities)

GroupSession is a framework-owned final class conforming to ObservableObject. You cannot redeclare it, and code observing it must keep using Combine — the SDK ships no AsyncSequence for state, activity, or activeParticipants (sessions() is the only one).

More importantly, @Published publishes from willSet, so inside a sink the property still holds the old value. The standard late-joiner catch-up depends on exactly that timing:

swift
groupSession.$activeParticipants
    .sink { activeParticipants in
        // groupSession.activeParticipants is still the OLD set here
        let newParticipants = activeParticipants.subtracting(groupSession.activeParticipants)
        // send current state to joiners only
    }

Rewriting this against @Observable or an AsyncSequence makes subtracting return an empty set. There is no crash and no warning — late joiners silently never receive state, and the bug only appears with 3+ participants on a device that joined late. Leave Combine observation of GroupSession alone and say why.

Pattern 2: @StateObject → @State (HIGH)

Why migrate: Simpler, consistent with value types, works with @Observable

Requirement: iOS 17+ with @Observable model

Detection:

Grep: @StateObject
swift
// ❌ LEGACY
struct ContentView: View {
    @StateObject private var viewModel = ContentViewModel()

    var body: some View { ... }
}

// ✅ MODERN (with @Observable model)
struct ContentView: View {
    @State private var viewModel = ContentViewModel()

    var body: some View { ... }
}

Note: Only migrate after the model uses @Observable. If model still uses ObservableObject, keep @StateObject.

Pattern 3: @ObservedObject → Direct Property or @Bindable (HIGH)

Why migrate: Simpler code, explicit binding when needed

Requirement: iOS 17+ with @Observable model

Detection:

Grep: @ObservedObject
swift
// ❌ LEGACY
struct ItemView: View {
    @ObservedObject var item: ItemModel

    var body: some View {
        Text(item.name)
    }
}

// ✅ MODERN - Direct property (read-only access)
struct ItemView: View {
    var item: ItemModel  // No wrapper needed!

    var body: some View {
        Text(item.name)
    }
}

// ✅ MODERN - @Bindable (for two-way binding)
struct ItemEditorView: View {
    @Bindable var item: ItemModel

    var body: some View {
        TextField("Name", text: $item.name)  // Binding works
    }
}

Decision tree:

  • Need binding ($item.property)? → Use @Bindable
  • Just reading properties? → Use plain property (no wrapper)

Pattern 4: @EnvironmentObject → @Environment (HIGH)

Why migrate: Type-safe, works with @Observable

Requirement: iOS 17+ with @Observable model

Detection:

Grep: @EnvironmentObject
Grep: \.environmentObject\(
swift
// ❌ LEGACY - Setting
ContentView()
    .environmentObject(settings)

// ❌ LEGACY - Reading
struct SettingsView: View {
    @EnvironmentObject var settings: AppSettings

    var body: some View { ... }
}

// ✅ MODERN - Setting
ContentView()
    .environment(settings)

// ✅ MODERN - Reading
struct SettingsView: View {
    @Environment(AppSettings.self) var settings

    var body: some View { ... }
}

// ✅ MODERN - With binding
struct SettingsEditorView: View {
    @Environment(AppSettings.self) var settings

    var body: some View {
        @Bindable var settings = settings
        Toggle("Dark Mode", isOn: $settings.darkMode)
    }
}

Pattern 5: onChange(of:perform:) → onChange(of:initial:_:) (MEDIUM)

Why migrate: Deprecated modifier, new API has initial parameter

Requirement: iOS 17+

Detection:

Grep: \.onChange\(of:.*perform:
swift
// ❌ DEPRECATED
.onChange(of: searchText) { newValue in
    performSearch(newValue)
}

// ✅ MODERN (iOS 17+)
.onChange(of: searchText) { oldValue, newValue in
    performSearch(newValue)
}

// ✅ With initial execution
.onChange(of: searchText, initial: true) { oldValue, newValue in
    performSearch(newValue)
}

Pattern 6: Completion Handlers → async/await (MEDIUM)

Why migrate: Cleaner code, better error handling, structured concurrency

Requirement: iOS 15+ (widely adopted in iOS 17+)

Detection:

Grep: completion:\s*@escaping
Grep: completionHandler:
Grep: DispatchQueue\.main\.async
swift
// ❌ LEGACY
func fetchUser(id: String, completion: @escaping (Result<User, Error>) -> Void) {
    URLSession.shared.dataTask(with: url) { data, response, error in
        DispatchQueue.main.async {
            if let error = error {
                completion(.failure(error))
                return
            }
            // Parse and return
            completion(.success(user))
        }
    }.resume()
}

// ✅ MODERN
func fetchUser(id: String) async throws -> User {
    let (data, _) = try await URLSession.shared.data(from: url)
    return try JSONDecoder().decode(User.self, from: data)
}

Pattern 7: withAnimation Closures → Animation Parameter (LOW)

Why migrate: Cleaner API, avoids closure

Requirement: iOS 17+

Detection:

Grep: withAnimation.*\{
swift
// ❌ LEGACY
withAnimation(.spring()) {
    isExpanded.toggle()
}

// ✅ MODERN (simple cases)
isExpanded.toggle()
// Apply animation to view:
.animation(.spring(), value: isExpanded)

// Or use new binding animation:
$isExpanded.animation(.spring()).wrappedValue.toggle()

Pattern 8: Swift Language Modernization (LOW)

Why migrate: Clearer, more efficient, modern Swift idioms

Detection:

Grep: Date\(\)
Grep: CGFloat
Grep: replacingOccurrences
Grep: DateFormatter\(\)
Grep: \.filter\(.*\)\.count
Grep: Task\.sleep\(nanoseconds:

Reference: See axiom-swift (skills/swift-modern.md) skill for the full modern API replacement table.

Report matches as LOW priority unless they appear in hot paths (then MEDIUM).

Audit Process

Step 1: Find Swift Files

Glob: **/*.swift

Step 2: Detect Legacy Patterns

ObservableObject:

Grep: ObservableObject
Grep: @Published

Property Wrappers:

Grep: @StateObject|@ObservedObject|@EnvironmentObject

Deprecated Modifiers:

Grep: onChange\(of:.*perform:

Completion Handlers:

Grep: completion:\s*@escaping
Grep: completionHandler:

Step 3: Categorize by Priority

HIGH Priority (significant benefits):

  • ObservableObject → @Observable
  • Property wrapper migrations

MEDIUM Priority (code quality):

  • Deprecated modifiers
  • async/await adoption

LOW Priority (minor improvements):

  • Animation syntax
  • Minor API updates

Output Format

markdown
# Modernization Analysis Results

## Summary
- **HIGH Priority**: [count] (Significant performance/maintainability gains)
- **MEDIUM Priority**: [count] (Deprecated APIs, code quality)
- **LOW Priority**: [count] (Minor improvements)

## Minimum Deployment Target Impact
- Current patterns support: iOS 14+
- After full modernization: iOS 17+

## HIGH Priority Migrations

### ObservableObject → @Observable

**Files affected**: 5
**Estimated effort**: 2-3 hours

#### Models to Migrate

1. `Models/ContentViewModel.swift:12`
   ```swift
   // Current
   class ContentViewModel: ObservableObject {
       @Published var items: [Item] = []
       @Published var isLoading = false
   }

   // Migrated
   @Observable
   class ContentViewModel {
       var items: [Item] = []
       var isLoading = false
   }
  1. Models/UserSettings.swift:8 [Similar migration...]
Views to Update After Model Migration
FileChange
Views/ContentView.swift:15@StateObject → @State
Views/ItemList.swift:23@ObservedObject → plain property
Views/SettingsView.swift:8@EnvironmentObject → @Environment

@EnvironmentObject → @Environment

  • Views/RootView.swift:45

    swift
    // Current
    .environmentObject(settings)
    
    // Migrated
    .environment(settings)
  • Views/SettingsView.swift:12

    swift
    // Current
    @EnvironmentObject var settings: AppSettings
    
    // Migrated
    @Environment(AppSettings.self) var settings

MEDIUM Priority Migrations

Deprecated onChange Modifier

  • Views/SearchView.swift:34
    swift
    // Deprecated
    .onChange(of: query) { newValue in
        search(newValue)
    }
    
    // Modern
    .onChange(of: query) { oldValue, newValue in
        search(newValue)
    }

async/await Opportunities

  • Services/NetworkService.swift - 3 completion handler methods
    • fetchUser(completion:) → fetchUser() async throws
    • fetchItems(completion:) → fetchItems() async throws
    • uploadData(completion:) → uploadData() async throws

Migration Order

  1. First: Migrate models to @Observable

    • All ObservableObject → @Observable
    • Remove all @Published
  2. Second: Update view property wrappers

    • @StateObject → @State (for owned models)
    • @ObservedObject → plain or @Bindable
    • @EnvironmentObject → @Environment
  3. Third: Update view modifiers

    • .environmentObject() → .environment()
    • Deprecated onChange syntax
  4. Fourth: Adopt async/await (optional, but recommended)

Breaking Changes Warning

⚠️ Deployment Target: Full migration requires iOS 17+

If you need to support iOS 16 or earlier:

  • Keep ObservableObject for those models
  • Use conditional compilation:
    swift
    #if os(iOS) && swift(>=5.9)
    @Observable
    class ViewModel { ... }
    #else
    class ViewModel: ObservableObject { ... }
    #endif

Verification

After migration:

  1. Build and fix any compiler errors
  2. Test view updates (properties should still trigger UI refresh)
  3. Test bindings (TextField, Toggle still work)
  4. Test environment injection

## When No Migration Needed

```markdown
# Modernization Analysis Results

## Summary
Codebase is already using modern patterns!

## Verified
- ✅ Using `@Observable` macro
- ✅ Using `@State` with Observable models
- ✅ Using `@Environment` for shared state
- ✅ No deprecated modifiers detected

## Optional Improvements
- Consider adopting iOS 18+ features when available
- Review remaining completion handlers for async/await conversion

Decision Flowchart

Is model a class with published properties?
├─ YES: Does it conform to ObservableObject?
│  ├─ YES: Is it a type you declare (not a framework class)?
│  │  ├─ NO → Keep as-is; report why (e.g. GroupSession)
│  │  └─ YES: Target iOS 17+?
│  │     ├─ YES → Migrate to @Observable
│  │     └─ NO → Keep ObservableObject
│  └─ NO: Already modern or not observable
└─ NO: Check if it's a struct (usually fine)

Is view using @StateObject?
├─ YES: Is the model @Observable?
│  ├─ YES → Change to @State
│  └─ NO → Keep @StateObject until model migrated
└─ NO: Check other wrappers

Is view using @ObservedObject?
├─ YES: Is the model @Observable?
│  ├─ YES: Need binding?
│  │  ├─ YES → Use @Bindable
│  │  └─ NO → Remove wrapper, use plain property
│  └─ NO → Keep @ObservedObject
└─ NO: Already modern

Is view using @EnvironmentObject?
├─ YES: Is the model @Observable?
│  ├─ YES → Change to @Environment(Type.self)
│  └─ NO → Keep @EnvironmentObject
└─ NO: Already modern

False Positives to Avoid

Not issues:

  • Third-party SDK types using ObservableObject
  • Models that intentionally support iOS 14-16
  • Combine publishers (not the same as @Published)
  • Already migrated code using @Observable
  • Apple protocol families unrelated to Observation — classes conforming to AppIntent, EntityQuery, AppEntity, WidgetConfiguration, TimelineProvider, or other App Intents / WidgetKit protocols are NOT ObservableObject and should not be flagged for @Observable migration
  • GroupSession and code observing it (SharePlay/GroupActivities) — a framework-owned ObservableObject you cannot redeclare, whose @Published willSet timing the participant-delta pattern depends on. See Pattern 1. Migrating it silently breaks late-joiner state catch-up.

Check before reporting:

  • Verify file is in your project, not dependencies
  • Check deployment target constraints
  • Confirm model is actually used in SwiftUI views
  • Confirm the class actually conforms to ObservableObject — do not flag classes just because they are classes
  • Confirm the type is yours to change — framework classes conforming to ObservableObject cannot be migrated regardless of deployment target

Invocation Examples

Prompts that should launch this agent:

Explicit command: Users can also invoke this agent directly with axiom-modernize or axiom-modernize

Scope

Scans for legacy patterns and provides migration paths with code examples.

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Son archivos de solo lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Axiom Modernize?

Use when the user wants to modernize iOS code to iOS 17/18 patterns, migrate from ObservableObject to @Observable, update @StateObject to @State, or adopt modern SwiftUI APIs.

¿Por qué usar Axiom Modernize en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Axiom Modernize está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Axiom Modernize en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-modernize. TypingMind lee el archivo SKILL.md de esa carpeta, empaqueta los archivos de la carpeta e instala el conjunto como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Axiom Modernize?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Axiom Modernize?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Axiom Modernize con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Axiom Modernize?

Sí. CharlesWiltgen la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇