Resource Modeling logo

Resource Modeling

Community
zhaoxuya520
resource-modeling

把业务对象建模为 REST 资源时使用。适用于 API 设计起点、复杂业务对象抽象、资源关系定义。优先使用 REST 资源模型 + 集合/单资源/子资源/动作四种模式。

Overview

Publisherzhaoxuya520
RepositoryAI-Fullstack-Delivery-Workflow
Skill nameresource-modeling
Stars
56
Forks
18
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by zhaoxuya520 on GitHub. Read the source before you install it.

Installation

Install the Resource Modeling AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/zhaoxuya520/AI-Fullstack-Delivery-Workflow/tree/master/workflows/api-designer/skills/resource-modeling
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zhaoxuya520/AI-Fullstack-Delivery-Workflow.git /tmp/AI-Fullstack-Delivery-Workflow
mkdir -p .claude/skills
cp -r /tmp/AI-Fullstack-Delivery-Workflow/workflows/api-designer/skills/resource-modeling .claude/skills/resource-modeling
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Resource Modeling in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Resource Modeling on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Resource Modeling is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

REST 资源建模

参考来源:Roy Fielding《Architectural Styles》、REST API Design Best Practices

适用场景

  • API 设计的第一步
  • 把业务对象抽象为可寻址资源
  • 复杂业务对象的关系建模
  • 决定资源粒度

不适用场景

  • RPC 风格 API(不需要资源建模)
  • GraphQL(用 schema 建模)

核心原则

text
1. 资源是名词,不是动词
   ✅ /users
   ❌ /createUser

2. 资源粒度合适
   不要太大(包含太多无关字段)
   不要太细(每个字段都成资源)

3. 资源对应业务对象
   从用户视角看是什么,资源就是什么
   不是从数据库表照搬

4. 资源关系清晰
   通过路径表达从属关系
   /users/123/orders 表示用户 123 的订单

四种资源模式

1. 集合(Collection)

text
/resources

GET    /resources         查询列表
POST   /resources         创建新资源

例:
  GET  /users           查询用户列表
  POST /users           创建用户

2. 单资源(Singleton)

text
/resources/{id}

GET    /resources/{id}    查询单个
PUT    /resources/{id}    完全替换
PATCH  /resources/{id}    部分更新
DELETE /resources/{id}    删除

例:
  GET    /users/123      查询用户 123
  PATCH  /users/123      更新用户 123

3. 子资源(Sub-resource)

text
/resources/{id}/sub-resources

例:
  /users/123/orders             用户 123 的订单
  /orders/456/items             订单 456 的商品
  /projects/789/members         项目 789 的成员

4. 动作端点(Actions)

text
当无法用状态变更自然表达时使用

/resources/{id}/actions/{action}

例:
  POST /orders/123/cancel       取消订单
  POST /users/123/reset-password 重置密码
  POST /reports/456/export      导出报表

资源命名规范

text
✅ 好的:
  - 复数形式(users / orders / products)
  - 小写 + 连字符(reset-password)
  - 名词

❌ 差的:
  - 单数(user / order)
  - 驼峰(ResetPassword)
  - 动词(getUser / createOrder)

建模示例

业务:电商订单系统

text
业务对象:
  - 用户 User
  - 商品 Product
  - 订单 Order
  - 订单项 OrderItem
  - 支付 Payment
  - 发货 Shipment

资源建模:

集合:
  /users
  /products
  /orders

单资源:
  /users/{id}
  /products/{id}
  /orders/{id}

子资源(用户的):
  /users/{id}/orders            用户的订单
  /users/{id}/addresses         用户的地址

子资源(订单的):
  /orders/{id}/items            订单项
  /orders/{id}/payments         订单支付记录
  /orders/{id}/shipments        发货记录

动作端点:
  POST /orders/{id}/cancel      取消订单
  POST /orders/{id}/refund      申请退款
  POST /orders/{id}/confirm     确认收货

注意:OrderItem 不需要顶层 /order-items
  它只在订单上下文中有意义

资源关系图

输出格式

markdown
## 资源建模:[业务模块]

### 业务对象清单

| 对象 | 业务含义 | 是否独立资源 |
|------|---------|------------|
| User | 用户 | 是(顶层) |
| Order | 订单 | 是(顶层) |
| OrderItem | 订单项 | 否(订单子资源) |

### 资源端点清单

| 资源 | 路径 | 说明 |
|------|------|------|
| 用户集合 | /users | 用户列表和创建 |
| 单用户 | /users/{id} | 用户详情和修改 |
| 用户订单 | /users/{id}/orders | 某用户的订单 |
| 订单集合 | /orders | 全部订单 |
| 单订单 | /orders/{id} | 订单详情 |
| 订单项 | /orders/{id}/items | 订单内的商品 |
| 取消订单 | POST /orders/{id}/cancel | 动作端点 |

### 资源关系图

[Mermaid ER 图]

### 关键决策

- OrderItem 不做顶层资源(不独立有意义)
- 用户地址作为子资源 /users/{id}/addresses
- 取消订单用动作端点(不是 PATCH status)

工作流程

text
1. 列出业务对象
2. 判断哪些是顶层资源
3. 判断哪些是子资源(不独立)
4. 列出资源关系(一对多 / 多对多)
5. 命名资源(复数 + 小写)
6. 识别需要动作端点的场景
7. 画 ER 关系图
8. 输出资源端点清单
9. 转交 endpoint-design 设计具体端点

质量自检

text
□ 资源是名词不是动词
□ 复数命名一致
□ 小写 + 连字符
□ 子资源是否真的不独立
□ 是否避免了过深嵌套(不超过 3 层)
□ 动作端点是否真的无法用 CRUD 表达
□ ER 关系图是否完整

常见坑

  1. 从数据库表照搬——所有表都是顶层资源
  2. 资源是动词——/getUser / /createOrder
  3. 嵌套太深——/users/123/orders/456/items/789/refunds/0
  4. 强行用 CRUD——/orders/{id} PATCH {status: "cancelled"} 不如 /orders/{id}/cancel
  5. 子资源独立化——/order-items 顶层资源(脱离订单无意义)
  6. 命名混乱——单复数混用 / 大小写混用

配套模板

  • templates/resource-model-template.md — 资源建模 + ER 图模板

与其他 skill 的协作

text
上游:
  product-manager 的业务实体清单
  database-engineer 的实体关系(参考但不照搬)

下游:
  endpoint-design → 设计每个资源的端点
  request-response → 设计字段

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Resource Modeling AI skill do?

把业务对象建模为 REST 资源时使用。适用于 API 设计起点、复杂业务对象抽象、资源关系定义。优先使用 REST 资源模型 + 集合/单资源/子资源/动作四种模式。

Why use Resource Modeling on TypingMind?

Because you install it once and use it with any model. Resource Modeling is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Resource Modeling in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/zhaoxuya520/AI-Fullstack-Delivery-Workflow/tree/master/workflows/api-designer/skills/resource-modeling. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Resource Modeling?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Resource Modeling?

As many as you like. As long as a model supports skills, you can use Resource Modeling with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Resource Modeling AI skill free?

It is published on GitHub by zhaoxuya520. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇