一键导入
frontend-page
Execute page designs from the design doc — compose shadcn components and wire to generated API types. Phase 4 execution, no re-design.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Execute page designs from the design doc — compose shadcn components and wire to generated API types. Phase 4 execution, no re-design.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate a fully-typed TypeScript API client from Strapi content-type schemas and route contracts. Use after backend-schema when you need to create or regenerate the frontend API layer.
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Use when you have a spec or requirements for a multi-step task, before touching code
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
Scaffold a new fullstack project using scaffold-mcp. Use when the user wants to create a new Strapi+React project or start building a fullstack application.
Use when executing implementation plans with independent tasks in the current session
| name | frontend-page |
| description | Execute page designs from the design doc — compose shadcn components and wire to generated API types. Phase 4 execution, no re-design. |
Build frontend pages by composing shadcn components and wiring them to api-types-mcp generated API client functions.
This skill EXECUTES. It does NOT design. Load the design doc from `docs/metaforge/specs/` first. The page tree, data sources, and component needs are already specified there. Only ask the user about gaps or ambiguities — never re-design pages, routes, or component choices that are already in the spec.api-client-gen has generated typed API functions (Phase 3 of feature cycle)shadcn-mcp or scaffold-mcp scaffold)api-types-mcp generate_api_clientdocs/metaforge/specs/ with page tree and component inventoryTwo directories are MCP-managed. Never edit files within them directly:
| Directory | Managed By | Purpose |
|---|---|---|
src/api/ | api-types-mcp | Generated client, namespaces, and types |
src/components/ui/ | shadcn-mcp | shadcn component source files |
If you need a component that doesn't exist, use shadcn-mcp to add it. If the API client is stale, re-run generate_api_client.
Read the design doc from docs/metaforge/specs/. Extract the page tree and component inventory:
Use api-types-mcp query_api_types to find the right functions and understand their signatures:
query_api_types({ query: "find article with pagination" })
query_api_types({ query: "create comment", operation: "create" })
query_api_types({ query: "how to filter by category", contentType: "article" })
Each result includes function signatures, TSDoc descriptions, and code snippets.
Use shadcn-mcp to add components to the project:
# Via shadcn-mcp tools:
# - search_components: find relevant components
# - get_component: add a component to the project
Create a new .tsx file under src/pages/.
Page structure pattern:
import { useEffect, useState } from "react";
import { createStrapiClient, type Article } from "@/api";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
const api = createStrapiClient({
baseUrl: import.meta.env.VITE_API_URL,
token: import.meta.env.VITE_STRAPI_TOKEN,
});
export function ArticlesPage() {
const [items, setItems] = useState<Article[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
async function loadItems() {
setLoading(true);
setError(null);
try {
const result = await api.articles.find({ sort: ["createdAt:desc"] });
setItems(result);
} catch (e) {
setError(e instanceof Error ? e.message : "Failed to load");
} finally {
setLoading(false);
}
}
useEffect(() => { loadItems(); }, []);
if (error) return <div className="p-6 text-red-500">{error}</div>;
return (
<div className="p-6">
<h1 className="text-2xl font-bold mb-4">Articles</h1>
{loading ? (
<div>Loading…</div>
) : (
<Table>
<TableHeader>
<TableRow>
<TableHead>Title</TableHead>
<TableHead>Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{items.map((item) => (
<TableRow key={item.id}>
<TableCell>{item.title}</TableCell>
<TableCell>{item.status}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)}
</div>
);
}
Register the page in the router (src/router.tsx or src/App.tsx):
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { ArticlesPage } from "@/pages/ArticlesPage";
export function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/articles" element={<ArticlesPage />} />
</Routes>
</BrowserRouter>
);
}
cd frontend && npm run devgit add frontend/src/pages/ frontend/src/App.tsx
git commit -m "checkpoint:feature/pages"
| UI Pattern | shadcn Components |
|---|---|
| List/table of data | table, badge (status), pagination |
| Create/edit form | form, input, select, textarea, button |
| Detail view | card, skeleton (loading state) |
| Confirmation | dialog, alert-dialog |
| Navigation | breadcrumb, tabs, navigation-menu |
| Feedback | toast, sonner, alert |
const [params, setParams] = useState<ArticleFindParams>({
pagination: { page: 1, pageSize: 10 },
sort: ["createdAt:desc"],
filters: { status: { $eq: "published" } },
});
useEffect(() => {
api.articles.find(params).then(setItems);
}, [params]);
async function handleCreate(formData: Omit<Article, "id" | "createdAt" | "updatedAt">) {
const created = await api.articles.create(formData);
setItems((prev) => [created, ...prev]);
}
async function handleDelete(id: number) {
await api.articles.delete(id);
setItems((prev) => prev.filter((item) => item.id !== id));
}
const featured = await api.articles.featured({ limit: 5 });
After page creation:
src/api/ files are owned by api-types-mcp — re-run generate_api_client, don't editsrc/components/ui/ files are owned by shadcn-mcp — re-add, don't editsrc/pages/ files are yours — edit freely