ablevarghese/ios-claude-toolkit/forge-development

Claude Code and agent skill by ablevarghese/ios-claude-toolkit

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use ANY TIME Swift code is written, modified, or created — even for 'small' changes. TDD-first Swift/SwiftUI development with hexagonal architecture, MVVM, and protocol-based DI. Triggers: implementing features, writing Swift code, creating views or viewmodels, refactoring, fixing bugs, adding a new screen, building a service, wiring dependencies, setting up DI. Covers Swift 6 strict concurrency, Sendable compliance, and error handling. If unsure whether to use this skill, use it — it is the default for all Swift implementation work. For code review without changes, use ios-review instead.

Install

npx vskill@latest install ablevarghese/ios-claude-toolkit/forge-development

SKILL.md

The same SKILL.md was published earlier as ablevarghese/ios-claude-toolkit/forge-development.

FORGE — Development & Code Engineering

Swift/SwiftUI development skill for iOS apps. Enforces hexagonal architecture + MVVM + protocol-based DI with TDD-first methodology.

Iron Law: "No implementation without a failing test first. No exception."
Project Discovery: Before executing, determine project-specific values (project name, scheme, bundle ID, target, architecture layers) from project configuration files (CLAUDE.md, project.yml, .xcodeproj, Package.swift).

Phased TDD Workflow: RED → GREEN → REFACTOR

TDD is not optional. Every implementation begins with a failing test. This section shows the complete cycle with real Swift/XCTest examples.

Phase 1: RED — Write the Failing Test

Write the test first. It must fail. If it passes before you write implementation code, the test is wrong — it's not testing anything new.

swift
// File: Tests/ServicesTests/TransferServiceTests.swift
final class TransferServiceTests: XCTestCase {
// MARK: - test_methodName_whenCondition_shouldExpectedBehavior
func test_executeTransfer_whenSufficientBalance_shouldDebitSenderAndCreditRecipient() async throws {
// Arrange
let mockRepo = MockTransferRepository()
let mockBalanceService = MockBalanceService(balance: Decimal(1000))
let sut = TransferService(
repository: mockRepo,
balanceService: mockBalanceService
)
let request = TransferRequest(
senderId: UUID(),
recipientId: UUID(),
amount: Decimal(250),
currency: .usd
)
// Act
let result = try await sut.execute(request)
// Assert
XCTAssertEqual(result.status, .completed)
XCTAssertEqual(mockRepo.savedTransfer?.amount, Decimal(250))
XCTAssertEqual(mockBalanceService.debitedAmount, Decimal(250))
XCTAssertEqual(mockBalanceService.creditedAmount, Decimal(250))
}
func test_executeTransfer_whenInsufficientBalance_shouldThrowInsufficientFunds() async {
// Arrange
let mockBalanceService = MockBalanceService(balance: Decimal(100))
let sut = TransferService(
repository: MockTransferRepository(),
balanceService: mockBalanceService
)
let request = TransferRequest(
senderId: UUID(),
recipientId: UUID(),
amount: Decimal(500),
currency: .usd
)
// Act & Assert
do {
_ = try await sut.execute(request)
XCTFail("Expected TransferError.insufficientFunds to be thrown")
} catch let error as TransferError {
XCTAssertEqual(error, .insufficientFunds(available: Decimal(100), requested: Decimal(500)))
} catch {
XCTFail("Unexpected error type: \(error)")
}
}
}

Run the test. It must fail:

❌ test_executeTransfer_whenSufficientBalance_shouldDebitSenderAndCreditRecipient — Error: Cannot find 'TransferService' in scope

This failure confirms the test is real. Now proceed to GREEN.

Phase Gate: RED

Cannot proceed to GREEN until ALL conditions are met:

  • [ ] Test file exists and compiles
  • [ ] Test has been RUN (not just written)
  • [ ] Output shows FAILURE (not compilation error — a genuine test assertion failure)
  • [ ] You can explain in one sentence WHY it fails

Proof required: Show the test run command and its failure output.

If test passes immediately: The test is wrong — it's testing existing behavior, not new behavior. Delete the test. Write one that actually fails. This is the most common TDD mistake.

If you wrote implementation code before reaching this gate: STOP. Delete the implementation. You violated the Iron Law. Return to RED.

Phase 2: GREEN — Minimum Implementation to Pass

Write only enough code to make the test pass. Resist the urge to over-engineer.

swift
// File: Sources/Services/TransferService.swift
final class TransferService: TransferServiceProtocol {
private let repository: TransferRepositoryProtocol
private let balanceService: BalanceServiceProtocol
init(repository: TransferRepositoryProtocol, balanceService: BalanceServiceProtocol) {
self.repository = repository
self.balanceService = balanceService
}
func execute(_ request: TransferRequest) async throws -> Transfer {
let balance = try await balanceService.getBalance(for: request.senderId)
guard balance >= request.amount else {
throw TransferError.insufficientFunds(
available: balance,
requested: request.amount
)
}
try await balanceService.debit(userId: request.senderId, amount: request.amount)
try await balanceService.credit(userId: request.recipientId, amount: request.amount)
let transfer = Transfer(
id: UUID(),
senderId: request.senderId,
recipientId: request.recipientId,
amount: request.amount,
currency: request.currency,
status: .completed,
createdAt: Date()
)
try await repository.save(transfer)
return transfer
}
}

Run the test. It must pass:

✅ test_executeTransfer_whenSufficientBalance_shouldDebitSenderAndCreditRecipient — Passed
✅ test_executeTransfer_whenInsufficientBalance_shouldThrowInsufficientFunds — Passed
Phase Gate: GREEN

Cannot proceed to REFACTOR until ALL conditions are met:

  • [ ] The previously-failing test now PASSES
  • [ ] You wrote the MINIMUM code to pass (not the "right" code — the minimum)
  • [ ] All OTHER existing tests still pass (no regressions)

Proof required: Show test suite output. Previously-red test is green. No other tests broken.

Counter: If you wrote more than ~20 lines to pass one test, you're over-engineering the GREEN phase. The point is minimum viable — elegance comes in REFACTOR.

Phase 3: REFACTOR — Improve Without Changing Behavior

Now clean up. Extract, rename, simplify — but the tests must stay green after every change.

Common refactoring targets:

  • Extract validation into a private method
  • Add Sendable conformance if the type crosses actor boundaries
  • Ensure @MainActor is applied if needed
  • Improve naming for clarity
  • Remove duplication
Phase Gate: REFACTOR

Cannot commit until ALL conditions are met:

  • [ ] All tests pass (zero failures)
  • [ ] No new compiler warnings introduced
  • [ ] Import boundaries verified (Domain imports only Foundation)
  • [ ] No force unwraps added
  • [ ] No .shared singletons introduced

Proof required: Full test suite output — zero failures, zero warnings.


Architecture Gate (Before Writing ANY File)

Before creating or modifying any Swift file, verify:

  1. Which layer does this file belong to? (Presentation / Domain / Infrastructure)
  2. What does it import? Check: Does any import violate the dependency rule?
  • Presentation: may import Domain + SwiftUI/UIKit
  • Domain: may import ONLY Foundation (no frameworks, no infrastructure)
  • Infrastructure: may import Domain + external frameworks (Supabase, Stripe, etc.)
  1. If an import violates the rule, extract a protocol in the Domain layer first.

Cannot write the file until layer and imports are verified. Writing code in the wrong layer cascades architectural violations that are expensive to fix later.


Architecture: Hexagonal (Ports & Adapters)

Layer Diagram
┌─────────────────────────────────────────┐
│ Presentation Layer │
│ Views, ViewModels, UI Components │
│ Imports: SwiftUI, Domain │
│ NEVER imports: Infrastructure │
├─────────────────────────────────────────┤
│ Domain Layer │
│ Entities, Ports (Protocols), │
│ Use Cases, Domain Errors │
│ Imports: Foundation ONLY │
│ NEVER imports: SwiftUI, UIKit, │
│ third-party frameworks │
├─────────────────────────────────────────┤
│ Infrastructure Layer │
│ Adapters, Repositories, │
│ API Clients, Database Access │
│ Imports: Domain, third-party SDKs │
│ NEVER imports: Presentation │
└─────────────────────────────────────────┘
Dependency Direction: INWARD ONLY
Presentation → Domain ← Infrastructure
Architecture Violation Detection Decision Tree
START: You're about to add an import statement.
Q1: Does this import cross a layer boundary?
├── NO → Proceed. Same-layer imports are fine.
└── YES →
Q2: Does the dependency flow inward (toward Domain)?
├── YES → Proceed. This is correct.
└── NO → VIOLATION DETECTED.
Q3: What kind of violation?
├── Domain imports a framework (SwiftUI, UIKit, SDK)
│ → Extract a protocol (port) in Domain.
│ Implement it as an adapter in Infrastructure.
├── Presentation imports Infrastructure directly
│ → Inject the dependency via protocol from Domain.
│ The DI container wires the concrete type.
├── Infrastructure imports Presentation
│ → This is always wrong. Reverse the dependency.
│ Use a delegate protocol or closure callback.
└── Any layer imports a concrete type from another layer
→ Replace with protocol import.
Register concrete type in DI container.
Dependency Injection Pattern
swift
// 1. Define port (protocol) in Domain layer
protocol UserRepositoryProtocol: Sendable {
func findById(_ id: UUID) async throws -> User?
func save(_ user: User) async throws
}
// 2. Implement adapter in Infrastructure layer
final class SupabaseUserRepository: UserRepositoryProtocol {
private let client: SupabaseClient
init(client: SupabaseClient) {
self.client = client
}
func findById(_ id: UUID) async throws -> User? {
// Supabase-specific implementation
}
func save(_ user: User) async throws {
// Supabase-specific implementation
}
}
// 3. Register in DI container (App layer)
container.register(UserRepositoryProtocol.self) { resolver in
SupabaseUserRepository(client: resolver.resolve(SupabaseClient.self))
}
// 4. Consume via protocol (Presentation or Use Case layer)
@MainActor
final class UserProfileViewModel: ObservableObject {
private let repository: UserRepositoryProtocol
init(repository: UserRepositoryProtocol) {
self.repository = repository
}
}

SwiftUI View Composition

When to Extract Subviews

Extract a subview when:

  • The body property exceeds ~30 lines
  • A visual section is reused in multiple views
  • A section has its own state or logic
  • The view has more than 3 levels of nesting
@ViewBuilder Usage

Use @ViewBuilder for computed properties and helper methods that return views:

swift
struct TransferDetailView: View {
let transfer: Transfer
var body: some View {
ScrollView {
VStack(spacing: 16) {
headerSection
amountSection
statusSection
}
.padding()
}
}
@ViewBuilder
private var headerSection: some View {
HStack {
AvatarView(userId: transfer.senderId)
Image(systemName: "arrow.right")
AvatarView(userId: transfer.recipientId)
}
}
@ViewBuilder
private var amountSection: some View {
VStack {
Text(transfer.amount, format: .currency(code: transfer.currency.rawValue))
.font(.largeTitle.bold())
Text(transfer.createdAt, style: .date)
.font(.caption)
.foregroundStyle(.secondary)
}
}

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ablevarghese/ios-claude-toolkit/forge-development/badge)](https://verified-skill.com/skills/ablevarghese/ios-claude-toolkit/forge-development)

Something wrong with this skill or its page? Tell us.