add-resource
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAdd Resource
添加资源
Always use the skill to retrieve the ***plain syntax rules — but only if you haven't done so yet.
load-plain-referenceLinked resources are external files referenced from within a spec using markdown link syntax. The file contents are passed to the renderer alongside the spec, providing additional context for code generation.
.plain请务必使用技能来获取***plain语法规则——但仅在你尚未获取的情况下使用。
load-plain-reference链接资源是指在规范中使用Markdown链接语法引用的外部文件。文件内容会与规范一起传递给渲染器,为代码生成提供额外上下文。
.plainWorkflow
工作流程
- Identify or create the resource file. It should be in the directory or in the same folder (or a subfolder) as the
resources/file..plain - Add the markdown link at the appropriate place in the spec.
- Verify the file path is relative to the file location.
.plain - Read the file back to confirm correct link syntax and path.
- 识别或创建资源文件。文件应位于目录中,或与
resources/文件处于同一文件夹(或其子文件夹)。.plain - 在规范的适当位置添加Markdown链接。
- 验证文件路径是否相对于文件的位置。
.plain - 重新读取文件以确认链接语法和路径正确。
Format
格式
Use standard markdown link syntax inside any spec section:
plain
***definitions***
- :AuthData: is the authentication data structure. Its format is defined
in the [auth schema](resources/auth_schema.json).
***implementation reqs***
- When transforming :BackupData:, use the JOLT transform defined in
[backup_transform.jolt](resources/backup_transform.jolt).
***functional specs***
- The system should expose an API conforming to the
[API specification](resources/api_spec.yaml).在规范的任意部分内使用标准Markdown链接语法:
plain
***definitions***
- :AuthData: 是认证数据结构。其格式定义在
[auth schema](resources/auth_schema.json)中。
***implementation reqs***
- 转换:BackupData:时,请使用[backup_transform.jolt](resources/backup_transform.jolt)中定义的JOLT转换规则。
***functional specs***
- 系统应暴露符合[API specification](resources/api_spec.yaml)的API。Path Rules
路径规则
- Paths are resolved relative to the file location.
.plain - Only files in the same folder or subfolders are supported.
- No external URLs — only local file references.
- No absolute paths.
- 路径会相对于文件的位置解析。
.plain - 仅支持同一文件夹或子文件夹中的文件。
- 不支持外部URL——仅允许本地文件引用。
- 不允许使用绝对路径。
Common Resource Types
常见资源类型
| Type | Typical location | Use case |
|---|---|---|
| JSON Schema | | Defining data structure contracts |
| OpenAPI / Swagger spec | | API endpoint definitions |
| Data transforms | | Data transformation rules |
| Test fixtures | | Sample data for tests |
| Configuration examples | | Reference configurations |
| 类型 | 典型位置 | 使用场景 |
|---|---|---|
| JSON Schema | | 定义数据结构契约 |
| OpenAPI / Swagger spec | | API端点定义 |
| 数据转换规则 | | 数据转换规则 |
| 测试夹具 | | 测试用示例数据 |
| 配置示例 | | 参考配置 |
When to Use Resources
何时使用资源
- The information is too detailed or structured to express inline in the spec (e.g., a full JSON schema).
- The same data is referenced by multiple specs or sections.
- The resource is an industry-standard format (OpenAPI, JSON Schema) that the renderer can interpret directly.
- 信息过于详细或结构化,无法在规范中内联表达(例如完整的JSON Schema)。
- 同一数据被多个规范或章节引用。
- 资源是渲染器可直接解析的行业标准格式(如OpenAPI、JSON Schema)。
When NOT to Use Resources
何时不使用资源
- The information is short enough to include inline in the spec text.
- The file is generated code (those belong in , not
plain_modules/).resources/
- 信息足够简短,可以直接包含在规范文本中。
- 文件是生成的代码(这类文件应放在中,而非
plain_modules/)。resources/
Validation Checklist
验证检查清单
- Resource file exists at the specified path
- Path is relative to the file, not absolute
.plain - File is in the same folder or a subfolder (no references)
../ - Markdown link syntax is correct:
[display text](relative/path) - Resource content is relevant and adds value beyond what the spec text says
- No external URLs used
- 资源文件存在于指定路径
- 路径相对于文件,而非绝对路径
.plain - 文件位于同一文件夹或子文件夹中(无引用)
../ - Markdown链接语法正确:
[显示文本](相对路径) - 资源内容相关且为规范文本提供额外价值
- 未使用外部URL