Logo Generate Requirement Drafts

Generate Requirement Drafts

Tổ chứcPhổ biến
matlab
generate-requirement-drafts

Tạo bản nháp yêu cầu từ các mô hình Simulink. Dùng khi soạn thảo hoặc cập nhật artifact yêu cầu từ một mô hình. Ưu tiên Requirements Toolbox (.slreqx) nếu có; nếu không, dùng YAML có cấu trúc.

Add to TypingMind

Tổng quan

Nhà phát hànhmatlab
Kho mãsimulink-agentic-toolkit
Tên kỹ nănggenerate-requirement-drafts
Sao
1.2K
Bản fork
112
Tệp đi kèm
5
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được matlab công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Generate Requirement Drafts trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/model-based-design-core/generate-requirement-drafts
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matlab/simulink-agentic-toolkit.git /tmp/simulink-agentic-toolkit
mkdir -p .claude/skills
cp -r /tmp/simulink-agentic-toolkit/skills-catalog/model-based-design-core/generate-requirement-drafts .claude/skills/generate-requirement-drafts
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Generate Requirement Drafts trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Generate Requirement Drafts ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Generate Requirement Drafts với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Generate Requirement Drafts

Generate draft requirements from Simulink models using the richest artifact the environment supports. All outputs are drafts requiring human review and approval before baselining.

When to Use

  • Drafting or updating requirements from a Simulink model
  • Creating .slreqx or .yaml requirements artifacts
  • Establishing model-to-requirement traceability

When NOT to Use

  • Importing requirements from an existing source of truth (ReqIF, DOORS, Word, Excel) — use Requirements Toolbox import APIs directly
  • Writing or running tests — use the testing-simulink-models skill
  • Free-form prose notes with no saved artifact
  • User explicitly wants a different text format (markdown, Word)

Output Conventions

  • Default file names: <Model>_Requirements.slreqx or <model>_requirements.yaml
  • Stable IDs: REQ_<SYSTEM>_001, REQ_<SYSTEM>_002, … — use one consistent project-wide prefix with sequential integers across all requirements, even when they derive from different subsystems. Do not switch to per-subsystem prefixes or hierarchical decimal numbering (e.g. CB-1.1, TP-1.1).
  • Follow repo conventions if .slreqx or .yaml files already exist
  • When updating an existing artifact, preserve existing IDs — append new IDs, never renumber
  • Every generated requirement must be marked as draft — use "draft" in Keywords (slreq) or status: Draft + keywords: [draft] (YAML)

Writing Good Requirements

Requirements must express behavioral intent (WHAT the system shall do), not restate model topology (HOW it is implemented). Put the WHY in Rationale. Use EARS (Easy Approach to Requirements Syntax) patterns:

EARS Patterns

Choose the pattern that best fits the model behavior:

PatternTemplateWhen to Use
UbiquitousThe <system> shall <response>.Always-on behavior, invariants
Event-drivenWhen <trigger>, the <system> shall <response>.A momentary trigger causes a one-time response: input events, entering a Stateflow state (the transition itself)
State-drivenWhile <state>, the <system> shall <response>.Behavior that holds continuously while in a Stateflow state or mode — the ongoing response, not the entry transition
Unwanted behaviorIf <condition>, then the <system> shall <response>.Error handling, safety limits, saturation
Optional featureWhere <feature>, the <system> shall <response>.Variant subsystems, configurable features
CombinedWhile <state>, when <trigger>, the <system> shall <response>.State + event combinations

Examples — Model Concepts to EARS Requirements

❌ Bad — restates implementation✅ Good — EARS pattern
"Saturation block limits output to [0,1]""If throttle command exceeds ThrottleMax (1.0) or falls below ThrottleMin (0.0), then the controller shall clamp the output to the valid range."
"BrakeLogic subsystem disengages controller""When brake pedal input exceeds BrakeThreshold (0.0), the controller shall disengage cruise control."
"Gain block multiplies by 2.5""While cruise control is active, the controller shall amplify speed error by Kp (2.5) to compute proportional correction."
"Stateflow chart transitions to Idle""When the driver presses the off button, the system shall transition to the Idle state."
"Defrost state runs the heater at full power""While in the Defrost state, the system shall drive the heater at full power."
"Variant subsystem selects Algorithm A""Where the adaptive mode is enabled, the controller shall use the predictive algorithm."

Rules

  • Write requirements using EARS patterns — pick the pattern that matches the model behavior
  • Use block/subsystem names (e.g. Saturation, BrakeLogic) only in Rationale, Description, or provenance notes — never in the requirement Summary. (A workspace parameter rendered as VarName (value) is required in the Summary and is not a block name.)
  • When referencing a numeric value, include the workspace variable name and resolved value: VarName (value). If the model uses a literal with no variable, record the numeric literal directly
  • Put the WHY in Rationale, not in the requirement statement
  • One subsystem may support zero, one, or several behavioral requirements — don't force a 1:1 mapping
  • For a Stateflow state or mode, separate entering it from being in it: the entry transition is event-driven (When <trigger>, … shall transition to <state>), but the behavior that holds throughout the mode is state-driven (While <state>, … shall <response>). When asked for a mode's behavior, prefer the While <state> form — do not fold it into a When entry statement

Backend Decision Gate

Choose once at the start, then stay on that path.

SituationBackend
User explicitly asks for .slreqx, traceability views, or repo already uses .slreqxRequirements Toolbox — if probe fails, inform the user that Requirements Toolbox is unavailable; do NOT silently fall back
User explicitly asks for .yaml, or repo already uses .yaml requirementsStructured YAML
No format specified — probe for Requirements ToolboxRequirements Toolbox if probe succeeds
No format specified and probe failsStructured YAML (silent fallback is OK here since user had no preference)

Probe (run via evaluate_matlab_code):

matlab
hasSlreq = ~isempty(which('slreq.new'));
if hasSlreq, try, slreq.find(Type="Link"); catch, hasSlreq = false; end, end
disp(hasSlreq)

Workflow

  • Call model_overview, model_read, model_query_params, model_resolve_params as MCP tools — never pass their names to evaluate_matlab_code.
  • Use evaluate_matlab_code only for MATLAB code, such as the backend probe and the slreq.* APIs in Path A.
  1. Understand the model — use the model_overview and model_read tools to understand subsystems, interfaces, control logic.

  2. Extract parameters — use the model_query_params / model_resolve_params tools for thresholds, gains, sample times that should appear in requirement text. Record both variable names and resolved values.

  3. Build a capture table (backend-neutral):

    IdParentIdSummaryDescriptionSourceBlockRationaleASILPriorityKeywords
  4. Run the backend path (A or B below).

  5. Review using the gate below.

Path A — Requirements Toolbox (.slreqx)

Use when probe succeeds. For full API patterns see references/slreq-patterns.md.

matlab
model = "CruiseControl";
load_system(model);
rs = slreq.new(model + "_Requirements");

% Add requirements with hierarchy — note behavioral "shall" statements
req = add(rs, Id="REQ_CC_001", ...
    Summary="If throttle command exceeds ThrottleMax (1.0) or falls below ThrottleMin (0.0), then the controller shall clamp the output to the valid range.", ...
    Description="Derived from CruiseControl/ThrottleCmd.");
req.Rationale = "Prevents invalid actuator commands that could damage the throttle body.";
req.Keywords = ["draft","auto-generated","control","safety"];

child = add(req, Id="REQ_CC_002", ...
    Summary="When brake pedal input exceeds BrakeThreshold (0.0), the controller shall disengage cruise control.", ...
    Description="Derived from CruiseControl/BrakeLogic.");
child.Keywords = ["draft","auto-generated","safety","brake"];

% Create traceability links: use block handle from SID (blk_X → X) for robustness
lnk = slreq.createLink(Simulink.ID.getHandle(model + ":5"), req);
slreq.createLink(Simulink.ID.getHandle(model + ":8"), child);

save(rs);
% Save all link sets
linkSets = slreq.find(Type="LinkSet");
for i = 1:numel(linkSets), save(linkSets(i)); end

Link rules:

  • Source = model element, destination = requirement → link type is automatically Implement
  • Prefer subsystem-level links; use block-level only when the requirement is block-specific
  • Every model-derived requirement must have at least one traceability link
  • The model must be loaded (load_system) before creating links with block paths

Path B — Structured YAML fallback

Use when Requirements Toolbox is unavailable. For schema and field rules see references/yaml-requirements.md.

  1. Generate a <model>_requirements.yaml file from the capture table
  2. Set status: Draft and include draft in keywords for every requirement
  3. Self-review: all required fields set, asil/status/priority use valid values, IDs sequential, derived_from references valid IDs or is null
  4. Validate:
bash
python -c "import yaml, sys; yaml.safe_load(open(sys.argv[1])); print('OK')" path/to/requirements.yaml

Guardrails

AlwaysNever
Mark every generated requirement as DRAFTEmit markdown or ad hoc text when .slreqx is available and no text format was requested
Write requirements using EARS patternsRestate block topology as the requirement summary
Include parameter name + value: VarName (value)Create both .slreqx and .yaml unless user asks for both
Link direction: model element → requirementReverse the link direction (requirement → block)
load_system before creating traceability linksOver-link every primitive block — prefer subsystem links
Use only R2023a+ APIsSilently fall back to YAML when user explicitly requested .slreqx
Stay consistent with existing repo formatRenumber existing requirement IDs on regeneration

Review Gate

Before finishing, verify (both backends):

  • Every requirement has Id, Summary, and Description
  • Every requirement is marked as DRAFT (via Keywords or status field)
  • Summaries use EARS patterns, not block-topology restatements
  • Numeric values include parameter name + value where a workspace variable exists
  • IDs are stable and sequential; existing IDs preserved on regeneration

slreq path only:

  • Model-derived requirements have a traceability link to the source model element
  • Link direction is model element → requirement (not reversed)
  • Subsystem-level linking preferred over block-level
  • Requirement set and all link sets are saved

YAML path only:

  • File parses without errors
  • asil and priority use valid enum values (or Unset when unknown)

References

  • references/slreq-patterns.md — Requirements Toolbox API cookbook
  • references/yaml-requirements.md — Structured YAML schema and field rules
  • assets/slreq_from_model.m — End-to-end slreq example
  • assets/requirements.yaml — Structured YAML example

Copyright 2026 The MathWorks, Inc.


Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Generate Requirement Drafts làm được gì?

Tạo bản nháp yêu cầu từ các mô hình Simulink. Dùng khi soạn thảo hoặc cập nhật artifact yêu cầu từ một mô hình. Ưu tiên Requirements Toolbox (.slreqx) nếu có; nếu không, dùng YAML có cấu trúc.

Vì sao nên dùng Generate Requirement Drafts trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Generate Requirement Drafts là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Generate Requirement Drafts trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/matlab/simulink-agentic-toolkit/tree/main/skills-catalog/model-based-design-core/generate-requirement-drafts. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Generate Requirement Drafts?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Generate Requirement Drafts với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Generate Requirement Drafts với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Generate Requirement Drafts có miễn phí không?

Kỹ năng này được matlab phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇