# Swift anti pattern guard

> Swift anti pattern guard is an open-source agent skill for developer tools. Flags outdated Swift patterns like ObservableObject and NavigationView and suggests modern. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/pstuart/pstuart/tree/main/plugins/swift-modern-dev/skills/swift-anti-pattern-guard
- **Repository:** https://github.com/pstuart/pstuart
- **GitHub stars:** 20
- **License:** MIT
- **Skill name:** swift-anti-pattern-guard
- **Collection:** https://github.com/pstuart/pstuart
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill guides an agent through reviewing Swift code for legacy patterns across the observation family, GCD main-queue calls, NavigationView and Core Data. For each match it reports the file, the pattern and a modern replacement such as @Observable, @MainActor, NavigationStack or SwiftData.

The workflow is a grep pass over the target path with ripgrep, grouping findings by file and explaining why each pattern hurts concurrency, state invalidation or maintenance. Fixes are meant to be minimal and local, and the skill warns against rewriting whole modules or drive-by refactors without review.

It expects a Swift codebase and a shell with ripgrep available. The guidance is advisory and aligns with the repository's own deployment targets and conventions.

## When your agent uses it

> Use when reviewing Swift code for outdated patterns, modernizing a project, running architecture health checks, or grepping for ObservableObject, DispatchQueue.main, NavigationView, or Core Data.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/pstuart/pstuart/tree/HEAD/plugins/swift-modern-dev/skills/swift-anti-pattern-guard)
- [License: MIT](https://github.com/pstuart/pstuart/tree/HEAD/plugins/swift-modern-dev/skills/swift-anti-pattern-guard)

## Features

- **Observation pattern detection:** Finds ObservableObject, @Published and related property wrappers and suggests @Observable replacements.
- **Main queue migration:** Flags DispatchQueue.main calls and recommends @MainActor or MainActor.run alternatives.
- **Navigation modernization:** Identifies NavigationView usage and points to NavigationStack or NavigationSplitView.
- **Core Data review:** Spots Core Data types and suggests SwiftData equivalents while preserving existing persistence.
- **Grep-based scan:** Runs a ripgrep command across Swift files to collect all forbidden tokens in a path.

## Good for

- Review my Swift project for outdated ObservableObject usage
- Find DispatchQueue.main calls and suggest @MainActor replacements
- Check whether my app still uses NavigationView
- Audit Core Data usage and outline a SwiftData path
- Run an architecture health check on this Swift codebase

## Install

### Claude Code

This skill ships in the `swift-modern-dev` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add pstuart/pstuart
/plugin install swift-modern-dev@pstuart
```

Or copy only this skill to `~/.claude/skills/swift-anti-pattern-guard`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/swift-anti-pattern-guard &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-anti-pattern-guard" ~/.claude/skills/swift-anti-pattern-guard &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/swift-anti-pattern-guard` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/swift-anti-pattern-guard` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/swift-anti-pattern-guard &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-anti-pattern-guard" ~/.agents/skills/swift-anti-pattern-guard &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/swift-anti-pattern-guard` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/swift-anti-pattern-guard` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/swift-anti-pattern-guard &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-anti-pattern-guard" ~/.cursor/skills/swift-anti-pattern-guard &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/swift-anti-pattern-guard` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/pstuart/pstuart.git --path plugins/swift-modern-dev/skills/swift-anti-pattern-guard
```

Or copy the folder to `~/.gemini/skills/swift-anti-pattern-guard` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/swift-anti-pattern-guard`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/swift-anti-pattern-guard &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-anti-pattern-guard" ~/.copilot/skills/swift-anti-pattern-guard &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/swift-anti-pattern-guard` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/pstuart/pstuart.git
```

Then copy `pstuart/plugins/swift-modern-dev/skills/swift-anti-pattern-guard` into your agent's skills folder as `swift-anti-pattern-guard`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Swift anti pattern guard need to run?

It uses ripgrep over Swift files in the target path, so ripgrep needs to be available in the environment.

### Does Swift anti pattern guard change my code automatically?

No. It is advisory, reports findings with replacements, and suggests minimal fixes rather than rewriting whole modules.

### Which patterns does Swift anti pattern guard check?

Phase one covers the observation family, GCD main queue calls, NavigationView and Core Data types.

### When does Swift anti pattern guard trigger?

When reviewing Swift code for outdated patterns, modernizing a project, running architecture health checks, or grepping for the listed tokens.

### How do I install Swift anti pattern guard in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/swift-anti-pattern-guard to use it in all your projects, or to .claude/skills/swift-anti-pattern-guard in one project. Or install the swift-modern-dev plugin, which includes it: /plugin marketplace add pstuart/pstuart, then /plugin install swift-modern-dev@pstuart.

### Does Swift anti pattern guard run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Swift anti pattern guard?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Swift anti pattern guard?

The closest alternatives to Swift anti pattern guard are Swift modern architecture, Axiom modernize, Axiom analyze swiftui performance, Axiom swift simplifier and Axiom swift.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Swift modern architecture](https://ai-powered.com/skills/swift-modern-architecture): Swift modern architecture is an open-source agent skill for developer tools.
- [Axiom modernize](https://ai-powered.com/skills/axiom-modernize): Axiom modernize is an open-source agent skill for developer tools.
- [Axiom analyze swiftui performance](https://ai-powered.com/skills/axiom-analyze-swiftui-performance): Axiom analyze swiftui performance is an open-source agent skill for developer tools.
- [Axiom swift simplifier](https://ai-powered.com/skills/axiom-swift-simplifier): Axiom swift simplifier is an open-source agent skill for developer tools.
- [Axiom swift](https://ai-powered.com/skills/axiom-swift-charleswiltgen-2): Axiom swift is an open-source agent skill for developer tools.
- [Axiom analyze swift performance](https://ai-powered.com/skills/axiom-analyze-swift-performance): Axiom analyze swift performance is an open-source agent skill for developer tools.
- [Axiom audit swiftdata](https://ai-powered.com/skills/axiom-audit-swiftdata): Axiom audit swiftdata is an open-source agent skill for developer tools.
- [Swift performance optimization](https://ai-powered.com/skills/swift-performance-optimization): Swift performance optimization is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/swift-anti-pattern-guard
