Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问clear审计提醒

api-response-mockerAPI response mocker 文档

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

1,406

周安装

58

GitHub Stars

53

下载量

459
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:api-response-mocker(API response mocker 文档)
来源仓库:https://github.com/dkyazzentwatwa/chatgpt-skills
仓库路径:skills/api-response-mocker
安装命令:
npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill api-response-mocker
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill api-response-mocker

简介

用于生成逼真的模拟 API 响应,支持 JSON 和 XML 格式及嵌套数据结构。

  • 适用于前端开发和测试阶段,提供 Faker 集成实现姓名、邮箱等假数据生成。
  • 支持基于 schema 的结构定义、数组生成和跨对象引用关系建模。
  • 可导出多种格式供不同客户端使用,简化联调和自动化测试流程。
  • 建议在隔离环境中运行,避免在生产系统误用导致数据泄露或异常行为。

SKILL.md

API Response Mocker

Generate realistic mock API responses with fake data using Faker.

Features

  • Schema-Based Generation: Define response structure
  • Faker Integration: Realistic fake data
  • Nested Objects: Complex nested structures
  • Arrays: Generate lists of objects
  • Relationships: Reference other mock data
  • Multiple Formats: JSON, XML output

Quick Start

from api_mocker import APIMocker

mocker = APIMocker()

# Generate user response
user = mocker.generate({
    "id": "uuid",
    "name": "name",
    "email": "email",
    "created_at": "datetime"
})

# Generate list of users
users = mocker.generate_list({
    "id": "uuid",
    "name": "name",
    "email": "email"
}, count=10)

CLI Usage

# Generate from schema file
python api_mocker.py --schema user_schema.json --output user.json

# Generate list
python api_mocker.py --schema product.json --count 50 --output products.json

# Generate with seed (reproducible)
python api_mocker.py --schema order.json --seed 42 --output order.json

# Preview without saving
python api_mocker.py --schema customer.json --preview

Schema Format

Define fields using Faker provider names:

{
    "id": "uuid",
    "first_name": "first_name",
    "last_name": "last_name",
    "email": "email",
    "phone": "phone_number",
    "company": "company",
    "address": {
        "street": "street_address",
        "city": "city",
        "state": "state",
        "zip": "zipcode",
        "country": "country"
    },
    "created_at": "date_time_this_year",
    "is_active": "boolean"
}

Available Data Types

Personal

  • name, first_name, last_name
  • email, safe_email
  • phone_number
  • ssn

Address

  • address, street_address
  • city, state, state_abbr
  • zipcode, postcode
  • country, country_code
  • latitude, longitude

Internet

  • url, domain_name
  • ipv4, ipv6
  • user_name, password
  • uuid, uuid4
  • mac_address

Business

  • company, company_suffix
  • job, job_title
  • bs, catch_phrase

Financial

  • credit_card_number
  • iban, bban
  • currency_code
  • price (custom: returns float)

Date/Time

  • date, time
  • date_time, date_time_this_year
  • date_of_birth
  • iso8601

Text

  • text, sentence, paragraph
  • word, words
  • slug

Numeric

  • random_int, random_number
  • random_float (use {"type": "float", "min": 0, "max": 100})
  • boolean

Advanced Schemas

Arrays

{
    "id": "uuid",
    "name": "name",
    "tags": {
        "_array": true,
        "_count": 3,
        "_item": "word"
    },
    "orders": {
        "_array": true,
        "_count": 5,
        "_item": {
            "order_id": "uuid",
            "amount": "random_int",
            "date": "date"
        }
    }
}

Custom Values

{
    "id": "uuid",
    "status": {
        "_choice": ["pending", "active", "completed"]
    },
    "priority": {
        "_range": [1, 5]
    },
    "score": {
        "_float": {"min": 0.0, "max": 100.0, "decimals": 2}
    }
}

Nested Objects

{
    "user": {
        "id": "uuid",
        "profile": {
            "bio": "paragraph",
            "avatar_url": "image_url",
            "social": {
                "twitter": "user_name",
                "linkedin": "url"
            }
        }
    }
}

API Reference

APIMocker Class

class APIMocker:
    def __init__(self, locale: str = "en_US", seed: int = None)

    # Generation
    def generate(self, schema: dict) -> dict
    def generate_list(self, schema: dict, count: int = 10) -> list

    # File operations
    def from_schema_file(self, filepath: str) -> dict
    def save(self, data: any, filepath: str, format: str = "json")

    # Utilities
    def set_seed(self, seed: int)
    def get_faker(self) -> Faker

Example Schemas

User Response

{
    "id": "uuid",
    "username": "user_name",
    "email": "email",
    "profile": {
        "first_name": "first_name",
        "last_name": "last_name",
        "avatar": "image_url",
        "bio": "sentence"
    },
    "created_at": "iso8601",
    "last_login": "date_time_this_month"
}

E-commerce Product

{
    "sku": "uuid",
    "name": "catch_phrase",
    "description": "paragraph",
    "price": {"_float": {"min": 9.99, "max": 999.99}},
    "currency": "currency_code",
    "category": {"_choice": ["Electronics", "Clothing", "Home", "Sports"]},
    "in_stock": "boolean",
    "rating": {"_float": {"min": 1, "max": 5, "decimals": 1}},
    "reviews_count": {"_range": [0, 500]}
}

API Error Response

{
    "error": {
        "code": {"_choice": ["NOT_FOUND", "UNAUTHORIZED", "BAD_REQUEST"]},
        "message": "sentence",
        "request_id": "uuid",
        "timestamp": "iso8601"
    }
}

Dependencies

  • faker>=22.0.0

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

27.65%
按下载量换算127

Claude Code

23.35%
按下载量换算107

Codex

20.33%
按下载量换算93

Gemini CLI

13.1%
按下载量换算60

Antigravity

9.1%
按下载量换算42

windsurf

3.52%
按下载量换算16

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills