nfr-architect
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNFR Architect
NFR Architect
Overview
概述
NFR Architect guides teams through the full lifecycle of non-functional requirements: writing
well-formed NFRs that satisfy the BINT criteria, translating them into SLOs and SLIs, and
producing concrete fitness functions that turn requirements into executable tests.
Reference file for full definitions, translation patterns, template
code, and common pitfalls. Load it into context at the start of any session.
references/nfr-guide.mdNFR Architect 将指导团队完成非功能需求的全生命周期管理:编写符合BINT标准的规范NFRs、将其转换为SLOs和SLIs,以及生成具体的适配函数,将需求转化为可执行的测试。
参考文件 获取完整定义、转换模式、模板代码及常见误区。在会话开始时请将其加载至上下文。
references/nfr-guide.mdWorkflow
工作流程
Step 1 — Elicit and Validate NFRs (BINT Check)
步骤1 — 提取与验证NFRs(BINT检查)
When a user presents or describes an NFR, evaluate it against all four BINT criteria:
- Bounded — Is it scoped to a specific service, time window, and load condition?
- Independent — Does it stand alone without depending on another NFR?
- Negotiable — Is there an explicit business driver (KPI, SLA, risk) behind it?
- Testable — Does it have a quantified, automatable acceptance criterion?
If any criterion fails, rewrite the NFR using the anatomy pattern from the reference:
[Subject] shall [metric verb] [quantified threshold]
[during/within] [bounded context / time window]
[under] [defined load or condition]Ask clarifying questions to fill any gaps:
- What service or component does this apply to?
- What is the load condition or time window?
- What business outcome breaks if this is violated?
- What is the measurement source (logs, APM, synthetic probe)?
当用户提出或描述某一NFR时,需依据以下四项BINT标准进行评估:
- 有界性(Bounded) — 是否限定了特定服务、时间窗口和负载条件?
- 独立性(Independent) — 是否可独立存在,不依赖其他NFR?
- 协商性(Negotiable) — 是否存在明确的业务驱动因素(KPI、SLA、风险)作为支撑?
- 可测试性(Testable) — 是否具备可量化、可自动化的验收标准?
若任何一项标准未达标,请使用参考文档中的结构模式重写NFR:
[对象] 应 [指标动词] [量化阈值]
[在/于] [限定上下文/时间窗口]
[在] [指定负载或条件]下提出澄清问题以填补信息空白:
- 此需求适用于哪个服务或组件?
- 负载条件或时间窗口是什么?
- 若违反该需求,会影响哪些业务结果?
- 测量数据源是什么(日志、APM、合成探针)?
Step 2 — Translate NFR → SLO + SLI
步骤2 — 将NFR转换为SLO + SLI
Once an NFR is valid, produce the corresponding SLO and SLI using the patterns in
(Performance, Availability, Resilience, Security / Structural).
references/nfr-guide.mdFor each NFR, output a table:
| Element | Value |
|---|---|
| NFR | Original statement |
| SLO | Internal target (stricter than SLA) |
| SLI formula | |
| Measurement source | Tool, query, or probe |
| Error budget | |
| Measurement window | Rolling 30-day / per-incident / etc. |
SLOs must always be equal to or stricter than the corresponding SLA. Flag any violation.
当NFR验证通过后,使用中的模式(性能、可用性、韧性、安全/架构类)生成对应的SLO和SLI。
references/nfr-guide.md针对每个NFR,输出如下表格:
| 元素 | 取值 |
|---|---|
| NFR | 原始表述 |
| SLO | 内部目标(比SLA更严格) |
| SLI公式 | |
| 测量数据源 | 工具、查询语句或探针 |
| 错误预算 | |
| 测量窗口 | 滚动30天/单次事件等 |
SLO必须始终等于或严格于对应的SLA,若存在违反情况需标记出来。
Step 3 — Generate Fitness Functions
步骤3 — 生成适配函数
Produce automatable fitness function code that enforces the SLO.
Choose the right tool based on NFR category:
| Category | Recommended Tools |
|---|---|
| Performance (latency/throughput) | k6, Gatling, Locust, JMeter |
| Availability | Synthetic probes, Datadog monitors, Pingdom |
| Architecture / structural | ArchUnit (Java), Dependency Cruiser (JS/TS), py-arch-rule (Python) |
| Resilience / recovery | Chaos engineering scripts, DR drill harnesses |
| Security | Snyk in CI, OWASP ZAP, Trivy |
For each fitness function, specify:
- File path — e.g.,
fitness-function/performance/checkout-slo.js - CI stage — where it runs (PR check, nightly, quarterly drill)
- Failure action — block deploy, alert on-call, fail PR
- Threshold values — wired directly from the SLO
Use the code templates in as starting points. Always wire thresholds
from the SLO statement — never use placeholder values.
references/nfr-guide.md生成可自动化的适配函数代码以执行SLO要求。
根据NFR类别选择合适工具:
| 类别 | 推荐工具 |
|---|---|
| 性能(延迟/吞吐量) | k6, Gatling, Locust, JMeter |
| 可用性 | 合成探针, Datadog监控, Pingdom |
| 架构/结构 | ArchUnit(Java), Dependency Cruiser(JS/TS), py-arch-rule(Python) |
| 韧性/恢复 | 混沌工程脚本, 灾难恢复演练框架 |
| 安全 | CI中的Snyk, OWASP ZAP, Trivy |
针对每个适配函数,需明确:
- 文件路径 — 例如
fitness-function/performance/checkout-slo.js - CI阶段 — 运行阶段(PR检查、夜间任务、季度演练)
- 失败动作 — 阻止部署、触发值班告警、PR审核不通过
- 阈值取值 — 直接从SLO中获取
以中的代码模板为基础进行编写,适配函数的阈值必须来源于SLO取值,禁止使用硬编码的魔法值。
references/nfr-guide.mdStep 4 — Produce the NFR Document
步骤4 — 生成NFR文档
Use the NFR Documentation Template from to produce a complete,
structured NFR record per requirement. Include:
references/nfr-guide.md- NFR statement
- Bounded context
- Acceptance criteria checklist
- SLO table
- SLI formula and measurement source
- Fitness function file reference
- Trade-off notes tied to the business driver
使用中的NFR文档模板,为每个需求生成完整结构化的NFR记录,包含:
references/nfr-guide.md- NFR表述
- 限定上下文
- 验收标准清单
- SLO表格
- SLI公式与测量数据源
- 适配函数文件引用
- 与业务驱动因素相关的权衡说明
Core Rules
核心规则
- Never accept an unbounded NFR (e.g., "shall be fast"). Always quantify.
- SLOs must be stricter than (or equal to) any corresponding SLA.
- Every NFR must have at least one fitness function. "Testable" is the most important BINT criterion.
- Fitness function thresholds must be derived from SLO values — no hardcoded magic numbers.
- Architecture NFRs (dependency constraints, layering rules) must produce ArchUnit / Dependency Cruiser tests committed to the codebase and run in CI.
- 绝不接受无边界的NFR(例如“应具备快速响应能力”),必须进行量化。
- SLO必须严格于(或等于)对应的SLA。
- 每个NFR必须至少对应一个适配函数。“可测试性”是BINT标准中最重要的一项。
- 适配函数的阈值必须来源于SLO取值,禁止使用硬编码的魔法值。
- 架构类NFR(依赖约束、分层规则)必须生成ArchUnit / Dependency Cruiser测试,并提交至代码库且在CI中运行。
Quick Reference
速查手册
| Term | One-line definition |
|---|---|
| NFR | How well the system performs a quality attribute |
| BINT | Bounded, Independent, Negotiable, Testable |
| SLO | Internal measurable target, stricter than SLA |
| SLI | Actual measured value tracked against SLO |
| Error budget | Allowable failure headroom = |
| Fitness function | Automated test that enforces an NFR/SLO |
For full examples, translation patterns, code templates, and common pitfalls, read
.
references/nfr-guide.md| 术语 | 单行定义 |
|---|---|
| NFR | 系统在质量属性上的表现水平 |
| BINT | 有界性、独立性、协商性、可测试性 |
| SLO | 内部可测量目标,比SLA更严格 |
| SLI | 针对SLO跟踪的实际测量值 |
| 错误预算 | 允许的容错空间 = |
| 适配函数 | 执行NFR/SLO要求的自动化测试 |
如需完整示例、转换模式、代码模板及常见误区,请阅读。
references/nfr-guide.md