create-import-module
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Import Module
创建导入模块
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 an Import Module Is
什么是导入模块
An import module is a file that lives in the directory and contains only , , and/or . It must not contain and must not use in its frontmatter. Other modules pull in its content via the field in their YAML frontmatter, gaining access to its definitions and reqs.
.plaintemplate/***definitions******implementation reqs******test reqs******functional specs***requiresimportUse import modules for:
- Sharing concept definitions across multiple modules
- Providing common implementation requirements (e.g., technology stack, coding standards)
- Providing common test requirements
- Creating reusable foundational structure (templates)
If the module needs functional specs (i.e., it describes what software should do), it is not an import module — see the skill.
create-requires-module导入模块是位于****目录下的文件,仅包含、和/或。它绝对不能包含,且在其YAML前置元数据中不得使用字段。其他模块可通过其YAML前置元数据中的字段引入其内容,从而获取其中的定义和要求。
template/.plain***definitions******implementation reqs******test reqs******functional specs***requiresimport导入模块适用于:
- 在多个模块之间共享概念定义
- 提供通用的实现要求(如技术栈、编码标准)
- 提供通用的测试要求
- 创建可复用的基础结构(模板)
如果模块需要包含功能规格(即描述软件应实现的功能),则它不是导入模块——请参考技能。
create-requires-moduleWorkflow
工作流程
- Determine what shared content this module should provide — which definitions, implementation reqs, or test reqs will other modules need?
- Create the file in the
.plaindirectory with YAML frontmatter. Usetemplate/to declare concepts that importing modules must define. It may optionallyrequired_conceptsother templates for layered reuse, but must not useimport.requires - Add the shared content — definitions, implementation reqs, and/or test reqs.
- Do not add — import modules must not contain functional specs.
***functional specs*** - Verify concept availability — ensure all referenced are either defined in this module, provided by its own imports, declared as
:Concepts:, or are predefined concepts.required_concepts
- 确定该模块应提供的共享内容——其他模块需要哪些定义、实现要求或测试要求?
- 在目录下创建带有YAML前置元数据的
template/文件。使用.plain声明导入模块必须定义的概念。它可以选择性地required_concepts其他模板以实现分层复用,但绝对不能使用import。requires - 添加共享内容——定义、实现要求和/或测试要求。
- 不要添加——导入模块不得包含功能规格。
***functional specs*** - 验证概念可用性——确保所有引用的要么在本模块中定义,要么由其自身导入的模板提供,要么被声明为
:Concepts:,要么是预定义概念。required_concepts
Format
格式
The field is a list of module paths in the YAML frontmatter:
importplain
---
import:
- base_template
required_concepts: [":AppName:"]
description: Shared API definitions and reqs
---
***definitions***
- :ApiClient: is the HTTP client used to communicate with external services.
- :ApiResponse: is the response returned by :ApiClient:.
***implementation reqs***
- :Implementation: should handle HTTP errors by raising appropriate exceptions.
- :ApiClient: should support configurable timeouts.
***test reqs***
- :ConformanceTests: should mock all external HTTP calls made by :ApiClient:.The default import directory is — the prefix is not needed in import paths. The extension is omitted. Note the absence of — import modules must not have them.
template/template/.plain***functional specs***importplain
---
import:
- base_template
required_concepts: [":AppName:"]
description: Shared API definitions and reqs
---
***definitions***
- :ApiClient: is the HTTP client used to communicate with external services.
- :ApiResponse: is the response returned by :ApiClient:.
***implementation reqs***
- :Implementation: should handle HTTP errors by raising appropriate exceptions.
- :ApiClient: should support configurable timeouts.
***test reqs***
- :ConformanceTests: should mock all external HTTP calls made by :ApiClient:.默认导入目录为——导入路径中无需添加前缀,也无需包含扩展名。注意此处没有——导入模块不得包含该内容。
template/template/.plain***functional specs***Satisfying Required Concepts
满足必填概念
If an imported template declares , the importing module must define those concepts in its own section:
required_concepts***definitions***plain
---
import:
- auth_template
---
> auth_template declares required_concepts: [":AuthSchema:", ":AuthApiSpec:"]
> So this module must define them:
***definitions***
- :AuthSchema: is the JSON schema describing the authentication data structure.
- :AuthApiSpec: is the OpenAPI specification for the external service's auth endpoint.如果导入的模板声明了,则导入模块必须在其自身的部分定义这些概念:
required_concepts***definitions***plain
---
import:
- auth_template
---
> auth_template declares required_concepts: [":AuthSchema:", ":AuthApiSpec:"]
> So this module must define them:
***definitions***
- :AuthSchema: is the JSON schema describing the authentication data structure.
- :AuthApiSpec: is the OpenAPI specification for the external service's auth endpoint.Import 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 in the directory
template/ - Module does not contain
***functional specs*** - Module does not use in its frontmatter
requires - Contains at least one of: definitions, implementation reqs, or test reqs
- All from any imports this module itself uses are satisfied
required_concepts - declared for any concepts referenced but not defined here
required_concepts - No concept name collisions between this module's imports and local definitions
- YAML frontmatter is correctly formatted between markers
---
- 模块文件位于目录下
template/ - 模块不包含
***functional specs*** - 模块在前置元数据中不使用
requires - 至少包含以下内容之一:定义、实现要求或测试要求
- 本模块使用的所有导入模板所声明的均已满足
required_concepts - 所有被引用但未在此处定义的概念均已声明为
required_concepts - 本模块的导入内容与本地定义之间不存在概念名称冲突
- YAML前置元数据在标记之间格式正确
---