用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Miasakiii/skills-manager --skill code-generator命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | code-generator |
| version | 1.0.0 |
| description | 代码模板生成,支持多种语言和框架 |
| summary | 根据用户需求生成代码模板,支持 React/Vue/Express/FastAPI 等主流框架。 包含最佳实践和项目结构建议。 |
| skill_type | component |
| intent | 快速生成符合最佳实践的代码模板和脚手架 |
| type | tool |
| tags | ["code","template","scaffolding","generator"] |
| category | development |
| author | skills-manager |
| license | MIT |
根据用户需求生成代码模板:
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
| type | string | ✅ | 模型类型:component / api / test / config |
| framework | string | ✅ | 框架:react / vue / express / fastapi / flask |
| name | string | ✅ | 组件/模块名称 |
| language | string | ❌ | 语言:typescript / javascript / python,默认 typescript |
| features | array | ❌ | 附加功能:["styled-components", "testing", "storybook"] |
// 生成的 React 组件模板
import React from 'react';
interface {Name}Props {
// 定义 props
}
export const {Name}: React.FC<{Name}Props> = (props) => {
return (
<div>
{/* 组件内容 */}
</div>
);
};
export default {Name};
<!-- 生成的 Vue 组件模板 -->
<template>
<div class="{name}">
<!-- 组件内容 -->
</div>
</template>
<script setup lang="ts">
interface Props {
// 定义 props
}
const props = defineProps<Props>();
</script>
<style scoped>
.{name} {
/* 样式 */
}
</style>
// 生成的 Express 路由模板
import { Router, Request, Response } from 'express';
const router = Router();
router.get('/{name}', async (req: Request, res: Response) => {
try {
// 处理逻辑
res.json({ success: true });
} catch (error) {
res.status(500).json({ error: 'Internal server error' });
}
});
export default router;
# 生成的 FastAPI 路由模板
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
router = APIRouter()
class {Name}Response(BaseModel):
success: bool
data: dict = None
@router.get("/{name}", response_model={Name}Response)
async def get_{name}():
try:
# 处理逻辑
return {Name}Response(success=True)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
输入:
{
"type": "component",
"framework": "react",
"name": "UserCard",
"language": "typescript",
"features": ["styled-components", "testing"]
}
输出:
{
"files": [
{
"path": "src/components/UserCard/UserCard.tsx",
"content": "// React 组件代码..."
},
{
"path": "src/components/UserCard/UserCard.styles.ts",
"content": "// styled-components 样式..."
},
{
"path": "src/components/UserCard/UserCard.test.tsx",
"content": "// 测试代码..."
},
{
"path": "src/components/UserCard/index.ts",
"content": "export { default } from './UserCard';"
}
],
"instructions": [
"将文件放入 src/components/UserCard/ 目录",
"运行 npm install styled-components @types/styled-components",
"在需要的地方 import UserCard from '@/components/UserCard'"
]
}