Agent Skills
› theopenco/llmgateway
› frontend
frontend
GitHub指导构建和修改 LLM Gateway Next.js 前端应用,涵盖组件开发、API 调用、数据获取、导航布局及数值格式化等规范。
Trigger Scenarios
编辑 React 组件或页面
添加仪表盘页面
从 UI 调用 API
格式化显示值
Install
npx skills add theopenco/llmgateway --skill frontend -g -y
SKILL.md
Frontmatter
{
"name": "frontend",
"description": "Build and change LLM Gateway Next.js frontends — apps\/ui, apps\/playground, apps\/code, apps\/airside, and ee\/admin — including API calls, data fetching, navigation, dashboard routes, dialogs and popovers, charts, number formatting, and user settings. Use when editing React components or pages in those apps, adding a dashboard page, calling the API from the UI, or formatting displayed values."
}
Frontend
Data
- Call the Hono API only through the generated typed client:
useFetchClient()oruseApi()from@/lib/fetch-client. Regenerate it by running thegeneratescript inapps/api, then in the app. Utility functions take the client as a parameter from the calling component. - Backend logic lives in
apps/api; frontends add no Next.js API routes and no server actions that call the API. A server action adds a hop with its own timeout, rejects instead of returning (leaving loading state stuck), and breaks after a deploy. Server actions are only for what the API cannot do, such as setting the app's own httpOnly cookies. - Server components may read through the server API client (
createServerApiClient) for SSR. Every write runs in the browser via$api.useMutation, followed byrouter.refresh()or a query invalidation. - In
ee/admin, a globalMutationCachetoasts every failed mutation: setmeta.errorMessagefor its wording, ormeta.inlineError(or anonError) when the call site renders the error itself. - Fetch data with TanStack Query, not
useEffect. - Capability flags from the API are
falsewhen unset (non-null columns), while@llmgateway/modelsdefinitions leave themundefined. Use||for fallbacks between flags on API data. - Store user settings that are not in the database in cookies so SSR sees them.
- Frontend gates are UX only; the API endpoint enforces auth, verification, and permissions itself.
Navigation and layout
- Use
next/linkfor internal links andnext/navigation's router for programmatic navigation. - Keep inline links in prose attached to nearby words with a non-breaking space or a short
whitespace-nowrapwrapper. - New org-level dashboard pages live under
apps/ui/src/app/dashboard/[orgId]/org/; every other segment there is parsed as aprojectId. - Portaled popovers inside a
Dialoguse the sharedDialogSafePopover(packages/shared/src/components/ui/popover.tsx), which stays inside the dialog's scroll lock.
Display
- Format counts and chart values with
formatNumber,formatCompactNumber, andformatChartValuefrom@llmgateway/shared/number-format. Keep date, currency, and CSV formatting separate. - Format chart tooltip values with
ChartTooltipContent'svalueFormatter;formatterreplaces the whole row and drops series labels. - Chart tooltips list rows by value, largest first.
ChartTooltipContentalready does this; a custom tooltip must order its rows withsortTooltipPayloadorsortByValueDescfrom@llmgateway/shared/chart-tooltip.
Before a PR, follow the screenshot rules in the pull-request skill.
Version History
- d41bf19 Current 2026-10-19 04:12


