Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6ed3c33
docs(skill): app-implement-feature follows concept folders with Inter…
hanrw Nov 19, 2026
e26f578
refactor: one ASCKit module laid out by concept folders
hanrw Nov 19, 2026
92f37e7
docs: describe concept folders instead of Domain/Infrastructure layers
hanrw Nov 19, 2026
c6cdebf
refactor(cli): name Internal/ implementations only in ClientProvider
hanrw Nov 19, 2026
36a1e24
refactor(skills): split ShellRunner's decisions from the process call
hanrw Nov 19, 2026
8aa5f05
refactor(iris): split IrisClient's requests and replies from the URLS…
hanrw Nov 19, 2026
504c59e
refactor(iris): split browser cookie selection from the SweetCookieKi…
hanrw Nov 19, 2026
e8637cb
test(iris): cover the app-bundle repository now its HTTP call is in S…
hanrw Nov 19, 2026
22a5831
refactor(screenshots): split image inlining from the WebKit snapshot
hanrw Nov 19, 2026
3004745
refactor(iris): sign in through @Mockable roles instead of concrete H…
hanrw Nov 19, 2026
ed7a107
refactor(iris): repositories depend on the @Mockable IrisAPI role
hanrw Nov 19, 2026
5bbc98d
refactor(plugins): marketplace decisions through @Mockable folder and…
hanrw Nov 19, 2026
258cf42
refactor: name protocols for what they are, not XxxRepository
hanrw Nov 19, 2026
83d7b0e
docs(skill): fix-bug names the renamed protocols
hanrw Nov 19, 2026
d5d7c09
refactor: Repository for CRUD, role nouns for the 11 workflow protocols
hanrw Nov 19, 2026
bac708f
refactor: the submission protocols are repositories again
hanrw Nov 19, 2026
3c323f6
feat(versions): a version sends itself to review, refusing when not e…
hanrw Nov 19, 2026
f91d908
fix(web): Submit for Review reports a failed submission as failed
hanrw Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
299 changes: 193 additions & 106 deletions .claude/skills/app-implement-feature/SKILL.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

33 changes: 19 additions & 14 deletions .claude/skills/app-implement-feature/references/domain-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ public protocol PaymentProcessor: Sendable {
func refund(transactionId: String, amount: Decimal) async throws -> RefundResult
}

// CRUD for an aggregate: XxxRepository. Anything more than CRUD takes a role noun.
@Mockable
public protocol Repository: Sendable {
associatedtype Entity
associatedtype ID

func findById(_ id: ID) async throws -> Entity?
func save(_ entity: Entity) async throws
func delete(_ id: ID) async throws
public protocol OrderRepository: Sendable {
func all() async throws -> [Order]
func fetch(id: OrderId) async throws -> Order
func save(_ order: Order) async throws
func delete(id: OrderId) async throws
}
```

Expand Down Expand Up @@ -196,30 +195,36 @@ public enum OrderStatus: Int, Comparable, Sendable, CaseIterable {

## Actors for Thread Safety

Use actors for stateful domain services:
Use actors for stateful domain objects (named for what they are, never `XxxManager`):

```swift
public actor OrderManager {
private let repository: any OrderRepository
public actor OrderBook {
private let orders: any OrderRepository
private var cachedOrders: [OrderId: Order] = [:]

public init(repository: any OrderRepository) {
self.repository = repository
public init(orders: any OrderRepository) {
self.orders = orders
}

public func getOrder(_ id: OrderId) async throws -> Order {
if let cached = cachedOrders[id] {
return cached
}
let order = try await repository.fetch(id: id)
let order = try await orders.fetch(id: id)
cachedOrders[id] = order
return order
}

public func all() async throws -> [Order] {
let all = try await orders.all()
for order in all { cachedOrders[order.id] = order }
return all
}

public func updateStatus(_ id: OrderId, to status: OrderStatus) async throws {
var order = try await getOrder(id)
order = order.withStatus(status)
try await repository.save(order)
try await orders.save(order)
cachedOrders[id] = order
}

Expand Down
64 changes: 64 additions & 0 deletions .claude/skills/app-implement-feature/references/domain-shape.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Think the domain first

Before any change, a fix too, ask how the domain should be, not only where the
line fits. The aim is a domain that is **easy to understand**: someone new
reads a type's surface and can explain it in the user's words. Borrow from DDD
only what serves that; no pattern is added for its own sake.

The tree, the words, every law and its owner are in `docs/CANONICAL_MODEL.md`;
the Swift patterns in [domain-models.md](domain-models.md).

## Five questions, of every type the change touches

**1. Would the user say it?**
Names come from what the user sees (the screens, the CLI, the API), never the
mechanism. If the facts need a concept the code doesn't have, it is hiding as
an optional or a flag. *"Cancellable" is a word users meet; `statusCode < 3`
is not.*

**2. Does the thing decide about itself?**
A rule lives on the thing it is about; callers tell it, they don't read its
state and decide. *Three views writing `order.status == .pending ||
order.status == .processing` means the rule is `Order.canBeCancelled`, and
callers ask for it.*

**3. Can you see every state?**
Each state a user can meet is a case with its data; one value never means two
things. *A payment that timed out may have gone through: it is `unconfirmed`,
not `failed`. A missing answer is a case (`unknown`), not a thrown error.*

**4. Is it as small as it can be?**
A value when it is data with rules; an actor or class only when it changes
over time; a `@Mockable` protocol only at the outside world (a network, a
database, a process), named for its role. No type, layer or flag the change
doesn't need — but never drop a rule the domain keeps.

**5. Is what differs between cases data?**
A table, a value, a registration — never `if kind == "premium"` or a subclass
per variant. *A shipping rule per country is a lookup in `ShippingRates`, not
a `switch` in the checkout view.*

## Check by concept

The five questions look at one type. To find what is wrong across the domain,
check each **concept folder** as a whole. Each row names a smell you can grep
for.

| # | Ask | The smell |
|---|---|---|
| 1 | **Does anything cross the fence?** Only a public face or an id may | another concept's `Internal/` type used here; `App/` building an adapter it should only wire |
| 2 | **Does every word mean one thing here?** | one name for two facts |
| 3 | **Does every law have one owner?** | the same rule written twice, drifting; a caller reading state to decide |
| 4 | **Is the business above, and the technique below?** | a request, SQL or JSON assembled in the public face or in `App/`; a domain decision in `Internal/System/` |
| 5 | **Does a new case add data, not an edit?** | a `switch` on a variant name; one type changing for several reasons |
| 6 | **Does the question have a home?** | a rule that lives only in a doc, a view, or a comment |

A finding goes in `CANONICAL_MODEL.md`: as a fix when a law already says what
is right, or as an open question when the design must decide first.

## Keep it in scope

- Fix what these questions find **in the types the change touches**, test
first. Record the rest in `CANONICAL_MODEL.md` for its own change.
- A new aggregate, a moved law or a changed owner is a design change: write it
into `CANONICAL_MODEL.md` first, as part of the Phase 0 design.
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ final class OrderState: @unchecked Sendable {
private(set) var orders: [Order] = []
private(set) var isLoading: Bool = false

private let manager: OrderManager // Actor
private let book: OrderBook // Actor

init(manager: OrderManager) {
self.manager = manager
init(book: OrderBook) {
self.book = book
}

@MainActor
Expand All @@ -190,7 +190,7 @@ final class OrderState: @unchecked Sendable {
defer { isLoading = false }

do {
orders = try await manager.fetchAll()
orders = try await book.all()
} catch {
// Handle error
}
Expand All @@ -199,10 +199,10 @@ final class OrderState: @unchecked Sendable {
@MainActor
func updateStatus(_ orderId: OrderId, to status: OrderStatus) async {
do {
try await manager.updateStatus(orderId, to: status)
try await book.updateStatus(orderId, to: status)
// Refresh the specific order
if let index = orders.firstIndex(where: { $0.id == orderId }) {
orders[index] = try await manager.fetch(orderId)
orders[index] = try await book.getOrder(orderId)
}
} catch {
// Handle error
Expand Down
Loading
Loading