pure-admin-thin-crud-gen
Pure Admin Thin CRUD Generator
Overview
Generate runnable Vue pages under src/views/<module>/ and route modules under src/router/modules/ from swagger-ts-api output in src/api/swagger/Api.ts plus the wrapper behavior in src/api/api.ts.
Keep generation AI-driven. Do not run external OpenAPI generators. Do not add helper generation scripts.
Input Contract
Require these inputs before generation:
moduleSelector(required): select target module bytag, entity name, or path keyword.selectorMode(optional): defaultauto. Allowed values:auto,tag,entity,path.forceDetailPage(optional): defaultauto. Allowed values:auto,true,false.pageMode(optional): defaultcrud. Allowed values:crud,dashboard,mixed.routeBase(optional): default/<kebab-module>.outputMode(fixed): always output full file contents.
If the user only gives a vague module name, resolve it with selectorMode=auto and state the matched methods explicitly.
Hard Constraints
Follow all rules below:
- Parse and generate by AI from local
Api.tsandapi.ts. - Do not regenerate APIs with external tools.
- Do not build reusable business UI component libraries.
- Use only Element Plus components for page UI.
- Generate pages by mode:
crud/mixed: generate at leastindex.vueandedit.vue(plus optionaldetail.vue)dashboard: generatedashboard.vueorindex.vue; addedit.vueonly when create/update flow is required
- Create
src/router/modules/<kebab-module>.ts. - Use repository conventions first; only fall back to generic heuristics if needed.
- Do not add new runtime dependencies just for generated pages.
Repository-First Facts
Assume and use these local facts:
- API calls are made through
APIfromsrc/api/api.ts. APIunwraps axios response once and returns swagger response objects directly.- Swagger methods live in
src/api/swagger/Api.tsinsidenew Api().apimethod map. - Method doc blocks include
@tags,@name,@summary,@request. - Router static modules are auto-collected by
import.meta.glob("./modules/**/*.ts"); usually nosrc/router/index.tsedits are needed.
Workflow
Execute this sequence every time.
1) Parse target API methods
Group candidate methods using @tags, path, and method names.
Identify:
- list:
/listor method names ending withList - detail:
/detail/{id}or path with/{id}plus GET semantics - create:
/createor POST with create semantics - update:
/updateor PUT/PATCH or POST update semantics - delete: DELETE with
/{id}or/delete - action: non-CRUD operation (
retry,enable,disable,reset,export,vip, etc.)
Read detailed rules from references/api-parsing-rules.md.
2) Infer request/response shapes
Infer from Dashv1*Request/Response, Entpb*, Sharedv1*, and GinxDataResponse*.
Determine:
- query fields
- pagination fields and base index
- list data key (
users,admins,voice_generate_text, etc.) - total key (
total_size,total,count, fallback) - form fields and scalar types
3) Decide generated files
Default set (pageMode=crud|mixed):
src/views/<module>/index.vuesrc/views/<module>/edit.vuesrc/router/modules/<module>.ts
Mode adjustment:
pageMode=dashboard: allowsrc/views/<module>/dashboard.vueas main page and skipedit.vuewhen module has no create/update requirement.
Generate src/views/<module>/detail.vue when:
forceDetailPage=true, or- a clear detail endpoint exists and read-only view improves usability, or
- field count and density make list-only preview unreasonable.
4) Apply required UI behavior
Read exact page rules from references/page-generation-spec.md.
When user asks dashboard pages, additionally apply references/dashboard-best-practices.md.
Mandatory behavior:
- list page filtering, table, pagination, loading, errors, success messages
- delete and action operations behind
ElMessageBox.confirm - edit/detail route id parsing and auto-fetch
- 0-based backend paging mapped to 1-based
el-pagination - unified error and retry behavior for each async block (table/card/chart)
- request abstraction is AI-selected:
useRequestis optional and only used when it clearly simplifies complex async flows - list filters must align with real API query fields (no fake backend filters)
- server-paged list must keep server
totalsemantics (no client-side current-page total override) - invalid route id must not fallback to create; show error and leave page safely
- detail page must show explicit empty state when payload is empty
- dashboard/list pages must satisfy visual quality baseline (hierarchy, spacing, table readability, semantic status style)
- rendering must be runtime-safe: no direct array method calls on uncertain API fields without
Array.isArrayguard/normalizer
Required snippets:
const id = computed(() => route.params.id ?? route.query.id);
const pageIndex = ref(0);
// UI current-page = pageIndex + 1
// onCurrentChange(uiPage) => pageIndex = uiPage - 1
5) Generate route module
Create src/router/modules/<module>.ts using local route style:
const Layout = () => import("@/layout/index.vue");export default { ... } satisfies RouteConfigsTable;- include menu
meta.titleand default icon when user does not specify one. - route object must include
path,redirect,meta, andchildren. - default root
pathisrouteBaseor/<module>. - default root
redirectis<rootPath>/index. - list child route uses
<rootPath>/indexandshowLink: true. - edit child route uses
<rootPath>/edit/:id?andshowLink: false. - detail child route (when generated) uses
<rootPath>/detail/:idandshowLink: false. - hidden child routes should set
meta.activePathto list route path for menu highlight consistency.
6) Verify generated result
Run at least:
pnpm typecheck
If typecheck fails, fix generated files before final output.
7) Return output in fixed contract
Always respond in the exact 4 sections defined in references/output-contract.md.
Degrade Gracefully
If the selected module lacks full CRUD endpoints:
- generate only valid pages and operations
- remove unsupported actions from UI
- state missing endpoints in section 1 (API recognition)
- keep code runnable and predictable
References
Load only needed files:
- API parsing rules:
references/api-parsing-rules.md - Page generation specification:
references/page-generation-spec.md - Dashboard best practices:
references/dashboard-best-practices.md - Response/output contract:
references/output-contract.md
If considering useRequest, follow repository-safe policy:
- use import path
vue-hooks-plus/es/useRequest - do not add dependency automatically
- keep manual state flow when complexity is low
More from go-sphere/skills
ent-seed-sql-generator
Generate deterministic INSERT SQL seed data from Go Ent schemas and mixed inputs. This skill is REQUIRED whenever you need to create seed SQL for development or testing - it handles entity inference, relationship integrity, stable IDs, and dialect-specific SQL generation including JSON, arrays, and complex types. Use this skill for any task involving seed data, test fixtures, demo initialization, or database population from Ent schema definitions, even if the user doesn't explicitly mention "seed" or "SQL".
27pure-admin-crud-generator
Generate CRUD pages and router modules for pure-admin-thin from local swagger API definitions. MUST be used whenever you need to scaffold admin list/edit/detail pages, dashboard views, or route configurations from existing API methods in src/api/swagger/Api.ts. This skill replaces manual Vue page creation - use it for any admin panel development task involving API-driven pages.
25proto-api-generator
Design proto3 + HTTP API contracts for go-sphere scaffold projects from prompts, input folders, or requirement docs with mock data. Use when defining service APIs, selecting between entpb/shared/custom messages, and enforcing scaffold conventions, router-safety rules, and service-local error placement. This skill is REQUIRED for any proto API design task in go-sphere scaffold - always use it instead of writing proto files from scratch.
21sphere-feature-workflow
Implement end-to-end feature changes in go-sphere scaffold projects by following sphere-layout conventions and generation workflow. Use when adding or modifying APIs, protobuf contracts, Ent schemas, bind/map registration, service logic, or cross-layer refactors that must stay protocol-first and avoid manual edits to generated files. This skill is REQUIRED for any task involving go-sphere proto files, Ent schemas, service implementations, or generation commands (make gen/proto, make gen/docs, make gen/wire).
19proto-service-generator
Generate or complete Go service implementations from protobuf-generated HTTP interfaces in go-sphere scaffold projects. Use when you need to create `internal/service/<module>/*.go` files, add missing method implementations to existing services, or generate compilable stubs for new proto endpoints. Trigger for: service implementation, proto handler, append-only update, interface assertion, CRUD via Ent, stub method generation.
18ent-schema-generator
Design and generate Go + Ent database schemas for sphere-layout projects from requirements. Use when users describe data models, entity relationships, database tables, or schema changes — including prompts, Markdown docs, existing proto/service files, or demo behavior. Produces implementation-ready schema plans with field definitions, ID strategies, relation designs, indexes, entproto annotations, and bind/render/service integration guidance.
16