一键导入
create-api-route
Create a new Next.js API route for the Mycosoft website. Use when adding backend API endpoints, proxy routes to MAS/MINDEX, or webhook handlers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new Next.js API route for the Mycosoft website. Use when adding backend API endpoints, proxy routes to MAS/MINDEX, or webhook handlers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Deploy or restart the MINDEX API service on VM 192.168.0.189. Use when updating MINDEX, restarting the database API, or deploying MINDEX changes.
Execute non-trivial work using plan-first, verify-first, and lessons-fed defaults. Use when running 3+ step tasks, architectural work, or anything that may require re-planning.
Deploy the Mycosoft website to the Sandbox VM (192.168.0.187). Use when the user asks to deploy, push to sandbox, rebuild the website container, or update the live site.
Integrate neuromorphic UI into a page. Use when converting Shadcn pages to neuromorphic design or adding neuromorphic styling.
Deploy or restart the MAS orchestrator service on VM 192.168.0.188. Use when updating the Multi-Agent System, restarting the orchestrator, or deploying MAS changes.
Start the Mycosoft website dev server on port 3010. Use when the user wants to run the dev server, start development, or test the website locally.
| name | create-api-route |
| description | Create a new Next.js API route for the Mycosoft website. Use when adding backend API endpoints, proxy routes to MAS/MINDEX, or webhook handlers. |
API Route Progress:
- [ ] Step 1: Create route file
- [ ] Step 2: Implement handlers
- [ ] Step 3: Test the endpoint
Create app/api/your-endpoint/route.ts:
import { NextRequest, NextResponse } from 'next/server';
export async function GET(request: NextRequest) {
try {
const response = await fetch(
`${process.env.MAS_API_URL}/api/endpoint`,
{
headers: {
'Content-Type': 'application/json',
},
next: { revalidate: 60 }, // Cache for 60 seconds
}
);
if (!response.ok) {
throw new Error(`Backend API error: ${response.status}`);
}
const data = await response.json();
return NextResponse.json(data);
} catch (error) {
console.error('API route error:', error);
return NextResponse.json(
{ error: 'Service unavailable' },
{ status: 500 }
);
}
}
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const response = await fetch(
`${process.env.MAS_API_URL}/api/endpoint`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
}
);
if (!response.ok) {
throw new Error(`Backend API error: ${response.status}`);
}
const data = await response.json();
return NextResponse.json(data);
} catch (error) {
console.error('API route error:', error);
return NextResponse.json(
{ error: 'Failed to process request' },
{ status: 500 }
);
}
}
Create app/api/your-endpoint/[id]/route.ts:
import { NextRequest, NextResponse } from 'next/server';
interface RouteParams {
params: Promise<{ id: string }>;
}
export async function GET(request: NextRequest, { params }: RouteParams) {
const { id } = await params;
try {
const response = await fetch(
`${process.env.MAS_API_URL}/api/endpoint/${id}`
);
if (!response.ok) throw new Error(`API error: ${response.status}`);
const data = await response.json();
return NextResponse.json(data);
} catch (error) {
return NextResponse.json({ error: 'Not found' }, { status: 404 });
}
}
# GET
curl http://localhost:3010/api/your-endpoint
# POST
curl -X POST http://localhost:3010/api/your-endpoint \
-H "Content-Type: application/json" \
-d '{"key": "value"}'
process.env.MAS_API_URL, process.env.MINDEX_API_URL