Fetches axiom-swift-performance from charleswiltgen/axiom and configures it for Cursor.
3
Select Cursor when prompted
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
◆ Which agents do you want to install to?
│
│ ── Universal (.agents/skills) ────────────────
│ · Cline · Codex · Goose · Windsurf
│ ●Cursor(selected)
│ · Cursor · Aider · Continue
4
Verify installation
Confirm successful installation by checking the skill directory location:
.cursor/skills/axiom-swift-performance
Restart Cursor to activate axiom-swift-performance. Access via /axiom-swift-performance in your agent's command palette.
⚠
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
App profiling shows Swift code as the bottleneck (Time Profiler hotspots)
Excessive memory allocations or retain/release traffic
Implementing performance-critical algorithms or data structures
Writing framework or library code with performance requirements
Optimizing tight loops or frequently called methods
Dealing with large data structures or collections
Code review identifying performance anti-patterns
Quick Decision Tree
Performance issue identified?
│
├─ Profiler shows excessive copying?
│ └─ → Part 1: Noncopyable Types
│ └─ → Part 2: Copy-on-Write
│
├─ Retain/release overhead in Time Profiler?
│ └─ → Part 4: ARC Optimization
│
├─ Generic code in hot path?
│ └─ → Part 5: Generics & Specialization
│
├─ Collection operations slow?
│ └─ → Part 7: Collection Performance
│
├─ Async/await overhead visible?
│ └─ → Part 8: Concurrency Performance
│
├─ Struct vs class decision?
│ └─ → Part 3: Value vs Reference
│
└─ Memory layout concerns?
└─ → Part 9: Memory Layout
The Four Principles of Swift Performance
From WWDC 2024-10217: Swift's low-level performance characteristics come down to four areas. Each maps to a Part in this skill.
Principle
What It Costs
Skill Coverage
Function Calls
Dispatch overhead, optimization barriers
Part 5 (Generics), Part 6 (Inlining)
Memory Allocation
Stack vs heap, allocation frequency
Part 3 (Value vs Reference), Part 7 (Collections)
Memory Layout
Cache locality, padding, contiguity
Part 9 (Memory Layout), Part 11 (Span)
Value Copying
COW triggers, defensive copies, ARC traffic
Part 1 (Noncopyable), Part 2 (COW), Part 4 (ARC)
Understanding which principle is causing your bottleneck determines which Part to use.
Part 1: Noncopyable Types (~Copyable)
Swift 6.0+ introduces noncopyable types for performance-critical scenarios where you want to avoid implicit copies.
When to Use
Large types that should never be copied (file handles, GPU buffers)
Types with ownership semantics (must be explicitly consumed)
Performance-critical code where copies are expensive
Basic Pattern
// Noncopyable typestructFileHandle:~Copyable{privatelet fd:Int32init(path:String)throws{self.fd =open(path,O_RDONLY)guard fd !=-1else{throwFileError.openFailed }}deinit{close(fd)}// Must explicitly consume consuming funcclose(){_= consume self}}// UsagefuncprocessFile()throws{let handle =tryFileHandle(path:"/data.txt")// handle is automatically consumed at end of scope// Cannot accidentally copy handle}
Ownership Annotations
// consuming - takes ownership, caller cannot use afterfuncprocess(consuming data:[UInt8]){// data is consumed}// borrowing - temporary access without ownershipfuncvalidate(borrowing data:[UInt8])->Bool{// data can still be used by callerreturn data.count >0}// inout - mutable accessfuncmodify(inout data:[UInt8]){ data.append(0)}
Performance Impact
Eliminates implicit copies: Compiler error instead of runtime copy
Zero-cost abstraction: Same performance as manual memory management
Use when: Type is expensive to copy (>64 bytes) and copies are rare
Part 2: Copy-on-Write (COW)
Swift collections use COW for efficient memory sharing. Understanding when copies happen is critical for performance.
How COW Works
var array1 =[1,2,3]// Single allocationvar array2 = array1 // Share storage (no copy)array2.append(4)// Now copies (array1 modified array2)
For custom COW implementation, see Copy-Paste Pattern 1 (COW Wrapper) below.
Performance Tips
// ❌ Accidental copy in loopfor i in0..<array.count { array[i]=transform(array[i])// Copy on first mutation if shared!}// ✅ Reserve capacity first (ensures unique)array.reserveCapacity(array.count)for i in0..<array.count { array[i]=transform(array[i])}// ❌ Multiple mutations trigger multiple uniqueness checksarray.append(1)array.append(2)array.append(3)// ✅ Single reservationarray.reserveCapacity(array.count +3)array.append(contentsOf:[1,2,3])
Defensive Copies
From WWDC 2024-10217: Swift sometimes inserts defensive copies when it cannot prove a value won't be mutated through a shared reference.
classDataStore{var items:[Item]=[]// COW type stored in class}funcprocess(_ store:DataStore){for item in store.items {// Swift may defensively copy `items` because:// 1. store.items is a class property (another reference could mutate it)// 2. The loop needs a stable snapshothandle(item)}}
How to avoid: Copy to a local variable first — one explicit copy instead of repeated defensive copies:
funcprocess(_ store:DataStore){let items = store.items // One copyfor item in items {handle(item)// No more defensive copies}}
In profiler: Defensive copies appear as unexpected swift_retain/swift_release pairs or Array.__allocating_init calls when you didn't expect allocation.
Part 3: Value vs Reference Semantics
Choosing between struct and class has significant performance implications.
Decision Matrix
Factor
Use Struct
Use Class
Size
≤ 64 bytes
> 64 bytes or contains large data
Identity
No identity needed
Needs identity (===)
Inheritance
Not needed
Inheritance required
Mutation
Infrequent
Frequent in-place updates
Sharing
No sharing needed
Must be shared across scope
Small Structs (Fast)
// ✅ Fast - fits in registers, no heap allocationstructPoint{var x:Double// 8 bytesvar y:Double// 8 bytes}// Total: 16 bytes - excellent for structstructColor{var r, g, b, a:UInt8// 4 bytes total - perfect for struct}
›Access to product documentation and roadmap tools (Jira, Notion, etc.)
›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Steps
1Install product management skill
2Start with user story generation for known feature
3Progress to competitive analysis: research 2-3 competitors
4Use for roadmap prioritization: apply RICE/ICE scoring
5Draft stakeholder communications and refine based on feedback
6Build template library for recurring PM tasks
7Share effective prompts with product team
Common Pitfalls
⚠Not validating competitive research—verify facts before sharing
⚠Accepting user stories without involving engineering team
⚠Over-relying on frameworks without qualitative judgment
⚠Not customizing outputs to company culture and communication style
⚠Skipping stakeholder validation of generated requirements
Best Practices
✓ Do
+Validate research and competitive analysis with real data
+Collaborate with engineering when generating technical requirements
+Customize frameworks and templates to your company context
+Use skill for first drafts, refine with stakeholder input
+Document successful prompt patterns for PM tasks
+Combine AI efficiency with human judgment and intuition
✗ Don't
−Don't publish competitive analysis without fact-checking
−Don't finalize user stories without engineering review
−Don't make prioritization decisions solely on AI scoring
−Don't skip customer validation of generated requirements
−Don't ignore company-specific context and culture
💡 Pro Tips
★Provide context: company goals, constraints, customer feedback
★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
★Use skill for 70% generation + 30% customization to company needs
When to Use This
✓ Use when
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid when
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path
1Basic: user stories, feature specs, status updates