← 返回 Skills 市场
119
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install django-vue-admin
功能描述
Generate complete django-vue-admin style CRUD code including Django models, serializers, views, URLs, Vue API, and Vue pages from module descriptions.
使用说明 (SKILL.md)
django-vue-admin 代码生成器
一键生成完整的 django-vue-admin 风格项目代码。
功能
用户告诉 Skill 要创建的模块,Skill 自动生成:
- Django Model
- Django Serializer
- Django ViewSet
- Django URL
- Vue 页面
- Vue API
自动读取模板文档
Skill 内置以下模板文档,会自动读取用于代码生成:
| 文档 | 用途 |
|---|---|
templates/CORE_MODULES.md |
核心模块完整代码(用户/角色/组织/权限/字典/文件) |
templates/BUSINESS_LOGIC.md |
业务逻辑参考(用户/权限/工作流) |
templates/LOGIC_FLOW.md |
流程逻辑(登录/权限校验/数据权限) |
templates/FIELD_TEMPLATE.md |
字段模板(常用字段组合) |
Skill 会根据用户描述的模块,自动:
- 读取 FIELD_TEMPLATE.md 获取字段定义
- 读取 BUSINESS_LOGIC.md 获取业务逻辑模式
- 读取 LOGIC_FLOW.md 获取流程逻辑
- 生成完整的 CRUD 代码
使用方式
示例对话
用户: 创建一个产品管理模块,包含名称、价格、库存、分类字段
Skill: 自动生成以下代码:
# apps/product/models.py
class Product(CommonBModel):
name = models.CharField('产品名称', max_length=200)
price = models.DecimalField('价格', max_digits=10, decimal_places=2)
stock = models.IntegerField('库存', default=0)
category = models.ForeignKey('Category', on_delete=models.CASCADE, verbose_name='分类')
status = models.BooleanField('状态', default=True)
...
用户直接复制到项目中即可使用。
代码生成器
内置模板
1. Model 模板
from django.db import models
from utils.model import CommonBModel
class Product(CommonBModel):
"""产品"""
name = models.CharField('产品名称', max_length=200)
code = models.CharField('产品编码', max_length=50, unique=True)
price = models.DecimalField('价格', max_digits=10, decimal_places=2)
stock = models.IntegerField('库存', default=0)
status = models.BooleanField('状态', default=True)
description = models.TextField('描述', blank=True)
# 关联字段
category = models.ForeignKey('Category', on_delete=models.CASCADE,
verbose_name='分类', related_name='products')
class Meta:
verbose_name = '产品'
verbose_name_plural = '产品'
ordering = ['-create_time']
def __str__(self):
return self.name
2. Serializer 模板
from rest_framework import serializers
from .models import Product
class ProductSerializer(serializers.ModelSerializer):
category_name = serializers.CharField(source='category.name', read_only=True)
class Meta:
model = Product
fields = '__all__'
@staticmethod
def setup_eager_loading(queryset):
return queryset.select_related('category', 'create_by', 'belong_dept')
class ProductCreateSerializer(serializers.ModelSerializer):
class Meta:
model = Product
fields = ['name', 'code', 'category', 'price', 'stock', 'status', 'description']
3. ViewSet 模板
from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import IsAuthenticated
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.filters import SearchFilter, OrderingFilter
from .models import Product
from .serializers import ProductSerializer, ProductCreateSerializer
from utils.permission import RbacPermission
class ProductViewSet(ModelViewSet):
"""产品管理"""
perms_map = {
'get': '*',
'post': 'product_create',
'put': 'product_update',
'delete': 'product_delete',
}
permission_classes = [IsAuthenticated, RbacPermission]
queryset = Product.objects.all()
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
search_fields = ['name', 'code']
filterset_fields = ['category', 'status']
ordering = ['-create_time']
def get_serializer_class(self):
if self.action in ['list', 'retrieve']:
return ProductSerializer
return ProductCreateSerializer
def get_queryset(self):
from utils.queryset import get_data_scope
return get_data_scope(self.request.user, super().get_queryset())
4. URL 模板
from rest_framework.routers import DefaultRouter
from .views import ProductViewSet
router = DefaultRouter()
router.register(r'product', ProductViewSet, basename='product')
urlpatterns = router.urls
5. Vue API 模板
export function getProductList(params) {
return request({ url: '/myapp/product/', method: 'get', params })
}
export function getProduct(id) {
return request({ url: `/myapp/product/${id}/`, method: 'get' })
}
export function createProduct(data) {
return request({ url: '/myapp/product/', method: 'post', data })
}
export function updateProduct(id, data) {
return request({ url: `/myapp/product/${id}/`, method: 'put', data })
}
export function deleteProduct(id) {
return request({ url: `/myapp/product/${id}/`, method: 'delete' })
}
6. Vue 页面模板
\x3Ctemplate>
\x3Cdiv class="app-container">
\x3Cdiv class="filter-container">
\x3Cel-input v-model="listQuery.name" placeholder="名称" style="width: 200px" @keyup.enter.native="handleFilter" />
\x3Cel-button type="primary" icon="el-icon-search" @click="handleFilter">搜索\x3C/el-button>
\x3Cel-button type="primary" icon="el-icon-plus" @click="handleCreate" v-permission="['product_create']">新增\x3C/el-button>
\x3C/div>
\x3Cel-table v-loading="listLoading" :data="list" border stripe>
\x3Cel-table-column prop="id" label="ID" width="80" />
\x3Cel-table-column prop="name" label="名称" />
\x3Cel-table-column prop="price" label="价格" width="100">
\x3Ctemplate slot-scope="{row}">¥{{ row.price }}\x3C/template>
\x3C/el-table-column>
\x3Cel-table-column prop="stock" label="库存" width="80" />
\x3Cel-table-column prop="status" label="状态" width="80">
\x3Ctemplate slot-scope="{row}">
\x3Cel-tag :type="row.status ? 'success' : 'danger'">{{ row.status ? '启用' : '禁用' }}\x3C/el-tag>
\x3C/template>
\x3C/el-table-column>
\x3Cel-table-column label="操作" width="180" fixed="right">
\x3Ctemplate slot-scope="{row}">
\x3Cel-button type="text" @click="handleUpdate(row)" v-permission="['product_update']">编辑\x3C/el-button>
\x3Cel-button type="text" @click="handleDelete(row)" v-permission="['product_delete']">删除\x3C/el-button>
\x3C/template>
\x3C/el-table-column>
\x3C/el-table>
\x3Cpagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
\x3Cel-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="600px">
\x3Cel-form ref="dataForm" :model="temp" :rules="rules" label-width="100px">
\x3Cel-form-item label="名称" prop="name">
\x3Cel-input v-model="temp.name" />
\x3C/el-form-item>
\x3Cel-form-item label="价格" prop="price">
\x3Cel-input-number v-model="temp.price" :min="0" :precision="2" />
\x3C/el-form-item>
\x3Cel-form-item label="库存">
\x3Cel-input-number v-model="temp.stock" :min="0" />
\x3C/el-form-item>
\x3Cel-form-item label="状态">
\x3Cel-switch v-model="temp.status" />
\x3C/el-form-item>
\x3C/el-form>
\x3Cdiv slot="footer">
\x3Cel-button @click="dialogFormVisible = false">取消\x3C/el-button>
\x3Cel-button type="primary" @click="dialogStatus==='create'?createData():updateData()">确定\x3C/el-button>
\x3C/div>
\x3C/el-dialog>
\x3C/div>
\x3C/template>
\x3Cscript>
import Pagination from '@/components/Pagination'
import { getProductList, createProduct, updateProduct, deleteProduct } from '@/api/myapp'
export default {
components: { Pagination },
data() {
return {
list: [], total: 0, listLoading: true,
listQuery: { page: 1, limit: 20, name: '' },
dialogFormVisible: false, dialogStatus: '',
textMap: { update: '编辑', create: '新增' },
temp: { id: undefined, name: '', price: 0, stock: 0, status: true },
rules: { name: [{ required: true, message: '必填', trigger: 'blur' }] }
}
},
created() { this.getList() },
methods: {
getList() {
this.listLoading = true
getProductList(this.listQuery).then(res => {
this.list = res.results || res
this.total = res.count || this.list.length
this.listLoading = false
})
},
handleFilter() { this.listQuery.page = 1; this.getList() },
handleCreate() {
this.temp = { id: undefined, name: '', price: 0, stock: 0, status: true }
this.dialogStatus = 'create'
this.dialogFormVisible = true
},
handleUpdate(row) {
this.temp = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
},
createData() {
this.$refs.dataForm.validate(valid => {
if (valid) {
createProduct(this.temp).then(() => { this.dialogFormVisible = false; this.getList() })
}
})
},
updateData() {
this.$refs.dataForm.validate(valid => {
if (valid) {
updateProduct(this.temp.id, this.temp).then(() => { this.dialogFormVisible = false; this.getList() })
}
})
},
handleDelete(row) {
this.$confirm('确认删除?').then(() => { deleteProduct(row.id).then(() => this.getList()) })
}
}
}
\x3C/script>
字段类型映射
Django → Vue
| Django 字段 | Vue 组件 |
|---|---|
| CharField | el-input |
| TextField | el-input (type=textarea) |
| IntegerField | el-input-number |
| DecimalField | el-input-number |
| BooleanField | el-switch |
| ForeignKey | el-select |
| DateField | el-date-picker |
| DateTimeField | el-date-picker (type=datetime) |
| ImageField | el-upload |
| FileField | el-upload |
生成流程
当用户说"创建一个产品模块"时:
-
解析需求
- 模块名: Product
- 字段: name, price, stock, status
-
生成后端代码
- apps/myapp/models.py
- apps/myapp/serializers.py
- apps/myapp/views.py
- apps/myapp/urls.py
-
生成前端代码
- src/api/myapp.js
- src/views/myapp/product.vue
-
输出代码
- 用户直接复制使用
快速参考
常用字段
# 基础
name = models.CharField('名称', max_length=100)
code = models.CharField('编码', max_length=50, unique=True)
description = models.TextField('描述', blank=True)
status = models.BooleanField('状态', default=True)
sort = models.IntegerField('排序', default=0)
# 数值
price = models.DecimalField('价格', max_digits=10, decimal_places=2)
quantity = models.IntegerField('数量', default=0)
# 关联
category = models.ForeignKey('Category', on_delete=models.CASCADE, verbose_name='分类')
user = models.ForeignKey('system.User', on_delete=models.SET_NULL, null=True, verbose_name='用户')
# 文件
image = models.ImageField('图片', upload_to='images/', null=True, blank=True)
file = models.FileField('附件', upload_to='files/', null=True, blank=True)
# 时间
start_date = models.DateField('开始日期', null=True, blank=True)
expire_time = models.DateTimeField('过期时间', null=True, blank=True)
项目启动
# 克隆
git clone https://github.com/caoqianming/django-vue-admin.git myproject
cd myproject/server
# 环境
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# 配置
cp server/conf_e.py server/conf.py
# 数据库
python manage.py migrate
python manage.py loaddata db.json
# 运行
python manage.py runserver 0.0.0.0:8000
# 前端
cd ../client
npm install
npm run dev
安全使用建议
This skill appears to do what it says: it generates Django models/serializers/viewsets/urls and Vue API/page templates from templates and a local generator. Before using it in a real project: 1) Review the generated code — do not deploy blindly. The templates reference project-specific helpers (utils.model, utils.permission, utils.queryset, etc.) that are not included, so you'll need to adapt or implement those. 2) Test generated endpoints in a safe/dev environment and verify permissions/data-scope logic matches your security model. 3) Be aware the generator uses simple regex parsing of model text and can mis-parse complex Django constructs (custom fields, decorators, multi-line arguments), so inspect fields and serializers for correctness. 4) There are no network calls or secret exfiltration requests in the package, but standard caution applies: review any code prior to committing to your codebase.
功能分析
Type: OpenClaw Skill
Name: django-vue-admin
Version: 1.0.0
The skill bundle is a comprehensive code generation tool for the 'django-vue-admin' framework. It provides the AI agent with templates and logic to generate Django models, serializers, ViewSets, and Vue.js frontend components. The included Python script (templates/generator.py) and markdown documentation (SKILL.md, CORE_MODULES.md, LOGIC_FLOW.md) are designed to automate CRUD module creation and explain the framework's RBAC permission system. There is no evidence of malicious intent, data exfiltration, or harmful prompt injection; the file-writing behavior is consistent with the stated purpose of a code generator.
能力评估
Purpose & Capability
Name/description match the bundled artifacts: multiple backend/frontend templates and a Python generator are present and appropriate for a 'django-vue-admin' CRUD code generator.
Instruction Scope
SKILL.md describes reading the included template docs and generating code from user module descriptions; instructions stay within that scope. Note: the generator is regex-based and will parse model text you provide — it may mis-handle complex/edge-case Django constructs, and the generated code assumes project-specific utilities (utils.model, utils.permission, utils.queryset) that are not bundled.
Install Mechanism
No install spec and no downloads; this is an instruction-only skill with local templates and a generator script, which is the lowest-risk install model.
Credentials
No environment variables, binaries, or external credentials are requested. Generated code references project-local modules (utils.*) which is expected for a code generator but means you must provide or adapt those dependencies in your project.
Persistence & Privilege
Skill does not request always:true, does not modify other skills, and has no install hooks — it has no elevated persistence or system-wide privileges.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install django-vue-admin - 安装完成后,直接呼叫该 Skill 的名称或使用
/django-vue-admin触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
django-vue-admin 1.0.0
- 首次发布,支持一键生成完整的 django-vue-admin 风格项目代码
- 根据用户描述自动生成 Django Model、Serializer、ViewSet、URL 及 Vue 页面和 API
- 内置多种模板文档,实现自定义字段、业务逻辑与流程自动读取和应用
- 用户通过简单对话即可完成模块代码生成,支持 CRUD 全流程
元数据
常见问题
Django Vue Admin 是什么?
Generate complete django-vue-admin style CRUD code including Django models, serializers, views, URLs, Vue API, and Vue pages from module descriptions. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 119 次。
如何安装 Django Vue Admin?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install django-vue-admin」即可一键安装,无需额外配置。
Django Vue Admin 是免费的吗?
是的,Django Vue Admin 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Django Vue Admin 支持哪些平台?
Django Vue Admin 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Django Vue Admin?
由 jpzhengcn(@jpzhengcn)开发并维护,当前版本 v1.0.0。
推荐 Skills