with one click
feature-docs
// [Documentation] Use when you need to create or update business feature documentation.
// [Documentation] Use when you need to create or update business feature documentation.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | feature-docs |
| description | [Documentation] Use when you need to create or update business feature documentation. |
Codex compatibility note:
- Invoke repository skills with
$skill-namein Codex; this mirrored copy rewrites legacy Claude/skill-namereferences.- Prefer the
plan-hardskill for planning guidance in this Codex mirror.- Task tracker mandate: BEFORE executing any workflow or skill step, create/update task tracking for all steps and keep it synchronized as progress changes.
- User-question prompts mean to ask the user directly in Codex.
- Ignore Claude-specific mode-switch instructions when they appear.
- Strict execution contract: when a user explicitly invokes a skill, execute that skill protocol as written.
- Subagent authorization: when a skill is user-invoked or AI-detected and its protocol requires subagents, that skill activation authorizes use of the required
spawn_agentsubagent(s) for that task.- Do not skip, reorder, or merge protocol steps unless the user explicitly approves the deviation first.
- For workflow skills, execute each listed child-skill step explicitly and report step-by-step evidence.
- If a required step/tool cannot run in this environment, stop and ask the user before adapting.
Codex does not receive Claude hook-based doc injection. When coding, planning, debugging, testing, or reviewing, open project docs explicitly using this routing.
Always read:
docs/project-config.json (project-specific paths, commands, modules, and workflow/test settings)docs/project-reference/docs-index-reference.md (routes to the full docs/project-reference/* catalog)docs/project-reference/lessons.md (always-on guardrails and anti-patterns)Situation-based docs:
backend-patterns-reference.md, domain-entities-reference.md, project-structure-reference.mdfrontend-patterns-reference.md, scss-styling-guide.md, design-system/README.mdfeature-docs-reference.mdintegration-test-reference.mde2e-test-reference.mdcode-review-rules.md plus domain docs above based on changed filesDo not read all docs blindly. Start from docs-index-reference.md, then open only relevant files for the task.
[IMPORTANT] task tracking โ Break ALL work into small tasks BEFORE starting. For simple tasks, ask user whether to skip.
Goal: Generate comprehensive 17-section business feature docs with mandatory code evidence for all test cases.
Modes:
| Mode | Trigger | Input | Output |
|---|---|---|---|
init | No docs/business-features/{Module}/ exists | Full source code | Complete 17-section doc from scratch |
update | Docs exist + code changed | Git diff / explicit module | Section-impact-mapped updates |
audit | Explicit --audit flag or user request | Source + existing docs | Staleness report per section |
Workflow:
file:line) for every test casedocs/business-features/{Module}/Key Rules:
docs/project-reference/spec-principles.md โ spec quality standards, AI-implementability criteria, tech-agnostic rules (read Section 4 completeness checklists before Phase 3.5 verification)FilePath:LineNumber) โ no exceptionsIntegrationTest field โ IntegrationTest: Orders/OrderCommandIntegrationTests.cs::{MethodName}. No test yet โ Status: Untested[Trait("TestSpec", "TC-{FEATURE}-{NNN}")] in integration tests. Missing โ Status: Untested
docs/project-reference/domain-entities-reference.mdโ Domain entity catalog, relationships, cross-service sync (read directly when relevant; do not rely on hook-injected conversation text)
Before implementation, search codebase for project-specific patterns:
business-features, detailed-features, feature-docs-template[BLOCKING] Read
feature-docs-reference.mdfor project-specific patterns. If not found, use search-based discovery.
Generate feature docs following project conventions.
GOLD STANDARD: Search existing feature docs: find docs/business-features -name "README.*.md" -type f | head -5
Template: docs/templates/detailed-feature-docs-template.md
EVERY test case MUST ATTENTION have verifiable code evidence โ non-negotiable.
**Evidence**: `{RelativeFilePath}:{LineNumber}` or `{RelativeFilePath}:{StartLine}-{EndLine}`
| Valid | Invalid |
|---|---|
ErrorMessage.cs:83 | {FilePath}:{LineRange} (template) |
Handler.cs:42-52 | SomeFile.cs (no line) |
interviews.service.ts:115-118 | "Based on CQRS pattern" (vague) |
All documentation MUST be placed in correct folder structure:
docs/
โโโ BUSINESS-FEATURES.md # Master index (UPDATE if new module)
โโโ templates/
โ โโโ detailed-feature-docs-template.md # MASTER TEMPLATE
โโโ business-features/
โโโ {Module}/ # One folder per service/module in your project
โ โโโ README.md # Complete module documentation
โ โโโ INDEX.md # Navigation hub
โ โโโ API-REFERENCE.md # Endpoint documentation
โ โโโ TROUBLESHOOTING.md # Issue resolution guide
โ โโโ detailed-features/
โ โโโ README.{FeatureName}.md # Comprehensive (17-section, max 1200 lines)
โโโ ...
Search your codebase to discover the module-to-folder mapping:
# Find all service directories
ls -d src/Services/*/
# Find all existing feature doc modules
ls -d docs/business-features/*/
Map each module code to its folder name and service path. Example pattern:
| Module Code | Folder Name | Service Path |
|---|---|---|
| {Module1} | {Module1} | src/Services/{Module1}/ |
| {Module2} | {Module2} | src/Services/{Module2}/ |
All feature documentation MUST follow this section order:
| # | Section | Audience |
|---|---|---|
| 1 | Header + Metadata (YAML frontmatter) | All |
| 2 | Glossary | All |
| 3 | Executive Summary | PO, BA |
| 4 | Business Requirements | BA, Dev |
| 5 | Domain Model | Dev, Architect |
| 6 | Business Rules | BA, Dev |
| 7 | Process Flows | BA, Dev |
| 8 | Commands & Operations | Dev |
| 9 | Events & Background Jobs | Dev |
| 10 | UI Pages | Dev, UX |
| 11 | API Reference (Simplified) | Dev |
| 12 | Cross-Service Integration | Architect |
| 13 | Security & Permissions | Dev, Architect |
| 14 | Performance Considerations | Dev, Architect |
| 15 | Test Specifications | QA, Dev |
| 16 | Troubleshooting | Dev, QA |
| 17 | Version History | All |
| Audience | Sections |
|---|---|
| Product Owner | Executive Summary, Business Requirements |
| Business Analyst | Business Requirements, Business Rules, Process Flows, Domain Model |
| Developer | Domain Model, Commands & Operations, API Reference, Events, UI Pages |
| Technical Architect | Domain Model, Cross-Service Integration, Security, Performance |
| QA/QC | Test Specifications, Business Rules, Troubleshooting |
| UX Designer | UI Pages, Process Flows |
Before any extraction, detect mode:
docs/business-features/{Module}/ exists (or --audit flag)docs/business-features/ treeMode routing:
| Condition | Mode | Next Step |
|---|---|---|
docs/business-features/{Module}/ NOT found | INIT | โ Mode: INIT |
docs/business-features/{Module}/ exists | UPDATE | โ Phase 1.5 (existing update mode) |
--audit flag OR user requests audit | AUDIT | โ Mode: AUDIT |
Scale gate for INIT mode (workflow context only): If
workflow-spec-driven-devis the caller AND module_count โฅ 4 โ MUST spawn sub-agents (one per module) in ONE message. When feature-docs is invoked STANDALONE for a single module, no scale gate applies โ single-module init is always single-session.
When no docs exist, run spec-discovery-style extraction before formatting into 17-section docs.
Map module's codebase before reading any file in detail:
git ls-files src/Services/{Module}/ (or relevant path) โ full file inventoryGoal: Count ALL operations before planning extraction tasks. This number is the minimum TC count for Section 15.
Write-side entry points:
# CQRS command handlers
grep -r "ICommandHandler\|CommandHandler\b" src/Services/{Module}/ --include="*.cs" -l
# REST/MVC mutating endpoints
grep -r "\[HttpPost\]\|\[HttpPut\]\|\[HttpPatch\]\|\[HttpDelete\]" src/Services/{Module}/ --include="*.cs" -l
# Event consumers / background jobs
grep -r "IConsumer\|EventHandler\|IMessageConsumer\|BackgroundJob\|IHostedService" src/Services/{Module}/ --include="*.cs" -l
Read-side entry points:
# CQRS query handlers
grep -r "IQueryHandler\|QueryHandler\b" src/Services/{Module}/ --include="*.cs" -l
# REST/MVC GET endpoints
grep -r "\[HttpGet\]" src/Services/{Module}/ --include="*.cs" -l
Actor/Role Discovery (feeds Phase E + Section 13):
# Permission attributes and role guards
grep -r "\[Authorize\]\|RequirePermission\|IsInRole\|HasPermission" src/Services/{Module}/ --include="*.cs" -l
# Role/permission enums
grep -r "enum.*Role\|enum.*Permission" src/Services/{Module}/ --include="*.cs" -n | head -20
# Frontend route guards (if applicable)
grep -r "canActivate\|AuthGuard\|RoleGuard\|PermissionGuard" src/{frontend-root}/ --include="*.ts" -l 2>/dev/null | grep -i {module} | head -5
Use Case Inventory Output:
| Layer | Write Ops (N) | Read Ops (M) | Event-Driven (K) | Background (J) | Total | Actor Roles |
|---|---|---|---|---|---|---|
| {Module} | N | M | K | J | N+M+K+J | [roles from grep] |
[GATE โ BLOCKING before Phase A extraction]:
For each entity in Entity layer:
[Source: file:line]ERD Generation (mandatory after all entities extracted):
erDiagram blockstring, number, boolean, date, list, map%% [AGGREGATE: ...]%% [CROSS-REF: module-name].ai/workspace/analysis/{Module}-erd.md for Section 5For each validator/command handler in Validation layer:
[Source: file:line] per rule groupFor each application-layer entry point โ read in this priority order:
UseCaseCommands/) โ one entry per handler class. Extract: handler name โ business operation name (tech-agnostic), command fields, validation rules referenced, output type.UseCaseQueries/) โ one entry per handler class. Extract: operation name, filter parameters, return shape, pagination.UseCaseEvents/) โ one entry per consumer. Extract: event consumed, side effects produced, output state changes.Write operation description in business language only โ no C# type names or class names. Write with [Source: file:line] per entry.
MUST: Every operation in Use Case Inventory (Step 1-INIT.1.5) โ exactly one Phase C entry. After Phase C: count entries. If count < Grand Total from inventory โ create fill tasks before Phase D.
Before extracting events and cross-service integrations, run graph analysis to discover ALL consumers and producers:
# Trace cross-service flow from the primary entity file
python .claude/scripts/code_graph trace src/Services/{Module}/{Module}.Domain/Entities/{PrimaryEntity}.cs --direction both --json
# Find all files connected to the primary service entry point
python .claude/scripts/code_graph connections src/Services/{Module}/{Module}.Service/Controllers/{PrimaryController}.cs --json
If .code-graph/graph.db is unavailable: Fall back to grepping for IBusMessage, IConsumer, [IntegrationEvent] patterns:
grep -rn "IBusMessage\|IConsumer\|IntegrationEvent" src/Services/{Module}/ --include="*.cs"
Use graph output to enumerate: outbound events (produces), inbound events (consumes), cross-service commands. Feed all findings into Section 12 and Section 9.
For each event handler and bus consumer:
[Source: file:line]Sources โ all three required:
User Story format (MANDATORY for every story):
"As a {actor from actor catalog}, I want to {action verb + object}, so that {business outcome}."
Story template:
## Journey: {JourneyName}
- **User Story:** As a {actor}, I want to {action}, so that {outcome}.
- **Actor:** {exact role name from actor catalog}
- **Operation Type:** write | read | event-driven | background | ui-screen
- **Trigger:** {what starts this journey}
- **Preconditions:** {what must already exist}
- **Happy Path:** 1. {Step 1} ...
- **Alternative Paths:** {Condition A} โ {what happens}
- **Outcome:** {what actor achieves}
- **Acceptance Criteria:**
- GIVEN {precondition} WHEN {action} THEN {outcome}
[Source: path/to/handler-or-component.ext:line_range]
Per-phase E completeness checklist (BLOCKING before proceeding to Step 1-INIT.7):
[Source: file:line]After extraction is complete, format the extracted content into the 17-section structure:
| Extracted Phase | Target Section |
|---|---|
| Phase A entities | Section 5 (Domain Model) โ with ERD + [Source: file:line] |
| Phase B rules | Section 6 (Business Rules) + Section 4 (Business Requirements FR-XX) |
| Phase C operations | Section 8 (Commands) + Section 11 (API Reference) |
| Phase D events | Section 9 (Events & Background Jobs) + Section 12 (Cross-Service) |
| Phase E journeys | Section 10 (UI Pages) + Section 15 (Test Specs with TC-XX IDs) |
| Auth rules | Section 13 (Security & Permissions) |
[BLOCKING] Section 15 Readiness Gate โ Before writing Section 15, verify foundational sections are complete:
| Section | Required for TC writing? | Check |
|---|---|---|
| S4 Business Reqs | Yes โ TCs map to FR-XX | โฅ1 FR-XX entry present |
| S6 Business Rules | Yes โ TCs reference BR-XX | โฅ1 BR-XX with error condition present |
| S8 Commands | Yes โ TCs need operation targets | โฅ1 command entry present |
| S13 Security | Yes โ TCs must include auth checks | Permission matrix present |
If 2 or more of these sections are missing or empty โ use a direct user question to ask user whether to proceed with placeholder TCs or halt and complete foundational sections first.
[BLOCKING] Section 15 Quantity Gate (runs after Readiness Gate):
Before writing any TCs, verify the planned TC count covers the Use Case Inventory:
| Check | Required | Planned | Status |
|---|---|---|---|
| CRUD/Core TCs | โฅ Write Ops (N) from inventory | {n} | PASS/FAIL |
| Read/View TCs | โฅ Read Ops with filters (M) | {n} | PASS/FAIL |
| Event/Background TCs | โฅ Event-Driven (K) + Background (J) | {n} | PASS/FAIL |
| Permission TCs | โฅ actor count ร 2 | {n} | PASS/FAIL |
| Total | โฅ Grand Total (N+M+K+J) | {n} | PASS/FAIL |
If any row FAILS or planned count < Grand Total: split TC generation into operation-group batches (โค20 ops per task tracking). Do NOT write TCs until all batch tasks are planned and the total is โฅ Grand Total.
[REQUIRED] TC ID Collision Prevention:
grep -n "TC-{FEATURE}-" docs/business-features/{Module}/detailed-features/README.*.md 2>/dev/null | sort | tail -10
Note the highest existing ID before assigning new ones. See .claude/skills/shared/tc-format.md โ Decade-Based Numbering for range rules.
[REQUIRED] Doc Network Step (INIT mode โ INSERT; UPDATE mode โ VERIFY):
INIT mode: Before completing INIT, insert a
## Related Documentationsection into the feature doc. Place it immediately after the frontmatter header (before Section 1 content). Note: This step fires late in the INIT workflow โ retroactively insert at the document top before saving.UPDATE mode: Do NOT re-insert this section if it already exists โ instead verify that the links are current (paths match current module structure, no broken references). If the section is missing from an older doc, add it now.
## Related Documentation | Type | Path | Description | | ----------------- | ------------------------------------------------------------ | -------------------------------------------------------- | | Engineering Spec | `docs/specs/{app-bucket}/{system-name}/` | Tech-agnostic spec bundle (create via $spec-discovery) | | QA Test Dashboard | `docs/specs/{Module}/README.md` | All TCs, execution status, integration test traceability | | Integration Tests | `src/Services/{ServiceName}/{ServiceName}.IntegrationTests/` | Test code; linked by [Trait("TestSpec", "TC-...")] | | Parent Feature | _(if sub-feature)_ | | | Child Features | _(if this doc is a parent)_ | |Fill in
{app-bucket},{system-name},{Module},{ServiceName}from the current module context. Use(not yet created)for paths that don't exist yet โ they serve as navigational intent markers.Why: This section is the navigation hub for all consumers of this feature area. Without it, every AI session must scan the entire docs tree to find related artifacts.
When audit mode is triggered:
Read docs/business-features/{Module}/detailed-features/README.{Feature}.md frontmatter โ last_updated
Run git log --since="{last_updated}" --name-only -- src/Services/{Module}/
If changed files found โ flag sections using Phase 1.5 impact mapping table
Output docs/business-features/{Module}/AUDIT-{date}.md:
# Feature Doc Audit โ {date}
## {FeatureName}
| Section | Status | Changed Source Files | Action |
| -------------------------- | ---------- | ------------------------------- | ------------------- |
| Section 5 (Domain Model) | โ ๏ธ STALE | EntityX.cs (changed 2026-04-18) | Re-extract entities |
| Section 6 (Business Rules) | โ
Current | โ | โ |
When no module specified, auto-detect from git changes:
git diff --name-only HEAD (staged + unstaged); if none โ git diff --name-only HEAD~1docs/business-features/{Module}/ exists.claude/, docs/, config files changed โ report "No business feature docs impacted" and exitPath-to-Module Detection Rules:
Search your codebase to build the path-to-module mapping. Common patterns:
| Changed File Path Pattern | Detected Module |
|---|---|
src/Services/{Module}/** | {Module} |
{frontend-apps-dir}/{app-name}/** | {Module} (map app name to module) |
{frontend-libs-dir}/{domain-lib}/src/{feature}/** | {Module} (map feature to module) |
Build a project-specific mapping by examining:
ls -d src/Services/*/
ls -d {frontend-apps-dir}/*/
Module source priority: (1) user-specified โ (2) domain-implied (grep to verify) โ (3) auto-detected from git diff (Step 1.0)
docs/BUSINESS-FEATURES.md (master index)docs/business-features/{Module}/INDEX.md (if exists)docs/business-features/{Module}/README.md (if exists)Grep evidence from source:
{Module}.Domain/Entities/{Module}.Application/UseCaseCommands/{Module}.Application/UseCaseQueries/{Module}.Service/Controllers/{frontend-apps-dir}/{app}/ or {frontend-libs-dir}/{lib}/Build knowledge model in .ai/workspace/analysis/[feature-name].md. Discover: entities/enums, commands/queries/events/jobs, controllers/DTOs, frontend components, cross-service bus messages.
When UPDATING existing feature docs (not from scratch):
docs/specs/{app-bucket}/{system-name}/ exists)docs/specs/{app-bucket}/{system-name}/ exists| Change Type | Impacted Sections |
|---|---|
| New entity property | 4 (Business Requirements), 5 (Domain Model), 11 (API Reference) |
| New API endpoint | 11 (API Reference), 13 (Security & Permissions) |
| New frontend component | 10 (UI Pages) |
| New filter/query | 4 (Business Requirements), 11 (API Reference) |
| Any new functionality | 15 (Test Specifications) โ MANDATORY |
| Any change | 3 (Executive Summary), 17 (Version History) โ ALWAYS UPDATE |
CRITICAL: When documenting ANY new functionality, MUST update:
[BLOCKING] TC Format: Use canonical format in
.claude/skills/shared/tc-format.md. NEVER use abbreviated flat GIVEN/WHEN/THEN โ use full template with all required fields (Objective, Preconditions, GWT steps, Acceptance Criteria, Test Data, Edge Cases, Evidence, IntegrationTest, Status). Section 15 owned exclusively by$tdd-specโ feature-docs populates only during INIT. Existing TCs MUST NOT be overwritten during UPDATE mode.
[BLOCKING] TC ID Collision Prevention: Before assigning new TC IDs, check highest existing ID:
grep -n "TC-{FEATURE}-" docs/business-features/{Module}/detailed-features/README.*.md | sort | tail -5Assign next sequential ID. See
.claude/skills/shared/tc-format.mdโ Decade-Based Numbering section for range rules.
Failure to update Section 15 = blocking quality issue.
Always create/update CHANGELOG.md entry under [Unreleased] following Keep a Changelog format.
Generate at docs/business-features/{Module}/detailed-features/README.{FeatureName}.md.
Business Requirements (FR-XX):
#### FR-{MOD}-01: {Requirement Title}
| Aspect | Details |
| --------------- | --------------------------------- |
| **Description** | {What this requirement enables} |
| **Scope** | {Who can use / affected entities} |
| **Evidence** | `{FilePath}:{LineRange}` |
User Stories (US-XX):
#### US-{MOD}-01: {Story Title}
**As a** {role}
**I want** {goal/desire}
**So that** {benefit/value}
**Acceptance Criteria**:
- [ ] AC-01: {Criterion with evidence reference}
- [ ] AC-02: {Criterion with evidence reference}
**Related Requirements**: FR-{MOD}-01, FR-{MOD}-02
**Evidence**: `{FilePath}:{LineRange}`
Test Summary Table (MANDATORY):
| Category | P0 (Critical) | P1 (High) | P2 (Medium) | P3 (Low) | Total |
| ----------- | :-----------: | :-------: | :---------: | :------: | :-----: |
| {Category1} | {N} | {N} | {N} | {N} | {N} |
| **Total** | **{N}** | **{N}** | **{N}** | **{N}** | **{N}** |
Test Case Format (TC-XX):
[BLOCKING] Canonical TC format authority:
.claude/skills/shared/tc-format.mdโ always use for full TC template. Below is the minimum required format for feature docs Section 15.
#### TC-{FEATURE}-001: {Test Name} [P0]
**Objective:** {One sentence: what behavior this TC verifies}
**Preconditions:**
- {Required system state}
**GIVEN** {initial context}
**WHEN** {action performed}
**THEN** {expected outcome}
**Acceptance Criteria:**
- Success: {observable outcome}
- Failure: {error condition + message}
**Test Data:** `{ "field": "value" }`
**Edge Cases:**
- {Invalid scenario} โ {Expected error/behavior}
**Evidence:** `{FilePath}:{LineRange}`
**IntegrationTest:** `{TestFile}.cs::{MethodName}` (or `Untested`)
**Status:** Tested | Untested | Planned
Troubleshooting Format:
#### {Issue Title}
**Symptoms**: {Observable problem}
**Causes**:
1. {Cause 1}
2. {Cause 2}
**Resolution**:
- {Step 1}
- {Step 2}
Permission Matrix:
| Role | View | Create | Edit | Delete | Special |
| ----- | :--: | :----: | :--: | :----: | ----------- |
| Admin | โ
| โ
| โ
| โ
| Full access |
Every feature doc MUST include a Mermaid erDiagram in Section 5:
erDiagram
{EntityA} {
string id PK
string name
string status
}
{EntityB} {
string id PK
string entityAId FK
}
{EntityA} ||--o{ {EntityB} : "contains"
ERD rules (same as spec-discovery standard):
string, number, boolean, date, list, map%% [AGGREGATE: EntityName]%% [CROSS-REF: module-name][Source: path/to/entity-files:line_range] required after the ERD block.
Business Rules (Section 6) Format:
Each rule group MUST include [Source: file:line]:
### BR-{MOD}-01: {Rule Group Name}
| Field/Operation | Rule | Error Condition | Error Message |
| --------------- | ------------ | --------------- | ------------------ |
| {field} | {constraint} | {when violated} | {message constant} |
[Source: {Service}/{Layer}/{File}.cs:{line_range}]
No .ai.md companion files. Single README.{Feature}.md only output. Template: docs/templates/detailed-feature-docs-template.md (authoritative).
file:line referencesREADME.{FeatureName}-Part1.md and README.{FeatureName}-Part2.mdTC-{FEATURE}- prefix; NEVER renumberINDEX.md and BUSINESS-FEATURES.md to link both partsAfter creating/updating module docs, update docs/BUSINESS-FEATURES.md:
| **{Module}** | [Description] | [View Details](./business-features/{Module}/README.md) |
After every feature-docs run (init or update), append to docs/business-features/{Module}/CHANGELOG.md:
## [Unreleased] โ {date}
### Updated
- {FeatureName}: updated sections {list of section numbers} โ triggered by {git ref or user request}
- Reason: {brief description of change}
Create docs/business-features/{Module}/CHANGELOG.md if it does not exist.
Before writing documentation, verify:
EVERY test case:
ErrorMessage.csEVERY test case:
ErrorMessage.cs{FilePath}, {LineRange})CRITICAL: ANY pass finds hallucinated content โ re-investigate and fix before completing.
Flag items requiring implementation assumptions:
[Source: file:line]. Missing field โ flag.If >3 INCOMPLETE items โ HALT, present gap list via ask the user directly before completing.
Reference: docs/project-reference/spec-principles.md Section 4 (AI-Implementability Checklist).
[Unreleased]file:line format{FilePath}, {LineRange})ErrorMessage.cserDiagram present with all entities[Source: file:line] after each entity definition and after ERD block%% [AGGREGATE: ...][Source: file:line] present after each rule group tableErrorMessage.cs or equivalent constants file[Source: file:line]documentationfeature-implementationMANDATORY IMPORTANT MUST ATTENTION โ NO EXCEPTIONS: If you are NOT already in a workflow, you MUST ATTENTION use a direct user question to ask the user. Do NOT judge task complexity or decide this is "simple enough to skip" โ the user decides whether to use a workflow, not you:
- Activate
tdd-featureworkflow (Recommended) โ scout โ investigate โ domain-analysis โ tdd-spec โ tdd-spec-review โ plan โ plan-review โ plan-validate โ why-review โ cook โ review-domain-entities โ integration-test โ integration-test-review โ integration-test-verify โ test โ workflow-review-changes โ sre-review โ changelog โ docs-update โ watzup โ workflow-end- Execute
$feature-docsdirectly โ run this skill standalone
[BLOCKING] After completing, use a direct user question to present options. Do NOT skip โ user decides:
| Skill | Relationship | When to Call |
|---|---|---|
$spec-discovery | Producer โ extracts engineering spec bundle that feeds this skill's INIT mode | Run spec-discovery first when creating docs for the first time; use its output as Section 12 source |
$tdd-spec | Consumer โ reads Section 15 to generate/validate TCs | After creating/updating feature docs, call tdd-spec to populate or review Section 15 |
$tdd-spec-review | Reviewer โ audits TC coverage in Section 15 | After tdd-spec, to validate TC completeness and GIVEN/WHEN/THEN quality |
$tdd-spec [direction=sync] | Dashboard โ syncs docs/specs/{Module}/README.md from Section 15 | After tdd-spec update, to keep QA dashboard current |
$integration-test | End consumer โ generates test code from TCs in Section 15 | After tdd-spec, to produce actual integration test files |
$docs-update | Orchestrator โ calls this skill as Phase 2 | Run $docs-update for full chain sync; it calls $feature-docs internally |
$review-changes | Trigger โ detects feature doc staleness | Calls $docs-update when business doc is stale relative to code changes |
When called outside a workflow, follow this chain to keep all spec layers in sync. Skip steps already done in the same session.
feature-docs (you are here)
โ
โโ BEFORE this skill (if doc doesn't exist yet):
โ [REQUIRED] โ $spec-discovery [init mode]
โ Extracts engineering spec bundle. Provides basis for Sections 1-14 accuracy.
โ Skip if: feature docs updating existing content, or small feature with no domain model.
โ
โโ AFTER this skill:
โ
โโ [REQUIRED] โ $tdd-spec [CREATE or UPDATE mode]
โ Section 15 is incomplete without explicit tdd-spec run.
โ CREATE: new feature doc just created โ write TCs from spec.
โ UPDATE: existing doc updated โ update TCs to match changed behavior.
โ
โโ [REQUIRED] โ $tdd-spec-review
โ Validates TC coverage, GIVEN/WHEN/THEN completeness, no duplicate TC codes.
โ
โโ [REQUIRED] โ $tdd-spec [direction=sync]
โ Syncs Section 15 TCs to QA dashboard at docs/specs/{Module}/README.md.
โ
โโ [RECOMMENDED] โ $integration-test [from-changes or from-prompt mode]
โ Generates/updates integration test files from changed TCs.
โ
โโ [RECOMMENDED] โ $docs-update
If code changes triggered this doc update, run $docs-update for full chain including
spec-discovery (Phase 2.5) and tdd-spec (Phase 3).
[REQUIRED] Every feature doc managed by this skill must have a
## Related Documentationsection:INIT mode: INSERT the section (place immediately after frontmatter, before Section 1 content) UPDATE mode: VERIFY the section exists and links are current; add it if missing from an older doc
Do not re-add if already present. Check before marking this skill complete.
Template to insert or verify in docs/business-features/{Module}/README.md:
## Related Documentation
| Type | Link | Description |
| ----------------- | --------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| Engineering Spec | [docs/specs/{app-bucket}/{system-name}/](../../specs/{app-bucket}/{system-name}/) | Tech-agnostic spec bundle (domain model, rules, API contracts) |
| QA Test Dashboard | [docs/specs/{Module}/README.md](../../specs/{Module}/README.md) | All TCs, execution status, integration test links |
| Integration Tests | `src/Services/{ServiceName}/{ServiceName}.IntegrationTests/` | Test code linked to TCs via [Trait("TestSpec", "TC-...")] |
| Related Modules | _(list any cross-module dependencies here)_ | |
Fill in {app-bucket}, {system-name}, {Module}, {ServiceName} from context.
If docs/specs/{app-bucket}/{system-name}/ does not exist yet, write: (spec bundle not yet created โ run $spec-discovery init).
This section enables:
$docs-update detecting when spec bundle was updated but business doc wasn't[IMPORTANT] Use task tracking to break ALL work into small tasks BEFORE starting โ including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
Cross-Service Check โ Microservices/event-driven: MANDATORY before concluding investigation, plan, spec, or feature doc. Missing downstream consumer = silent regression.
Boundary Grep terms Event producers Publish,Dispatch,Send,emit,EventBus,outbox,IntegrationEventEvent consumers Consumer,EventHandler,Subscribe,@EventListener,inboxSagas/orchestration Saga,ProcessManager,Choreography,Workflow,OrchestratorSync service calls HTTP/gRPC calls to/from other services Shared contracts OpenAPI spec, proto, shared DTO โ flag breaking changes Data ownership Other service reads/writes same table/collection โ Shared-DB anti-pattern Per touchpoint: owner service ยท message name ยท consumers ยท risk (NONE / ADDITIVE / BREAKING).
BLOCKED until: Producers scanned ยท Consumers scanned ยท Sagas checked ยท Contracts reviewed ยท Breaking-change risk flagged
Evidence-Based Reasoning โ Speculation is FORBIDDEN. Every claim needs proof.
- Cite
file:line, grep results, or framework docs for EVERY claim- Declare confidence: >80% act freely, 60-80% verify first, <60% DO NOT recommend
- Cross-service validation required for architectural changes
- "I don't have enough evidence" is valid and expected output
BLOCKED until:
- [ ]Evidence file path (file:line)- [ ]Grep search performed- [ ]3+ similar patterns found- [ ]Confidence level statedForbidden without proof: "obviously", "I think", "should be", "probably", "this is because" If incomplete โ output:
"Insufficient evidence. Verified: [...]. Not verified: [...]."
Critical Thinking Mindset โ Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act. Anti-hallucination: Never present guess as fact โ cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence โ certainty without evidence root of all hallucination.
AI Mistake Prevention โ Failure modes to avoid on every task:
Check downstream references before deleting. Deleting components causes documentation and code staleness cascades. Map all referencing files before removal. Verify AI-generated content against actual code. AI hallucinates APIs, class names, and method signatures. Always grep to confirm existence before documenting or referencing. Trace full dependency chain after edits. Changing a definition misses downstream variables and consumers derived from it. Always trace the full chain. Trace ALL code paths when verifying correctness. Confirming code exists is not confirming it executes. Always trace early exits, error branches, and conditional skips โ not just happy path. When debugging, ask "whose responsibility?" before fixing. Trace whether bug is in caller (wrong data) or callee (wrong handling). Fix at responsible layer โ never patch symptom site. Assume existing values are intentional โ ask WHY before changing. Before changing any constant, limit, flag, or pattern: read comments, check git blame, examine surrounding code. Verify ALL affected outputs, not just the first. Changes touching multiple stacks require verifying EVERY output. One green check is not all green checks. Holistic-first debugging โ resist nearest-attention trap. When investigating any failure, list EVERY precondition first (config, env vars, DB names, endpoints, DI registrations, data preconditions), then verify each against evidence before forming any code-layer hypothesis. Surgical changes โ apply the diff test. Bug fix: every changed line must trace directly to the bug. Don't restyle or improve adjacent code. Enhancement task: implement improvements AND announce them explicitly. Surface ambiguity before coding โ don't pick silently. If request has multiple interpretations, present each with effort estimate and ask. Never assume all-records, file-based, or more complex path.
IMPORTANT MUST ATTENTION cite file:line evidence for every claim. Confidence >80% to act, <60% = do NOT recommend.
MUST ATTENTION apply critical thinking โ every claim needs traced proof, confidence >80% to act. Anti-hallucination: never present guess as fact.
MUST ATTENTION apply AI mistake prevention โ holistic-first debugging, fix at responsible layer, surface ambiguity before coding, re-read files after compaction.
FilePath:LineNumber) โ no exceptions$tdd-spec after INIT[TASK-PLANNING] MUST ATTENTION analyze task scope and break into small todo tasks/sub-tasks via task tracking before acting.
Source: .claude/hooks/lib/prompt-injections.cjs + .claude/.ck.json
$workflow-start <workflowId> for standard; sequence custom steps manually[CRITICAL] Hard-won project debugging/architecture rules. MUST ATTENTION apply BEFORE forming hypothesis or writing code.
Goal: Prevent recurrence of known failure patterns โ debugging, architecture, naming, AI orchestration, environment.
Top Rules (apply always):
ExecuteInjectScopedAsync for parallel async + repo/UoW โ NEVER ExecuteUowTaskwhere python/where py) โ NEVER assume python/python3 resolvesExecuteInjectScopedAsync, NEVER ExecuteUowTask. ExecuteUowTask creates new UoW but reuses outer DI scope (same DbContext) โ parallel iterations sharing non-thread-safe DbContext silently corrupt data. ExecuteInjectScopedAsync creates new UoW + new DI scope (fresh repo per iteration).AccountUserEntityEventBusMessage = Accounts owns). Core services (Accounts, Communication) are leaders. Feature services (Growth, Talents) sending to core MUST use {CoreServiceName}...RequestBusMessage โ never define own event for core to consume.HrManagerOrHrOrPayrollHrOperationsPolicy names set members, not what it guards. Add role โ rename = broken abstraction. Rule: names express DOES/GUARDS, not CONTAINS. Test: adding/removing member forces rename? YES = content-driven = bad โ rename to purpose (e.g., HrOperationsAccessPolicy). Nuance: "Or" fine in behavioral idioms (FirstOrDefault, SuccessOrThrow) โ expresses HAPPENS, not membership.python/python3 resolves โ verify alias first. Python may not be in bash PATH under those names. Check: where python / where py. Prefer py (Windows Python Launcher) for one-liners, node if JS alternative exists.Test-specific lessons โ
docs/project-reference/integration-test-reference.mdLessons Learned section. Production-code anti-patterns โdocs/project-reference/backend-patterns-reference.mdAnti-Patterns section. Generic debugging/refactoring reminders โ System Lessons in.claude/hooks/lib/prompt-injections.cjs.
ExecuteInjectScopedAsync, NEVER ExecuteUowTask (shared DbContext = silent data corruption){CoreServiceName}...RequestBusMessagepython/python3 resolves โ run where python/where py first, use py launcher or nodeBreak work into small tasks (task tracking) before starting. Add final task: "Analyze AI mistakes & lessons learned".
Extract lessons โ ROOT CAUSE ONLY, not symptom fixes:
$learn.$code-review/$code-simplifier/$security/$lint catch this?" โ Yes โ improve review skill instead.$learn.
[TASK-PLANNING] [MANDATORY] BEFORE executing any workflow or skill step, create/update task tracking for all planned steps, then keep it synchronized as each step starts/completes.