Agent skill

Mock Codegen

by ChenyCHENYU in ChenyCHENYU/Robot_Admin

A skill your agent uses when: generating mock data for development without a backend.

MITAuto-check passedDevelopment

Install Mock Codegen

skills CLI
$ npx skills add ChenyCHENYU/Robot_Admin --skill mock-codegen -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ChenyCHENYU/Robot_Admin mock-codegen --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ChenyCHENYU/Robot_Admin.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/mock-codegen .claude/skills/mock-codegen && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mock-codegen
GitHub stars
1k
Token cost
~1.2k tokens
SKILL.md length
186 words
Files
1
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when: generating mock data for development without a backend.

  • Works in 5 steps: 确认是否需要 Mock → 根据 page-spec 推导字段类型 → 生成 getMockList 函数 → …
  • : generating mock data for development without a backend
  • SKILL.md covers 触发, Robot Admin Mock 约定, 步骤 and 输出文件, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Mock Codegen is an agent skill from ChenyCHENYU/Robot_Admin. Use when: generating mock data for development without a backend. Optional skill - activated when user confirms or explicitly requests it. Triggers on: 生成mock, mock数据, 模拟数据, mock生成, 前端mock, 联调前mock.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Project scaffolding. It works with Vue.js. The repository describes itself as: 一款专为开发者省时间、提效率的现代化中后台模板,跳过低质造轮子,上手即开工!Vue 3 + TS + Naive UI,更有 Bun+Vite 双引擎,性能直接拉满💥 毫秒级热更新不卡顿,开发丝滑,您试试!还有49 个成熟组件,演示页+文档双重完善,无残缺、无坑点,复制即用无需额外调试;配套 8 个 @robot-admin…. The licence is MIT.

When your agent uses it

  • : generating mock data for development without a backend
  • Explicitly requests it

Example prompts

  • “/mock-codegen”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. 确认是否需要 Mock
  2. 根据 page-spec 推导字段类型
  3. 生成 getMockList 函数
  4. 注入 Headless CRUD(可选)
  5. 简单赋值模式

What it can do on your machine

Read from SKILL.md and the folder at commit d9770ea. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mock Codegen loads about 1.2k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 186 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ChenyCHENYU/Robot_Admin at commit d9770ea, republished under its MIT licence (© ChenyCHENYU). 186 words, ~1,151 tokens.

Download SKILL.mdSave it as .claude/skills/mock-codegen/SKILL.md (or your agent's skills folder).
name
mock-codegen
description
Use when: generating mock data for development without a backend. Optional skill - activated when user confirms or explicitly requests it. Triggers on: 生成mock, mock数据, 模拟数据, mock生成, 前端mock, 联调前mock.

Skill: Mock 数据生成(mock-codegen)

⚡ 可选技能 — 默认不在标准工作流中强制执行。

触发方式:

  • 执行完整流程时(prototype-scan → api-contract → page-codegen),AI 会在最后询问:"是否需要生成 Mock 数据以便在联调前使用?"
  • 用户明确说"帮我生成 mock 数据"时直接执行

触发

  • 用户显式请求 Mock 数据生成
  • 执行完整代码生成流程结束时,由 AI 确认后执行
  • 接收 page-spec JSON 作为输入(来自 prototype-scan)

Robot Admin Mock 约定

本项目采用轻量级内联 Mock 模式:

  • Mock 数据直接写在 data.ts 中,以函数或常量导出
  • useTableCrud 支持传入本地数据数组代替真实 API 调用
  • 不依赖 MSW / axios-mock-adapter 等重量级 mock 框架
  • 通过环境变量 VITE_APP_ENV=development 判断是否启用

步骤

1. 确认是否需要 Mock

在完整流程末尾,AI 询问:

✅ 页面代码已生成完成。

是否需要生成 Mock 数据(开发联调前使用)?
- 输入 Y / 是 → 生成 Mock 并注入 data.ts
- 输入 N / 否 → 跳过,等后端接口就绪后对接
2. 根据 page-spec 推导字段类型

从 page-spec.columns + page-spec.form 推导每个字段的 mock 策略:

字段类型/名称特征Mock 策略
id / *IdDate.now() + index 或递增数字
name / *Name中文姓名候选数组随机取
status从 page-spec tagMap 的 key 中随机取
date / *Time / createTimenew Date().toISOString() ± 随机天数
phone / mobile1${['3','5','7','8'][r]}${随机9位数}
emailuser${i}@example.com
amount / price / *FeeMath.floor(Math.random() * 10000)
count / num / qtyMath.floor(Math.random() * 100)
type / category从 options 配置中随机取 value
remark / desc / note候选文本数组随机取
boolean / enabledMath.random() > 0.5
3. 生成 getMockList 函数

在 data.ts 中追加以下代码(放在文件末尾,用区块注释隔开):

typescript
// ================= Mock 数据(联调前使用,对接真实接口后可删除)=================

/**
 * * @description: 生成{{资源名}}模拟数据列表
 * ? @param {number} count 生成条数,默认 30
 * ! @return {ResourceItem[]} 模拟数据数组
 */
export const getMockList = (count = 30): {{ResourceItem}}[] => {
  // 候选数据池
  const names = ['张三', '李四', '王五', '赵六', '陈七', '周八', '吴九', '郑十']
  const depts = ['技术部', '市场部', '运营部', '财务部', '人事部']

  return Array.from({ length: count }, (_, i) => ({
    id: i + 1,
    // ... 根据 page-spec 字段自动生成(每个字段对应上表策略)
    createTime: new Date(Date.now() - Math.random() * 30 * 24 * 3600 * 1000).toLocaleString(),
    updateTime: new Date().toLocaleString(),
  }))
}

/**
 * * @description: 生成分页 Mock 响应(模拟后端响应结构)
 * ? @param {number} page 当前页
 * ? @param {number} pageSize 每页条数
 * ! @return {object} 分页响应对象
 */
export const getMockPageResult = (page = 1, pageSize = 20) => {
  const allData = getMockList(100)
  const start = (page - 1) * pageSize
  return {
    list: allData.slice(start, start + pageSize),
    total: allData.length,
    page,
    pageSize,
  }
}
4. 注入 Headless CRUD(可选)

如果页面使用了表格 CRUD,直接通过 query 注入 Mock 查询函数,不伪造接口配置:

typescript
import { useNaiveTableCrud } from '@robot-admin/request-core/naive'

const tableCrud = useNaiveTableCrud({
  autoLoad: 'mounted',
  defaultPageSize: 20,
  query: async ({ page, pageSize }) => {
    const result = getMockList(page, pageSize)
    return { items: result.list, total: result.total }
  },
  columns: getTableColumns(),
})
5. 简单赋值模式

不需要 CRUD 状态机的纯展示页可直接在 onMounted 中赋值:

typescript
// index.vue 中
const tableData = ref<ResourceItem[]>([])
const loading = ref(false)

onMounted(async () => {
  loading.value = true
  try {
    // 开发 Mock 模式 —— 对接真实接口时替换为 API 调用
    // const res = await getResourceListApi({ page: 1, pageSize: 20 })
    // tableData.value = res.data.list
    tableData.value = getMockList(30) // 开发 Mock 用
  } finally {
    loading.value = false
  }
})

输出文件

文件操作
src/views/<domain>/<name>/data.ts追加 getMockList + getMockPageResult
src/views/<domain>/<name>/index.vue可选:修改 onMounted 注入 mock 数据

注意事项

  1. Mock 代码加注释:所有 Mock 代码块前后加 // ===== Mock 数据 ===== 注释,便于对接真实接口时批量删除
  2. 不影响生产:Mock 代码仅在开发时使用,不影响生产构建
  3. 字段名必须一致:Mock 数据的字段名必须与 getTableColumns() 中的 key 完全一致
  4. 状态字段取合法值:status 等字段的值必须来自 STATUS_TAG_CONFIG 的 key,否则渲染会出现空白
  5. 数量建议 20-50 条:足够测试分页逻辑,不超过内存限制

© ChenyCHENYU, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/mock-codegen of ChenyCHENYU/Robot_Admin.

Open the folder on GitHubat commit d9770ea

Compare with similar skills

Mock Codegen next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mock Codegen compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mock Codegen this skillChenyCHENYU/Robot_Admin1k—~1.2kAutomated safety check: PassMIT
Jeecg Codegen Newjeecgboot/skills239—~2.4kAutomated safety check: PassApache-2.0
Add Componentindielayer/ui222—~293Automated safety check: PassMIT
Cabloy Frontend Scaffoldcabloy/cabloy982—~4.1kAutomated safety check: PassMIT
Fe Tools Template RecommenderMichealWayne/fe-tools207—~1kAutomated safety check: PassNone
MoviePilot Plugin Developerjxxghp/MoviePilot12k—~6.4kAutomated safety check: PassGPL-3.0

Similar skills

  • Jeecg Codegen New

    jeecgboot/skills

    A skill your agent uses when user asks to generate JeecgBoot CRUD code, create a new module, add/modify fields on existing module, or says "代码生成", "生成代码", "创建模块", "新增功能", "建表", "加字段", "加一个字段"…

    239 GitHub stars~2.4k tokensUpdated 20 days ago
    DevelopmentAuto-check passed
  • Add Component

    indielayer/ui

    Add a new Vue component to @indielayer/ui with themes, tests, docs, and registry exports.

    222 GitHub stars~293 tokensUpdated today
    DevelopmentAuto-check passed
  • A skill your agent uses whenever the user wants the Zova frontend path in this Cabloy repo: create or extend pages, components, api or model beans, route/query/params work, metadata refresh…

    982 GitHub stars~4.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Fe Tools Template Recommender

    MichealWayne/fe-tools

    Recommend the most suitable project template or initialization path from fe-tools project-templates based on product, framework, runtime, and delivery constraints.

    207 GitHub stars~1k tokensUpdated 29 days ago
    DevelopmentAuto-check passed
  • Builds, fixes and validates MoviePilot local plugins for V3 and V2 hosts: metadata files, source layout, Vue and Vuetify pages, commands, services and local reload.

    12k GitHub stars~6.4k tokensUpdated today
    DevelopmentAuto-check passed
  • Jeecg Uniapp Codegen

    jeecgboot/skills

    JeecgBoot UniApp3 移动端 CRUD 代码生成器。Use when user asks to generate UniApp3/mobile/APP CRUD pages, create mobile list/form pages, or says '生成移动端代码', '生成APP页面', 'uniapp代码生成', '移动端CRUD', '生成uniapp页面'…

    239 GitHub stars~2.7k tokensUpdated 20 days ago
    DevelopmentAuto-check passed

More from ChenyCHENYU/Robot_Admin

  • API Contract

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs.

    1k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Branch Sync

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: upgrading dependencies, adding common features, or when the user explicitly requests branch sync check.

    1k GitHub stars~883 tokensUpdated today
    Auto-check passed
  • Convention Audit

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: reviewing code for compliance with Robot Admin project conventions, or when generating a compliance report.

    1k GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Page Codegen

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: generating Vue 3 page code from either a page-spec JSON or a natural language description.

    1k GitHub stars~3.5k tokensUpdated today
    Auto-check passed
  • Prototype Scan

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: analyzing Axure exported HTML prototype files or detailed design documents to extract page inventory, classify interaction patterns, and produce a structured page-spec…

    1k GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Route Sync

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: registering new pages into the dynamic router system.

    1k GitHub stars~1.5k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Mock Codegen

What does Mock Codegen do?

A skill your agent uses when: generating mock data for development without a backend. Mock Codegen is an agent skill from ChenyCHENYU/Robot_Admin. Use when: generating mock data for development without a backend.

When should I use Mock Codegen?

Mock Codegen fits situations like: : generating mock data for development without a backend; explicitly requests it.

How do I install Mock Codegen in Claude Code?

Run `npx skills add ChenyCHENYU/Robot_Admin --skill mock-codegen -a claude-code`. Or copy the skill folder (.github/skills/mock-codegen in ChenyCHENYU/Robot_Admin) into .claude/skills/mock-codegen in your project. Claude Code loads it when a task matches its description.

How do I install Mock Codegen in Codex?

Run `npx skills add ChenyCHENYU/Robot_Admin --skill mock-codegen -a codex`. Or copy the skill folder (.github/skills/mock-codegen in ChenyCHENYU/Robot_Admin) into .agents/skills/mock-codegen in your project. Codex loads it when a task matches its description.

Can I use Mock Codegen in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ChenyCHENYU/Robot_Admin --skill mock-codegen -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mock-codegen, .gemini/skills/mock-codegen, .github/skills/mock-codegen and .opencode/skills/mock-codegen in your project.

What does Mock Codegen need to run?

SKILL.md names no scripts, command-line tools or credentials: Mock Codegen is instructions for the agent only.

Does Mock Codegen access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mock Codegen safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mock Codegen use?

Mock Codegen is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mock Codegen use?

About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mock Codegen?

Skills that share tags, products or a category with Mock Codegen: Jeecg Codegen New (jeecgboot/skills, 239 stars), Add Component (indielayer/ui, 222 stars), Cabloy Frontend Scaffold (cabloy/cabloy, 982 stars) and Fe Tools Template Recommender (MichealWayne/fe-tools, 207 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mock Codegen?

ChenyCHENYU (a GitHub user) maintains it in ChenyCHENYU/Robot_Admin, which has 1,020 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 8, 2026.

Source: ChenyCHENYU/Robot_Admin on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.