用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ag2ai/resource-hub --skill add-frontend-page命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | add-frontend-page |
| description | Step-by-step guide to add a new page or component to the React frontend |
| license | Apache-2.0 |
Create frontend/src/components/MyComponent.tsx:
import { useState } from "react";
interface Props {
title: string;
}
export function MyComponent({ title }: Props) {
const [data, setData] = useState<string>("");
return (
<div>
<h2>{title}</h2>
<p>{data || "No data yet."}</p>
</div>
);
}
Rules:
App.tsx)Props interface for all component propsfrontend/src/components/import { MyComponent } from "./components/MyComponent";
export default function App() {
return (
<div style={{ maxWidth: 800, margin: "0 auto", padding: "2rem" }}>
<h1>Project Name</h1>
<MyComponent title="Dashboard" />
<Chat />
</div>
);
}
import { useEffect, useState } from "react";
export function Dashboard() {
const [health, setHealth] = useState<{ status: string; agents: string[] } | null>(null);
useEffect(() => {
fetch("/api/health")
.then((r) => r.json())
.then(setHealth);
}, []);
if (!health) return <p>Loading...</p>;
return (
<div>
<p>Status: {health.status}</p>
<ul>
{health.agents.map((a) => (
<li key={a}>{a}</li>
))}
</ul>
</div>
);
}
Use the same pattern as Chat.tsx:
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
const ws = new WebSocket(`${protocol}//${window.location.host}/ws/chat`);
ws.onopen = () => ws.send(JSON.stringify({ message: text }));
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
// Handle msg.type: "agent_message", "status", "error", "done"
};
This template uses inline styles for simplicity. When adding styles:
style={{}} for one-off stylingmaxWidth: 800, margin: "0 auto" for content sectionsMyComponent.module.cssfrontend/src/components/ with typed PropsApp.tsx/api/ or /ws/ prefix (Vite proxies to backend)