Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Declares card-management API endpoints in api.ts as four ordered keys: query, rawResponseSchema, transformResponse, responseSchema.
45% 86%+41 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 10 of 22 without it.
3 of 3 safety checks passed
Not used yet
Every endpoint is a declaration. Four keys, always in this order:
someEndpoint: build.query<Canonical, Request>({
query: (request) => ({
url: "/v1/some/path",
method: "GET",
}),
rawResponseSchema: SomeWireSchema, // the wire shape
transformResponse: transformSome, // wire -> canonical
responseSchema: SomeSchema, // what callers receive
});
| Key | Answers | Lives in |
|---|---|---|
query | What we send | api.ts |
rawResponseSchema | What the backend promised | schema.ts |
transformResponse | How it becomes ours | transforms.ts |
responseSchema | What the caller gets | schema.ts |
Drop the keys you do not need. An endpoint whose wire shape is already canonical declares
responseSchema alone — logout and getUser both do.
Return the wire contract, nothing more. A field the backend never sent does not belong on the answer. If a caller needs one of its own request values afterwards, it already has it.
queryFnqueryFn is the escape hatch for endpoints that are not one HTTP call. None here is, and it costs
more than it looks:
transformResponse for a queryFn endpoint. getTransformCallbackForEndpoint
in buildThunks is guarded by endpointDefinition.query &&. The mapper is silently ignored, so the
mapping moves inside the function, by hand.baseQuery result is unknown, so the body needs a cast or a manual safeParse.if (response.error) return { error: response.error }.Next to this one in the catalogue, plus more from the same author.