Improve the AI-written code in all your SwiftUI projects with my free agent skill

If you’re writing SwiftUI with AI coding agents like Claude Code, Codex, or Gemini, I’ve written an open-source SwiftUI agent skill that helps identify and fix common mistakes they make when writing SwiftUI – things like modern API usage, performance, accessibility, and more.

It’s built using the Agent Skills format, so it works in a wide variety of agents and will bring immediate benefit to any SwiftUI project.

Even better, most people can install it with just one command:

npx skills add https://github.com/twostraws/swiftui-agent-skill --skill swiftui-pro

For more information about installing and using agent skills in Xcode, check out my YouTube video: Agent Skills in Xcode - Build better SwiftUI apps with AI agents.

Update: I've released several more agent skills, covering SwiftUI, SwiftData, Swift Concurrency, and Swift Testing. You can find them all in a new repository: Swift Agent Skills.

Why I made this skill

I’ve been working with SwiftUI since June 2019, and as it evolved over time I started to see people adopt some coding patterns that were less than ideal – they sometimes made buttons invisible to VoiceOver, they used deprecated API without realizing, and they would accidentally write code that caused performance problems.

In the past I’ve run workshops helping folks identify this kind of code and get it resolved, culminating in my famous “Kobayashi Maru” workshop. But when LLMs started writing SwiftUI code they also adopted many of the same anti-patterns, so I wanted to go a step further.

Recently I wrote an article about the biggest problems in AI-generated Swift code, and also converted it to an AGENTS.md file that quietly helps make all LLMs smarter while they work.

Sadly, a prominent member of our community decided to plagiarize me, taking huge swathes of my work (often word for word!) and copying it into their own project, then adding their own name at the top as copyright. You can find out more about that in a video I made about building apps with AI.

I don’t have the patience for that kind of behavior, so I built this agent skill to show that we’re better – it’s packed with everything from my original AGENTS.md file and a whole lot more.

This means you get:

  • 💫 Fully updated API guidance to help you write the smartest, simplest SwiftUI.
  • 🚀 Actionable, real-world advice based on years of experience.
  • 🙌 The guarantee that checks have not been stolen from other people.

What’s in the skill

I’ve packed my SwiftUI agent skill with a wide range of checks and advice that will help tools like Claude Code and Codex review your code and suggest lots of helpful improvements, including:

  • Extensive advice on deprecated API and what to use instead, such as avoiding foregroundColor(), avoiding Text concatenation with +, and staying away from ObservableObject unless it’s strictly required.
  • Performance tips such as avoiding doing View work in initializers or body properties, breaking up SwiftUI views to make the most of the @Observable macro, and modern formatting APIs.
  • Accessibility guidance such as ensuring all controls are labeled, touch areas are big enough, and fonts scale correctly.
  • Useful Swift tips such as localizedStandardContains(), preferring count(where:) over filter() then count, and using automatic grammar agreement.

…and that’s just a tiny slice of what’s in there – you’ll also find concurrency tips, design help, project hygiene advice, and more, all of which come together to help ensure the Swift agent of your choosing is as helpful as possible.

I hope the skill is useful to you!