@dtt_siye/atool 1.3.1 → 1.5.0

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.
Files changed (56) hide show
  1. package/README.md +97 -214
  2. package/README.md.atool-backup.20260410_114701 +299 -0
  3. package/VERSION +1 -1
  4. package/bin/atool.js +55 -9
  5. package/hooks/doc-sync-reminder +4 -4
  6. package/hooks/hooks-cursor.json +20 -0
  7. package/hooks/hooks.json +21 -1
  8. package/hooks/pre-commit +191 -0
  9. package/hooks/prompt-guard +84 -35
  10. package/hooks/session-start +34 -12
  11. package/hooks/task-state-tracker +145 -0
  12. package/install.sh +14 -4
  13. package/lib/common.sh +36 -23
  14. package/lib/compute-importance.sh +73 -0
  15. package/lib/install-cursor.sh +24 -2
  16. package/lib/install-hooks.sh +64 -0
  17. package/lib/install-kiro.sh +26 -2
  18. package/lib/install-skills.sh +5 -2
  19. package/lib/pre-scan.sh +13 -1
  20. package/lib/project-init.sh +28 -9
  21. package/package.json +1 -1
  22. package/skills/agent-audit/SKILL.md +180 -0
  23. package/skills/ai-project-architecture/SKILL.md +33 -534
  24. package/skills/ai-project-architecture/rules/architecture-validation.md +200 -0
  25. package/skills/ai-project-architecture/rules/compliance-check.md +83 -0
  26. package/skills/ai-project-architecture/rules/iron-laws.md +188 -0
  27. package/skills/ai-project-architecture/rules/migration.md +94 -0
  28. package/skills/ai-project-architecture/rules/refactoring.md +91 -0
  29. package/skills/ai-project-architecture/rules/testing.md +249 -0
  30. package/skills/ai-project-architecture/rules/verification.md +111 -0
  31. package/skills/architecture-guard/SKILL.md +164 -0
  32. package/skills/architecture-guard/rules/violation-detection.md +90 -0
  33. package/skills/atool-init/SKILL.md +24 -4
  34. package/skills/ci-feedback/SKILL.md +165 -0
  35. package/skills/project-analyze/SKILL.md +129 -19
  36. package/skills/project-analyze/phases/phase1-setup.md +76 -5
  37. package/skills/project-analyze/phases/phase2-understand.md +137 -26
  38. package/skills/project-analyze/phases/phase2.5-refine.md +32 -23
  39. package/skills/project-analyze/phases/phase3-graph.md +39 -5
  40. package/skills/project-analyze/phases/phase4-synthesize.md +17 -1
  41. package/skills/project-analyze/phases/phase5-export.md +42 -4
  42. package/skills/project-analyze/prompts/understand-agent.md +156 -298
  43. package/skills/project-analyze/rules/java.md +69 -1
  44. package/skills/project-query/SKILL.md +91 -200
  45. package/skills/project-query/rules/aggregate-stats.md +301 -0
  46. package/skills/project-query/rules/data-lineage.md +228 -0
  47. package/skills/project-query/rules/impact-analysis.md +218 -0
  48. package/skills/project-query/rules/neighborhood.md +234 -0
  49. package/skills/project-query/rules/node-lookup.md +97 -0
  50. package/skills/project-query/rules/path-query.md +135 -0
  51. package/skills/software-architecture/SKILL.md +39 -501
  52. package/skills/software-architecture/rules/concurrency-ha.md +346 -0
  53. package/skills/software-architecture/rules/ddd.md +450 -0
  54. package/skills/software-architecture/rules/decision-workflow.md +155 -0
  55. package/skills/software-architecture/rules/deployment.md +508 -0
  56. package/skills/software-architecture/rules/styles.md +232 -0
@@ -22,8 +22,6 @@ Use this skill when asked to design, evolve, review, or scaffold backend/system
22
22
 
23
23
  Do not trigger for isolated code formatting or minor bug fixes unless they affect architecture or non-functional requirements.
24
24
 
25
- ---
26
-
27
25
  ## Core Philosophy
28
26
 
29
27
  Three principles drive every architecture decision:
@@ -36,8 +34,6 @@ Three principles drive every architecture decision:
36
34
 
37
35
  Prefer: **suitable over trendy**, **simple over grand but fragile**, **evolvable over one-step finality**.
38
36
 
39
- ---
40
-
41
37
  ## Non-Negotiable Principles
42
38
 
43
39
  1. **Suitability first** — choose what the team can realistically build, operate, and debug.
@@ -47,381 +43,24 @@ Prefer: **suitable over trendy**, **simple over grand but fragile**, **evolvable
47
43
  5. **Clear boundaries** — every service/module/repo/DB boundary must correspond to a real business capability, not arbitrary technical slicing.
48
44
  6. **Operational reality** — architecture is incomplete without deployment, observability, rollback, security, and change management.
49
45
 
50
- ---
51
-
52
- ## Architecture Decision Workflow
53
-
54
- ### Step 1: Frame the Problem
55
- State: business goal, users/traffic/environments, latency/availability/scalability/security expectations, team capability, delivery timeline, major constraints (existing stack, compliance, integration dependencies).
56
-
57
- ### Step 2: Identify the Dominant Technical Problem
58
- Classify the main driver: high concurrency / high availability / performance bottleneck / delivery speed / integration complexity / data consistency / cost or ops burden.
59
-
60
- ### Step 3: Choose the Minimum Viable Architecture Style
61
-
62
- Use this progression — explain why simpler options are not enough before recommending a more complex one:
63
-
64
- | Style | Choose when |
65
- |-------|------------|
66
- | **Monolith** | Small scope, small team, fast delivery, domain still changing |
67
- | **Distributed modular** | Modules need independent scaling/deployment, multiple channels sharing backend |
68
- | **SOA** | Enterprise-level shared service layer, heterogeneous protocols already in use |
69
- | **Microservices** | Clear business capability splits, teams own services independently, full ops/tooling ready |
70
- | **Serverless** | Event-driven, bursty traffic, minimal infra management desired |
71
-
72
- ### Step 4: Define Architecture Building Blocks
73
- Define only what is necessary: client/frontend, gateway/access layer, application/service layer, domain/business layer, persistence/data layer, cache, MQ, config center, service registry, auth/identity, observability, deployment/CI-CD, rollback/resilience.
74
-
75
- ### Step 5: Map NFRs to Concrete Design
76
- | NFR | Concrete mechanisms |
77
- |-----|-------------------|
78
- | High concurrency | Statelessness, horizontal scaling, cache, queue, async, read-write split |
79
- | High availability | Degrade, rate limit, rollback, gray release, redundancy |
80
- | Performance | Static resources, request merge, caching, async IO |
81
- | Maintainability | Clear service boundaries, API contracts, documentation, automated tests |
82
- | Security | Authn/authz, validation, audit, masking, secure defaults |
83
-
84
- ### Step 6: Produce Deliverables
85
- Architecture summary, component view, deployment view, service decomposition, data flow, interface contract outline, risk list with mitigations, phased evolution roadmap, implementation checklist.
86
-
87
- ---
88
-
89
- ## Architecture Style Rules
90
-
91
- ### Monolith
92
- - Keep clear layered/module boundaries inside — do not let it become "big ball of mud"
93
- - Isolate domain modules even within one repo
94
- - Prepare extraction seams around high-change or high-load modules
95
- - **Do not recommend microservices if the only reason is "future scalability" without present evidence**
96
-
97
- ### Distributed Modular System
98
- - Define interface boundaries early
99
- - Keep shared business logic in versioned service layers or libraries
100
- - Make remote communication explicit and observable
101
-
102
- ### Microservices
103
- Choose only when **all** are mostly true: clean business capability splits, teams own services independently, full tooling ready (CI/CD, tracing, monitoring, config, registry, gateway).
104
-
105
- Rules:
106
- - Each service = one clear business capability
107
- - Services must be independently deployable
108
- - Do not share databases across services unless transitional and justified
109
- - Document consistency strategy when data spans services
110
- - Ensure automated contract and integration testing
111
-
112
- **Warning signs:** too-tiny services without strong boundaries, no tracing/gateway/config center/rollback plan, distributed transactions added casually, services split by technical layer instead of business capability.
113
-
114
- ### Serverless
115
- - Address function granularity — too fine creates orchestration overhead
116
- - Handle observability and integration testing explicitly
117
-
118
- ---
119
-
120
- ## Clean Architecture & DDD Principles
121
-
122
- - Follow **Domain-Driven Design** and ubiquitous language
123
- - Separate domain entities from infrastructure concerns
124
- - Keep business logic independent of frameworks
125
- - Define use cases clearly and keep them isolated
126
- - Use **domain-specific names**: `OrderCalculator`, `UserAuthenticator` — avoid generic names like `utils`, `helpers`, `common`, `shared`
127
- - Separate concerns: no business logic in UI components, no DB queries in controllers
128
-
129
- ---
130
-
131
- ## High-Concurrency Design
132
-
133
- When concurrency is a key requirement, apply these levers in order:
134
-
135
- 1. **Statelessness** — prefer stateless services; use token-based context; avoid sticky sessions
136
- 2. **Splitting** — by business domain, read/write characteristics, or function/sub-capability
137
- 3. **Service governance** — discovery, routing, timeout, retry, rate limiting, fallback
138
- 4. **Caching by layer** — client cache → CDN/edge → gateway/access → application → data layer. Define cacheable objects, TTL, invalidation strategy; call out consistency risks
139
- 5. **Message queue and async** — use MQ only for: decoupling, async non-blocking work, traffic buffering/peak shaving, eventual consistency. Define retry/dead-letter/compensation
140
- 6. **Reduce request count** — staticization, request merge/aggregation, rate limiting, load shaping
141
- 7. **Speed up the path** — parallelize independent steps, async notifications, read replicas, delayed writes for non-real-time ops
142
- 8. **Resource scaling** — horizontal scaling preferred; vertical scaling acceptable as fastest short-term fix
143
-
144
- ---
145
-
146
- ## High-Availability Design
147
-
148
- ### Degradation
149
- - Centralized degrade switches
150
- - Fallback to local cache / stale data / read-only mode where acceptable
151
- - Front-loaded degrade at gateway or Nginx
152
- - Business-priority downgrade: keep core flow, defer/disable non-core features
153
-
154
- ### Rate Limiting and Protection
155
- - Controls for malicious traffic, abnormal IPs, gateway-level throttling
156
-
157
- ### Rollback
158
- Every architecture proposal must include: rollback path, stable previous version reference, gray release strategy if relevant.
159
-
160
- ### Monitoring and Alerts
161
- At minimum: metrics, logs, traces, alert thresholds, **business error monitoring** (not just system error monitoring).
162
-
163
- ---
164
-
165
- ## Business Design Rules
166
-
167
- Always consider for order, payment, submission, workflow, approval, job triggering, messaging, and callback scenarios:
168
-
169
- - **Duplicate-prevention design**
170
- - **Idempotency** — explicit design for any operation that may be retried
171
- - **State machines** — for workflows with distinct states and transitions
172
- - **Operation feedback** in admin/backoffice systems
173
- - **Approval flow** for high-risk or business-controlled changes
174
- - **Backup / recovery** thinking
175
-
176
- ---
177
-
178
- ## Cloud-Native Platform Baseline
179
-
180
- Only include components the scenario justifies — do not recommend the full stack for a small internal system:
181
-
182
- WAF / CDN / ingress / LB → API gateway → service registry/discovery → config center → auth / OAuth2 → service-to-service client or RPC → cache layer → relational DB (with replicas/shards if needed) → MQ → object storage → search engine (if needed) → metrics + tracing + logs → alerting → container registry → CI/CD → Kubernetes or equivalent.
183
-
184
- ---
185
-
186
- ## Output Format
187
-
188
- ### 概述
189
-
190
- 架构设计产出 6 个交付物(A-F)+ ADR 模板。每个交付物有明确的模板结构和必填字段。
191
-
192
- 如果文档写入 `docs/400-architecture/`,需遵循 `doc-standards-enforcer` 的 frontmatter 规范。
193
-
194
- ---
195
-
196
- ### A. Architecture Summary(架构摘要)
197
-
198
- ```markdown
199
- # {Project Name} Architecture Summary
200
-
201
- ## 1. Business Context
202
- - 业务目标(1-2 句)
203
- - 目标用户和规模(用户数/并发量/数据量)
204
- - 核心业务流程(Mermaid flowchart)
205
-
206
- ## 2. Dominant Technical Drivers
207
- | 驱动因素 | 优先级 | 当前状态 | 目标状态 |
208
- |---------|--------|---------|---------|
209
- | 高并发 | P0 | 100 QPS | 10K QPS |
210
- | 高可用 | P0 | 99% | 99.9% |
211
- | 安全 | P1 | 基础认证 | OAuth2 + RBAC |
212
-
213
- ## 3. Architecture Style Decision
214
- - 推荐风格:{Monolith / Distributed / Microservices / Serverless}
215
- - 选择理由(为什么更简单的方案不够用)
216
- - 对比表:
217
- | 方案 | 优势 | 劣势 | 适用条件 | 选择 |
218
- |------|------|------|---------|------|
219
-
220
- ## 4. Architecture Overview Diagram
221
- (Mermaid graph TB,展示所有核心组件和交互关系)
222
- ```
223
-
224
- ### B. Component Design(组件设计)
225
-
226
- ```markdown
227
- # Component Design
228
-
229
- ## 组件清单
230
- | 组件 | 职责 | 技术选型 | 部署方式 | 依赖组件 | SLA |
231
- |------|------|---------|---------|---------|-----|
232
- | API Gateway | 路由+限流+认证 | Kong/Nginx | K8s Pod | Auth Service | 99.9% |
233
- | User Service | 用户生命周期 | Spring Boot | K8s Pod | DB, Cache | 99.9% |
234
-
235
- ## 分层架构
236
- | 层 | 职责 | 包含组件 | 通信协议 |
237
- |---|------|---------|---------|
238
- | 接入层 | 路由、认证、限流 | Gateway, LB | HTTPS |
239
- | 应用层 | 业务编排 | Services | gRPC/REST |
240
- | 领域层 | 核心业务逻辑 | Domain Models | In-process |
241
- | 数据层 | 持久化 | DB, Cache, MQ | TCP |
242
-
243
- ## 每个核心组件详细设计
244
- 对每个组件:
245
- - 职责边界(做什么 / 不做什么)
246
- - 接口定义(暴露的 API 摘要)
247
- - 数据归属(拥有哪些实体)
248
- - 扩展策略(水平/垂直,触发条件)
249
- - 容错机制(降级/熔断/重试策略)
250
- ```
251
-
252
- ### C. Data and Interaction Design(数据与交互设计)
253
-
254
- ```markdown
255
- # Data and Interaction Design
256
-
257
- ## 1. 数据归属矩阵
258
- | 数据实体 | 归属服务 | 读取方 | 写入方 | 一致性要求 |
259
- |---------|---------|--------|--------|-----------|
260
- | User | User Service | Order, Payment | User Service | 强一致 |
261
- | Order | Order Service | Payment, Report | Order Service | 最终一致 |
262
-
263
- ## 2. 同步/异步通信边界
264
- | 源 | 目标 | 方式 | 协议 | 超时 | 重试 | 降级策略 |
265
- |---|------|------|------|------|------|---------|
266
- | Gateway → UserSvc | 同步 | REST | 3s | 2次 | 返回缓存 |
267
- | OrderSvc → PaymentSvc | 异步 | MQ(RabbitMQ) | - | 3次+DLQ | 人工补偿 |
268
-
269
- ## 3. API 契约摘要
270
- | API | Method | Path | 请求方 | 提供方 | 关键参数 |
271
- |-----|--------|------|--------|--------|---------|
272
-
273
- ## 4. 缓存策略
274
- | 缓存对象 | 缓存层 | TTL | 失效策略 | 一致性风险 |
275
- |---------|--------|-----|---------|-----------|
46
+ ## Quick Workflow
276
47
 
277
- ## 5. 数据一致性方案
278
- 对跨服务的数据操作:
279
- | 场景 | 涉及服务 | 一致性策略 | 补偿机制 |
280
- |------|---------|-----------|---------|
281
- | 下单支付 | Order+Payment | Saga | 退款补偿 |
282
- ```
48
+ 1. **Frame the problem** — Identify business goals, constraints, and technical drivers
49
+ 2. **Choose architecture style** — Select between monolith, distributed, microservices, or serverless
50
+ 3. **Design core building blocks** Define essential components and their interactions
51
+ 4. **Map NFRs to mechanisms** — Translate non-functional requirements into concrete design choices
52
+ 5. **Design for scale** Apply concurrency, availability, and deployment patterns
53
+ 6. **Validate and document** — Review checklist and produce architecture deliverables
283
54
 
284
- ### D. Deployment and Operations(部署与运维)
55
+ ## File Reference Map
285
56
 
286
- ```markdown
287
- # Deployment and Operations
288
-
289
- ## 1. 部署拓扑
290
- (Mermaid graph,展示环境布局)
291
-
292
- ## 2. 环境配置矩阵
293
- | 环境 | 用途 | 实例数 | 数据库 | 缓存 | 配置来源 |
294
- |------|------|--------|--------|------|---------|
295
- | dev | 开发 | 1 | SQLite/H2 | 本地 | .env |
296
- | staging | 预发布 | 2 | MySQL | Redis | ConfigCenter |
297
- | production | 生产 | 3+ | MySQL(主从) | Redis(集群) | ConfigCenter |
298
-
299
- ## 3. CI/CD 流程
300
- (Mermaid flowchart:代码提交 → 构建 → 测试 → 镜像 → 部署 → 健康检查)
301
-
302
- ## 4. 可观测性
303
- | 维度 | 工具 | 关键指标 | 告警阈值 |
304
- |------|------|---------|---------|
305
- | Metrics | Prometheus | API 延迟 P99 | > 500ms |
306
- | Logging | ELK/Loki | 错误率 | > 1% |
307
- | Tracing | Jaeger | 链路完整性 | 采样率 > 10% |
308
-
309
- ## 5. 回滚策略
310
- | 场景 | 回滚方式 | RTO | 数据处理 |
311
- |------|---------|-----|---------|
312
- | 代码缺陷 | 回退到上一版本 | < 5min | 无需处理 |
313
- | 数据迁移失败 | 执行回滚脚本 | < 30min | 备份恢复 |
314
-
315
- ## 6. 扩缩容规则
316
- | 服务 | 指标 | 扩容阈值 | 缩容阈值 | 最大/最小实例 |
317
- |------|------|---------|---------|-------------|
318
- ```
319
-
320
- ### E. Risk and Trade-offs(风险与权衡)
321
-
322
- ```markdown
323
- # Risk and Trade-offs
324
-
325
- ## 风险登记册
326
- | ID | 风险描述 | 概率 | 影响 | 缓解措施 | 负责人 | 状态 |
327
- |----|---------|------|------|---------|--------|------|
328
- | R001 | 第三方支付接口不稳定 | 高 | 高 | 多通道+降级 | Arch | Open |
329
-
330
- ## 架构权衡
331
- | 决策 | 获得 | 付出 | 接受理由 |
332
- |------|------|------|---------|
333
- | 引入 MQ 异步 | 解耦+削峰 | 运维复杂度+最终一致 | 峰值流量 10x |
334
- ```
335
-
336
- ### F. Evolution Roadmap(演进路线图)
337
-
338
- ```markdown
339
- # Evolution Roadmap
340
-
341
- | 阶段 | 时间范围 | 目标 | 关键动作 | 验证标准 |
342
- |------|---------|------|---------|---------|
343
- | Phase 1 | 1-2周 | 快速修复 | 解耦循环依赖、统一日志 | 循环依赖 = 0 |
344
- | Phase 2 | 2-4周 | 中期重构 | 抽取共享服务、引入缓存 | P99 < 200ms |
345
- | Phase 3 | 1-3月 | 架构升级 | 服务拆分、K8s 部署 | 可独立部署 |
346
-
347
- 每个 Phase 包含:
348
- - 目标(解决什么问题)
349
- - 涉及模块/服务
350
- - 风险评估
351
- - 回退方案
352
- - 验证标准(可度量)
353
- ```
354
-
355
- ---
356
-
357
- ### G. ADR Template(架构决策记录 — 新增)
358
-
359
- 每个重要架构决策生成一份 ADR:
360
-
361
- ```markdown
362
- # ADR-{SEQ}: {Decision Title}
363
-
364
- ## Status
365
- Proposed | Accepted | Deprecated | Superseded by ADR-{N}
366
-
367
- ## Context
368
- - 背景:什么业务/技术问题触发了这个决策?
369
- - 约束:有什么限制(团队能力/时间/预算/合规)?
370
- - 当前状态:现在是怎么做的?为什么不够用?
371
-
372
- ## Decision
373
- 我们决定 {具体决策}。
374
-
375
- ## Options Considered
376
- | 选项 | 优势 | 劣势 | 评估 |
377
- |------|------|------|------|
378
- | 选项 A(选中)| ... | ... | ✅ 最佳 |
379
- | 选项 B | ... | ... | ❌ 不满足 NFR |
380
- | 选项 C | ... | ... | ❌ 团队不熟悉 |
381
-
382
- ## Consequences
383
- ### 正面
384
- - ...
385
-
386
- ### 负面
387
- - ...
388
-
389
- ### 风险
390
- - ...
391
-
392
- ## NFR Impact
393
- | NFR | 影响 | 缓解措施 |
394
- |-----|------|---------|
395
- | NFR-SYS-001 性能 | P99 可能增加 50ms | 引入缓存层 |
396
-
397
- ## Related
398
- - 相关 ADR:ADR-{N}
399
- - 相关 PRD:PRD-{MOD}-{SEQ}(来自 requirements-writer)
400
- - 相关模块:{module list}
401
- ```
402
-
403
- ---
404
-
405
- ### NFR 统一编号体系
406
-
407
- 与 requirements-writer 的 NFR 编号对齐:
408
-
409
- ```
410
- NFR-{SCOPE}-{SEQ}
411
-
412
- SCOPE 可选值:
413
- SYS — 系统级(跨所有模块)
414
- {MOD} — 模块级(如 USER, ORDER)
415
-
416
- 示例:
417
- NFR-SYS-001: 系统整体 API P99 延迟 < 500ms
418
- NFR-SYS-002: 系统可用性 > 99.9%
419
- NFR-USER-001: 用户注册 API 响应 < 200ms
420
- ```
421
-
422
- architecture 中定义的系统级 NFR(NFR-SYS-*)是 requirements-writer 模块级 NFR(NFR-{MOD}-*)的上游约束。模块级 NFR 不得超过系统级 NFR 的范围。
423
-
424
- ---
57
+ | File | When to Read | Content |
58
+ |------|-------------|---------|
59
+ | `rules/decision-workflow.md` | Starting architecture design | Six-step decision process, ADR template, deliverables checklist |
60
+ | `rules/styles.md` | Choosing architecture style | Monolith vs microservices vs serverless selection criteria, evolution paths |
61
+ | `rules/concurrency-ha.md` | Designing for performance | High concurrency patterns, high availability strategies, monitoring setup |
62
+ | `rules/ddd.md` | Implementing clean architecture | DDD principles, clean architecture layers, domain modeling patterns |
63
+ | `rules/deployment.md` | Planning deployment | CI/CD pipelines, container orchestration, monitoring, disaster recovery |
425
64
 
426
65
  ## Integration with Tech-Stack Skills
427
66
 
@@ -446,134 +85,33 @@ This skill orchestrates architecture; stack-specific skills govern implementatio
446
85
 
447
86
  | Workflow | When to Use | How |
448
87
  |----------|-------------|-----|
449
- | **project-analyze** | Analyzing an existing project's architecture | Run `/project-analyze` (v5.1 五维分析框架) first to generate knowledge graph and module inventory, then use that data to inform architecture review |
450
- | **code-review** | Architecture compliance validation | code-review Dimension 5 validates architecture compliance; for major violations, follow up with this skill for deeper review |
451
- | **doc-standards-enforcer** | Producing architecture documentation (ADRs, HLD/LLD) | After producing architecture deliverables, validate documentation format with `doc-standards-enforcer` |
452
- | **doc-coauthoring** | Co-authoring technical specs or design documents | Use `doc-coauthoring` workflow for collaborative document creation; this skill provides technical content accuracy |
453
- | **project-query** | 需要查询架构分析详细数据(层违反、耦合度等) | 建议运行 |
454
-
455
- ### Architecture Review Workflow
456
-
457
- For existing projects requiring architecture assessment:
458
-
459
- 1. Run `/project-analyze` (v5.1 五维分析框架) to generate knowledge graph
460
- 2. Review the generated architecture diagrams and module dependency graph
461
- 3. Use this skill's Review Checklist against the analysis results
462
- 4. Produce ADR or architecture improvement plan
463
- 5. Validate output with `doc-standards-enforcer`
464
-
465
- ### project-analyze 数据契约(Refine Mode 输入)
466
-
467
- 以下文件是 Refine Mode 的输入数据源,project-analyze 必须确保这些文件在 Phase 2.5 调用前存在:
468
-
469
- | 文件 | 内容 | 生成阶段 |
470
- |------|------|---------|
471
- | `.atool-docs/knowledge-graph.json` | 耦合度量、依赖图 | Phase 3 |
472
- | `.atool-docs/multi-dimensional-analysis.json` | 五维分析数据 | Phase 3 |
473
- | `.atool-docs/modules/*/data.json` | 模块级结构化数据 | Phase 2 |
474
- | `atool-analysis/modules/*/prd.md` | 精炼后的模块 PRD(含 NFR-{MOD}-NNN) | Phase 2.5 |
475
- | `atool-analysis/modules/*/dev-guide.md` | 精炼后的架构文档(含 ADR) | Phase 2.5 |
476
-
477
- ---
478
-
479
- ## Refine Mode(精炼模式 — 由 project-analyze Phase 2.5 调用)
480
-
481
- ### 触发条件
482
-
483
- Phase 2.5 通过 sub-agent prompt 内联激活,不由用户手动触发。在 requirements-writer Refine Mode 完成后自动进入。
484
-
485
- ### 输入
486
-
487
- | 文件 | 用途 |
488
- |------|------|
489
- | `atool-analysis/modules/{name}/README.md` | 模块业务概述 |
490
- | `atool-analysis/modules/{name}/prd.md` | 精炼后的标准 PRD(8 节,含 NFR-{MOD}-NNN) |
491
- | `atool-analysis/modules/{name}/api.md` | 接口定义 → API 契约设计 |
492
- | `atool-analysis/modules/{name}/data-model.md` | 数据模型 → 数据所有权 |
493
- | `atool-analysis/modules/{name}/dev-guide.md` | Phase 2 初稿 → 追加架构章节 |
494
- | `.atool-docs/modules/{name}/data.json` | 结构化数据(含 refine_hints) |
495
- | `{stack}-conventions` Architecture + API Design 节 | 栈级架构规范约束 |
496
-
497
- ### 精炼逻辑
498
-
499
- 在 `dev-guide.md` 基础上**追加**架构章节(不删除原有内容):
500
-
501
- 1. **B-subset. 组件设计**(从 Output Format B 裁剪到模块级):
502
- - 模块内部分层表(层名 / 职责 / 关键类)
503
- - 边界定义(公开接口 vs 内部实现)
504
- - 依赖方向约束
505
-
506
- 2. **C-subset. 数据与交互设计**(从 Output Format C 裁剪到模块级):
507
- - 数据所有权声明(本模块拥有哪些实体)
508
- - 同步/异步通信边界表
509
- - API 契约摘要(引用 api.md)
510
-
511
- 3. **ADR(架构决策记录)**:
512
- - 使用 G. ADR Template 的 7 节结构
513
- - 至少 1 个 ADR(该模块最关键的架构决策)
514
- - Status / Context / Decision / Options / Consequences / NFR Impact / Related
88
+ | **project-analyze** | Analyzing existing architecture | Run `/project-analyze` to generate knowledge graph and dependency analysis |
89
+ | **code-review** | Architecture compliance validation | code-review Dimension 5 validates architectural principles |
90
+ | **doc-standards-enforcer** | Validating architecture documentation | Validate ADR and HLD/LLD format compliance |
91
+ | **doc-coauthoring** | Collaborative architecture design | Use for co-authoring technical specifications |
92
+ | **requirements-writer** | Aligning NFRs with architecture | System-level NFRs constrain module-level requirements |
515
93
 
516
- 4. **NFR 对齐**:
517
- - 确保 prd.md 中的 NFR-{MOD}-NNN 与架构选择一致
518
- - 首轮标注 `[待系统级确认]`(Phase 4 生成 NFR-SYS-NNN 后回扫替换)
519
-
520
- ### 不做的事(硬性)
521
-
522
- - ❌ 不生成 A(Architecture Summary)— 项目级,Phase 4 负责
523
- - ❌ 不生成 D(Deployment)— 项目级,Phase 4 负责
524
- - ❌ 不生成 E(Risk)/ F(Roadmap)— 项目级,Phase 4 负责
525
- - ❌ 不做交互式 6 步决策工作流 — 信息从 Phase 2 产物中提取
526
- - ❌ 不修改 prd.md / api.md / data-model.md — 只精炼 dev-guide.md
527
-
528
- ### 输出质量门禁
529
-
530
- 精炼后的 dev-guide.md 必须通过以下检查(由 Phase 2.5 Gate 3 执行):
531
- - 包含"组件设计"或"Component Design"章节
532
- - 包含至少 1 个 ADR 条目
533
- - ADR 包含 Status + Decision + Consequences(7 节中最关键的 3 节)
534
-
535
- ---
536
-
537
- ## Guardrails
538
-
539
- Do **not**:
540
- - Recommend microservices by default
541
- - Add Redis, MQ, ES, Kubernetes, or gateway without tying them to a requirement
542
- - Create service splits that mirror technical layers instead of business capabilities
543
- - Ignore rollback, observability, or release strategy
544
- - Propose strong consistency across distributed services without calling out complexity and cost
545
- - Treat architecture diagrams as sufficient without delivery and ops explanation
546
- - Overfit for hypothetical future scale while hurting current delivery
547
-
548
- ---
549
-
550
- ## Review Checklist
551
-
552
- **Problem-fit:** Business problem clearly stated? Main technical driver identified? Design solves real problem rather than showcases technology?
553
-
554
- **Simplicity:** Is there a simpler design that would work now? Unnecessary distributed complexity avoided?
555
-
556
- **Boundaries:** Service/module boundaries aligned to business capability? Data ownership clear? Sync and async boundaries clear?
557
-
558
- **NFR mapping:** Each key NFR mapped to concrete architecture measures? Concurrency, availability, security, and performance handled explicitly?
559
-
560
- **Operability:** Monitoring, logs, traces, alerts, and rollback covered? Deployment topology described?
94
+ ## Output Format
561
95
 
562
- **Safety and correctness:** Duplicate prevention and idempotency addressed? Rate limits, degradation, and fallback paths defined? Consistency trade-offs explained?
96
+ Architecture deliverables include A-F:
97
+ - A: Architecture Summary
98
+ - B: Component View
99
+ - C: Data & Interaction Design
100
+ - D: Deployment Strategy
101
+ - E: Risk Assessment
102
+ - F: Evolution Roadmap
563
103
 
564
- **Evolution:** Design supports incremental evolution? Phased roadmap instead of "final architecture" thinking?
104
+ For module-level architecture refinement (Refine Mode), integrate with project-analyze Phase 2.5 to enhance development guides with component design, ADRs, and NFR alignment.
565
105
 
566
- ---
106
+ ## Constraints
567
107
 
568
- ## Skill 协作
108
+ - Must follow six-step decision workflow
109
+ - Architecture style must match actual needs, not trends
110
+ - Every NFR must have concrete implementation mechanisms
111
+ - Must include deployment, monitoring, and rollback strategies
112
+ - Documentation must follow ADR template
113
+ - Architecture must support evolution, not assume finality
569
114
 
570
- | 协作 Skill | 触发条件 | 交互方式 |
571
- |-----------|---------|---------|
572
- | **project-analyze** | Phase 2.5 Refine Mode 调用;Phase 4 聚合时引用 A/E/F 模板结构 | 读取模块文档 + 知识图谱 |
573
- | **code-review** | 架构合规性验证 | code-review Dimension 5 验证架构合规;重大违规时建议运行本 skill 深度评审 |
574
- | **doc-standards-enforcer** | 产出架构文档(ADR、HLD/LLD) | 架构交付物完成后,用 `doc-standards-enforcer` 验证文档格式 |
575
- | **doc-coauthoring** | 协作撰写技术规格或设计文档 | 本 skill 提供技术内容准确性,`doc-coauthoring` 管理协作流程 |
576
- | **project-query** | 需要查询架构分析详细数据(层违反、耦合度等) | 建议运行 |
577
- | **requirements-writer** | NFR-SYS-* 是 NFR-{MOD}-* 的上游约束 | 系统级 NFR 约束模块级 NFR 范围 |
578
- | **java-conventions** | Java/Spring 项目架构设计 | 加载栈级分层/命名/并发规范 |
579
- | **web-conventions** | 前端项目架构设计 | 加载前端项目结构/组件规范 |
115
+ > IMPORTANT: When this skill is invoked, you MUST read the relevant
116
+ > subdirectory files based on the current design phase. Do NOT execute using
117
+ > only this SKILL.md content.