kiranism-shadcn-dashboard
它能做什么
这个技能是在 Next.js 和 shadcn 管理后台模板中构建功能的指南。适合使用这套起始模板、并希望新页面与其结构保持一致的开发者。
适用场景
- ✓你想为后台添加一个新页面或功能模块的时候。
- ✓你需要以模板的风格添加数据表格、表单或导航项的时候。
- ✓你想为后台添加主题或设置基于角色的访问权限的时候。
技能链接
https://github.com/Kiranism/next-shadcn-dashboard-starter/blob/main/.agents/skills/kiranism-shadcn-dashboard/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请按照模板的写法,为我的后台添加一个新的客户页面,包含可搜索的表格。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在模板中查找每类文件应放的位置,并遵循其约定。然后,它会在相应的文件夹中构建页面、表格或表单。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Dashboard Development Guide
This skill encodes the exact patterns and conventions used in this Next.js 16 + shadcn/ui admin dashboard template.
Quick Reference: What Goes Where
| Task | Location |
|---|---|
| New page | src/app/dashboard/<name>/page.tsx |
| New feature module | src/features/<name>/ |
| Feature components | src/features/<name>/components/ |
| API types | src/features/<name>/api/types.ts |
| Service layer | src/features/<name>/api/service.ts |
| Query + mutation opts | src/features/<name>/api/queries.ts |
| Zod schemas | src/features/<name>/schemas/<name>.ts |
| Filter/select options | src/features/<name>/constants/ |
| Nav config | src/config/nav-config.ts |
| Types | src/types/index.ts |
| Mock data | src/constants/mock-api-<name>.ts |
| Search params | src/lib/searchparams.ts |
| Query client | src/lib/query-client.ts |
| Theme CSS | src/styles/themes/<name>.css |
| Theme registry | src/components/themes/theme.config.ts |
| Custom hook | src/hooks/ |
| Icons registry | src/components/icons.tsx |
Adding a New Feature (End-to-End)
When a user asks to add a feature (e.g., "add an orders page"), follow these steps in order. Each step below shows the minimal pattern — see reference files for full templates.
Step 1: Mock API (src/constants/mock-api-<name>.ts)
See references/mock-api-guide.md for the complete template. Key structure:
import { faker } from '@faker-js/faker';
import { matchSorter } from 'match-sorter';
import { delay } from './mock-api';
export type Order = {
id: number;
customer: string;
status: string;
total: number;
created_at: string;
updated_at: string;
};
export const fakeOrders = {
records: [] as Order[],
initialize() {
/* generate with faker */
},
async getOrders({ page, limit, search, sort }) {
/* filter, sort, paginate, return { items, total_items } */
},
async getOrderById(id: number) {
/* find by id */
},
async createOrder(data) {
/* push to records */
},
async updateOrder(id, data) {
/* merge into record */
},
async deleteOrder(id) {
/* filter out */
}
};
fakeOrders.initialize();
Every method should call await delay(800) to simulate network latency. Use matchSorter for search. Return { items, total_items } from list methods.
Step 2: API Layer (src/features/<name>/api/)
Each feature has 4 API files: types → service → queries → mutations.
Types (api/types.ts) — re-export the entity type from mock API, plus filter/response/payload types:
export type { Order } from '@/constants/mock-api-orders';
export type OrderFilters = { page?: number; limit?: number; search?: string; sort?: string };
export type OrdersResponse = { items: Order[]; total_items: number };
export type OrderMutationPayload = { customer: string; status: string; total: number };
Service (api/service.ts) — data access layer. One exported function per operation:
import { fakeOrders } from '@/constants/mock-api-orders';
import type { OrderFilters, OrdersResponse, OrderMutationPayload } from './types';
export async function getOrders(filters: OrderFilters): Promise<OrdersResponse> {
return fakeOrders.getOrders(filters);
}
export async function getOrderById(id: number) {
return fakeOrders.getOrderById(id);
}
export async function createOrder(data: OrderMutationPayload) {
return fakeOrders.createOrder(data);
}
export async function updateOrder(id: number, data: OrderMutationPayload) {
return fakeOrders.updateOrder(id, data);
}
export async function deleteOrder(id: number) {
return fakeOrders.deleteOrder(id);
}
Queries (api/queries.ts) — one object for reads (keys + queryOptions) and one for writes (mutationOptions with only mutationFn). Same shape as todosQueries / todosMutations in TanStack's official Next.js optimistic updates example:
i
常见问题
这个模板使用哪个框架?
技能描述的是一个基于 React 构建 shadcn 组件的 Next.js 16 项目。
它能帮助处理访问控制吗?
能。技能涵盖为页面设置基于角色的访问控制。
新页面应该放在哪里?
页面放在仪表盘应用文件夹中,功能代码放在它自己的 features 文件夹中。
详情
作者的原始描述
Guide for building features, pages, tables, forms, themes, and navigation in this Next.js 16 shadcn dashboard template. Use this skill whenever the user wants to add a new page, create a feature module, build a data table, add a form, configure navigation items, add a theme, set up RBAC access control, or work with the dashboard's patterns and conventions. Also triggers when adding routes under /dashboard, working with Clerk auth/orgs/billing, creating mock APIs, or modifying the sidebar. Even if the user doesn't mention "dashboard" explicitly — if they're adding UI, pages, or features to this
热度
- GitHub 星标
- 7.2k
- 排名
- #13309
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …