create-requires-module
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Requires Module
创建使用Requires的模块
Always use the skill to retrieve the ***plain syntax rules — but only if you haven't done so yet.
load-plain-reference请始终使用技能来获取***plain语法规则——但仅在尚未获取的情况下使用。
load-plain-referenceWhat Requires Does
Requires的作用
requiresrequiresWhen this module is rendered:
- The required module's generated code () is copied as the starting point.
plain_modules/<required_module> - The required module's become visible as previous functional specs.
***functional specs*** - Only from the required module are available (not its full definitions).
exported_concepts
Use for:
requires- Ensuring a module is built after another in the build chain
- Building on top of an existing module's functionality
- Extending a base module with additional features
If you only need shared definitions and reqs (no functional specs, no generated code), use instead — see the skill.
importcreate-import-modulerequiresrequires当此模块被渲染时:
- 被依赖模块的生成代码()会被复制作为起点。
plain_modules/<required_module> - 被依赖模块的功能规范会作为前置功能规范可见。
- 仅能使用被依赖模块的(而非其完整定义)。
exported_concepts
requires- 确保一个模块在构建链中晚于另一个模块构建
- 基于现有模块的功能进行开发
- 扩展基础模块的功能,添加新特性
如果仅需要共享定义和依赖(不需要功能规范、不需要生成代码),请使用替代——详见技能。
importcreate-import-moduleWorkflow
工作流程
- Identify the dependency. Determine which module this new module builds on. That module must already exist and be renderable.
- Create the file at the repository root with YAML frontmatter containing the
.plainfield. Modules with functional specs live at the root, not inrequires.template/ - Review the required module's functional specs — they will be treated as previous requirements. Your new functional specs must not conflict with them.
- Review the required module's — only those concepts are available to reference from the required module.
exported_concepts - Add module-specific content — definitions, implementation reqs, test reqs, and functional specs unique to this module.
- Check for conflicts between your new functional specs and the required module's specs.
- 确定依赖项:明确新模块将基于哪个模块构建。该模块必须已存在且可被渲染。
- 在仓库根目录创建.plain文件,在YAML前置元数据中包含字段。带有功能规范的模块需放在根目录,而非
requires目录下。template/ - 查看被依赖模块的功能规范——这些规范会被视为前置要求。新的功能规范不得与之冲突。
- 查看被依赖模块的——仅这些概念可被当前模块引用。
exported_concepts - 添加模块专属内容——包括定义、实现要求、测试要求以及该模块独有的功能规范。
- 检查冲突:确保新功能规范与被依赖模块的规范无冲突。
Format
格式
The field is a list of module paths in the YAML frontmatter:
requiresplain
---
requires:
- base_module
import:
- shared_template
description: Extended module that builds on base_module
---
***definitions***
- :NewFeature: is a feature added by this module.
***functional specs***
- The system should support :NewFeature:.A module can use both and together. points to other root-level modules; resolves from the default directory (no prefix needed).
requiresimportrequiresimporttemplate/requiresplain
---
requires:
- base_module
import:
- shared_template
description: Extended module that builds on base_module
---
***definitions***
- :NewFeature: is a feature added by this module.
***functional specs***
- The system should support :NewFeature:.一个模块可同时使用和。指向其他根目录下的模块;从默认的目录解析(无需前缀)。
requiresimportrequiresimporttemplate/Exported Concepts
导出概念
The required module controls what concepts are visible via :
exported_conceptsplain
> In the required module's frontmatter:
---
exported_concepts: [":StorageClient:", ":BackupResult:"]
---Only and would be available to modules that this one. All other concepts from the required module are internal.
:StorageClient::BackupResult:require被依赖模块通过控制哪些概念可见:
exported_conceptsplain
> In the required module's frontmatter:
---
exported_concepts: [":StorageClient:", ":BackupResult:"]
---只有和可被该模块的其他模块使用。被依赖模块的所有其他概念均为内部概念。
:StorageClient::BackupResult:requireChronological Ordering with Requires
使用Requires实现时序排序
Functional specs from modules are considered previous functional specs. This means:
requires- They are already rendered and their code exists.
- Your new specs are rendered after them, with full awareness of what they defined.
- Your new specs must not conflict with the required module's specs.
- The renderer sees the required module's functional specs as context when rendering yours.
The current module may or may not be functionally related to the required module. In some cases simply enforces build order — the two modules may be independent pieces of the same project that need to be built in sequence.
requires来自模块的功能规范会被视为前置功能规范,这意味着:
requires- 这些规范已被渲染,对应的代码已存在。
- 新规范会在之后被渲染,且完全知晓前置规范的定义。
- 新规范不得与被依赖模块的规范冲突。
- 渲染器在渲染新规范时,会将被依赖模块的功能规范作为上下文。
当前模块与被依赖模块可能存在功能关联,也可能没有。在某些情况下,仅用于强制构建顺序——两个模块可能是同一项目中需要按顺序构建的独立部分。
requiresImport vs Requires
Import与Requires对比
| Aspect | | |
|---|---|---|
| Pulls in definitions | Yes | No (only |
| Pulls in implementation reqs | Yes | No |
| Pulls in test reqs | Yes | No |
| Pulls in functional specs | No | Yes (as previous requirements) |
| Copies generated code | No | Yes |
| Typical use | Templates, shared definitions | Build dependency chain |
| 方面 | | |
|---|---|---|
| 引入定义 | 是 | 否(仅引入 |
| 引入实现要求 | 是 | 否 |
| 引入测试要求 | 是 | 否 |
| 引入功能规范 | 否 | 是(作为前置要求) |
| 复制生成的代码 | 否 | 是 |
| 典型用途 | 模板、共享定义 | 构建依赖链 |
Validation Checklist
验证检查清单
- Module file is at the repository root (not in )
template/ - Required module exists and is renderable
- Required module's provide the concepts you need
exported_concepts - New functional specs do not conflict with the required module's specs
- Module has at least one functional spec and one implementation req
- Both and
requiresare used correctly (not mixed up)import - YAML frontmatter is correctly formatted between markers
---
- 模块文件位于仓库根目录(而非目录)
template/ - 被依赖模块已存在且可被渲染
- 被依赖模块的提供了所需的概念
exported_concepts - 新功能规范与被依赖模块的规范无冲突
- 模块至少包含一个功能规范和一个实现要求
- 和
requires使用正确(未混淆)import - YAML前置元数据在标记之间格式正确
---