nfr-architect

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

NFR 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
references/nfr-guide.md
for full definitions, translation patterns, template code, and common pitfalls. Load it into context at the start of any session.

NFR Architect 将指导团队完成非功能需求的全生命周期管理:编写符合BINT标准的规范NFRs、将其转换为SLOs和SLIs,以及生成具体的适配函数,将需求转化为可执行的测试。
参考文件
references/nfr-guide.md
获取完整定义、转换模式、模板代码及常见误区。在会话开始时请将其加载至上下文。

Workflow

工作流程

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
references/nfr-guide.md
(Performance, Availability, Resilience, Security / Structural).
For each NFR, output a table:
ElementValue
NFROriginal statement
SLOInternal target (stricter than SLA)
SLI formula
(good events / total events) × 100
or equivalent
Measurement sourceTool, query, or probe
Error budget
1 − SLO
headroom
Measurement windowRolling 30-day / per-incident / etc.
SLOs must always be equal to or stricter than the corresponding SLA. Flag any violation.

当NFR验证通过后,使用
references/nfr-guide.md
中的模式(性能、可用性、韧性、安全/架构类)生成对应的SLO和SLI。
针对每个NFR,输出如下表格:
元素取值
NFR原始表述
SLO内部目标(比SLA更严格)
SLI公式
(正常事件数 / 总事件数) × 100
或等价公式
测量数据源工具、查询语句或探针
错误预算
1 − SLO
允许的容错空间
测量窗口滚动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:
CategoryRecommended Tools
Performance (latency/throughput)k6, Gatling, Locust, JMeter
AvailabilitySynthetic probes, Datadog monitors, Pingdom
Architecture / structuralArchUnit (Java), Dependency Cruiser (JS/TS), py-arch-rule (Python)
Resilience / recoveryChaos engineering scripts, DR drill harnesses
SecuritySnyk in CI, OWASP ZAP, Trivy
For each fitness function, specify:
  1. File path — e.g.,
    fitness-function/performance/checkout-slo.js
  2. CI stage — where it runs (PR check, nightly, quarterly drill)
  3. Failure action — block deploy, alert on-call, fail PR
  4. Threshold values — wired directly from the SLO
Use the code templates in
references/nfr-guide.md
as starting points. Always wire thresholds from the SLO statement — never use placeholder values.

生成可自动化的适配函数代码以执行SLO要求。
根据NFR类别选择合适工具:
类别推荐工具
性能(延迟/吞吐量)k6, Gatling, Locust, JMeter
可用性合成探针, Datadog监控, Pingdom
架构/结构ArchUnit(Java), Dependency Cruiser(JS/TS), py-arch-rule(Python)
韧性/恢复混沌工程脚本, 灾难恢复演练框架
安全CI中的Snyk, OWASP ZAP, Trivy
针对每个适配函数,需明确:
  1. 文件路径 — 例如
    fitness-function/performance/checkout-slo.js
  2. CI阶段 — 运行阶段(PR检查、夜间任务、季度演练)
  3. 失败动作 — 阻止部署、触发值班告警、PR审核不通过
  4. 阈值取值 — 直接从SLO中获取
references/nfr-guide.md
中的代码模板为基础进行编写,适配函数的阈值必须来源于SLO取值,禁止使用硬编码的魔法值。

Step 4 — Produce the NFR Document

步骤4 — 生成NFR文档

Use the NFR Documentation Template from
references/nfr-guide.md
to produce a complete, structured NFR record per requirement. Include:
  • 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

使用
references/nfr-guide.md
中的NFR文档模板,为每个需求生成完整结构化的NFR记录,包含:
  • 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

速查手册

TermOne-line definition
NFRHow well the system performs a quality attribute
BINTBounded, Independent, Negotiable, Testable
SLOInternal measurable target, stricter than SLA
SLIActual measured value tracked against SLO
Error budgetAllowable failure headroom =
1 − SLO
Fitness functionAutomated 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跟踪的实际测量值
错误预算允许的容错空间 =
1 − SLO
适配函数执行NFR/SLO要求的自动化测试
如需完整示例、转换模式、代码模板及常见误区,请阅读
references/nfr-guide.md