一键导入
domain-driven-design
Guide for implementing domain entities, services, and ports following the project's DDD conventions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide for implementing domain entities, services, and ports following the project's DDD conventions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Long-running (multi-hour) adversarial hunt for P0/P1/P2 bugs across the codebase. Mixes codebase observation, mechanical linting, real test + telemetry verification, and parallel skeptic sub-agents that must REFUTE each candidate before it is accepted. Fixes verified bugs on a branch off main with surgical per-bug commits, re-runs gates, and writes a dated report to the Desktop. Never pushes or merges. Use when you want a deep, autonomous bug-finding-and-fixing pass.
Diagnose and durably eliminate flaky/intermittent test failures (passes locally but fails CI, rotates between tests, red only under load). Reproduce under contention, instrument the real state instead of guessing, root-cause by signal not duration, fix at the source, validate multi-run. Use when a test is flaky, CI is intermittently red, or fixing one flake unmasks others.
Safely prune dead local branches, git worktrees, and remote branches in this repo. Use when asked to "prune dead branches", "clean up worktrees", "delete merged branches", "tidy up git", or after a batch of PRs has merged. Knows this repo merges via squash, so it verifies death by PR state, not just git ancestry.
Reduce test-suite wall-clock (dev + CI) without losing coverage or telemetry. Measure the phase breakdown first, then apply proven levers (parallelize turbo, narrow imports vs barrels, lazy-load heavy graphs, pool/worker config, DB pool sizing) and capture the before/after delta. Use when tests are slow, CI time is high, or to set/check a perf baseline. Composes with the read-only test-perf and test-census skills.
Census the repo's tests by TYPE, not by name. Classifies every tracked test file via content heuristics into unit / integration / react-component / e2e (plus a separate db pgTAP count), in precedence order so buckets are mutually exclusive. Use when the user asks "what kinds of tests do we have", "how many component vs integration tests", "what's our e2e coverage", or wants a per-area test-type breakdown.
Snapshot test-suite timings in this repo. Runs the unit and/or integration suites (or a single integration project) and reports wall-clock time, Vitest's own phase breakdown (transform/setup/import/tests/environment), and the slowest test files. Use when the user asks "how slow are the tests", "where does the test time go", wants a perf baseline, or wants to check the suite hasn't regressed.
基于 SOC 职业分类
| name | domain-driven-design |
| description | Guide for implementing domain entities, services, and ports following the project's DDD conventions. |
| metadata | {"short-description":"Project-specific DDD implementation guide"} |
Guide for implementing domain entities, services, and ports following the project's DDD conventions.
Domain records extend their DB row shape:
// CORRECT — extends row shape
import type { TeamMediaAssetRowShape } from '@tx-agent-kit/db'
export interface MediaAssetRecord extends Omit<TeamMediaAssetRowShape, 'assetTypeData'> {
readonly assetTypeData: AssetTypeData | null
}
// WRONG — standalone interface (ESLint will block this)
export interface MediaAssetRecord {
id: string
teamId: string
// ... manually listing all fields
}
Either for validation with typed errorsOption for computed values that might not existthrow — failures are valuespackages/infra/db/src/schema.tspackages/core/src/domains/<domain>/domain/packages/core/src/domains/<domain>/ports/packages/core/src/domains/<domain>/application/packages/core/src/domains/<domain>/adapters/apps/api/src/mappers/apps/api/src/routes/packages/contracts/src/apps/api/src/server-lib.tspackages/core/src/index.tspnpm type-check && pnpm lint:quiet && pnpm test:quietOrgMemberRecord extends OrgMemberRowShape { userName?: string })TeamDashboard { team: TeamRecord; assetCount: number })AssetWithOwner = MediaAssetRecord & { ownerName: string })Aggregate, View, Dashboard (allowed by ESLint for standalone interfaces)Events are public nouns. Ports are public verbs. Errors are private semantics.
events.ts at its root: packages/core/src/domains/<domain>/events.tsdomain/*-events.ts; events.ts re-exports themEither): yesCoreError// BAD — cross-domain error coupling:
import { OrganizationNotFoundError } from '../../organization/domain/organization-errors.js'
// GOOD — translated at the port seam:
type LoadOrganizationForAssetError =
| { _tag: 'OrganizationMissing' }
| { _tag: 'OrganizationUnavailable' }
Centralized in packages/contracts/src/constants.ts (import from @tx-agent-kit/contracts).
Never hardcode magic numbers in services — import from contracts.
See packages/core/CLAUDE.md for detailed rules, examples, and patterns.