@gordon.gan/specflow 1.3.3-beta → 1.4.1
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/README.md +6 -2
- package/dist/integrations/shared/capability-evidence.js +37 -1
- package/dist/integrations/shared/command-catalog.js +1 -0
- package/dist/integrations/shared/parity-manifest.js +6 -0
- package/package.json +1 -1
- package/prompts/approval/database-guidance.md +79 -0
- package/prompts/approval/generate.md +1191 -0
- package/skills/database/LICENSE +405 -0
- package/skills/database/ORIGIN.md +6 -0
- package/skills/database/README.md +30 -0
- package/skills/database/elasticsearch/LICENSE.txt +202 -0
- package/skills/database/elasticsearch/SKILL.md +199 -0
- package/skills/database/elasticsearch/examples/01-fulltext-search.md +215 -0
- package/skills/database/elasticsearch/examples/02-aggregation-report.md +206 -0
- package/skills/database/elasticsearch/examples/03-reindex-zero-downtime.md +200 -0
- package/skills/database/elasticsearch/examples/04-cluster-monitoring.md +204 -0
- package/skills/database/elasticsearch/references/01-query-dsl-fulltext.md +162 -0
- package/skills/database/elasticsearch/references/02-query-dsl-term.md +210 -0
- package/skills/database/elasticsearch/references/03-aggregations-metric.md +161 -0
- package/skills/database/elasticsearch/references/04-aggregations-bucket.md +236 -0
- package/skills/database/elasticsearch/references/05-mapping-types.md +134 -0
- package/skills/database/elasticsearch/references/06-analyzers.md +187 -0
- package/skills/database/elasticsearch/references/07-cluster-ops.md +225 -0
- package/skills/database/elasticsearch/references/08-elk-integration.md +170 -0
- package/skills/database/mysql/SKILL.md +195 -0
- package/skills/database/mysql/examples/01-connection-pool.md +75 -0
- package/skills/database/mysql/examples/02-slow-query-optimization.md +98 -0
- package/skills/database/mysql/examples/03-master-slave-setup.md +144 -0
- package/skills/database/mysql/examples/04-backup-strategy.md +212 -0
- package/skills/database/mysql/references/01-functions-string.md +103 -0
- package/skills/database/mysql/references/02-functions-date.md +152 -0
- package/skills/database/mysql/references/03-functions-aggregate-window.md +167 -0
- package/skills/database/mysql/references/04-functions-json.md +129 -0
- package/skills/database/mysql/references/05-sql-ddl-types.md +235 -0
- package/skills/database/mysql/references/06-index-optimization.md +232 -0
- package/skills/database/mysql/references/07-replication-ha.md +213 -0
- package/skills/database/mysql/references/08-backup-restore.md +207 -0
- package/skills/database/mysql/references/09-advanced-features.md +345 -0
- package/skills/database/oracle/LICENSE.txt +202 -0
- package/skills/database/oracle/SKILL.md +238 -0
- package/skills/database/oracle/examples/01-plsql-procedure.md +90 -0
- package/skills/database/oracle/examples/02-awr-analysis.md +99 -0
- package/skills/database/oracle/examples/03-rman-backup.md +108 -0
- package/skills/database/oracle/examples/04-dataguard-setup.md +146 -0
- package/skills/database/oracle/references/01-functions-string.md +91 -0
- package/skills/database/oracle/references/02-functions-date.md +71 -0
- package/skills/database/oracle/references/03-analytic-functions.md +103 -0
- package/skills/database/oracle/references/04-plsql-guide.md +303 -0
- package/skills/database/oracle/references/05-performance-tuning.md +164 -0
- package/skills/database/oracle/references/06-backup-recovery.md +115 -0
- package/skills/database/oracle/references/07-dataguard-rac.md +76 -0
- package/skills/database/oracle/references/08-security.md +170 -0
- package/skills/database/oracle/references/09-sql-syntax.md +152 -0
- package/skills/database/oracle/references/10-features.md +174 -0
- package/skills/database/postgresql/LICENSE.txt +202 -0
- package/skills/database/postgresql/SKILL.md +182 -0
- package/skills/database/postgresql/examples/.gitkeep +0 -0
- package/skills/database/postgresql/examples/01-jsonb-query.md +72 -0
- package/skills/database/postgresql/examples/02-cte-recursive.md +110 -0
- package/skills/database/postgresql/examples/03-performance-tuning.md +114 -0
- package/skills/database/postgresql/examples/04-streaming-replication.md +113 -0
- package/skills/database/postgresql/references/.gitkeep +0 -0
- package/skills/database/postgresql/references/01-functions-string.md +174 -0
- package/skills/database/postgresql/references/02-functions-datetime.md +54 -0
- package/skills/database/postgresql/references/03-functions-aggregate-window.md +142 -0
- package/skills/database/postgresql/references/04-functions-jsonb.md +117 -0
- package/skills/database/postgresql/references/05-fulltext-search.md +109 -0
- package/skills/database/postgresql/references/06-index-types.md +95 -0
- package/skills/database/postgresql/references/07-partition-fdw.md +133 -0
- package/skills/database/postgresql/references/08-replication-backup.md +215 -0
- package/skills/database/redis/LICENSE.txt +202 -0
- package/skills/database/redis/SKILL.md +922 -0
- package/skills/database/redis/examples/01-cache-usage.md +104 -0
- package/skills/database/redis/examples/02-session-storage.md +72 -0
- package/skills/database/redis/examples/03-leaderboard.md +63 -0
- package/skills/database/redis/examples/04-redis-cluster-setup.md +70 -0
- package/skills/database/redis/examples/05-stream-queue.md +65 -0
- package/skills/database/redis/references/command-quick-ref.md +180 -0
- package/skills/database/redis/references/commands-admin-key.md +413 -0
- package/skills/database/redis/references/commands-set-sorted-advanced.md +539 -0
- package/skills/database/redis/references/commands-string-hash-list.md +458 -0
- package/skills/database/redis/references/memory-optimization.md +150 -0
- package/skills/database/redis/references/redis-conf-production.md +139 -0
- package/skills/specflow-approval/SKILL.md +427 -0
- package/templates/approval.md +464 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Redis 生产配置最佳实践
|
|
2
|
+
|
|
3
|
+
## 推荐生产配置 (redis.conf)
|
|
4
|
+
|
|
5
|
+
```conf
|
|
6
|
+
# ────────────────────────────────────
|
|
7
|
+
# 基础配置
|
|
8
|
+
# ────────────────────────────────────
|
|
9
|
+
daemonize no
|
|
10
|
+
pidfile /var/run/redis_6379.pid
|
|
11
|
+
port 6379
|
|
12
|
+
bind 0.0.0.0 # 生产环境改为内网 IP
|
|
13
|
+
protected-mode yes
|
|
14
|
+
|
|
15
|
+
# ────────────────────────────────────
|
|
16
|
+
# 内存管理
|
|
17
|
+
# ────────────────────────────────────
|
|
18
|
+
maxmemory 4gb
|
|
19
|
+
maxmemory-policy allkeys-lru
|
|
20
|
+
maxmemory-samples 10 # LRU 采样样本数 (越大越精确)
|
|
21
|
+
|
|
22
|
+
# ────────────────────────────────────
|
|
23
|
+
# 持久化 — 混合模式
|
|
24
|
+
# ────────────────────────────────────
|
|
25
|
+
save 900 1
|
|
26
|
+
save 300 10
|
|
27
|
+
save 60 10000
|
|
28
|
+
stop-writes-on-bgsave-error yes
|
|
29
|
+
rdbcompression yes
|
|
30
|
+
rdbchecksum yes
|
|
31
|
+
dbfilename dump.rdb
|
|
32
|
+
dir /data/redis/
|
|
33
|
+
|
|
34
|
+
appendonly yes
|
|
35
|
+
appendfilename "appendonly.aof"
|
|
36
|
+
appendfsync everysec
|
|
37
|
+
no-appendfsync-on-rewrite no
|
|
38
|
+
auto-aof-rewrite-percentage 100
|
|
39
|
+
auto-aof-rewrite-min-size 64mb
|
|
40
|
+
aof-load-truncated yes
|
|
41
|
+
aof-use-rdb-preamble yes # 混合持久化 (Redis 4.0+)
|
|
42
|
+
|
|
43
|
+
# ────────────────────────────────────
|
|
44
|
+
# 网络与连接
|
|
45
|
+
# ────────────────────────────────────
|
|
46
|
+
tcp-backlog 511
|
|
47
|
+
timeout 300
|
|
48
|
+
tcp-keepalive 300
|
|
49
|
+
maxclients 10000
|
|
50
|
+
|
|
51
|
+
# ────────────────────────────────────
|
|
52
|
+
# 复制
|
|
53
|
+
# ────────────────────────────────────
|
|
54
|
+
replica-serve-stale-data yes
|
|
55
|
+
replica-read-only yes
|
|
56
|
+
repl-diskless-sync no
|
|
57
|
+
repl-diskless-sync-delay 5
|
|
58
|
+
repl-disable-tcp-nodelay no
|
|
59
|
+
replica-priority 100
|
|
60
|
+
|
|
61
|
+
# ────────────────────────────────────
|
|
62
|
+
# 安全
|
|
63
|
+
# ────────────────────────────────────
|
|
64
|
+
requirepass your-strong-password-here
|
|
65
|
+
rename-command FLUSHALL ""
|
|
66
|
+
rename-command FLUSHDB ""
|
|
67
|
+
rename-command CONFIG ""
|
|
68
|
+
rename-command SHUTDOWN ""
|
|
69
|
+
rename-command DEBUG ""
|
|
70
|
+
rename-command SLAVEOF ""
|
|
71
|
+
|
|
72
|
+
# ────────────────────────────────────
|
|
73
|
+
# 慢查询日志
|
|
74
|
+
# ────────────────────────────────────
|
|
75
|
+
slowlog-log-slower-than 10000 # 记录 >10ms 的命令
|
|
76
|
+
slowlog-max-len 128
|
|
77
|
+
|
|
78
|
+
# ────────────────────────────────────
|
|
79
|
+
# 高级配置
|
|
80
|
+
# ────────────────────────────────────
|
|
81
|
+
hash-max-ziplist-entries 512
|
|
82
|
+
hash-max-ziplist-value 64
|
|
83
|
+
list-max-ziplist-size -2
|
|
84
|
+
list-compress-depth 0
|
|
85
|
+
set-max-intset-entries 512
|
|
86
|
+
zset-max-ziplist-entries 128
|
|
87
|
+
zset-max-ziplist-value 64
|
|
88
|
+
|
|
89
|
+
hz 10
|
|
90
|
+
dynamic-hz yes
|
|
91
|
+
activedefrag yes # 自动碎片整理 (Redis 4.0+)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Docker 部署
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# 单机 Redis
|
|
98
|
+
docker run -d --name redis \
|
|
99
|
+
-p 6379:6379 \
|
|
100
|
+
-v /data/redis/data:/data \
|
|
101
|
+
-v /data/redis/redis.conf:/usr/local/etc/redis/redis.conf \
|
|
102
|
+
redis:7-alpine redis-server /usr/local/etc/redis/redis.conf
|
|
103
|
+
|
|
104
|
+
# Redis Cluster
|
|
105
|
+
docker network create redis-cluster
|
|
106
|
+
|
|
107
|
+
for port in 7000 7001 7002 7003 7004 7005; do
|
|
108
|
+
mkdir -p /data/redis/${port}
|
|
109
|
+
docker run -d --name redis-${port} \
|
|
110
|
+
--net redis-cluster \
|
|
111
|
+
-p ${port}:${port} \
|
|
112
|
+
-v /data/redis/${port}:/data \
|
|
113
|
+
redis:7-alpine redis-server \
|
|
114
|
+
--port ${port} \
|
|
115
|
+
--cluster-enabled yes \
|
|
116
|
+
--cluster-config-file nodes.conf \
|
|
117
|
+
--cluster-node-timeout 5000 \
|
|
118
|
+
--appendonly yes
|
|
119
|
+
done
|
|
120
|
+
|
|
121
|
+
# 创建集群
|
|
122
|
+
docker exec redis-7000 redis-cli --cluster create \
|
|
123
|
+
192.168.1.100:7000 192.168.1.100:7001 192.168.1.100:7002 \
|
|
124
|
+
192.168.1.100:7003 192.168.1.100:7004 192.168.1.100:7005 \
|
|
125
|
+
--cluster-replicas 1
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 性能调优检查清单
|
|
129
|
+
|
|
130
|
+
- [ ] `maxmemory` 设置为物理内存的 60-70%
|
|
131
|
+
- [ ] `maxmemory-policy` 设为 `allkeys-lru`(缓存场景)
|
|
132
|
+
- [ ] 禁用危险命令(FLUSHALL/CONFIG/EVAL...)
|
|
133
|
+
- [ ] 慢查询阈值 ≤ 10ms
|
|
134
|
+
- [ ] 连接池配置合理(maxTotal ≤ maxclients)
|
|
135
|
+
- [ ] Big Key 已拆分或索引
|
|
136
|
+
- [ ] 不分业务混用实例
|
|
137
|
+
- [ ] 监控指标已接入(INFO 命令定期采集)
|
|
138
|
+
- [ ] RDB + AOF 混合持久化已配置
|
|
139
|
+
- [ ] 主从 / Sentinel / Cluster 已部署
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specflow-approval
|
|
3
|
+
description: "Post-refine technical approval document -- AI closed-loop check + code/baseline grounding + over-design guard + implementability assessment"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SpecFlow: Approval
|
|
7
|
+
|
|
8
|
+
> **HARD GATE**: phase must be `refined`. Run `/specflow:refine` first if not.
|
|
9
|
+
> **HARD GATE**: User must confirm before `approval.md` is written to the change directory.
|
|
10
|
+
> Approval does NOT advance phase — it produces an optional review artifact for human sign-off.
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
Approval is the **post-refine, pre-apply technical review pass**: it reads the four
|
|
15
|
+
refined artifacts (`proposal.md`, delta `specs/`, `design.md`, `tasks.md`), **grounds them
|
|
16
|
+
against existing project code and spec baseline**, and produces a single `approval.md`
|
|
17
|
+
technical-approval document for human sign-off.
|
|
18
|
+
|
|
19
|
+
It is **optional**. Skip it when you want to go straight from refine to apply. Use it when
|
|
20
|
+
the change is significant enough to warrant formal technical review before implementation
|
|
21
|
+
begins — architecture decisions, cross-team impact, regulatory exposure, or any change where
|
|
22
|
+
"should we even build this, this way?" deserves a documented answer.
|
|
23
|
+
|
|
24
|
+
Unlike `/specflow:review` (which reviews code after implementation) and `/specflow:verify`
|
|
25
|
+
(which validates implementation against specs), approval reviews the **plan** before any
|
|
26
|
+
code is written. It fills the gap between refine convergence and apply execution.
|
|
27
|
+
|
|
28
|
+
Approval does five things a deterministic CLI cannot:
|
|
29
|
+
|
|
30
|
+
1. **Integrates** the four artifacts into a single narrative with cross-references.
|
|
31
|
+
2. **Checks closed-loop coherence** across requirements ↔ design ↔ specs ↔ tasks using
|
|
32
|
+
semantic reasoning (fuzzy wording detection, coverage gaps, traceability).
|
|
33
|
+
3. **Grounds the plan against reality** — reads existing project code (anchor files) and
|
|
34
|
+
the main spec baseline to verify the plan can actually land on this codebase.
|
|
35
|
+
4. **Guards design quality** — detects over-engineering (YAGNI violations) while confirming
|
|
36
|
+
reasonable extensibility is preserved.
|
|
37
|
+
5. **Assesses implementability** — can an engineer execute this plan without getting stuck?
|
|
38
|
+
|
|
39
|
+
## Invocation
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
/specflow:approval <change-name>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Cursor: `specflow:approval <change-name>`;Codex: `$specflow-approval <change-name>`.
|
|
46
|
+
|
|
47
|
+
## Prerequisites
|
|
48
|
+
|
|
49
|
+
- An active change exists with `.specflow.yaml` and `phase: refined`.
|
|
50
|
+
- If phase is not `refined`, REFUSE to proceed and suggest: "This change is in phase
|
|
51
|
+
`<phase>`. Run `/specflow:refine` first to complete deep review before generating an
|
|
52
|
+
approval document."
|
|
53
|
+
- All four refined artifacts exist in `specflow/changes/<name>/`:
|
|
54
|
+
- `proposal.md`
|
|
55
|
+
- `specs/**/*.md` (at least one delta spec)
|
|
56
|
+
- `design.md`
|
|
57
|
+
- `tasks.md`
|
|
58
|
+
- `specflow` CLI is available on PATH (for `specflow validate` and optional status lookup).
|
|
59
|
+
- Optional: `explore.md` with `Status: confirmed` (enriches the approval's "why" section).
|
|
60
|
+
|
|
61
|
+
## Artifact Language Setup
|
|
62
|
+
|
|
63
|
+
Read `.claude/specflow/prompts/shared/artifact-language.md` and resolve the active planning
|
|
64
|
+
root's `specflow/config.yaml` before generating `approval.md`. Apply the policy to all
|
|
65
|
+
human-readable narrative content (summaries, assessments, evidence). Preserve protocol
|
|
66
|
+
markers (`### Requirement:`, `#### Scenario:`, `- **WHEN**`, `- **THEN**`), capability IDs,
|
|
67
|
+
change names, file paths, commands, and code in their original form.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Stage 1: Pre-flight Validation
|
|
72
|
+
|
|
73
|
+
1. Read `.specflow.yaml` and confirm `phase: refined`. If not, refuse and suggest `/specflow:refine`.
|
|
74
|
+
2. Confirm all four artifacts exist. If any is missing, stop and tell the user which are missing.
|
|
75
|
+
3. Read `specflow/config.yaml` and resolve `artifacts.language` (default `en`).
|
|
76
|
+
4. Detect project tech stack signals at the project root only (do not recurse):
|
|
77
|
+
- `package.json` → Node/TS/JS ecosystem
|
|
78
|
+
- `go.mod` → Go
|
|
79
|
+
- `pyproject.toml` / `requirements.txt` → Python
|
|
80
|
+
- `Cargo.toml` → Rust
|
|
81
|
+
- `tsconfig.json` → TypeScript (refines Node detection)
|
|
82
|
+
- If none match, set `techStack: unknown`
|
|
83
|
+
5. **Detect database stack** (for §4.4 guidance). Follow
|
|
84
|
+
`prompts/approval/database-guidance.md` §1 — set
|
|
85
|
+
`dbStack: mysql|postgresql|oracle|redis|elasticsearch|none`. Prefer OLTP
|
|
86
|
+
(`mysql`/`postgresql`/`oracle`) over cache/search when multiple match.
|
|
87
|
+
6. Read `specflow/specs/` baseline if it exists (for Pass 7 baseline cross-check).
|
|
88
|
+
|
|
89
|
+
Announce: "Generating technical approval document for change `<name>` (phase=refined, language=<lang>, techStack=<stack>, dbStack=<db>)."
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Stage 2: Load Execution Instructions
|
|
94
|
+
|
|
95
|
+
Read these files and follow them:
|
|
96
|
+
|
|
97
|
+
1. `.claude/specflow/prompts/approval/generate.md` (or repo `prompts/approval/generate.md`)
|
|
98
|
+
2. `prompts/approval/database-guidance.md` — DB skill router for **local** packs under
|
|
99
|
+
`skills/database/` (in-repo maintenance; **no remote skill dependency**). **Not an MCP
|
|
100
|
+
tool**: on `dbStack` hit, `Read` matched `SKILL.md` + focused references; on `none`,
|
|
101
|
+
LLM-only §4.4.
|
|
102
|
+
|
|
103
|
+
`generate.md` + `database-guidance.md` together specify:
|
|
104
|
+
|
|
105
|
+
- The 7-dimension closed-loop verification (Passes 1–7, each with AI self-prompt, verdict rules, evidence format)
|
|
106
|
+
- The design quality assessment (over-engineering signals + extensibility signals)
|
|
107
|
+
- The architecture design (Mermaid diagrams + **图要点说明** + core-component table)
|
|
108
|
+
- The detailed design generation (设计要点一览 + Happy Path 完整时序 + 业务场景时序与说明 +
|
|
109
|
+
data ER/DDL + interfaces inventory/fields/examples/errors + logic/config/compat)
|
|
110
|
+
- The test strategy (layered test matrix mapped to §5 acceptance criteria)
|
|
111
|
+
- The deployment/release/rollback plan
|
|
112
|
+
- The implementability assessment (7 dimensions with verdict rules)
|
|
113
|
+
- The approval document structure and generation rules
|
|
114
|
+
- Protocol-marker preservation and language policy enforcement
|
|
115
|
+
- §1 绪论与边界 (proposal + optional explore + AI; absorbs What/Impact; **no 变更摘要 chapter**;
|
|
116
|
+
pain-point diagram, User Journey, Non-Goals with reasons)
|
|
117
|
+
- Document order: §1 绪论 → §2 评估 → §3 架构 → §4 详细设计 → **§5 验收标准** → §6 测试 → …
|
|
118
|
+
- **Quality Gates G1–G4** + **Style & Tone** (hard rules in generate.md Part E)
|
|
119
|
+
- **DB guidance router** (`database-guidance.md` + local `skills/database/`): match project
|
|
120
|
+
stack → Read in-repo skill; no hit → LLM fallback; **never** fetch remote skills / MCP wrap
|
|
121
|
+
- Anchor-file extraction and code-reading rules (depth: anchor file only, no recursion)
|
|
122
|
+
|
|
123
|
+
You MUST read `generate.md` before performing any analysis or writing `approval.md`. Do not
|
|
124
|
+
invent the assessment dimensions or document structure — they are defined in that prompt.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Stage 3: Extract Anchor Files
|
|
129
|
+
|
|
130
|
+
Before running the closed-loop passes, extract the set of **anchor files** that the plan
|
|
131
|
+
references. These are the files Pass 6 (Code Grounding) will read.
|
|
132
|
+
|
|
133
|
+
**Extraction rules** (defined in detail in `generate.md` Part A → Pass 6):
|
|
134
|
+
|
|
135
|
+
1. Scan `design.md` and `tasks.md` for file path references (backtick-quoted paths, code
|
|
136
|
+
blocks, or inline paths like `src/core/...`).
|
|
137
|
+
2. Collect only paths under the project root that look like source files (`.ts`, `.js`,
|
|
138
|
+
`.py`, `.go`, `.rs`, `.kt`, `.java`, etc.) or config files (`package.json`, `tsconfig.json`,
|
|
139
|
+
etc.).
|
|
140
|
+
3. Deduplicate. Do NOT read directories, only files.
|
|
141
|
+
4. **Depth limit: read the anchor file itself only.** Do not follow imports, do not recurse.
|
|
142
|
+
5. If no anchor files are found and the project has no source code (greenfield), Pass 6
|
|
143
|
+
will emit `skipped (greenfield — no existing code)`. If the project HAS source code but
|
|
144
|
+
the plan references no existing files, that is a `FAIL` (plan is ungrounded).
|
|
145
|
+
|
|
146
|
+
Announce the extracted anchor file list to the user before Pass 1 begins.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Stage 4: AI Closed-Loop Verification
|
|
151
|
+
|
|
152
|
+
Perform the 7 closed-loop passes defined in `generate.md`, in order:
|
|
153
|
+
|
|
154
|
+
### Internal coherence (Passes 1–5)
|
|
155
|
+
|
|
156
|
+
1. **Pass 1 — Requirement Closure**: proposal ↔ specs coverage
|
|
157
|
+
2. **Pass 2 — Design Closure**: design decisions ↔ spec requirements
|
|
158
|
+
3. **Pass 3 — Spec Closure**: scenario completeness + testability (3-level grading) + delta integrity
|
|
159
|
+
4. **Pass 4 — Implementation Closure**: tasks ↔ spec requirements coverage + granularity
|
|
160
|
+
5. **Pass 5 — Risk Closure**: risks ↔ mitigations + BREAKING migration + unidentified risks
|
|
161
|
+
|
|
162
|
+
### External grounding (Passes 6–7)
|
|
163
|
+
|
|
164
|
+
6. **Pass 6 — Code Grounding**: design/tasks anchor files exist in the project + structure
|
|
165
|
+
compatibility + tech-stack consistency. Reads actual project code (anchor files only).
|
|
166
|
+
7. **Pass 7 — Baseline Cross-Check**: delta specs vs `specflow/specs/` main baseline —
|
|
167
|
+
conflict detection, duplicate-definition detection, MODIFIED name matching.
|
|
168
|
+
|
|
169
|
+
Each Pass must produce a brief result for the conversation (verdict + one-line evidence).
|
|
170
|
+
Do **not** dump full coverage matrices into chat unless the user asks or a Pass is
|
|
171
|
+
`WARNING`/`FAIL`.
|
|
172
|
+
|
|
173
|
+
### Closed-Loop Overall Verdict
|
|
174
|
+
|
|
175
|
+
After all 7 Passes:
|
|
176
|
+
|
|
177
|
+
- `FAIL` if any Pass is `FAIL`
|
|
178
|
+
- `PASS WITH WARNINGS` if no `FAIL` but at least one `WARNING`
|
|
179
|
+
- `PASS` if all Passes are `PASS` (a `SKIPPED` Pass does not affect the verdict)
|
|
180
|
+
|
|
181
|
+
When writing `approval.md` **§8**, use the **single compact table** only (see generate.md
|
|
182
|
+
Part E §8): no per-Pass long sections, no duplicate summary table. Expand evidence only
|
|
183
|
+
for ⚠️/❌ rows (max 2–3 bullets).
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Stage 5: Design Quality Assessment
|
|
188
|
+
|
|
189
|
+
Perform the two design-quality checks defined in `generate.md` Part B:
|
|
190
|
+
|
|
191
|
+
### Over-Engineering Check
|
|
192
|
+
|
|
193
|
+
Scan `design.md` and `tasks.md` for the 5 over-engineering signals:
|
|
194
|
+
|
|
195
|
+
1. Interface for unrequested requirements
|
|
196
|
+
2. Unnecessary abstraction layers
|
|
197
|
+
3. Pre-built unused infrastructure
|
|
198
|
+
4. Config fields beyond current needs
|
|
199
|
+
5. Complexity exceeding problem scale
|
|
200
|
+
|
|
201
|
+
**Verdict rule**: 1 signal → `WARNING`; 3+ signals → `FAIL`; 0 signals → `PASS`.
|
|
202
|
+
|
|
203
|
+
### Extensibility Assessment
|
|
204
|
+
|
|
205
|
+
Scan `design.md` for the 5 extensibility signals:
|
|
206
|
+
|
|
207
|
+
1. Namespace reservation
|
|
208
|
+
2. Stable interface, replaceable implementation
|
|
209
|
+
3. Explicit Non-Goals
|
|
210
|
+
4. Backward-compatibility path
|
|
211
|
+
5. Decision rationale mentions extensibility trade-off
|
|
212
|
+
|
|
213
|
+
**Verdict rule**: 4-5 signals present → `PASS`; 2-3 → `WARNING`; 0-1 → `WARNING`.
|
|
214
|
+
|
|
215
|
+
### Combined Design Quality Verdict
|
|
216
|
+
|
|
217
|
+
- `FAIL` if over-engineering is `FAIL`
|
|
218
|
+
- `WARNING` if either check is `WARNING`
|
|
219
|
+
- `PASS` if both are `PASS`
|
|
220
|
+
- **Special**: if over-engineering = `WARNING`/`FAIL` AND extensibility = `WARNING` →
|
|
221
|
+
escalate to `FAIL` (the plan is both bloated AND not extensible)
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Stage 6: Architecture Design
|
|
226
|
+
|
|
227
|
+
Produce the **architecture design** section (approval.md **§3** 架构整体设计) defined in
|
|
228
|
+
`generate.md` Part E. This answers "what modules make up the system, how they depend on
|
|
229
|
+
and interact with each other, and what each module's responsibility and boundary is."
|
|
230
|
+
|
|
231
|
+
It is complementary to Detailed Design: architecture is about **module-to-module
|
|
232
|
+
relationships** (macro), detailed design is about **module-internal implementation**
|
|
233
|
+
(micro). Architecture is placed **before** acceptance criteria so implementers read
|
|
234
|
+
structure first.
|
|
235
|
+
|
|
236
|
+
### 3.1 Overall Architecture
|
|
237
|
+
|
|
238
|
+
Draw Mermaid diagram(s) — module dependency / layered and optionally system interaction:
|
|
239
|
+
|
|
240
|
+
Requirements:
|
|
241
|
+
|
|
242
|
+
1. **Mark changed modules** (`[新增]` / `[修改]`) so the change surface is visible.
|
|
243
|
+
2. Label edges with dependency direction or interaction messages.
|
|
244
|
+
3. Project-type mapping: CLI/library → `src/core/*`, `src/cli/*`; Web → services/components;
|
|
245
|
+
multi-repo → repositories/services.
|
|
246
|
+
4. Consistent with **§2** decisions.
|
|
247
|
+
5. **Hard rule — 图要点说明**: every architecture diagram MUST be followed by a numbered
|
|
248
|
+
「设计说明 / 图要点」list (boundaries, invariants, reuse vs new) — not a restatement of
|
|
249
|
+
node names. Align with scenario-job-compile §3 style.
|
|
250
|
+
|
|
251
|
+
### 3.2 Core Components
|
|
252
|
+
|
|
253
|
+
| Component | Responsibility | Boundary (does / does NOT) | Depends on | Change type |
|
|
254
|
+
|-----------|---------------|----------------------------|-----------|-------------|
|
|
255
|
+
|
|
256
|
+
Requirements: list added+modified components;「不做什么」boundaries; 1:1 with diagram;
|
|
257
|
+
trace to §2 decisions. Optional short「组件边界总原则」list.
|
|
258
|
+
|
|
259
|
+
**If no architecture change**: write explicit `不涉及架构变更(...)` marker.
|
|
260
|
+
|
|
261
|
+
### 3.3 Architecture Consistency Self-check
|
|
262
|
+
|
|
263
|
+
- Diagrams mark added/modified modules; each has 图要点说明.
|
|
264
|
+
- Each component has a "does NOT do" boundary; diagram ↔ table 1:1.
|
|
265
|
+
- Boundaries trace to §2 decisions.
|
|
266
|
+
|
|
267
|
+
Present the architecture design to the user as part of the confirmation summary.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Stage 7: Detailed Design
|
|
272
|
+
|
|
273
|
+
Produce the **detailed design** section (approval.md **§4** 方案详细设计) defined in
|
|
274
|
+
`generate.md` Part E.
|
|
275
|
+
|
|
276
|
+
**Selective** categories; uninvolved ones get explicit「不涉及 X」markers.
|
|
277
|
+
|
|
278
|
+
Order and hard requirements (from `generate.md` §4.1–4.8):
|
|
279
|
+
|
|
280
|
+
1. **设计要点一览** — P1…Pn invariants from design decisions (required).
|
|
281
|
+
2. **核心业务时序 · Happy Path** — complete Mermaid `sequenceDiagram` for the main success
|
|
282
|
+
path + post-diagram「设计要点」(required).
|
|
283
|
+
3. **业务场景时序** — each scenario: purpose + diagram + **设计要点说明** (required notes;
|
|
284
|
+
bare diagrams fail quality).
|
|
285
|
+
4. **数据结构** — Before drafting §4.4: follow `database-guidance.md`. If `dbStack` hit,
|
|
286
|
+
`Read` `skills/database/<stack>/SKILL.md` (+ DDL/index/JSON refs as needed).
|
|
287
|
+
If `none`, LLM-only with SpecFlow §4.4 hard bar (ER + full CREATE TABLE + field tables…).
|
|
288
|
+
5. **接口设计** — inventory + fields + examples + errors…
|
|
289
|
+
6. **核心算法 / 配置 / 兼容性** — as applicable.
|
|
290
|
+
|
|
291
|
+
**Traceability**: every element → **§5** Requirement/Scenario and **§2** decision.
|
|
292
|
+
If not implementer-ready, mark `[待 refine 澄清: <元素>]`.
|
|
293
|
+
|
|
294
|
+
Present the detailed design to the user as part of the confirmation summary.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Stage 8: Acceptance Criteria (after design)
|
|
299
|
+
|
|
300
|
+
Produce **§5 验收标准** only **after** §3 architecture and §4 detailed design are drafted
|
|
301
|
+
in the document order. Exhaustive Requirement + Scenario list with 3-level testability.
|
|
302
|
+
Do not place acceptance before the design chapters.
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Stage 9: Test Strategy
|
|
307
|
+
|
|
308
|
+
Produce the **test strategy** section (approval.md **§6** 测试策略). Every §5 acceptance
|
|
309
|
+
criterion maps to ≥1 test layer with tools and verifiable goals.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Stage 10: Deployment & Release
|
|
314
|
+
|
|
315
|
+
Produce the **deployment / release / rollback** section (approval.md **§7**).
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Stage 11: Implementability Assessment
|
|
320
|
+
|
|
321
|
+
Perform the 7 implementability dimensions defined in `generate.md` Part C.
|
|
322
|
+
|
|
323
|
+
1. **Completeness** — no TODOs, placeholders, vague tasks
|
|
324
|
+
2. **Spec Alignment** — tasks cover all spec requirements, no scope creep
|
|
325
|
+
3. **Task Actionability** — can an engineer execute each task without ambiguity
|
|
326
|
+
4. **Technical Feasibility** — design decisions are achievable in the detected tech stack
|
|
327
|
+
5. **Dependency Clarity** — task dependencies and external dependencies are explicit
|
|
328
|
+
6. **Architecture Consistency** — design choices match project's existing tech stack, directory structure, error-handling patterns, and test framework (grounded in code reading from Pass 6)
|
|
329
|
+
7. **Implementation Risk** — high-risk module changes, data migration, concurrency, external API breaks, team tech-stack unfamiliarity
|
|
330
|
+
|
|
331
|
+
Each dimension produces a verdict (`READY` | `NEEDS REFINEMENT` | `BLOCKED`) with evidence.
|
|
332
|
+
|
|
333
|
+
### Implementability Overall Verdict
|
|
334
|
+
|
|
335
|
+
- `BLOCKED` if any dimension is `BLOCKED`
|
|
336
|
+
- `NEEDS REFINEMENT` if no `BLOCKED` but any dimension is `NEEDS REFINEMENT`
|
|
337
|
+
- `READY` if all 7 are `READY`
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Stage 12: Generate approval.md
|
|
342
|
+
|
|
343
|
+
Following the document structure and generation rules in `generate.md` Part E, produce
|
|
344
|
+
`approval.md` inside the change directory at `specflow/changes/<name>/approval.md`.
|
|
345
|
+
|
|
346
|
+
Document chapter order (hard):
|
|
347
|
+
|
|
348
|
+
1. §1 绪论与边界 (proposal + optional explore + AI; includes What/Impact; **no 变更摘要**)
|
|
349
|
+
2. §2 技术方案评估
|
|
350
|
+
3. §3 架构整体设计 (图 + **图要点说明** + 组件)
|
|
351
|
+
4. §4 方案详细设计 (设计要点 + Happy Path + 业务场景说明 + 数据/接口…)
|
|
352
|
+
5. §5 验收标准 (**after** design)
|
|
353
|
+
6. §6 测试策略 → §7 部署 → §8 闭环 → §9 可实施性 → §10 审批
|
|
354
|
+
|
|
355
|
+
Key rules:
|
|
356
|
+
|
|
357
|
+
- §1 truthful: pains from proposal/design/confirmed explore; User Journey → §5; Non-Goals with reasons; What/Impact in §1.2.
|
|
358
|
+
- Decision Review includes every `design.md` decision.
|
|
359
|
+
- §5 Acceptance exhaustive with 3-level testability; placed after §3/§4.
|
|
360
|
+
- §3 every architecture diagram has「设计说明 / 图要点」; component table with「不做什么」.
|
|
361
|
+
- §4 has 设计要点一览, complete Happy Path sequence + notes, each business scenario with 设计要点; DB/API hard bars (§4.4/§4.5).
|
|
362
|
+
- **Quality Gates G1–G4**: >5-line prose flow → Mermaid; interfaces need failure examples; JSON/new-column need存量填充策略; rollback data compatibility explicit.
|
|
363
|
+
- **Style & Tone**: plain language; gloss obscure abbreviations on first use; ban「尽量/大概/一般情况下」; use「必须/禁止/采用 XX 方案」.
|
|
364
|
+
- **§8 闭环**: one compact table only; PASS one line; ⚠️/❌ ≤3 bullets; no per-Pass essays.
|
|
365
|
+
- Test Strategy maps every §5 criterion to ≥1 layer.
|
|
366
|
+
- Deployment selective; Code Grounding cites real files; sign-off blank; never recommend approve if any verdict is `FAIL`.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Gate: User Confirmation
|
|
371
|
+
|
|
372
|
+
Present a summary to the user:
|
|
373
|
+
|
|
374
|
+
- Closed-loop overall verdict (PASS / PASS WITH WARNINGS / FAIL)
|
|
375
|
+
- Design quality verdict (PASS / WARNING / FAIL)
|
|
376
|
+
- Implementability overall verdict (READY / NEEDS REFINEMENT / BLOCKED)
|
|
377
|
+
- AI pre-approval recommendation (建议批准 / 有条件批准 / 退回 refine / 拒绝)
|
|
378
|
+
- The path where `approval.md` will be written
|
|
379
|
+
|
|
380
|
+
Ask explicitly:
|
|
381
|
+
|
|
382
|
+
> "确认生成审批文档并写入 `specflow/changes/<name>/approval.md`?"
|
|
383
|
+
|
|
384
|
+
Do NOT write the file until the user confirms. If the user wants changes to the assessment,
|
|
385
|
+
re-run the relevant Pass or dimension and update the summary before re-asking.
|
|
386
|
+
|
|
387
|
+
On confirmation:
|
|
388
|
+
|
|
389
|
+
1. Write `approval.md` to the change directory.
|
|
390
|
+
2. Do NOT change `phase` — it remains `refined`.
|
|
391
|
+
3. Report the file path and next-step suggestions.
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Stage 13: Next-Step Suggestions
|
|
396
|
+
|
|
397
|
+
Based on the assessment results:
|
|
398
|
+
|
|
399
|
+
- **If closed-loop = PASS, design quality = PASS, and implementability = READY**:
|
|
400
|
+
Suggest `/specflow:apply` to begin implementation.
|
|
401
|
+
|
|
402
|
+
- **If any verdict is WARNING**:
|
|
403
|
+
Suggest the user either (a) proceed to `/specflow:apply` after acknowledging the warnings
|
|
404
|
+
in the approval document, or (b) return to `/specflow:refine` to close the gaps first.
|
|
405
|
+
|
|
406
|
+
- **If any verdict is FAIL or implementability = BLOCKED**:
|
|
407
|
+
Strongly recommend `/specflow:refine` to resolve the failures before implementation.
|
|
408
|
+
Do NOT suggest `/specflow:apply` — the plan is not ready.
|
|
409
|
+
|
|
410
|
+
In all cases, remind the user that `approval.md` is an optional artifact: it does not block
|
|
411
|
+
`/specflow:apply` (which only requires `phase=refined`), and it does not affect
|
|
412
|
+
`/specflow:archive` (which scans `specs/`, not `approval.md`).
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Not Covered by Approval
|
|
417
|
+
|
|
418
|
+
- No code implementation — `/specflow:apply` owns that.
|
|
419
|
+
- No phase transition — phase stays `refined` until `/specflow:apply` advances it.
|
|
420
|
+
- No spec validation — `/specflow:verify` owns delta + main spec regression checks.
|
|
421
|
+
- No code review — `/specflow:review` owns post-implementation code quality checks.
|
|
422
|
+
- No artifact modification — approval reads the four artifacts (and project code, read-only)
|
|
423
|
+
but never modifies them. If a Pass reveals a gap, the user returns to `/specflow:refine`
|
|
424
|
+
to fix it; approval only documents the finding.
|
|
425
|
+
- No full codebase scan — approval reads only the anchor files extracted in Stage 3. Full
|
|
426
|
+
codebase investigation is `/specflow:explore`'s job.
|
|
427
|
+
- Approval is **not** a gate for apply. It is a decision-support artifact for human review.
|