소스 정보
- 저장소
- tomevault-io/skills-registry
- 최근 소스 활동
- 2026년 5월 11일 15:30
- 감지된 SKILL.md 언어
- 중국어
- 스타
- 0
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tomevault-io/skills-registry --skill apifox-mock-script-gen명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | apifox-mock-script-gen |
| description | | Use when this capability is needed. |
⚠️ 无文档不生成!必须先获取 API 文档,才能编写 Mock 脚本。
❌ 听到"营业时间"就认为是 object {monday: "5-18"}
✅ 必须先查看文档,确认是 array 还是 object
❌ 用户描述需求后直接生成代码
✅ 必须先调用 apifox_get_api_detail 获取文档
❌ 只检查顶层字段 $.data.businessHours 的类型
✅ 必须检查嵌套字段 $.data.businessHours[0].day 的类型
1. 🔴 强制:调用 mcp__apifox-api-docs-mcp__apifox_get_api_list
└─ 如果失败,停止并报错:"无法获取接口列表"
2. 🔴 强制:匹配目标接口并获取 apiId
└─ 如果找不到,停止并报错:"未找到目标接口"
3. 🔴 强制:调用 mcp__apifox-api-docs-mcp__apifox_get_api_detail
└─ 如果失败,停止并报错:"无法获取接口详情"
4. 🔴 强制:提取类型定义并创建映射表
└─ 遍历所有字段,记录路径和类型
在获取文档后,向用户确认:
1. 参照类型映射表生成 Mock 数据
2. 根据需求选择代码模式(见 references/code-patterns.md)
3. 为每个字段添加类型注释
✓ 步骤1:验证 API 调用方式(使用 fox. 前缀)
✓ 步骤2:验证函数调用(handleRequest() 被调用)
✓ 步骤3:🔴 逐字段验证类型(对照类型映射表)
✓ 步骤4:验证嵌套类型(array 元素、object 字段)
✓ 步骤5:验证必填字段(有默认值)
✓ 步骤6:验证注释完整性
从 API 文档提取类型后,创建类型映射表:
// 从 API 文档提取的类型定义
var typeMapping = {
// 基本类型
'$.data.code': 'integer',
'$.data.msg': 'string',
'$..data.id': 'integer',
// 对象类型
'$.data.description': 'object',
'$.data.description.title': 'string',
// 数组类型
'$.data.images': 'array',
'$.data.images[0]': 'string',
// 嵌套数组对象
'$.data.businessHours': 'array',
'$.data.businessHours[0]': 'object',
'$.data.businessHours[0].day': 'integer',
'$.data.businessHours[0].open': 'string'
};
| 文档类型 | JavaScript 类型 | Mock 示例 |
|---|---|---|
string | String | "测试文本" |
integer | Number (整数) | 123 |
number | Number (浮点) | 123.45 |
boolean | Boolean | true |
array | Array | [1, 2, 3] |
object | Object | { key: 'value' } |
// ✅ 正确:使用 fox. API
var responseJson = fox.mockResponse.json();
fox.mockResponse.setBody(responseJson);
// ❌ 错误:使用不存在的 API
response.json(data);
res.send(data);
| HTTP 方法 | 参数位置 | 正确的 API |
|---|---|---|
| GET | Query 参数 | fox.mockRequest.getParam(key) |
| POST | JSON Body | fox.mockRequest.body.key |
| ALL | Headers | fox.mockRequest.headers.get(key) |
| ALL | Cookies | fox.mockRequest.cookies.get(key) |
// ✅ 正确:定义并手动调用
var handleRequest = function() {
// 逻辑代码
};
handleRequest();
// ❌ 错误:使用参数化函数(不会被执行)
function handleMockRequest(req, res) {
// 逻辑代码
}
var MockJs = require('mockjs');
var handleRequest = function() {
var responseJson = fox.mockResponse.json();
// GET 请求:获取 Query 参数
var page = fox.mockRequest.getParam('page') || '1';
// POST 请求:获取 JSON Body
var body = fox.mockRequest.body || {};
responseJson.code = 0;
responseJson.msg = 'success';
responseJson.data = {
page: page,
moduleId: body.module || 1
};
fox.mockResponse.setBody(responseJson);
fox.mockResponse.setDelay(300);
};
handleRequest();
apifox_get_api_list 并获取接口列表apifox_get_api_detail 并获取完整文档fox.mockResponse.json() 获取响应对象fox.mockResponse.setBody() 设置响应handleRequest() 函数并在末尾调用(req, res) 参数模式fox. 前缀$.data.items[0].user.id)// 1. 引入依赖(如需要)
var MockJs = require('mockjs');
// 2. 主处理函数
var handleRequest = function() {
// 2.1 获取响应对象
var responseJson = fox.mockResponse.json();
// 2.2 获取请求参数(根据 HTTP 方法选择正确方式)
var param = fox.mockRequest.getParam('key'); // GET
// var body = fox.mockRequest.body.key; // POST
// 2.3 业务逻辑处理(分页、Token、异常等)
// 2.4 设置响应数据
responseJson.code = 0;
responseJson.msg = 'success';
responseJson.data = { /* Mock 数据 */ };
// 2.5 返回响应
fox.mockResponse.setBody(responseJson);
fox.mockResponse.setDelay(500); // 可选
};
// 3. 手动调用函数
handleRequest();
references/code-patterns.md - 分页、Token、异常等常见场景的代码模式references/error-cases.md - 常见错误及解决方案references/api-reference.md - 完整的 API 文档references/mock_script_guide.md - Apifox 官方文档mcp__apifox-api-docs-mcp__apifox_get_api_list - 获取接口列表mcp__apifox-api-docs-mcp__apifox_get_api_detail - 获取接口详情mcp__apifox-api-docs-mcp__apifox_health_check - 健康检查何时读取 code-patterns.md?
何时读取 error-cases.md?
何时读取 api-reference.md?
Converted and distributed by TomeVault — claim your Tome and manage your conversions.