Review aliasing, locking, and async-propagation patterns in <app> packages; produce a line-anchored report of shared-state interleaving, lock placement, and Deps interface wiring across the <scope> slice before the diff lands.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Ownership Author?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/facta-dev-ownership-author-ai-coding-playbook)
---
name: ownership-author
description: "Review aliasing, locking, and async-propagation patterns in <app> packages; produce a line-anchored report of shared-state interleaving, lock placement, and Deps interface wiring across the <scope> slice before the diff lands."
division: backend
---
# <app> Ownership Author
A reusable review workflow for aliasing and concurrency correctness in the `<app>` TypeScript codebase. An agent (e.g. the ownership reviewer role) invokes this skill on any diff that touches `src/features/<slice>/**/*.ts` or `src/platform/**/*.ts`; the skill is the workflow, the agent is the role. The output is a line-anchored report, not a rewrite.
## When to Activate
- A diff modifies a `Deps` interface, a use case, a handler in `http.ts`, or any interface wiring in `ports.ts`.
- Shared state is introduced or mutated (a hub map, an outbox worker, a cache) across concurrent async flows.
- An `AbortSignal` is dropped, wrapped, or replaced in the request path, or an async task outlives its request.
- A reviewer asks for an ownership pass before approving a PR that crosses Fastify's shared-event-loop request concurrence.
Do not activate for pure formatting, doc-only, or migration-only diffs.
## Core Principles
- Compiles is not correct. A slice alias that passes `pnpm build` (tsc) and interleaves badly on the second concurrent request is a bug this skill owns.
- The composition root stays thin. `src/bin/api.ts` wires consumer-defined ports into `Deps`; logic lives in the use cases.
- Never reach for global mutable singletons (or dynamic-execution tricks) to fix sharing. The fix is a copy, an owned queue, or an explicit lock discipline.
- Cite the failure mode, not the rule. "Shared-state race" is the rule; "races on the second concurrent request because Fastify serves requests concurrently on one event loop" is the review.
- Keep critical sections synchronous: no `await` inside a section another request can observe half-mutated; serialize through an owner loop (single worker/consumer) when ownership must move; `Promise.all` only for independent work — never hold a guard across a long I/O wait.
## Rules
- Anti-hallucination: do not fabricate file paths, line numbers, or diagnostics. Every finding must cite a path and line that exists in the diff or the working tree.
- Every stat needs a source. If you claim "races on the second request", cite the concurrent event-loop request model; if you cite a compiler or lint check, name it (`tsc --noEmit`, `require-atomic-updates`). No unsourced numbers.
- Do not emit the final review as a fenced code block when raw line-anchored output is expected — the report is plain text with one finding per line, severity-prefixed.
- Verify claims against the tree before reporting: read the cited file and line. A finding that cites a line the diff does not contain is a hallucination.
- `Deps` fields stay use cases and consumer-defined ports; a field that inlines a service or another slice's type is a BLOCK.
- No dynamic-execution escape hatch (`node:vm`, `eval`, `new Function`) to paper over sharing; src code importing these is a BLOCK. Propose the safe alternative (`structuredClone`, an owned queue, an explicit copy) instead.
## Research References
Provenance table — fill the link column from the primary source before relying on a claim. No claim may appear in a finding without a row here.
| claim | source | year | link |
| -------------------------------------------------------------------------------------------------- | ------------------------------------- | ---- | ------------------------ |
| Fastify serves each request concurrently on one shared event loop; awaits interleave | Node.js event loop documentation | 2024 | <TODO: primary doc link> |
| JS has no runtime race detector; interleaving is caught by review at await boundaries, not tooling | — (documented delta vs go test -race) | — | <TODO: primary doc link> |
| Cancellation propagates as an AbortSignal checked at await boundaries | Node.js AbortSignal documentation | 2024 | <TODO: primary doc link> |
| Objects/arrays share references across assignment; a deep copy needs structuredClone | MDN structuredClone | 2023 | <TODO: primary doc link> |
## Output Format
A line-anchored report, one finding per line, severity-prefixed, followed by a summary line. Plain text — not a fenced block:
```
BLOCK src/platform/realtime/hub.ts:42 subscribers map mutated from WS callbacks with no ownership boundary — interleaves on the second concurrent connection; serialize through an owner loop or guard the mutation.
WARN src/features/widgets/postgres.ts:18 list() returns a shared connection-scoped row array; callers can mutate it — return a copied/frozen variant.
PASS src/features/widgets/usecase.ts the AbortSignal flows from the request through the use case into the queries call.
```
Summary line: `ownership-author: N block(s), M warning(s), K pass — verdict: BLOCK | APPROVE`.