@pigcloud/skills 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -4
- package/README.en.md +74 -83
- package/README.md +74 -85
- package/bin/cli.js +114 -89
- package/bin/postinstall.js +1 -1
- package/package.json +1 -1
- package/rules/skill-profile-map.json +5 -5
- package/rules/skill-profile-map.md +2 -2
- package/scripts/validate-skill-shapes.js +2 -1
- package/scripts/validate-skills.ps1 +6 -6
- package/scripts/validate-skills.sh +5 -5
- package/skills/api-docs/SKILL.md +2 -2
- package/skills/domain-modeling/SKILL.md +4 -4
- package/skills/extract-business-facts/SKILL.md +336 -0
- package/skills/extract-business-facts/scripts/write-knowledge-base.js +227 -0
- package/skills/knowledge-capture/SKILL.md +16 -7
- package/skills/project-bootstrap/SKILL.md +2 -2
- package/skills/references/business-fact-extraction.md +414 -0
- package/skills/references/golden-prompt-suite.js +64 -14
- package/skills/references/rule-loading-map.md +18 -18
- package/skills/references/skill-authoring-standard.md +2 -2
- package/skills/references/skill-boundary-template.md +56 -23
- package/skills/references/skill-enhanced-template.md +80 -30
- package/skills/references/skill-reference-matrix.md +21 -20
- package/skills/{spec-refinement → spec}/SKILL.md +19 -14
- package/skills/technical-design/SKILL.md +4 -4
- package/pig-cloud-skills-commands/.codex-plugin/plugin.json +0 -35
- package/pig-cloud-skills-commands/README.md +0 -24
- package/pig-cloud-skills-commands/commands/analyze.md +0 -21
- package/pig-cloud-skills-commands/commands/build.md +0 -21
- package/pig-cloud-skills-commands/commands/design.md +0 -21
- package/pig-cloud-skills-commands/commands/distill.md +0 -21
- package/pig-cloud-skills-commands/commands/doc.md +0 -21
- package/pig-cloud-skills-commands/commands/infra.md +0 -21
- package/pig-cloud-skills-commands/commands/init.md +0 -20
- package/pig-cloud-skills-commands/commands/kb.md +0 -20
- package/pig-cloud-skills-commands/commands/perf.md +0 -20
- package/pig-cloud-skills-commands/commands/prd.md +0 -21
- package/pig-cloud-skills-commands/commands/review.md +0 -21
- package/pig-cloud-skills-commands/commands/security.md +0 -21
- package/pig-cloud-skills-commands/commands/test.md +0 -21
- package/pig-cloud-skills-commands/commands/workflow.md +0 -20
- package/skills/product-intake/SKILL.md +0 -98
- package/skills/references/agent-personas.md +0 -34
- package/skills/references/flow-test-cases.md +0 -62
- package/skills/references/full-chain-replay-scenarios.md +0 -79
- package/skills/references/hooks.md +0 -67
- package/skills/references/negative-replay-scenarios.md +0 -49
- package/skills/references/prompt-replay-checklist.md +0 -128
- package/skills/references/requirements-separation-map.md +0 -71
- package/skills/references/slash-commands.md +0 -34
- package/skills/spec-refinement/references/ears-syntax.md +0 -127
- package/skills/spec-refinement/references/requirement-checklist.md +0 -139
- package/skills/spec-refinement/references/spec-workbook.md +0 -75
package/bin/postinstall.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pigcloud/skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "AI skills pack with client-aware installation, shared skills and rules, Codex command entries, and Pig Cloud-specific overlays for requirements, implementation, and knowledge curation.",
|
|
5
5
|
"author": "Pig Skills Maintainers",
|
|
6
6
|
"license": "MIT",
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
"bundle": "workflow",
|
|
4
4
|
"profile": "router"
|
|
5
5
|
},
|
|
6
|
-
"
|
|
7
|
-
"bundle": "product",
|
|
8
|
-
"profile": "intake"
|
|
9
|
-
},
|
|
10
|
-
"spec-refinement": {
|
|
6
|
+
"spec": {
|
|
11
7
|
"bundle": "workflow",
|
|
12
8
|
"profile": "refinement"
|
|
13
9
|
},
|
|
@@ -31,6 +27,10 @@
|
|
|
31
27
|
"bundle": "product",
|
|
32
28
|
"profile": "modeling"
|
|
33
29
|
},
|
|
30
|
+
"extract-business-facts": {
|
|
31
|
+
"bundle": "product",
|
|
32
|
+
"profile": "modeling"
|
|
33
|
+
},
|
|
34
34
|
"api-docs": {
|
|
35
35
|
"bundle": "docs",
|
|
36
36
|
"profile": "api"
|
|
@@ -7,13 +7,13 @@ This file explains which canonical skill loads which rules bundle and profile.
|
|
|
7
7
|
| Skill | Bundle | Profile |
|
|
8
8
|
|---|---|---|
|
|
9
9
|
| `workflow-router` | `workflow` | `router` |
|
|
10
|
-
| `
|
|
11
|
-
| `spec-refinement` | `workflow` | `refinement` |
|
|
10
|
+
| `spec` | `workflow` | `refinement` |
|
|
12
11
|
| `technical-design` | `coding` | `analysis` |
|
|
13
12
|
| `feature-build` | `coding` | `implementation` |
|
|
14
13
|
| `test-design` | `coding` | `testing` |
|
|
15
14
|
| `code-review` | `review` | `code` |
|
|
16
15
|
| `domain-modeling` | `product` | `modeling` |
|
|
16
|
+
| `extract-business-facts` | `product` | `modeling` |
|
|
17
17
|
| `api-docs` | `docs` | `api` |
|
|
18
18
|
| `security-review` | `review` | `security` |
|
|
19
19
|
| `performance-check` | `review` | `performance` |
|
|
@@ -6,12 +6,13 @@ const path = require('path');
|
|
|
6
6
|
const repoRoot = path.join(__dirname, '..');
|
|
7
7
|
const skillsRoot = path.join(repoRoot, 'skills');
|
|
8
8
|
const enhancedTemplateSkills = new Set([
|
|
9
|
-
'spec
|
|
9
|
+
'spec',
|
|
10
10
|
'technical-design',
|
|
11
11
|
'feature-build',
|
|
12
12
|
'code-review',
|
|
13
13
|
'security-review',
|
|
14
14
|
'performance-check',
|
|
15
|
+
'extract-business-facts',
|
|
15
16
|
]);
|
|
16
17
|
const enhancedSections = [
|
|
17
18
|
'## Quick Start',
|
|
@@ -6,12 +6,12 @@ $ErrorActionPreference = 'Stop'
|
|
|
6
6
|
$repoRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path
|
|
7
7
|
$python = Join-Path $repoRoot '.tools\python.cmd'
|
|
8
8
|
if (-not $SkillsRoot) {
|
|
9
|
-
if (Test-Path -LiteralPath (Join-Path $repoRoot 'skills')) {
|
|
10
|
-
$SkillsRoot = Join-Path $repoRoot 'skills'
|
|
11
|
-
} else {
|
|
12
|
-
$SkillsRoot = Join-Path $repoRoot '.
|
|
13
|
-
}
|
|
14
|
-
}
|
|
9
|
+
if (Test-Path -LiteralPath (Join-Path $repoRoot 'skills')) {
|
|
10
|
+
$SkillsRoot = Join-Path $repoRoot 'skills'
|
|
11
|
+
} else {
|
|
12
|
+
$SkillsRoot = Join-Path $repoRoot '.codex\skills\pigcloud'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
15
|
$codexHome = $env:CODEX_HOME
|
|
16
16
|
if (-not $codexHome) {
|
|
17
17
|
$codexHome = Join-Path $HOME '.codex'
|
|
@@ -7,11 +7,11 @@ codex_home="${CODEX_HOME:-$HOME/.codex}"
|
|
|
7
7
|
validator="$codex_home/skills/.system/skill-creator/scripts/quick_validate.py"
|
|
8
8
|
if [ -n "${1:-}" ]; then
|
|
9
9
|
skills_root="$1"
|
|
10
|
-
elif [ -d "$repo_root/skills" ]; then
|
|
11
|
-
skills_root="$repo_root/skills"
|
|
12
|
-
else
|
|
13
|
-
skills_root="$repo_root/.
|
|
14
|
-
fi
|
|
10
|
+
elif [ -d "$repo_root/skills" ]; then
|
|
11
|
+
skills_root="$repo_root/skills"
|
|
12
|
+
else
|
|
13
|
+
skills_root="$repo_root/.codex/skills/pigcloud"
|
|
14
|
+
fi
|
|
15
15
|
|
|
16
16
|
if [ ! -f "$validator" ]; then
|
|
17
17
|
echo "Validator not found: $validator" >&2
|
package/skills/api-docs/SKILL.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: api-docs
|
|
3
|
-
description: 当接口需要可复用参考文档时,记录稳定的 API 行为、请求/响应契约和示例
|
|
3
|
+
description: 当接口需要可复用参考文档时,记录稳定的 API 行为、请求/响应契约和示例
|
|
4
4
|
lifecycle_stage: capture
|
|
5
5
|
rule_profile: api
|
|
6
6
|
dependencies:
|
|
7
|
-
- spec
|
|
7
|
+
- spec
|
|
8
8
|
triggers:
|
|
9
9
|
- API docs
|
|
10
10
|
- contract
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: domain-modeling
|
|
3
|
-
description: 当领域模型不清晰时,从代码或业务语言中提炼领域边界和核心概念
|
|
3
|
+
description: 当领域模型不清晰时,从代码或业务语言中提炼领域边界和核心概念
|
|
4
4
|
lifecycle_stage: design
|
|
5
5
|
rule_profile: modeling
|
|
6
6
|
dependencies: []
|
|
@@ -23,7 +23,7 @@ workflow:
|
|
|
23
23
|
- extract the core domain terms
|
|
24
24
|
- group concepts by boundary
|
|
25
25
|
- identify aggregates and dependencies
|
|
26
|
-
- hand off to technical-design or spec
|
|
26
|
+
- hand off to technical-design or spec
|
|
27
27
|
gates:
|
|
28
28
|
- stop at domain boundaries
|
|
29
29
|
- do not implement code
|
|
@@ -51,14 +51,14 @@ Extract domain boundaries and core concepts from messy input.
|
|
|
51
51
|
1. Extract the core domain terms.
|
|
52
52
|
2. Group concepts by boundary.
|
|
53
53
|
3. Identify aggregates and dependencies.
|
|
54
|
-
4. Hand off to `technical-design` or `spec
|
|
54
|
+
4. Hand off to `technical-design` or `spec`.
|
|
55
55
|
|
|
56
56
|
## Replay Signals
|
|
57
57
|
|
|
58
58
|
- Input signal: existing business language, product context, code, or documents.
|
|
59
59
|
- Output to verify: domain map, core concepts, boundary notes.
|
|
60
60
|
- Stop signal: implementation code or PRD drafting.
|
|
61
|
-
- Handoff signal: the boundary map is ready for `technical-design` or `spec
|
|
61
|
+
- Handoff signal: the boundary map is ready for `technical-design` or `spec`.
|
|
62
62
|
|
|
63
63
|
## Examples
|
|
64
64
|
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: extract-business-facts
|
|
3
|
+
description: Extract business facts, current behaviors, invariants, and terminology from code, tests, logs, and docs when Codex needs to reverse-engineer what the system actually does or prepare evidence-backed input for domain modeling, spec refinement, or knowledge capture.
|
|
4
|
+
lifecycle_stage: analysis
|
|
5
|
+
rule_profile: modeling
|
|
6
|
+
dependencies: []
|
|
7
|
+
triggers:
|
|
8
|
+
- reverse engineer behavior
|
|
9
|
+
- business facts
|
|
10
|
+
- current behavior
|
|
11
|
+
- code facts
|
|
12
|
+
- extract facts from code
|
|
13
|
+
- behavior map
|
|
14
|
+
inputs:
|
|
15
|
+
- code paths
|
|
16
|
+
- tests
|
|
17
|
+
- logs
|
|
18
|
+
- docs
|
|
19
|
+
- schemas
|
|
20
|
+
- runtime evidence
|
|
21
|
+
outputs:
|
|
22
|
+
- code fact map
|
|
23
|
+
- business fact map
|
|
24
|
+
- codewiki delta
|
|
25
|
+
- handoff notes
|
|
26
|
+
- knowledge-base file targets
|
|
27
|
+
workflow:
|
|
28
|
+
- collect code, test, doc, and runtime evidence for the requested area
|
|
29
|
+
- extract code facts first, then derive business meaning, then propose CodeWiki updates
|
|
30
|
+
- mark each fact as evidence-backed, inferred, or unknown
|
|
31
|
+
- summarize gaps, contradictions, and open questions
|
|
32
|
+
- choose the destination knowledge-base files before writing the final note
|
|
33
|
+
- hand off to domain-modeling, spec, or knowledge-capture
|
|
34
|
+
gates:
|
|
35
|
+
- stop at fact extraction
|
|
36
|
+
- do not design a new solution
|
|
37
|
+
- do not rewrite the PRD
|
|
38
|
+
- do not generate code
|
|
39
|
+
refs:
|
|
40
|
+
- skills/references/business-fact-extraction.md
|
|
41
|
+
- skills/references/skill-reference-matrix.md
|
|
42
|
+
- skills/references/rule-loading-map.md
|
|
43
|
+
- docs/codewiki-knowledge-base.md
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
# Extract Business Facts
|
|
47
|
+
|
|
48
|
+
## Purpose
|
|
49
|
+
|
|
50
|
+
Turn code-backed evidence into reusable business facts.
|
|
51
|
+
|
|
52
|
+
## Suitable / Unsuitable
|
|
53
|
+
|
|
54
|
+
- Suitable: reverse engineering, current behavior mapping, business rule extraction, terminology normalization, evidence-backed summaries
|
|
55
|
+
- Unsuitable: PRD drafting, solution design, implementation, review, final knowledge capture
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
- Start from code paths, tests, docs, runtime traces, and schemas.
|
|
60
|
+
- Produce the output in three stages: code facts, business facts, and CodeWiki updates.
|
|
61
|
+
- Keep evidence, inference, and unknowns distinct.
|
|
62
|
+
- Hand off the result when the facts are stable enough for `domain-modeling`, `spec`, or `knowledge-capture`.
|
|
63
|
+
|
|
64
|
+
## Write Back
|
|
65
|
+
|
|
66
|
+
- When the user wants persistence, render the staged output into a JSON fact pack.
|
|
67
|
+
- Use `skills/extract-business-facts/scripts/write-knowledge-base.js` to write the pack into the knowledge-base files.
|
|
68
|
+
- Keep the pack keyed by target file path under `knowledge-base/`.
|
|
69
|
+
- Write only the smallest matching file for each fact.
|
|
70
|
+
- Treat the script as a writer, not as a second analysis pass.
|
|
71
|
+
|
|
72
|
+
## Inputs / Outputs
|
|
73
|
+
|
|
74
|
+
- Inputs:
|
|
75
|
+
- code paths
|
|
76
|
+
- tests
|
|
77
|
+
- logs
|
|
78
|
+
- docs
|
|
79
|
+
- schemas
|
|
80
|
+
- runtime evidence
|
|
81
|
+
- Outputs:
|
|
82
|
+
- code fact map
|
|
83
|
+
- business fact map
|
|
84
|
+
- codewiki delta
|
|
85
|
+
- handoff notes
|
|
86
|
+
- knowledge-base file targets
|
|
87
|
+
|
|
88
|
+
## Output Template
|
|
89
|
+
|
|
90
|
+
### 1. Code Facts
|
|
91
|
+
|
|
92
|
+
#### `knowledge-base/realtime-code/modules.md`
|
|
93
|
+
|
|
94
|
+
- module:
|
|
95
|
+
- current responsibility:
|
|
96
|
+
- key entry points:
|
|
97
|
+
- important constraints:
|
|
98
|
+
- last verified:
|
|
99
|
+
|
|
100
|
+
#### `knowledge-base/realtime-code/flows.md`
|
|
101
|
+
|
|
102
|
+
- flow name:
|
|
103
|
+
- trigger:
|
|
104
|
+
- path:
|
|
105
|
+
- output:
|
|
106
|
+
- failure points:
|
|
107
|
+
- notes:
|
|
108
|
+
|
|
109
|
+
#### `knowledge-base/realtime-code/runtime-notes.md`
|
|
110
|
+
|
|
111
|
+
- fact:
|
|
112
|
+
- evidence:
|
|
113
|
+
- affected area:
|
|
114
|
+
- date:
|
|
115
|
+
- notes:
|
|
116
|
+
|
|
117
|
+
### 2. Business Facts
|
|
118
|
+
|
|
119
|
+
#### `knowledge-base/requirements/decisions.md`
|
|
120
|
+
|
|
121
|
+
- decision:
|
|
122
|
+
- reason:
|
|
123
|
+
- date or context:
|
|
124
|
+
- affected artifact:
|
|
125
|
+
- notes:
|
|
126
|
+
|
|
127
|
+
#### `knowledge-base/requirements/acceptance.md`
|
|
128
|
+
|
|
129
|
+
- requirement:
|
|
130
|
+
- acceptance criteria:
|
|
131
|
+
- out of scope:
|
|
132
|
+
- open questions:
|
|
133
|
+
- confirmed by:
|
|
134
|
+
|
|
135
|
+
#### `knowledge-base/requirements/conflicts.md`
|
|
136
|
+
|
|
137
|
+
- conflict:
|
|
138
|
+
- source:
|
|
139
|
+
- impact:
|
|
140
|
+
- resolution:
|
|
141
|
+
- status:
|
|
142
|
+
|
|
143
|
+
### 3. CodeWiki Update
|
|
144
|
+
|
|
145
|
+
#### `knowledge-base/codewiki/overview.md`
|
|
146
|
+
|
|
147
|
+
- one-line summary:
|
|
148
|
+
- what the system does:
|
|
149
|
+
- what changed:
|
|
150
|
+
- why it matters:
|
|
151
|
+
|
|
152
|
+
#### `knowledge-base/codewiki/architecture.md`
|
|
153
|
+
|
|
154
|
+
- layers:
|
|
155
|
+
- boundaries:
|
|
156
|
+
- dependencies:
|
|
157
|
+
- major integration points:
|
|
158
|
+
|
|
159
|
+
#### `knowledge-base/codewiki/modules.md`
|
|
160
|
+
|
|
161
|
+
- module name:
|
|
162
|
+
- responsibility:
|
|
163
|
+
- main interfaces:
|
|
164
|
+
- related runtime facts:
|
|
165
|
+
|
|
166
|
+
#### `knowledge-base/codewiki/flows.md`
|
|
167
|
+
|
|
168
|
+
- request flow:
|
|
169
|
+
- data flow:
|
|
170
|
+
- error flow:
|
|
171
|
+
- handoff flow:
|
|
172
|
+
|
|
173
|
+
#### `knowledge-base/codewiki/api.md`
|
|
174
|
+
|
|
175
|
+
- endpoint or contract:
|
|
176
|
+
- request shape:
|
|
177
|
+
- response shape:
|
|
178
|
+
- constraints:
|
|
179
|
+
|
|
180
|
+
#### `knowledge-base/codewiki/runbook.md`
|
|
181
|
+
|
|
182
|
+
- startup:
|
|
183
|
+
- verify:
|
|
184
|
+
- troubleshoot:
|
|
185
|
+
- recover:
|
|
186
|
+
|
|
187
|
+
#### `knowledge-base/codewiki/conventions.md`
|
|
188
|
+
|
|
189
|
+
- naming:
|
|
190
|
+
- layering:
|
|
191
|
+
- error handling:
|
|
192
|
+
- logging:
|
|
193
|
+
- data handling:
|
|
194
|
+
|
|
195
|
+
### 4. Enterprise Note
|
|
196
|
+
|
|
197
|
+
#### `knowledge-base/enterprise/decisions.md`
|
|
198
|
+
|
|
199
|
+
- decision:
|
|
200
|
+
- reason:
|
|
201
|
+
- scope:
|
|
202
|
+
- date:
|
|
203
|
+
- reusable lesson:
|
|
204
|
+
|
|
205
|
+
#### `knowledge-base/enterprise/pitfalls.md`
|
|
206
|
+
|
|
207
|
+
- pitfall:
|
|
208
|
+
- context:
|
|
209
|
+
- why it failed:
|
|
210
|
+
- how to avoid it:
|
|
211
|
+
|
|
212
|
+
#### `knowledge-base/enterprise/examples.md`
|
|
213
|
+
|
|
214
|
+
- example:
|
|
215
|
+
- context:
|
|
216
|
+
- lesson:
|
|
217
|
+
- reusable pattern:
|
|
218
|
+
|
|
219
|
+
#### `knowledge-base/enterprise/ai-coding-rules.md`
|
|
220
|
+
|
|
221
|
+
- rule:
|
|
222
|
+
- when it applies:
|
|
223
|
+
- why it matters:
|
|
224
|
+
- examples:
|
|
225
|
+
|
|
226
|
+
## Sample Output
|
|
227
|
+
|
|
228
|
+
### Code Facts
|
|
229
|
+
|
|
230
|
+
#### `knowledge-base/realtime-code/modules.md`
|
|
231
|
+
|
|
232
|
+
- module: `order-service`
|
|
233
|
+
- current responsibility: creates orders and reserves inventory
|
|
234
|
+
- key entry points: `createOrder()`, `reserveInventory()`
|
|
235
|
+
- important constraints: stock must be checked before commit
|
|
236
|
+
- last verified: 2026-06-22
|
|
237
|
+
|
|
238
|
+
#### `knowledge-base/realtime-code/flows.md`
|
|
239
|
+
|
|
240
|
+
- flow name: checkout order placement
|
|
241
|
+
- trigger: user confirms checkout
|
|
242
|
+
- path: validate stock -> reserve inventory -> create order
|
|
243
|
+
- output: confirmed order or shortage error
|
|
244
|
+
- failure points: stock shortage, reservation failure
|
|
245
|
+
- notes: reservation must happen before the order commit
|
|
246
|
+
|
|
247
|
+
### Business Facts
|
|
248
|
+
|
|
249
|
+
#### `knowledge-base/requirements/decisions.md`
|
|
250
|
+
|
|
251
|
+
- decision: inventory must be reserved before order confirmation
|
|
252
|
+
- reason: avoid overselling
|
|
253
|
+
- date or context: 2026-06-22, order flow review
|
|
254
|
+
- affected artifact: checkout spec
|
|
255
|
+
- notes: failure should return a clear stock shortage message
|
|
256
|
+
|
|
257
|
+
#### `knowledge-base/requirements/acceptance.md`
|
|
258
|
+
|
|
259
|
+
- requirement: checkout must not confirm an order when stock is unavailable
|
|
260
|
+
- acceptance criteria: shortage blocks confirmation and returns a clear message
|
|
261
|
+
- out of scope: backorder design
|
|
262
|
+
- open questions: whether to retry reservation automatically
|
|
263
|
+
- confirmed by: order flow review
|
|
264
|
+
|
|
265
|
+
### CodeWiki Update
|
|
266
|
+
|
|
267
|
+
#### `knowledge-base/codewiki/flows.md`
|
|
268
|
+
|
|
269
|
+
- request flow: checkout -> validate stock -> reserve inventory -> create order
|
|
270
|
+
- data flow: cart snapshot -> reservation record -> order record
|
|
271
|
+
- error flow: stock shortage -> stop checkout -> return shortage reason
|
|
272
|
+
- handoff flow: checkout service hands off to inventory service and order repository
|
|
273
|
+
|
|
274
|
+
#### `knowledge-base/codewiki/modules.md`
|
|
275
|
+
|
|
276
|
+
- module name: `order-service`
|
|
277
|
+
- responsibility: coordinates checkout and order creation
|
|
278
|
+
- main interfaces: `createOrder()`, `reserveInventory()`
|
|
279
|
+
- related runtime facts: inventory must be reserved before commit
|
|
280
|
+
|
|
281
|
+
### Enterprise Note
|
|
282
|
+
|
|
283
|
+
#### `knowledge-base/enterprise/pitfalls.md`
|
|
284
|
+
|
|
285
|
+
- pitfall: reservation happens after order creation
|
|
286
|
+
- context: checkout path
|
|
287
|
+
- why it failed: allowed overselling under concurrent requests
|
|
288
|
+
- how to avoid it: reserve before committing the order
|
|
289
|
+
|
|
290
|
+
#### `knowledge-base/enterprise/ai-coding-rules.md`
|
|
291
|
+
|
|
292
|
+
- rule: reserve inventory before committing the order
|
|
293
|
+
- when it applies: any checkout flow that can oversell
|
|
294
|
+
- why it matters: keeps business state consistent under concurrency
|
|
295
|
+
- examples: validate stock, reserve, then create the order
|
|
296
|
+
|
|
297
|
+
## Workflow
|
|
298
|
+
|
|
299
|
+
1. Collect code, test, doc, and runtime evidence for the requested area.
|
|
300
|
+
2. Write the code fact map with observed behavior, state changes, contracts, and evidence.
|
|
301
|
+
3. Derive the business fact map from the code facts and separate inference from proof.
|
|
302
|
+
4. Draft the CodeWiki delta with reusable architecture, flow, and convention updates.
|
|
303
|
+
5. Map each section to the exact knowledge-base files it should update.
|
|
304
|
+
6. Mark each fact as evidence-backed, inferred, or unknown.
|
|
305
|
+
7. Summarize gaps, contradictions, and open questions.
|
|
306
|
+
8. Hand off to `domain-modeling`, `spec`, or `knowledge-capture`.
|
|
307
|
+
|
|
308
|
+
## Replay Signals
|
|
309
|
+
|
|
310
|
+
- Input signal: codebase walkthrough, behavior reconstruction, business rule extraction, or current-state analysis.
|
|
311
|
+
- Output to verify: code fact map, business fact map, codewiki delta, file targets, gap list.
|
|
312
|
+
- Stop signal: solution design, PRD rewriting, or code generation.
|
|
313
|
+
- Handoff signal: the extracted facts are stable enough for downstream modeling or capture.
|
|
314
|
+
|
|
315
|
+
## Gotchas
|
|
316
|
+
|
|
317
|
+
- Do not infer business intent from comments alone.
|
|
318
|
+
- Do not merge evidence-backed facts and assumptions into one claim.
|
|
319
|
+
- Do not skip contradictory evidence.
|
|
320
|
+
- Do not turn extraction into design.
|
|
321
|
+
- Do not write the CodeWiki delta before the code facts are stable.
|
|
322
|
+
- Do not leave file targets implicit.
|
|
323
|
+
|
|
324
|
+
## Stop Rules
|
|
325
|
+
|
|
326
|
+
- Stop at fact extraction.
|
|
327
|
+
- Do not design a new solution.
|
|
328
|
+
- Do not rewrite the PRD.
|
|
329
|
+
- Do not generate code.
|
|
330
|
+
|
|
331
|
+
## References
|
|
332
|
+
|
|
333
|
+
- `skills/references/business-fact-extraction.md`
|
|
334
|
+
- `skills/references/skill-reference-matrix.md`
|
|
335
|
+
- `skills/references/rule-loading-map.md`
|
|
336
|
+
- `docs/codewiki-knowledge-base.md`
|