new-action
Scaffold a new backend server action with auth check, Zod input validation, repository call, and error handling
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Scaffold a new backend server action with auth check, Zod input validation, repository call, and error handling
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Generate a semver-compliant release note from git history; on user confirmation, bump version, update CHANGELOG, create git tag, and publish a GitHub Release with gh
Scaffold a typed React client component with props interface, Tailwind styling, and shadcn/ui primitives
Scaffold a React Hook Form with Zod validation, useMutation, and toast notifications
Create a Zod input schema file in src/backend/services/inputs/ for a domain entity
Scaffold a Next.js App Router page with optional server-side session check, metadata, and layout
Scaffold TanStack Query useQuery and/or useMutation hooks for a feature, calling a backend server action
| name | new-action |
| description | Scaffold a new backend server action with auth check, Zod input validation, repository call, and error handling |
Create a new backend server action for the techdiary.dev project.
src/backend/services/ named <domain>.action.ts or <domain>.actions.ts"use server" at the topparseAsync() from a Zod schema in src/backend/services/inputs/<domain>.input.tsawait authID() for protected actionshandleActionException(error) in the catchPromise<ActionResponse<T>> where T is the domain model from src/backend/models/domain-models.tspersistenceRepository.<entity> from src/backend/persistence/persistence-repositories.tsActionException for domain/auth errors"use server";
import { z } from "zod";
import { authID } from "./session.actions";
import { ActionException, handleActionException } from "./RepositoryException";
import { persistenceRepository } from "../persistence/persistence-repositories";
import { ActionResponse } from "../models/action-contracts";
import { <DomainModel> } from "../models/domain-models";
import { <Domain>Input } from "./inputs/<domain>.input";
export async function <actionName>(
_input: z.infer<typeof <Domain>Input.<actionName>Input>,
): Promise<ActionResponse<<DomainModel>>> {
try {
const input = await <Domain>Input.<actionName>Input.parseAsync(_input);
const userId = await authID();
if (!userId) throw new ActionException("Unauthorized");
const [result] = await persistenceRepository.<entity>.<operation>({
// query here
});
return { success: true, data: result };
} catch (error) {
return handleActionException(error);
}
}
src/backend/services/inputs/<domain>.input.ts exists. If not, suggest running /new-input first.src/backend/services/<domain>.action.ts.