一键导入
new-tab
Scaffold a new full-stack tab for dune-admin — Go route+handler+db func, api/client.ts namespace, and React tab component following the BasesTab pattern.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a new full-stack tab for dune-admin — Go route+handler+db func, api/client.ts namespace, and React tab component following the BasesTab pattern.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | new-tab |
| description | Scaffold a new full-stack tab for dune-admin — Go route+handler+db func, api/client.ts namespace, and React tab component following the BasesTab pattern. |
Read web/src/tabs/BasesTab.tsx before starting. It is the canonical reference.
server.gomux.HandleFunc("GET /api/v1/foos", handleGetFoos)
mux.HandleFunc("GET /api/v1/foos/{id}", handleGetFoo)
handlers_foos.goFollow the standard pattern — guard globalDB, call cmd* from db.go, use jsonOK/jsonErr.
Write the *_test.go file first (see tdd-go skill).
db.gofunc cmdFetchFoos(ctx context.Context, db *pgxpool.Pool) ([]fooRow, error) {
rows, err := db.Query(ctx, `SELECT id, name FROM dune.foos ORDER BY name`)
// ...scan rows...
}
Always use dune. schema prefix.
web/src/api/client.tsAdd to the api export object:
foos: {
list: () => req<FooRow[]>('GET', '/api/v1/foos'),
get: (id: number) => req<FooRow>('GET', `/api/v1/foos/${id}`),
},
Add the FooRow type nearby or in a types.ts if complex.
Simple tab → single file web/src/tabs/FoosTab.tsx:
export default function FoosTab() {
const [data, setData] = useState<FooRow[]>([])
const [loading, setLoading] = useState(false)
const load = async () => {
setLoading(true)
try {
setData(await api.foos.list())
} catch (e) {
toast.danger(`Failed: ${e instanceof Error ? e.message : String(e)}`)
} finally {
setLoading(false)
}
}
useEffect(() => { load() }, [])
const columns: Column<FooRow>[] = [
{ key: 'id', label: 'ID', sortable: true },
{ key: 'name', label: 'Name', sortable: true },
]
return (
<Panel>
<PageHeader title="Foos" onRefresh={load} loading={loading} />
<DataTable columns={columns} rows={data} loading={loading} rowKey="id" />
</Panel>
)
}
Complex tab → directory web/src/tabs/FoosTab/index.tsx + types.ts + components/ + modals/.
web/src/App.tsxAdd to the tab list and import the component.
make test-race # backend tests pass
cd web && pnpm lint # no new ESLint errors
cd web && pnpm build # tsc + vite clean
make verify # full suite
基于 SOC 职业分类
Run before any git push or PR creation. Ensures gosec, vulncheck, tests, and lint all pass — and that the user has approved the commit.
TDD workflow for dune-admin Go handlers and db.go functions. Use when adding a handler, implementing a feature, or fixing a bug in the Go backend.