Create Api logo

Create Api

Community
AntonHu
create-api

指导在前端项目中按团队规范创建和维护 HTTP 接口,包括类型定义、请求封装、命名约定与错误处理。当前端需要新增或调整 API 时使用本技能。

Overview

PublisherAntonHu
Repositoryai-coding-project
Skill namecreate-api
Stars
111
Forks
35
Bundled files
Instructions only
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.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

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

Installation

Install the Create Api 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/AntonHu/ai-coding-project/tree/main/.agents/skills/create-api
  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/AntonHu/ai-coding-project.git /tmp/ai-coding-project
mkdir -p .claude/skills
cp -r /tmp/ai-coding-project/.agents/skills/create-api .claude/skills/create-api
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Create Api 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 Create Api 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 Create Api 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.

创建与维护 API

使用场景

当前端需要:

  • 为某个业务模块 新增接口
  • 为已有接口 补充类型定义
  • 重构接口文件 或拆分模块

请使用本技能,并同时遵守 .agents/rules/05-API规范.md 中的强制规则。


步骤 1:确定接口归属模块

  1. 先确定业务模块名称(如 banner、user、ai-editor)。
  2. 对应的文件归属:
    • 请求封装文件:src/http/<module>.ts
    • 类型定义文件:src/interfaces/<module>/api.ts
    • 业务模型类型:src/interfaces/<module>/model.ts

约定:

  • 所有请求函数都放在 src/http 下按模块拆分,禁止在组件、page、store 中直接写 shentuHttpClient.xxx。

步骤 2:在 interfaces 中定义类型

在 src/interfaces/<module>/model.ts 中定义基础业务模型:

ts
// src/interfaces/banner/model.ts
export interface Banner {
  id: number;
  title: string;
  imageUrl: string;
  status: BannerStatus;
}

在 src/interfaces/<module>/api.ts 中定义请求/响应类型:

ts
// src/interfaces/banner/api.ts
import type {Banner} from './model';

export interface GetBannerListParams {
  page: number;
  pageSize: number;
  status?: Banner['status'];
}

export interface GetBannerListResponse {
  list: Banner[];
  total: number;
}

注意:

  • 请求参数类型和返回值类型应严格依据 Apifox 等接口文档,禁止凭空创造字段。
  • 返回值一般是 { code: number; msg: string; data: {...} } shentuHttpClient 内部已处理 code 判断并返回 data,因此这里只需定义 data 的结构。

步骤 3:在 http 中创建请求函数

在 src/http/<module>.ts 中:

ts
// src/http/banner.ts
import {shentuHttpClient} from '@/http';
import type {
  GetBannerListParams,
  GetBannerListResponse,
  GetBannerDetailResponse,
  CreateBannerParams,
  UpdateBannerParams,
} from '@/interfaces/banner/api';

export const getBannerList = async (params: GetBannerListParams) => {
  return shentuHttpClient.get<GetBannerListResponse>('/backend/banners', params);
};

export const getBannerDetail = async (id: number) => {
  return shentuHttpClient.get<GetBannerDetailResponse>(`/backend/banner/${id}`);
};

export const createBanner = async (data: CreateBannerParams) => {
  return shentuHttpClient.post<unknown>('/backend/banner', data);
};

export const updateBanner = async (data: UpdateBannerParams) => {
  return shentuHttpClient.put<unknown>(`/backend/banner/${data.id}`, data);
};

export const deleteBanner = async (id: number) => {
  return shentuHttpClient.delete<unknown>(`/backend/banner/${id}`);
};

步骤 4:命名与错误处理约定

命名(必须遵守 05-API规范 中的 NON-NEGOTIABLE):

  • 获取列表:getXxxList
  • 获取详情:getXxxDetail
  • 创建:createXxx
  • 更新:updateXxx
  • 删除:deleteXxx
  • 禁止 使用 fetchXxx 等前缀。

错误处理:

  • 接口错误由 shentuHttpClient 拦截器统一处理,业务代码中禁止重复加 message.error 等错误提示。
  • 业务侧只处理成功逻辑,以及前端自身校验错误(如表单校验失败)。

步骤 5:在业务代码中使用

在组件或 store 中使用时:

ts
import {getBannerList} from '@/http/banner';

const onLoad = async () => {
  const res = await getBannerList({page: 1, pageSize: 10});
  // 这里的 res 类型已经是 GetBannerListResponse
};

快速检查清单

  • 是否在 src/interfaces/<module>/api.ts 中定义了清晰的请求/响应类型?
  • 是否在 src/http/<module>.ts 中集中管理该模块的所有接口?
  • 函数命名是否符合 get/create/update/deleteXxx 规范?
  • 是否避免在业务代码中重复处理接口错误提示?

Frequently asked questions

What does the Create Api AI skill do?

指导在前端项目中按团队规范创建和维护 HTTP 接口,包括类型定义、请求封装、命名约定与错误处理。当前端需要新增或调整 API 时使用本技能。

Why use Create Api on TypingMind?

Because you install it once and use it with any model. Create Api 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 Create Api in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AntonHu/ai-coding-project/tree/main/.agents/skills/create-api. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Create Api?

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 Create Api?

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

Is the Create Api AI skill free?

It is published on GitHub by AntonHu. 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 👇