scaffold-api
Skill44 starsChanged 4 months agoMITView on GitHub
Generate a new authenticated Next.js API route following RDO project conventions
1 other project uses a version of this.
Adopted by
Most recently taken up by
- mean-weasel/bullhorntheir own version, first seen Apr 14, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- mean-weasel/bullhorn★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- new-migrationSkill
- scaffold-apiSkill
- new-migrationSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 7
Create a new Next.js API route at src/pages/api/$ARGUMENTS.ts following these project conventions exactly:
- Very specific: line 64
Use requireAdmin instead of requireAuth if the route is admin-only
- Very specific: line 65
Use AuthenticatedRequest type, never NextApiRequest
- Very specific: line 67
Use pool.query() for database access — no ORM
- Very specific: line 68
Never use do as a SQL alias (PostgreSQL reserved word) — use d instead
- Distinctive: line 71
Add proper query parameter validation before database queries
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create a new Next.js API route at src/pages/api/$ARGUMENTS.ts following these project conventions exactly:
Required Structure
- Swagger JSDoc comment block at the top of the file:
/**
* @swagger
* /api/$ARGUMENTS:
* get:
* summary: <describe endpoint>
* description: <longer description>
* tags: [<Feature Area>]
* security:
* - BearerAuth: []
* - CookieAuth: []
* parameters: [...]
* responses:
* 200: { description: Success }
* 401: { description: Unauthorized }
* 500: { description: Server error }
*/- Imports — always use these exact patterns:
import type { NextApiResponse } from 'next';
import { requireAuth, AuthenticatedRequest } from '@infrastructure/auth/middleware';
import pool from '@infrastructure/database/connection';- Handler function with method check and userId extraction:
async function handler(req: AuthenticatedRequest, res: NextApiResponse) {
if (req.method !== 'GET') {
return res.status(405).json({ error: 'Method not allowed' });
}
const userId = req.userId!;
try {
// Query logic here using pool.query()
const { rows } = await pool.query('SELECT ...', [userId]);
return res.status(200).json(rows);
} catch (error) {
console.error('[API_NAME] Error:', error);
return res.status(500).json({ error: 'Internal server error' });
}
}- Default export with auth wrapper:
export default requireAuth(handler);Rules
- Use
requireAdmininstead ofrequireAuthif the route is admin-only - Use
AuthenticatedRequesttype, neverNextApiRequest - Access user via
req.userId!(non-null assertion) - Use
pool.query()for database access — no ORM - Never use
doas a SQL alias (PostgreSQL reserved word) — usedinstead - Parse numeric scores with
parseFloat(String(value)).toFixed(1) - Define TypeScript interfaces for response shapes at the top of the file
- Add proper query parameter validation before database queries
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

