Skill: Codebase Analyst
Purpose
Analyze an existing iOS/Swift codebase to identify patterns, validate against MVVM + SPM architecture rules, detect anti-patterns, technical debt, missing tests, and security issues. Generate a report with actionable recommendations.
Execution Flow — 7 Steps
Step 1: Structure Scan
- Identify all
Package.swiftfiles and.xcodeproj/.xcworkspace - Map the SPM module structure (Core, CoreUI, Feature modules, Dependencias)
- Identify Swift version and iOS deployment target
- List all third-party dependencies from Package.swift
- Count files by type (.swift, .xib, .storyboard, .json, .strings)
- Identify build configurations and schemes
Step 2: Module Dependency Graph
- Parse all
Package.swiftfiles for dependency declarations - Map the module hierarchy: Dependencias → Core → CoreUI → Features
- Detect cross-feature dependencies (violations)
- Identify circular dependency chains
- Verify no feature module imports another feature module directly
- Generate a text-based dependency graph
Step 3: ViewModel Catalog
- Find all classes conforming to
ObservableObject - For each ViewModel, catalog:
- @MainActor presence
- @Published properties count and types
- Combine subscriptions (cancellables)
- Dependencies (protocols injected)
- Coordinator interactions
- Flag ViewModels without @MainActor
- Flag ViewModels with >8 @Published properties
Step 4: Coordinator Flow Mapping
- Find all Coordinator classes/protocols
- Map navigation flows between screens
- Identify deep link entry points
- Flag direct navigation from Views (bypassing Coordinators)
- Detect orphaned Coordinators (defined but not connected)
Step 5: API Endpoint Mapping
- Find all
EnrutadorApidefinitions - Map endpoints: URL, HTTP method, parameters
- Identify API implementations and their protocols
- Flag APIs without protocol abstraction
- Detect hardcoded URLs or API keys
Step 6: Anti-Pattern Detection
- God ViewModels — ViewModels with >300 lines or >10 methods
- Business logic in Views — Computation in
bodyproperty - Force unwrapping —
!usage outside tests - Any usage —
AnyorAnyObjectinstead of generics/protocols - Massive closures — Inline closures >20 lines
- Singleton abuse — Singletons outside Factory container
- TODO/HACK/FIXME — Technical debt markers
- Dead code — Unreferenced classes or methods
- Missing weak self — Closures capturing self strongly
- Storyboard/XIB usage — Should be SwiftUI per architecture
Step 7: Report Generation
Generate report:
# Codebase Analysis: [ProjectName]
**Date**: [date]
**Swift Version**: [version]
**iOS Target**: [target]
**SPM Modules**: [count]
## Module Dependency Graph
[Text diagram]
## ViewModel Health
| ViewModel | @MainActor | @Published | Cancellables | Issues |
|-----------|-----------|------------|--------------|--------|
## Coordinator Flows
[Flow diagram]
## API Endpoints
| Endpoint | Method | Module | Protocol |
|----------|--------|--------|----------|
## Anti-Patterns Found
| Severity | Type | File | Line | Description |
|----------|------|------|------|-------------|
## Technical Debt Score
[Score 0-100 with breakdown]
## Recommendations
[Prioritized action items]
Auto-Shielding
- ABORT if no Swift files found — wrong project type
- WARN if project uses Storyboards exclusively — may need migration assessment
Rules
- Never modify code during analysis — this is strictly read-only
- Report all findings with exact file paths and line numbers
- Categorize by severity: Critical, Warning, Info
- Include positive findings (things done well) alongside issues
- Technical debt score should be reproducible (same code = same score)
- Recommendations must be prioritized by impact and effort
Source: juankmvanegas/factoria-powers — distributed by TomeVault.