.claude/skills/implement-feature/SKILL.md
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
npx skillsauth add tddworks/claudebar implement-featureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Implement features using architecture-first design, TDD, rich domain models, and Swift 6.2 patterns.
┌─────────────────────────────────────────────────────────────┐
│ 1. ARCHITECTURE DESIGN (Required - User Approval Needed) │
├─────────────────────────────────────────────────────────────┤
│ • 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 │
├─────────────────────────────────────────────────────────────┤
│ • Domain model tests → Domain models │
│ • Infrastructure tests → Implementations │
│ • Integration and views │
└─────────────────────────────────────────────────────────────┘
Before writing any code, create an architecture diagram and get user approval.
Identify:
Use ASCII diagram showing all components and their interactions:
Example: Adding a new AI provider
┌─────────────────────────────────────────────────────────────────────┐
│ ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ External │ │ Infrastructure │ │ Domain │ │
│ └─────────────┘ └──────────────────┘ └──────────────────┘ │
│ │
│ ┌─────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ CLI Tool │────▶│ NewUsageProbe │────▶│ UsageSnapshot │ │
│ │ (new-cli) │ │ (implements │ │ (existing) │ │
│ └─────────────┘ │ UsageProbe) │ └──────────────────┘ │
│ └──────────────────┘ │ │
│ │ ▼ │
│ │ ┌──────────────────┐ │
│ │ │ NewProvider │ │
│ └─────────────▶│ (AIProvider) │ │
│ └──────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────┐ │
│ │ App Layer │ │
│ │ ┌────────────────────────────┐ │ │
│ │ │ ClaudeBarApp.swift │ │ │
│ │ │ (register new provider) │ │ │
│ │ └────────────────────────────┘ │ │
│ └──────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
List each component with:
Example:
| Component | Purpose | Inputs | Outputs | Dependencies |
|----------------|------------------------|-----------------|----------------|-----------------|
| NewUsageProbe | Fetch usage from CLI | CLI command | UsageSnapshot | CLIExecutor |
| NewProvider | Manages probe lifecycle| UsageProbe | snapshot state | UsageProbe |
IMPORTANT: Always ask user to review the architecture before implementing.
Use AskUserQuestion tool with options:
Do NOT proceed to Phase 1 until user explicitly approves.
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 }
}
Views consume domain models directly from QuotaMonitor:
// QuotaMonitor is the single source of truth
public actor QuotaMonitor {
private let providers: AIProviders // Hidden - use delegation methods
// Delegation methods (nonisolated for UI access)
public nonisolated var allProviders: [any AIProvider]
public nonisolated var enabledProviders: [any AIProvider]
public nonisolated func provider(for id: String) -> (any AIProvider)?
public nonisolated func addProvider(_ provider: any AIProvider)
public nonisolated func removeProvider(id: String)
// Selection state
public nonisolated var selectedProviderId: String
public nonisolated var selectedProvider: (any AIProvider)?
public nonisolated 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.enabledProviders, id: \.id) { provider in
ProviderPill(provider: provider)
}
}
}
@Mockable
public protocol UsageProbe: Sendable {
func probe() async throws -> UsageSnapshot
func isAvailable() async -> Bool
}
Full documentation: docs/ARCHITECTURE.md
| Layer | Location | Purpose |
|-------|----------|---------|
| Domain | Sources/Domain/ | QuotaMonitor (single source of truth), rich models, protocols |
| Infrastructure | Sources/Infrastructure/ | Probes, storage, adapters |
| App | Sources/App/ | SwiftUI views consuming domain directly (no ViewModel) |
Key patterns:
ZaiSettingsRepository, CopilotSettingsRepository)@Mockable for testingWe follow Chicago school TDD (state-based testing):
Test state and computed properties:
@Suite
struct FeatureModelTests {
@Test func `model computes status from state`() {
// Given - set up initial state
let model = FeatureModel(value: 50)
// When/Then - verify state/return value
#expect(model.status == .normal)
}
@Test func `model state changes correctly`() {
// Given
var model = FeatureModel(value: 100)
// When - perform action
model.consume(30)
// Then - verify new state
#expect(model.value == 70)
#expect(model.status == .healthy)
}
}
Stub dependencies to return data, assert on resulting state:
@Suite
struct FeatureServiceTests {
@Test func `service returns parsed data on success`() async throws {
// Given - stub dependency to return data (not verify calls)
let mockClient = MockNetworkClient()
given(mockClient).fetch(any()).willReturn(validResponseData)
let service = FeatureService(client: mockClient)
// When
let result = try await service.fetch()
// Then - verify returned state, not interactions
#expect(result.items.count == 3)
#expect(result.status == .loaded)
}
}
Wire up in ClaudeBarApp.swift and create views.
Sources/Domain/ with behavior@Mockable for external dependenciesSources/Infrastructure/swift test to verify all tests passdevelopment
Guide for making improvements to existing ClaudeBar functionality using TDD. Use this skill when: (1) Enhancing existing features (not adding new ones) (2) Improving UX, performance, or code quality (3) User asks "improve X", "make Y better", or "enhance Z" (4) Small enhancements that don't require full architecture design For NEW features, use implement-feature skill instead.
development
Manage ClaudeBar's GitHub Actions CI/CD pipelines: build, test, and release workflows. Use this skill when: (1) Setting up secrets for CI/CD (certificate, API key, Sparkle key, Codecov) (2) Creating a new release — tag-based or manual workflow_dispatch (3) Triggering or explaining the build.yml, tests.yml, or release.yml workflows (4) Debugging release failures (signing, notarization, appcast) (5) Managing beta vs stable channels for Sparkle auto-updates (6) User says "release a new version", "push a tag", "set up CI secrets", "why did the release fail"
development
Guide for fixing bugs in ClaudeBar following Chicago School TDD and rich domain design. Use this skill when: (1) User reports a bug or unexpected behavior (2) Fixing a defect in existing functionality (3) User asks "fix this bug" or "this doesn't work correctly" (4) Correcting behavior that violates the user's mental model
development
Guide for adding new report cards to ClaudeBar that analyze local data sources and display metrics with comparison deltas. Use this skill when: (1) Adding a new report/analytics card (e.g., weekly summary, model breakdown, session stats) (2) Creating data analysis features that read local files and display aggregated metrics (3) Adding comparison cards that show "today vs previous" style deltas (4) Building any feature that follows the DailyUsage pattern (parse → aggregate → report → card)