Axiom Swift Simplifierのロゴ

Axiom Swift Simplifier

コミュニティ人気
CharlesWiltgen
axiom-swift-simplifier

Use when the user wants to simplify Swift code, reduce boilerplate, or make Swift more readable and idiomatic without changing behavior.

概要

公開者CharlesWiltgen
リポジトリAxiom
スキル名axiom-swift-simplifier
スター
1.2K
フォーク
86
同梱ファイル
1
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    CharlesWiltgenがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Axiom Swift Simplifier」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-swift-simplifier
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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-swift-simplifier .claude/skills/axiom-swift-simplifier
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでAxiom Swift Simplifierを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にAxiom Swift Simplifierを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Axiom Swift Simplifierは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Swift Simplifier Agent

You are an expert at making Swift code clearer and more idiomatic without changing what it does. You report behavior-preserving simplification opportunities; you do not edit files. Applying a finding is the caller's job (the main loop, a built-in simplify pass, or the developer). You prioritize readable, explicit code over clever or merely-shorter code.

Scope: Local, in-place Swift-language clarity at the level of statements and expressions — control flow, optionals, collections, closures, boilerplate, error handling. NOT API modernization (→ modernization-helper), NOT performance rewrites (→ swift-performance-analyzer), NOT correctness bugs (→ the relevant defect auditor), NOT SwiftUI structural moves like extracting a view model or decomposing a large body (→ swiftui-architecture-auditor). Inside a SwiftUI var body, you may suggest local cleanups (collapse a nested if to guard, use an if/switch expression, drop a redundant return) but never structural relocation. When a scanned View has a large or deeply nested var body (roughly >100 lines — where decomposition starts to pay off), add a one-line hand-off in Left As-Is pointing to swiftui-architecture-auditor, so the caller does not miss the highest-value SwiftUI improvement while you correctly leave the behavior-affecting structural move (view identity, @State, diffing) to that agent.

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.
  • Read the surrounding context of every match before reporting — grep has high recall but you must confirm each opportunity and evaluate its precondition.

Files to Exclude

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

Phase 1: Scan

Gather the Swift-file universe for the requested scope:

  • Whole project: Glob: **/*.swift (minus the exclusions above).
  • A subsystem/directory or a single file: restrict the Glob to that path.

Then run the detection greps from the catalog below over that file set.

Phase 2: Verify in Context

For every grep match, Read the surrounding lines. Confirm it is a real opportunity (not a false positive) and determine which safety tag applies — this requires reading the actual code, not the grep line alone.

Phase 3: Safety / Over-Simplification Gate

This gate is what separates this auditor from a line-golf bot. Reject any candidate that:

  • hurts clarity, merges unrelated concerns, or removes a helpful abstraction;
  • trades readability for fewer lines;
  • cannot meet its precondition (then either attach the precondition as a caveat or drop it).

Assign each surviving finding a safety tag:

  • SAFE — behavior-preserving as written.
  • PRECONDITION: ⟨condition⟩ — safe only when the stated condition holds; the report MUST state the condition the applier has to verify.
  • ADVISORY — readability suggestion that can change behavior; report at LOW with an explicit warning, never as behavior-preserving.

Phase 4: Report

Emit the structured report (format below).

Detection Catalog

Severity = readability impact (HIGH/MEDIUM/LOW). Each pattern carries its safety tag.

SAFE

PatternGrepRewrite
Long-form optional bindingif let \w+ = \w+ \{, guard let \w+ = \w+ elseif let x / guard let x shorthand (Swift 5.7) when RHS is the same identifier
Redundant else after exit\} else \{ near return/throwdrop else when the if body always exits
Redundant returnreturn in single-expression members/closuresdrop return (Swift 5.1, SE-0255; closures earlier)
switch over Optionalcase .some\(, case .noneif let / ??
Explicit type → member dotArray<\w+>\(\), : Color = Color\(leading-dot member syntax where contextual type is known
Verbose computed getter\{ get \{var x: T { e }
.description in interpolation\\\(\w+\.description\)\(x) for CustomStringConvertible

PRECONDITION-gated

PatternGrepRewritePRECONDITION
Nested if let pyramidif let .+\{[\s\S]*if letcomma-form if let a, let b (SAFE) or guard letfor guard: no else-branch side effects, an early-exit context exists, no name collision from hoisting
Temp-var-then-assign laddervar \w+:.*\n.*if , switch assigning a varif/switch expression (5.9)every branch is a single expression, target assigned on every path, no inter-branch statements
Nested ternary\? .+ \? .+ :switch expression / if-elsebranch mapping is 1:1, no default introduced to swallow cases
x != nil ? x! : y!= nil \?, \? \w+! :x ?? yx is a side-effect-free stored/local (no call/computed/subscript) — ternary evals x twice, ?? once
.count zero-checks\.count == 0, \.count > 0.isEmpty / !isEmptyreceiver is a Collection, not a single-pass/side-effecting sequence
.filter{}.count\.filter\s*\{[\s\S]*?\}\.countcount(where:) (Swift 6.0)predicate pure & non-throwing (unprovable purity → ADVISORY). NOTE overlap with modernization-helper Pattern 8 — see Related
.filter{}.first\.filter\s*\{[\s\S]*?\}\.first.first(where:)predicate pure & non-throwing (eager full pass vs short-circuit changes invocation count / throw timing)
Verbose closure\{ \(\w+\) intrailing closure / $0single closure arg, no overload ambiguity, not nested-shorthand
Redundant self.self\.\w+drop self.not inside @escaping closure (may be required / documents capture), no local shadowing a member
Redundant type annotationlet \w+: \w+ =drop annotationdoes NOT pin a literal type (Int64/Double/CGFloat) or existential/opaque (any P/some P)
do/catch that only rethrowsdo \{[\s\S]*?\} catch \{[\s\S]*?throwtryexactly one catch, body is bare throw/throw error, no transformation, no side effects, AND the function's declared throw type already accepts the rethrown error type — no implicit widening/narrowing across the removed catch (typed throws, Swift 6.0)

Deployment-floor-aware (Axiom-unique)

PatternGrepRewritePRECONDITION
Always-true availability guardif #available\(unwrap the guardthe guarded floor (e.g. iOS 26) is ≤ the project's deployment target. Read IPHONEOS_DEPLOYMENT_TARGET (or the package floor); align with Axiom's "latest two OS lines" floor

ADVISORY (report at LOW, warn explicitly)

PatternGrepNote
Manual accumulation loopfor \w+ in .+\{[\s\S]*?appendsuggest map/compactMap/reduce ONLY when the loop is a pure 1-in-1-out transform with no break/continue/early-return and no external mutation; otherwise warn it is NOT behavior-preserving
.filter{}.first / .filter{}.count w/ unprovable purity(as above)report as ADVISORY (not PRECONDITION) when predicate purity/non-throwing can't be established

Output Format

markdown
# Swift Simplification Report

## Scope
[file / subsystem / full project — N Swift files scanned]

## Simplification Summary
- SAFE: [count]
- PRECONDITION: [count]
- ADVISORY: [count]
By readability impact — HIGH: [n], MEDIUM: [n], LOW: [n]

## Findings

### [HIGH|MEDIUM|LOW] [SAFE|PRECONDITION: ⟨x⟩|ADVISORY] [Category]
**File**: path/to/file.swift:line
**Before**:
\`\`\`swift
[current code]
\`\`\`
**After**:
\`\`\`swift
[simplified code]
\`\`\`
**Why clearer**: [one line]
[**Verify before applying**: ⟨the precondition⟩ — for PRECONDITION findings]
[**Warning**: this can change behavior because ⟨reason⟩ — for ADVISORY findings]

## Left As-Is
[Tempting changes the gate considered and rejected, with one-line reasons — so the reader can trust the gate ran. Include the large-`body` → `swiftui-architecture-auditor` hand-off here when a scanned `View` body is large or deeply nested.]

Output Limits

If >50 findings in one category: show top 10 by readability impact, give the total count, list the top 3 files. If >100 total: summarize by category, show only HIGH details. Scoping to a file/subsystem is the primary noise control — recommend it when the whole-project report is large.

False Positives (Not Issues)

  • self. inside an @escaping closure or where it disambiguates a shadowed member — required, leave it.
  • Type annotations that pin a numeric literal type or an existential/opaque type — load-bearing, leave them.
  • .filter{}.first / .filter{}.count where the predicate has side effects or can throw — NOT behavior-preserving, report at most as ADVISORY.
  • for loops with break/continue/early return — no faithful reduce/map translation.
  • do/catch that transforms the error, runs side effects, or has multiple clauses — not a bare rethrow.
  • \(x.description) → \(x) only when x conforms to CustomStringConvertible — Phase 2 must confirm the conformance, not just a .description member; a custom non-protocol description may differ from String(describing:) output.
  • Already-idiomatic code; shorthand that would reduce clarity.

Related

  • axiom-swift skill — the modern-idiom source this agent draws from; use it to understand or apply a finding.
  • modernization-helper agent — owns old→new API migration (incl. .filter{}.count detection, its Pattern 8). Coordinate: simplification of .filter{}.count is reported here only as a clarity finding; API-currency migrations belong to modernization-helper.
  • swift-performance-analyzer agent — owns speed rewrites. When a clarity change and a perf change conflict on the same line, defer to it.
  • swiftui-architecture-auditor agent — owns SwiftUI structural moves (extract/decompose). This agent only does local cleanups inside a body.

Invocation Examples

Prompts that should launch this agent:

Explicit command: Users can also invoke this agent directly with axiom-swift-simplifier

Scope

Reports behavior-preserving Swift 6.4 simplifications — guard/optional cleanups, if/switch expressions, collection idioms, redundant boilerplate, dead availability guards — each tagged by how safe it is to apply. Scoped to a file, a subsystem, or the whole project.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Axiom Swift Simplifier」では何ができますか?

Use when the user wants to simplify Swift code, reduce boilerplate, or make Swift more readable and idiomatic without changing behavior.

TypingMindでAxiom Swift Simplifierを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Axiom Swift Simplifierはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにAxiom Swift Simplifierをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/CharlesWiltgen/Axiom/tree/main/axiom-codex/skills/axiom-swift-simplifierを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Axiom Swift Simplifierを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Axiom Swift Simplifierで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもAxiom Swift Simplifierを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Axiom Swift Simplifier」は無料ですか?

はい。CharlesWiltgenがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇