IM

implement-feature

A structured workflow for adding features to ClaudeBar using architecture-first design, TDD, and Swift 6.2 patterns.

Install

mkdir -p .claude/skills/implement-feature && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2472" && unzip -o skill.zip -d .claude/skills/implement-feature && rm skill.zip

Installs to .claude/skills/implement-feature

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guide for implementing features in ClaudeBar following architecture-first design, TDD, rich domain models, and Swift 6.2 patterns. Use this skill when:
(1) Adding new functionality to the app
(2) Creating domain models that follow user's mental model
(3) Building SwiftUI views that consume domain models directly
(4) User asks "how do I implement X" or "add feature Y"
(5) Implementing any feature that spans Domain, Infrastructure, and App layers
448 chars · catalog description✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • →Design feature architecture
  • →Implement domain models with behavior
  • →Write Chicago-school TDD tests
  • →Build SwiftUI views consuming domain models
  • →Register new providers in ClaudeBar

How it works

The skill enforces a strict workflow: architecture design approval, followed by TDD implementation focusing on state-based testing and rich domain models.

Inputs & outputs

You give it
Feature requirements
You get back
Implemented feature code and tests

When to use implement-feature

  • →Add new functionality to ClaudeBar
  • →Create domain models following user mental models
  • →Implement SwiftUI views for domain features

About this skill

Implement Feature in ClaudeBar

Implement features using architecture-first design, TDD, rich domain models, and Swift 6.2 patterns.

Workflow Overview

┌─────────────────────────────────────────────────────────────┐
│  1. ARCHITECTURE DESIGN (Required - User Approval Needed)  │
├─────────────────────────────────────────────────────────────┤
│  • Read the design docs — they are the source of truth     │
│  • Place the feature: owner, capability, extension point    │
│  • Write the design change into the docs first              │
│  • Analyze requirements                                     │
│  • Create component diagram                                 │
│  • Show data flow and interactions                          │
│  • Present to user for review                               │
│  • Wait for approval before proceeding                      │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼ (User Approves)
┌─────────────────────────────────────────────────────────────┐
│  2. TDD IMPLEMENTATION                                      │
├─────────────────────────────────────────────────────────────┤
│  • Model tests → models (Quotas / Providers / Domain)       │
│  • Module tests → generic rules and workers (DataSources)   │
│  • Views, reading the domain directly                       │
└─────────────────────────────────────────────────────────────┘

Phase 0: Architecture Design (MANDATORY)

Before writing any code, design it in the docs and get user approval. The design docs are the source of truth (AGENTS.md → Design docs are the source of truth).

Step 0: Read the design docs, and place the feature in them

Read the design in order (ARCHITECTURE.md maps it): USER_JOURNEYS.md (the person and the moment), CANONICAL_MODEL.md (the tree, the words, each law and its owner, owned vs offered), TARGET_ARCHITECTURE.md (the pieces and their one job, the flows), then any docs/features/<context>/<x>/design.md it touches. Then answer:

QuestionIf yes
Does it answer another question than the product's lifecycle?it is a capability (CANONICAL §2.1): declared in the definition, its own types, reached through a handle that is nil when not declared — never a flag on Provider, never chosen by a provider's name. A runner outside the modules is supplied by the Engine (TARGET_ARCHITECTURE §10)
Does a provider need something the definition can't say?a generic rule or worker in DataSources (ENGINE_DESIGN), then a line of JSON — never a Swift line that names the provider
Does it react to a refresh, a selection, a setting?it observes an extension point (e.g. QuotaMonitor.onRefreshed) — the Monitor is not edited for it
Does it notify?its own port in Alerting — not a new method on an existing alerter
Does something already decide it? (a threshold crossed, a rate, a unit, the worst quota)use that owner: the feature is a new destination or a new read of it, never a parallel engine → A new feature next to an old one
Does it ask a type a new kind of question?a new value built from that type (ModelMix(of: days, in: unit)), not another read on it → question 6
Does it save a choice, or a secret?settings.json through JSONSettingsRepository; a secret through the one Keychain-with-fallback store (settings.md) — never a feature's own file
Does another open PR touch the same type?agree on one owner first; the later one rebases on it
Is a law missing, or owned twice?add it to CANONICAL §5 with one owner

When the docs don't cover it, write the change into them first (tree lines, laws with owners, a pieces table, a TARGET section) — that doc change is the architecture you present in Step 4. Code that disagrees with the docs is behind; don't bend the design to it.

Step 0b: Think the domain first

Before components, ask how the domain should be: from the root problem (the issue, the journey) to the facts it must respect, to the concepts those force, then compare with the code. Ask the seven questions of every type the feature touches, and draw now beside proposed → domain-shape.md. For each new type, write down its one reason to change and which side it lives on (kernel fact, App words or colours, storage in a module's Internal/, an OS port); a type with two reasons is two types. A new aggregate, a moved law or a changed owner goes into the docs in Step 0's change.

Step 1: Analyze Requirements

Identify:

  • What new models/types are needed
  • Which existing components will be modified
  • Data flow between components
  • External dependencies (CLI, API, etc.)

Step 2: Create Architecture Diagram

Use ASCII diagram showing all components and their interactions:

Example: added accounts — a definition change plus generic pieces

┌──────────────────────────────────────────────────────────────────────┐
│                            ARCHITECTURE                               │
├──────────────────────────────────────────────────────────────────────┤
│  Resources (data)        Modules (Swift, no vendor names)    App     │
│                                                                      │
│  ┌──────────────┐   ┌─────────────────────────────┐   ┌───────────┐  │
│  │ codex.json   │──▶│ Providers                   │──▶│ Accounts  │  │
│  │  accounts:   │   │  ProviderCatalog.detect()   │   │ card      │  │
│  │  folder, ids │   │  ProviderDefinition.Accounts│   └───────────┘  │
│  │  dataSources │   │  Provider owns its Accounts │                  │
│  └──────────────┘   └──────────────┬──────────────┘                  │
│                                    │                                 │
│                     ┌──────────────▼──────────────┐                  │
│                     │ DataSources                 │                  │
│                     │  identity, requiresFiles,   │                  │
│                     │  JSON-RPC `then`, env       │                  │
│                     └──────────────┬──────────────┘                  │
│                                    ▼                                 │
│                     ┌─────────────────────────────┐                  │
│                     │ Quotas  (UsageSnapshot …)   │                  │
│                     └─────────────────────────────┘                  │
└──────────────────────────────────────────────────────────────────────┘

Step 3: Document Component Interactions

List each component with:

  • Purpose: What it does
  • Inputs: What it receives
  • Outputs: What it produces
  • Dependencies: What it needs
Example:

| Component      | Purpose                | Inputs          | Outputs        | Dependencies    |
|----------------|------------------------|-----------------|----------------|-----------------|
| AddedAccounts  | Validate a login folder| folder path     | account config | DataSources     |
| identity rule  | Fail closed on swaps   | credential      | UsageError     | —               |

Step 4: Present for User Approval

IMPORTANT: Always ask user to confirm the design is correct before implementing — the doc change (tree, laws and owners, pieces), the diagram, and for UI a mockup in design-concept/<feature>/ on mock data. A new card, pane or screen has its mockup before any view code; the review looks at the mockup first, then the domain.

Use AskUserQuestion tool with options:

  • "Approve - proceed with implementation"
  • "Modify - I have feedback on the design"

Do NOT proceed to Phase 1 until user explicitly approves.


Core Principles

1. Rich Domain Models (User's Mental Model)

Domain models encapsulate behavior, not just data:

// Rich domain model with behavior
public struct UsageQuota: Sendable, Equatable {
    public let percentRemaining: Double

    // Domain behavior - computed from state
    public var status: QuotaStatus {
        QuotaStatus.from(percentRemaining: percentRemaining)
    }

    public var isDepleted: Bool { percentRemaining <= 0 }
    public var needsAttention: Bool { status.needsAttention }
}

2. Swift 6.2 Patterns (No ViewModel/AppState Layer)

Views consume domain models directly from QuotaMonitor:

// QuotaMonitor is the single source of truth
@MainActor @Observable
public final class QuotaMonitor {
    // The providers you keep: add, delete, order, the derived lineup
    public let providers: Providers

    public var logins: [Account]   // every login
    public var lineup: [Account]   // the lineup
    public func login(id: String) -> Account?

    // Selection state
    public var selectedProviderId: String
    public var selectedLogin: Account?
    public var selectedProviderStatus: QuotaStatus
}

// Views consume domain directly - NO AppState layer
struct MenuContentView: View {
    let monitor: QuotaMonitor  // Injected from app

    var body: some View {
        // Use delegation methods, not monitor.providers.enabled
        ForEach(monitor.lineup, id: \.id) { login in
            ProviderPill(provider: login)
        }
    }
}

3. Protocol-Based DI with @Mockable

Ports for what lies outside the app live at a module's root and are @Mockable; their implementations are internal in Internal/:

@Mockable
public protocol NetworkClient: Sendable {
    func request(_ request: URLRequest) async throws -> (Data, URLResponse)
}

Architecture

Reference: [MODULAR


Content truncated.

When not to use it

  • →When not following the ClaudeBar architecture

Prerequisites

Architecture design approval

Limitations

  • →Requires user approval for architecture design
  • →Strict adherence to Chicago-school TDD

How it compares

It mandates architecture approval before coding and strictly forbids ViewModel layers, ensuring views consume domain models directly.

Compared to similar skills

implement-feature side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
implement-feature (this skill)110moReviewAdvanced
add-provider18moNo flagsAdvanced
new-api-support19moReviewIntermediate
feature06moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry