swift-feature

swift-feature is a command for Claude Code from jeremieb/swift-unit-test-instructions. It costs 0 tokens per session (557 once invoked), scanned A, original, MIT.

A command for adding a Swift feature from planning through implementation and build checking. It uses MVVM, a pattern that keeps screen display, app logic, and data access in separate parts.

In plain words
What is it for?
Use it to add screens and related ViewModels or services, handle loading, errors, and empty states, add previews, and validate the build.
Why use it?
It helps prevent feature work from starting with unclear file changes or missing dependencies. It also requires confirmation of the plan before implementation.

Command for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to add screens and related ViewModels or services, handle loading, errors, and empty states, add previews, and validate the build.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/jeremieb/swift-unit-test-instructions/swift-feature
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/jeremieb/swift-unit-test-instructions

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-feature

README.md
[![agentmods](https://agentmods.dev/badge/commands/jeremieb/swift-unit-test-instructions/swift-feature.svg)](https://agentmods.dev/commands/jeremieb/swift-unit-test-instructions/swift-feature)
Your own site
<a href="https://agentmods.dev/commands/jeremieb/swift-unit-test-instructions/swift-feature"><img src="https://agentmods.dev/badge/commands/jeremieb/swift-unit-test-instructions/swift-feature.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 557 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00557
Opus 5 $0.00000 $0.00279
Sonnet 5 $0.00000 $0.00111
Haiku 4.5 $0.00000 $0.00056

Measured 8d ago against content hash b0651f45fb81, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

swift-feature scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/swift-feature.md · 86 lines

How it starts

The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implement a new Swift feature end-to-end: analysis, confirmation, implementation, and build validation.

Usage

/swift-feature [description of the feature]

Example: /swift-feature user profile screen that displays name, avatar, and a logout button

Phase 1 — Analysis

Before writing a single line of code:

  1. Read the existing folder structure to understand where the feature belongs
  2. Identify which files need to be created vs modified
  3. Check if any required services or protocols already exist
  4. Determine: does this need a new ViewModel? A new Service? A persistence change?

Present a concise plan:

Feature: [name]
New files:
  - Features/[Name]/[Name]View.swift
  - Features/[Name]/[Name]ViewModel.swift
Modified files:
  - App/ContentView.swift (add navigation entry)
Dependencies needed:
  - [Service] — already exists / needs to be created

STOP. Wait for user confirmation before proceeding.


Phase 2 — Implementation

Apply the confirmed plan:

  • Follow MVVM strictly: thin View, logic in ViewModel, data access in Service
  • Inject all dependencies via init
  • Handle loading state, error state, and empty state
  • Add #Preview that compiles with mock or default data
  • Use async/await — no completion handlers
  • Consult the matching skill for detailed patterns:
    • UI → swift-swiftui-component or swift-uikit-component skill
    • Networking → swift-networking skill
    • Persistence → swift-persistence skill

Phase 3 — Build Validation

Run /swift-build to confirm the project compiles.

  • On success: proceed to Phase 4
  • On failure: fix errors (max 2 attempts), then re-run
  • If still failing after 2 attempts: stop and present errors to user

Phase 4 — Test Check

Check if the new ViewModel or Service has tests:

  • If yes: run tests for the affected target
  • If no: flag it — "No tests found for [FeatureName]ViewModel. Use the swift-testing skill to add them."

Do not write tests automatically — keep this command focused on the feature implementation.

Read the full file on GitHub · 86 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 86 lines · 0 tokens per session scan A b0651f45fb81

Subscribe to this mod's changes

swift-feature is a command published in the GitHub repository jeremieb/swift-unit-test-instructions (5 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 557 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.