con un clic
code
Logic layer — server actions with auth, validation, tenant isolation
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Logic layer — server actions with auth, validation, tenant isolation
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Multi-slide bilingual brand carousels — Claude writes the deck, kun renders Anthropic-styled slides at exact platform sizes, a human approves, channels receive
Draft, stage, and publish brand social posts — Claude drafts, /higgs renders, a human approves, Hermes relays
Convert a file or URL to Markdown via MarkItDown (PDF, Office, images, audio, web)
Full pipeline — idea to production (chains every stage)
Autonomous block QA — detect, adversarially verify, fix safe tiers, hand the residual to a human
Technical spec — data model, file plan, refined acceptance criteria
Basado en la clasificación ocupacional SOC
| name | code |
| description | Logic layer — server actions with auth, validation, tenant isolation |
| when_to_use | Use when the Logic stage of the pipeline is reached or Abdout asks in prose to build the business-logic layer for a feature — server actions, CRUD operations, permission rules, or optimized queries — as distinct from /schema (data layer) or /wire (UI layer). Triggers on: server actions, logic layer with auth+validation+tenant isolation, pipeline Logic stage. |
| argument-hint | <feature> [product] |
Create server actions and business logic: auth-guarded, validated, tenant-scoped CRUD operations.
/code #42 — from issue spec/code billing — from feature name/code — from most recent feature issueRead the spec and schema stage output:
gh issue view <number> --repo <repo> --comments
Also read:
src/components/{scope}/{name}/validation.tsCreate src/components/{scope}/{name}/actions.ts:
"use server";
import { revalidatePath } from "next/cache";
import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import { create{Name}Schema, update{Name}Schema } from "./validation";
// CREATE
export async function create{Name}(formData: FormData) {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
const raw = Object.fromEntries(formData);
const data = create{Name}Schema.parse(raw);
await prisma.{name}.create({
data: {
...data,
// Tenant isolation — use the product's pattern
// schoolId: session.user.schoolId,
},
});
revalidatePath("/{route}");
}
// READ (list)
export async function get{Name}List() {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
return prisma.{name}.findMany({
where: {
// Tenant isolation
},
orderBy: { createdAt: "desc" },
});
}
// READ (single)
export async function get{Name}(id: string) {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
return prisma.{name}.findUnique({
where: { id },
});
}
// UPDATE
export async function update{Name}(id: string, formData: FormData) {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
const raw = Object.fromEntries(formData);
const data = update{Name}Schema.parse(raw);
await prisma.{name}.update({
where: { id },
data,
});
revalidatePath("/{route}");
}
// DELETE
export async function delete{Name}(id: string) {
const session = await auth();
if (!session?.user) throw new Error("Unauthorized");
await prisma.{name}.delete({
where: { id },
});
revalidatePath("/{route}");
}
Adapt to the product's actual patterns:
If the product uses role-based access, create src/components/{scope}/{name}/authorization.ts:
import { type Session } from "next-auth";
export function can{Name}(session: Session, action: "create" | "read" | "update" | "delete") {
const role = session.user.role;
switch (action) {
case "read": return true; // All authenticated users
case "create": return ["admin", "manager"].includes(role);
case "update": return ["admin", "manager"].includes(role);
case "delete": return role === "admin";
}
}
Only create this if the product has existing authorization patterns. Skip if not.
If the feature needs complex queries (joins, aggregations, search), create src/components/{scope}/{name}/queries.ts to separate them from actions.
Only create this if queries are complex enough to warrant separation. For simple CRUD, actions.ts is sufficient.
pnpm tsc --noEmit
Error recovery:
gh issue comment <number> --repo <repo> --body "## Code Stage Complete
**Actions**: \`{scope}/{name}/actions.ts\` — create, list, get, update, delete
**Authorization**: \`{scope}/{name}/authorization.ts\` (if created)
**Pattern**: Matches existing \`{reference feature}\` actions
**Types**: Compiling cleanly"
| Error | Fix | Max Retries |
|---|---|---|
| Import not found | Fix import paths, check barrel exports | 3 |
| Prisma type mismatch | Run prisma generate, fix field names | 3 |
| Auth type error | Read product's auth types, match interface | 3 |
| Zod parse type error | Align Zod schema with action parameters | 3 |
pnpm tsc --noEmit passes with 0 errors