[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78DGS8W4QSSG15D4KH010AJ":3,"skill-same:01M78DGS8W4QSSG15D4KH010AJ":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":33,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M78DGS8W4QSSG15D4KH010AJ","bc-refinement",null,"Use this skill when the user asks to refine a particular Bounded Context (BC) skill. The sub-agent will lock scope to a single BC, assess whether it is cohesive enough to remain one BC, ask questions to understand the actual business behaviour, identify gaps in the existing skill files, and then update all files to align with the business requirements.","mali-tintash\u002Fhgate","mali-tintash","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F53075248?v=4","01M78DG04F75J4YWYZ3M4MAYP9","Muhammad Ali","01M78DG05AYCDYETC2V5GDJN6D",7,"MIT","https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bc-refinement\ndescription: >\n  Use this skill when the user asks to refine a particular Bounded Context (BC) skill. The sub-agent will lock scope to a single BC, assess whether it is cohesive enough to remain one BC, ask questions to understand the actual business behaviour, identify gaps in the existing skill files, and then update all files to align with the business requirements.\ncontext: fork\n---\n# BC Skill Refinement Process\n\n---\n\n## Overview\n\nThis document defines the repeatable process used to bring a Bounded Context (BC) skill into alignment with its actual business behaviour.\n\n**Input**: An existing skill directory at `.github\u002Fskills\u002F\u003Cbc-name>\u002F`  \n**Output**: Fully updated `SKILL.md`, `domain-model.md`, `bdd-scenarios.md`,\n`decisions.md`, `status.md`, one or more `*-acl.md` files, and any new ACL files\nneeded. When the human has explicitly opted into Goal 3 business-logic\nverification for this BC scope, output also includes `properties.md`.\n\n**Golden rule: one BC per session.** If conversation drifts toward another BC, warn the developer, note it in the Deferred Items log, and suggest redirecting. The developer has final authority — but the risk of cross-BC contamination must be clearly stated before proceeding.\n\n---\n\n## Phase 0 — Read Everything First + Scope Lock\n\nBefore generating any output:\n\n1. Read all files in `.github\u002Fskills\u002F\u003Cbc-name>\u002F`\n2. Read all other BC skill files to understand what adjacent BCs already own\n3. Read `CLAUDE.md` for project-wide conventions\n\nThen declare a **Scope Lock** to the user:\n\n```\nScope lock: This session covers the [bc-name] BC only.\n\nIn scope:\n  - Everything owned and decided by this BC\n\nOut of scope (owned by other BCs):\n  - [List every adjacent BC and what it owns, one line each]\n\nAny concern that belongs to another BC will be noted in a Deferred Items log\nand addressed in a separate session. It will NOT be designed or implemented here.\n```\n\n**Do not generate any other output until Phase 0 is complete.**\n\nAt session start, update this BC's `status.md` from `DISCOVERED`, `REFINED`, or\n`SPEC_REVIEWED` to `REFINING`. If the file does not exist, create it from\n`assets\u002Fstatus-template.md` and record why lifecycle tracking was initialized\nlate. Immediately run `npm run project:sync` (the generator reads the lifecycle from\n`status.md`, which remains authoritative).\n\n---\n\n## Phase 1 — Business Alignment Interview\n\nAsk the user to describe what the BC is *actually supposed to do* in plain business language:\n\n> *\"Please describe the business behaviour of the `\u003Cbc-name>` BC — what triggers it, what it does, and what outcomes it produces. Don't worry about technical details; describe it as a business user would.\"*\n\n**Rules for this phase:**\n- Ask one focused question at a time; do not bundle.\n- Do **not** assume anything — if something is unclear, ask explicitly.\n- Do **not** generate code or updated files during this phase.\n- Document all open\u002Fdeferred questions (those the user could not answer yet).\n\n---\n\n## Phase 1.5 — Cohesion Check\n\nAfter the business alignment interview, **before** doing any gap analysis, assess whether the described BC is cohesive enough to remain a single BC.\n\n### Decomposition Signals\n\nFlag a potential split if **two or more** of these are true:\n\n| Signal | Example |\n|---|---|\n| Two distinct business concerns that could stand alone | \"manages catalog AND approves activations\" |\n| Aggregates with no direct relationship | different lifecycles, different owners, never referenced together |\n| Different roles trigger different parts independently | tenants interact with one part; LiveOps interact with another |\n| Unrelated external integrations | two external APIs that share no domain concepts |\n| The BC name uses \"and\" or is vague | \"Catalog and activations BC\" |\n| Different reasons to change | one part changes when products change; the other when approval rules change |\n\n### If no signals fire\n\nState clearly:\n```\nCohesion check passed — [bc-name] describes a single cohesive concern. Continuing to gap analysis.\n```\n\n### If signals fire\n\nPause refinement. Present a decomposition proposal:\n\n```\nCohesion concern: the described BC appears to cover [X] and [Y], which are distinct concerns.\n\nProposed split:\n  BC A — [Name]: owns [concern A]. Triggered by [trigger]. Produces [outcome].\n  BC B — [Name]: owns [concern B]. Triggered by [trigger]. Produces [outcome].\n\nRationale: [one sentence per signal that fired]\n\nOptions:\n  1. Split as proposed — proceed with BC A only this session; BC B gets its own session.\n  2. Keep as one BC — explain why these concerns must stay together.\n  3. Adjust the split — describe a different boundary.\n```\n\n**Do not proceed until the user explicitly chooses an option.** If they choose option 1, update the Scope Lock to reflect the narrower BC before continuing.\n\n---\n\n## Phase 2 — Gap Analysis\n\nCompare the business description (Phase 1) against the existing skill files. Produce a structured gap list:\n\n| Gap Category | Description |\n|---|---|\n| **Missing concepts** | Aggregates, entities, or lifecycle states absent from the current model |\n| **Wrong behaviour** | Existing rules that contradict the business description |\n| **Wrong cadence\u002Fschedule** | Cron jobs or polling intervals that differ from spec |\n| **Missing events** | Domain events that should be emitted but aren't listed |\n| **Missing integrations** | External systems that interact with this BC but have no ACL file |\n| **VO Discipline violations** | String-wrapper VO classes that should be type aliases |\n| **Cross-BC contamination** | Concepts, methods, or ports that belong to another BC |\n| **YAGNI contamination** | Methods or ports added for a BC that does not yet exist |\n\nPresent the gap list to the user for confirmation before proceeding.\n\nWhen identifying cross-BC contamination, name the BC it belongs to and add it to the Deferred Items log (see *Active Redirection* below).\n\n---\n\n## Phase 3 — Structured Clarification\n\nFor each non-trivial gap, ask a targeted clarifying question. Group questions by topic. Use multiple-choice where the answer space is bounded.\n\nCapture answers as a numbered list in the session plan. Mark deferred questions as `[OPEN]`.\n\n**Minimum questions to resolve before proceeding:**\n1. Granularity of any approval\u002Factivation lifecycle (e.g., per-product vs per-denomination)\n2. Status transitions — what statuses exist, what transitions are allowed, which are terminal\n3. Concurrency rules — can duplicate pending records exist?\n4. Who can trigger state transitions (tenant vs admin vs system job)?\n5. What domain events does **this BC** emit? *(Limit to the event name and payload. What consuming BCs do with those events is out of scope — that belongs in the consuming BC's refinement session.)*\n6. Any external API contracts — does a real API spec exist or is it TBD?\n\n---\n\n## Active Redirection (applies throughout the entire session)\n\nWhenever the user raises a concern that belongs to another BC — whether during interview, clarification, or execution — apply this protocol:\n\n1. **Acknowledge** the concern in one sentence.\n2. **Name the BC it belongs to.**\n3. **Log it** in the Deferred Items section (see format below).\n4. **Redirect** back to the current BC.\n\n```\nThat sounds like it belongs to the [X] BC — I've noted it in the Deferred Items log.\nLet's stay focused on [current BC] for now.\n```\n\n### Deferred Items Log\n\nMaintain a running list. Present it at the end of the session.\n\n```\n## Deferred Items (for other sessions)\n\n| BC | Item | Why deferred |\n|----|------|--------------|\n| Ordering BC    | Cart submission webhook handler  | Belongs to Ordering BC's ACL, not here |\n```\n\nIf the user wants to implement a deferred item in the current session, issue a clear warning before proceeding:\n\n```\n⚠️ Warning: implementing [item] here introduces cross-BC coupling.\n[item] belongs to the [X] BC. Adding it to [current BC] means [current BC]\nnow has a reason to change when [X] changes — violating single-responsibility.\n\nRecommended: defer to a separate [X] BC session.\nProceeding anyway? [yes \u002F no]\n```\n\n\n---\n\n## Phase 4 — Plan & Approval\n\nWrite a plan summarising:\n- New domain concepts to add (aggregates, entities, enums, type aliases)\n- Business rules to add or correct\n- Domain events to add\n- Schema changes\n- Files to update vs. files to create\n- Contamination to remove (with destination BC noted)\n\nPresent the plan using `exit_plan_mode`. Do not modify any files until the user approves.\n\n---\n\n## Phase 5 — Execution (Update Skill Files)\n\n**Before doing any work in this phase, read `references\u002Fphase-5-execution.md` in full and follow it exactly. It contains the complete body of this phase; do not proceed from memory or skip it.**\n\n## Phase 6 — Validation\n\n**Before doing any work in this phase, read `references\u002Fphase-6-validation.md` in full and follow it exactly. It contains the complete body of this phase; do not proceed from memory or skip it.**\n\n## Phase 7 — Session Close\n\nEnd every session with a structured summary:\n\n```\n## Session Summary — [bc-name] BC Refinement\n\n### What changed\n- [file]: [one-line description of change]\n\n### Open questions [OPEN]\n- [question]: deferred because [reason]\n\n### Deferred Items (for other sessions)\n| BC | Item | Why deferred |\n|----|------|--------------|\n| ...\n\n### Recommended next sessions\n1. [BC name] — [one sentence on why it should be refined next]\n```\n\nThis ensures nothing gets lost between sessions and the next refinement has a clear starting point.\n\n---\n\n## Standing Rules (Applied in Every Refinement)\n\n### BC Isolation\nA BC must have a **single reason to change**. If two concerns within a BC would evolve independently — triggered by different events, owned by different teams, or changing for different business reasons — they belong in separate BCs.\n\n- When another BC's logic is about to be added to the current BC, warn the developer and explain the coupling risk before proceeding. Cross-BC contamination typically starts with \"just one method.\"\n- A port or method that only makes sense when an adjacent (unbuilt) BC exists is a YAGNI violation — flag it, log it in Deferred Items, and recommend removing it. The developer decides.\n\n### VO Discipline\nA Value Object earns a dedicated class **only** when it carries at least one of:\n- Validation invariants\n- Non-trivial equality semantics\n- Behaviour (methods)\n\nPlain string\u002Fnumber wrappers are **`type` aliases** colocated with the aggregate file. Structural DDD elements (Aggregate, Repository, Domain Event, Application Service, ACL) remain uniform across BCs regardless of subdomain depth.\n\n### Schema-per-Tenant\n- **Global \u002F shared tables** → `public` schema\n- **Per-tenant tables** → `\u003Ctenant_schema>` set via CLS context\n- Repositories targeting tenant tables must call `Model.schema(tenantContextService.getTenantSchema())` on every query.\n- Cross-schema FKs from tenant tables to `public` tables are **logical only** (no Postgres FK constraint). Integrity maintained by: (a) public tables are append-only \u002F soft-delete only, (b) cascade rules enforced in application code.\n\n### Soft Delete\nNever hard-delete domain records. Use `isActive = false` (products), status terminal states (EXPIRED, REVOKED), or equivalent per BC.\n\n### Idempotency\nEvery sync job or external webhook handler must be safe to call twice. Use a checksum, external correlation ID, or UNIQUE constraint to guard against duplicate processing.\n\n### Decimal Money\nAlways use `DECIMAL(12,4)` for monetary amounts in Postgres. Never use `FLOAT` or `DOUBLE`. In TypeScript use `decimal.js` or equivalent. Never compare Money values with `==`.\n\n### Domain Events\nAll state transitions that adjacent BCs need to know about must emit a domain event. The event payload must contain enough context for consumers to act without querying back.\n\nDocument the event name and payload in this BC's skill. How consuming BCs handle the event is documented in the consuming BC's skill — not here.\n\n### ProductType Extensibility\nAlways use the `ProductType` enum. Never hardcode `'GIFT_CARD'` as a string literal.\n\n### Ports (Outbound Dependencies)\nEvery outbound dependency (external API, messaging, storage outside the BC) must be accessed via a **port interface** defined in the domain layer (`domain\u002Fports\u002F`). The ACL adapter in the infrastructure layer *implements* the port. Application services depend on the port interface, never on the adapter directly.\n\n```\nApplicationService → calls → SomePort          (domain\u002Fports\u002F)\n                                  ↑ implements\n                          SomeExternalClient    (infrastructure\u002Facl\u002F)\n```\n\nThis rule applies uniformly to **all** outbound integrations — there are no exceptions for \"simple\" sync jobs or polling clients.\n\n### No Raw External DTOs in Domain\nNo domain aggregate or application service may hold a raw API response object. Translation always happens in the ACL adapter.\n\n---\n\n## Reference Output\n\nThe **Catalog BC** skill (`.github\u002Fskills\u002Fcatalog\u002F`) is the canonical reference for a fully-refined, cleanly-scoped BC skill. It was produced by applying this process, including removing cross-BC contamination\n\nKey files to reference:\n- `SKILL.md` — purpose, full module tree, business rules, VO Discipline section, ubiquitous language\n- `domain-model.md` — type aliases block, true VO classes, Sequelize schemas, design decisions\n- `bdd-scenarios.md` — features ordered from infrastructure concern → core feature → supporting concern; no scenarios for adjacent BCs\n- `*-acl.md` — the BC's ACL companion file (proxy details, token lifecycle, error handling, env vars)\n","# BC Skill Refinement Process\n\n---\n\n## Overview\n\nThis document defines the repeatable process used to bring a Bounded Context (BC) skill into alignment with its actual business behaviour.\n\n**Input**: An existing skill directory at `.github\u002Fskills\u002F\u003Cbc-name>\u002F`  \n**Output**: Fully updated `SKILL.md`, `domain-model.md`, `bdd-scenarios.md`,\n`decisions.md`, `status.md`, one or more `*-acl.md` files, and any new ACL files\nneeded. When the human has explicitly opted into Goal 3 business-logic\nverification for this BC scope, output also includes `properties.md`.\n\n**Golden rule: one BC per session.** If conversation drifts toward another BC, warn the developer, note it in the Deferred Items log, and suggest redirecting. The developer has final authority — but the risk of cross-BC contamination must be clearly stated before proceeding.\n\n---\n\n## Phase 0 — Read Everything First + Scope Lock\n\nBefore generating any output:\n\n1. Read all files in `.github\u002Fskills\u002F\u003Cbc-name>\u002F`\n2. Read all other BC skill files to understand what adjacent BCs already own\n3. Read `CLAUDE.md` for project-wide conventions\n\nThen declare a **Scope Lock** to the user:\n\n```\nScope lock: This session covers the [bc-name] BC only.\n\nIn scope:\n  - Everything owned and decided by this BC\n\nOut of scope (owned by other BCs):\n  - [List every adjacent BC and what it owns, one line each]\n\nAny concern that belongs to another BC will be noted in a Deferred Items log\nand addressed in a separate session. It will NOT be designed or implemented here.\n```\n\n**Do not generate any other output until Phase 0 is complete.**\n\nAt session start, update this BC's `status.md` from `DISCOVERED`, `REFINED`, or\n`SPEC_REVIEWED` to `REFINING`. If the file does not exist, create it from\n`assets\u002Fstatus-template.md` and record why lifecycle tracking was initialized\nlate. Immediately run `npm run project:sync` (the generator reads the lifecycle from\n`status.md`, which remains authoritative).\n\n---\n\n## Phase 1 — Business Alignment Interview\n\nAsk the user to describe what the BC is *actually supposed to do* in plain business language:\n\n> *\"Please describe the business behaviour of the `\u003Cbc-name>` BC — what triggers it, what it does, and what outcomes it produces. Don't worry about technical details; describe it as a business user would.\"*\n\n**Rules for this phase:**\n- Ask one focused question at a time; do not bundle.\n- Do **not** assume anything — if something is unclear, ask explicitly.\n- Do **not** generate code or updated files during this phase.\n- Document all open\u002Fdeferred questions (those the user could not answer yet).\n\n---\n\n## Phase 1.5 — Cohesion Check\n\nAfter the business alignment interview, **before** doing any gap analysis, assess whether the described BC is cohesive enough to remain a single BC.\n\n### Decomposition Signals\n\nFlag a potential split if **two or more** of these are true:\n\n| Signal | Example |\n|---|---|\n| Two distinct business concerns that could stand alone | \"manages catalog AND approves activations\" |\n| Aggregates with no direct relationship | different lifecycles, different owners, never referenced together |\n| Different roles trigger different parts independently | tenants interact with one part; LiveOps interact with another |\n| Unrelated external integrations | two external APIs that share no domain concepts |\n| The BC name uses \"and\" or is vague | \"Catalog and activations BC\" |\n| Different reasons to change | one part changes when products change; the other when approval rules change |\n\n### If no signals fire\n\nState clearly:\n```\nCohesion check passed — [bc-name] describes a single cohesive concern. Continuing to gap analysis.\n```\n\n### If signals fire\n\nPause refinement. Present a decomposition proposal:\n\n```\nCohesion concern: the described BC appears to cover [X] and [Y], which are distinct concerns.\n\nProposed split:\n  BC A — [Name]: owns [concern A]. Triggered by [trigger]. Produces [outcome].\n  BC B — [Name]: owns [concern B]. Triggered by [trigger]. Produces [outcome].\n\nRationale: [one sentence per signal that fired]\n\nOptions:\n  1. Split as proposed — proceed with BC A only this session; BC B gets its own session.\n  2. Keep as one BC — explain why these concerns must stay together.\n  3. Adjust the split — describe a different boundary.\n```\n\n**Do not proceed until the user explicitly chooses an option.** If they choose option 1, update the Scope Lock to reflect the narrower BC before continuing.\n\n---\n\n## Phase 2 — Gap Analysis\n\nCompare the business description (Phase 1) against the existing skill files. Produce a structured gap list:\n\n| Gap Category | Description |\n|---|---|\n| **Missing concepts** | Aggregates, entities, or lifecycle states absent from the current model |\n| **Wrong behaviour** | Existing rules that contradict the business description |\n| **Wrong cadence\u002Fschedule** | Cron jobs or polling intervals that differ from spec |\n| **Missing events** | Domain events that should be emitted but aren't listed |\n| **Missing integrations** | External systems that interact with this BC but have no ACL file |\n| **VO Discipline violations** | String-wrapper VO classes that should be type aliases |\n| **Cross-BC contamination** | Concepts, methods, or ports that belong to another BC |\n| **YAGNI contamination** | Methods or ports added for a BC that does not yet exist |\n\nPresent the gap list to the user for confirmation before proceeding.\n\nWhen identifying cross-BC contamination, name the BC it belongs to and add it to the Deferred Items log (see *Active Redirection* below).\n\n---\n\n## Phase 3 — Structured Clarification\n\nFor each non-trivial gap, ask a targeted clarifying question. Group questions by topic. Use multiple-choice where the answer space is bounded.\n\nCapture answers as a numbered list in the session plan. Mark deferred questions as `[OPEN]`.\n\n**Minimum questions to resolve before proceeding:**\n1. Granularity of any approval\u002Factivation lifecycle (e.g., per-product vs per-denomination)\n2. Status transitions — what statuses exist, what transitions are allowed, which are terminal\n3. Concurrency rules — can duplicate pending records exist?\n4. Who can trigger state transitions (tenant vs admin vs system job)?\n5. What domain events does **this BC** emit? *(Limit to the event name and payload. What consuming BCs do with those events is out of scope — that belongs in the consuming BC's refinement session.)*\n6. Any external API contracts — does a real API spec exist or is it TBD?\n\n---\n\n## Active Redirection (applies throughout the entire session)\n\nWhenever the user raises a concern that belongs to another BC — whether during interview, clarification, or execution — apply this protocol:\n\n1. **Acknowledge** the concern in one sentence.\n2. **Name the BC it belongs to.**\n3. **Log it** in the Deferred Items section (see format below).\n4. **Redirect** back to the current BC.\n\n```\nThat sounds like it belongs to the [X] BC — I've noted it in the Deferred Items log.\nLet's stay focused on [current BC] for now.\n```\n\n### Deferred Items Log\n\nMaintain a running list. Present it at the end of the session.\n\n```\n## Deferred Items (for other sessions)\n\n| BC | Item | Why deferred |\n|----|------|--------------|\n| Ordering BC    | Cart submission webhook handler  | Belongs to Ordering BC's ACL, not here |\n```\n\nIf the user wants to implement a deferred item in the current session, issue a clear warning before proceeding:\n\n```\n⚠️ Warning: implementing [item] here introduces cross-BC coupling.\n[item] belongs to the [X] BC. Adding it to [current BC] means [current BC]\nnow has a reason to change when [X] changes — violating single-responsibility.\n\nRecommended: defer to a separate [X] BC session.\nProceeding anyway? [yes \u002F no]\n```\n\n\n---\n\n## Phase 4 — Plan & Approval\n\nWrite a plan summarising:\n- New domain concepts to add (aggregates, entities, enums, type aliases)\n- Business rules to add or correct\n- Domain events to add\n- Schema changes\n- Files to update vs. files to create\n- Contamination to remove (with destination BC noted)\n\nPresent the plan using `exit_plan_mode`. Do not modify any files until the user approves.\n\n---\n\n## Phase 5 — Execution (Update Skill Files)\n\n**Before doing any work in this phase, read `references\u002Fphase-5-execution.md` in full and follow it exactly. It contains the complete body of this phase; do not proceed from memory or skip it.**\n\n## Phase 6 — Validation\n\n**Before doing any work in this phase, read `references\u002Fphase-6-validation.md` in full and follow it exactly. It contains the complete body of this phase; do not proceed from memory or skip it.**\n\n## Phase 7 — Session Close\n\nEnd every session with a structured summary:\n\n```\n## Session Summary — [bc-name] BC Refinement\n\n### What changed\n- [file]: [one-line description of change]\n\n### Open questions [OPEN]\n- [question]: deferred because [reason]\n\n### Deferred Items (for other sessions)\n| BC | Item | Why deferred |\n|----|------|--------------|\n| ...\n\n### Recommended next sessions\n1. [BC name] — [one sentence on why it should be refined next]\n```\n\nThis ensures nothing gets lost between sessions and the next refinement has a clear starting point.\n\n---\n\n## Standing Rules (Applied in Every Refinement)\n\n### BC Isolation\nA BC must have a **single reason to change**. If two concerns within a BC would evolve independently — triggered by different events, owned by different teams, or changing for different business reasons — they belong in separate BCs.\n\n- When another BC's logic is about to be added to the current BC, warn the developer and explain the coupling risk before proceeding. Cross-BC contamination typically starts with \"just one method.\"\n- A port or method that only makes sense when an adjacent (unbuilt) BC exists is a YAGNI violation — flag it, log it in Deferred Items, and recommend removing it. The developer decides.\n\n### VO Discipline\nA Value Object earns a dedicated class **only** when it carries at least one of:\n- Validation invariants\n- Non-trivial equality semantics\n- Behaviour (methods)\n\nPlain string\u002Fnumber wrappers are **`type` aliases** colocated with the aggregate file. Structural DDD elements (Aggregate, Repository, Domain Event, Application Service, ACL) remain uniform across BCs regardless of subdomain depth.\n\n### Schema-per-Tenant\n- **Global \u002F shared tables** → `public` schema\n- **Per-tenant tables** → `\u003Ctenant_schema>` set via CLS context\n- Repositories targeting tenant tables must call `Model.schema(tenantContextService.getTenantSchema())` on every query.\n- Cross-schema FKs from tenant tables to `public` tables are **logical only** (no Postgres FK constraint). Integrity maintained by: (a) public tables are append-only \u002F soft-delete only, (b) cascade rules enforced in application code.\n\n### Soft Delete\nNever hard-delete domain records. Use `isActive = false` (products), status terminal states (EXPIRED, REVOKED), or equivalent per BC.\n\n### Idempotency\nEvery sync job or external webhook handler must be safe to call twice. Use a checksum, external correlation ID, or UNIQUE constraint to guard against duplicate processing.\n\n### Decimal Money\nAlways use `DECIMAL(12,4)` for monetary amounts in Postgres. Never use `FLOAT` or `DOUBLE`. In TypeScript use `decimal.js` or equivalent. Never compare Money values with `==`.\n\n### Domain Events\nAll state transitions that adjacent BCs need to know about must emit a domain event. The event payload must contain enough context for consumers to act without querying back.\n\nDocument the event name and payload in this BC's skill. How consuming BCs handle the event is documented in the consuming BC's skill — not here.\n\n### ProductType Extensibility\nAlways use the `ProductType` enum. Never hardcode `'GIFT_CARD'` as a string literal.\n\n### Ports (Outbound Dependencies)\nEvery outbound dependency (external API, messaging, storage outside the BC) must be accessed via a **port interface** defined in the domain layer (`domain\u002Fports\u002F`). The ACL adapter in the infrastructure layer *implements* the port. Application services depend on the port interface, never on the adapter directly.\n\n```\nApplicationService → calls → SomePort          (domain\u002Fports\u002F)\n                                  ↑ implements\n                          SomeExternalClient    (infrastructure\u002Facl\u002F)\n```\n\nThis rule applies uniformly to **all** outbound integrations — there are no exceptions for \"simple\" sync jobs or polling clients.\n\n### No Raw External DTOs in Domain\nNo domain aggregate or application service may hold a raw API response object. Translation always happens in the ACL adapter.\n\n---\n\n## Reference Output\n\nThe **Catalog BC** skill (`.github\u002Fskills\u002Fcatalog\u002F`) is the canonical reference for a fully-refined, cleanly-scoped BC skill. It was produced by applying this process, including removing cross-BC contamination\n\nKey files to reference:\n- `SKILL.md` — purpose, full module tree, business rules, VO Discipline section, ubiquitous language\n- `domain-model.md` — type aliases block, true VO classes, Sequelize schemas, design decisions\n- `bdd-scenarios.md` — features ordered from infrastructure concern → core feature → supporting concern; no scenarios for adjacent BCs\n- `*-acl.md` — the BC's ACL companion file (proxy details, token lifecycle, error handling, env vars)\n",{"name":5,"context":24,"description":25},"fork","Use this skill when the user asks to refine a particular Bounded Context (BC) skill. The sub-agent will lock scope to a single BC, assess whether it is cohesive enough to remain one BC, ask questions to understand the actual business behaviour, identify gaps in the existing skill files, and then update all files to align with the business requirements.\n","main","6a7f371586f355e96c59ae63ad3dc2c195477614","skills\u002Fbc-refinement",0,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate","https:\u002F\u002Fmali-tintash.github.io\u002Fhgate\u002F","https:\u002F\u002Fgithub.com\u002Fmali-tintash","www.tintash.com","| Tinkerer | Builder | ","2026-11-03 19:24:04",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add mali-tintash\u002Fhgate --skill bc-refinement",{"tool":42,"command":43},"bunx","bunx skills add mali-tintash\u002Fhgate --skill bc-refinement",{"tool":45,"command":46},"pnpm","pnpm dlx skills add mali-tintash\u002Fhgate --skill bc-refinement","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002FSKILL.md",true,[50,56,60,64,68,74,78],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"assets\u002Fbdd-scenarios-template.md","ASSET","资产文件",981,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002Fassets\u002Fbdd-scenarios-template.md",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"assets\u002Fproperties-template.md",6311,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002Fassets\u002Fproperties-template.md",{"path":61,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":62,"sourceHtmlUrl":63},"assets\u002Fproperty-discovery-template.md",4097,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002Fassets\u002Fproperty-discovery-template.md",{"path":65,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":66,"sourceHtmlUrl":67},"assets\u002Fstatus-template.md",599,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002Fassets\u002Fstatus-template.md",{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"decisions.md","REFERENCE","参考文档",2010,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002Fdecisions.md",{"path":75,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fphase-5-execution.md",10113,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002Freferences\u002Fphase-5-execution.md",{"path":79,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fphase-6-validation.md",3572,"https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fbc-refinement\u002Freferences\u002Fphase-6-validation.md",[83,89,95,101,108,115],{"skillNo":84,"name":85,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M78DHXACC092QA12GKTXQG37","cart","https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Ftools\u002Fverify-spec\u002Ftests\u002Ffixtures\u002Fgood\u002F.github\u002Fskills\u002Fcart\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M78DHW4KZPYHGSE6BB6DNWHZ","ordering","https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Ftools\u002Fproject-projection\u002Ftests\u002Ffixtures\u002Fexample\u002F.github\u002Fskills\u002Forders\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M78DHSTQSSD30FAQ6GEQGG4H","catalog","https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Ftools\u002Fproject-projection\u002Ftests\u002Ffixtures\u002Fexample\u002F.github\u002Fskills\u002Fcatalog\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M78DHK7ZYW1ATJH91DH0FEE3","hgate-guide","Use this skill when a user needs help deciding where to start or which hGATE skill to use next. It diagnoses the current lifecycle stage, checks available artifacts, recommends exactly one next skill, and explains that skill's input, output, fork requirement, and completion signal. Trigger phrases include \"how do I use hGATE\", \"what should I do next\", \"which skill should I use\", \"where do I start\", and \"guide me through the workflow\". It never invokes another skill or advances lifecycle state automatically.","https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fhgate-guide\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M78DHBF93F8N59EHDQEC04TM","domain-exploration","Use this skill when a user needs to understand a business problem or requirement, discover the relevant domain concepts, or determine whether the work belongs to one bounded context or several. Trigger phrases include \"explore this domain\", \"identify the bounded contexts\", \"is this one BC or multiple BCs\", \"help me understand this requirement\", \"break this problem into domains\", and \"where does this feature belong\". This skill is interactive and confirmation-gated. It does not produce source code or detailed BC specifications.","https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fdomain-exploration\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":19},"01M78DH5NKAX5GAWA05RHARJ7Y","cross-bc-validation","Use this skill to validate one completed business journey that crosses two or more implemented bounded contexts. It performs a read-only comparison of published contracts, events, ports, adapters, runtime wiring, and tests; identifies incompatible or missing journey hops; and routes each finding to its owning BC. Trigger phrases include \"validate this cross-BC feature\", \"verify the end-to-end bounded context flow\", \"check integration between these BCs\", and \"does this business journey work across contexts\". It does not redesign boundaries or implement fixes.","https:\u002F\u002Fgithub.com\u002Fmali-tintash\u002Fhgate\u002Fblob\u002Fmain\u002Fskills\u002Fcross-bc-validation\u002FSKILL.md",[],[]]