ワンクリックで
role-auth-extension
Use when extending user roles or securing pages behind custom roles (e.g. adding VENDOR, MANAGER, etc.).
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when extending user roles or securing pages behind custom roles (e.g. adding VENDOR, MANAGER, etc.).
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when adding a brand-new CRUD resource beyond the core entity (e.g. a second model the PS requires).
Use when building or restyling any page or component.
Use when constructing forms, inputs, submit behaviors, validation displays, and feedback toast alerts.
Use when creating new Next.js route handlers using the custom helper wrapper.
Use whenever the Prisma schema changes and a migration is needed.
Use when integrating third-party APIs (e.g. SMTP emails, SMS notification gateways, payment checkout gates, or OCR parsers).
| name | role-auth-extension |
| description | Use when extending user roles or securing pages behind custom roles (e.g. adding VENDOR, MANAGER, etc.). |
Follow these steps to add new roles (e.g., VENDOR, MANAGER, DELIVERY) and secure pages or endpoints accordingly:
Update schema.prisma:
prisma/schema.prisma.enum Role to include your new role:
enum Role {
USER
ADMIN
VENDOR // New role
}
npx prisma migrate dev --name add_role_vendor and npx prisma generate.Update Type Definitions:
src/types/next-auth.d.ts and add the new role string to the typescript Union type if it is strictly typed.Secure API Route Handlers:
const session = await auth();
if (session?.user?.role !== "VENDOR") {
return Response.json({ error: "Access denied" }, { status: 403 });
}
createApiRoute:
handler: async (req, { session }) => {
if (session.user.role !== "VENDOR") {
return Response.json({ error: "Forbidden" }, { status: 403 });
}
// ...
}
Secure Frontend Pages:
src/middleware.ts to block unauthorized navigation./dashboard/vendor/*) and checking token.role.