add-admin-dashboard
Skill1 starsChanged 2 days agoMITView on GitHub
Connect an existing Next.js admin dashboard to an existing API. Use when asked to add an admin panel, back office or staff dashboard to an app that already has an API (NestJS controllers, Next.js route handlers, or an OpenAPI file). Maps the API's resources, adds a client module and query hooks per resource, wires sign-in and roles, adds one list page and one form per resource, and verifies with a type check, a build and real requests.
In this repository10 other files it gives its agents.
- app-screenshotsSkill
- design-rulesSkill
- docs-checkSkill
- i18n-keys-checkSkill
- nextjs-claude-mdSkill
- nextjs-hooksSkill
- production-checkSkill
- rtl-checkSkill
- template-rebrandSkill
- vps-deploySkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Run node ${CLAUDE_SKILL_DIR}/scripts/map-api.mjs <api-folder-or-openapi-file> and save the output to docs/admin-api-map.txt.
- Distinctive: line 18
Check: each chosen resource has a list route and a write route in the map, and every route under "routes with no guard" is meant to be …
- Distinctive: line 37
Check: login with curl returns a token.
- Very specific: line 46
Check: npx tsc --noEmit passes with no new errors.
- Distinctive: line 50
Use the dashboard's table component.
- Distinctive: line 54
Check: signed in, the page shows the same total as the list route returns to curl.
- Distinctive: line 62
Check: an empty required field shows an error and sends no request.
- Very specific: line 67
Run the type check, lint and next build.
- Distinctive: line 70
Check: the build passes and both bad writes answer 400.
- Very specific: line 74
No secret in a NEXT_PUBLIC_ variable: the browser can read every one of them.
- Distinctive: line 76
Add one resource, check it, then start the next.
≈ “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
Add an admin dashboard to an existing API
Work in the dashboard's own conventions. Before writing anything, find one resource it already handles end to end (API function, query hook, list page, form) and copy that shape. Components never call the API directly, and there is only one HTTP client.
1. Map the API
Run node ${CLAUDE_SKILL_DIR}/scripts/map-api.mjs <api-folder-or-openapi-file> and save
the output to docs/admin-api-map.txt. Agree with the user which resources to manage:
usually the ones marked list page + ... form.
Check: each chosen resource has a list route and a write route in the map, and every route under "routes with no guard" is meant to be public, or reported to the user before going on.
2. Point the dashboard at the API
Set the API base URL in the dashboard's env file (the variable its HTTP client already
reads; NEXT_PUBLIC_ values are baked in at build time, so restart or rebuild after). Add
the dashboard's origin to the API's CORS allow-list.
Check: curl -s -o /dev/null -D - -X OPTIONS "<api>/<list route>" -H "Origin: <dashboard origin>" -H "Access-Control-Request-Method: GET"
prints Access-Control-Allow-Origin: <dashboard origin>.
3. Wire sign-in and roles
Make the dashboard's sign-in call the API's login route and map its answer (token, user, roles, permissions) into what the dashboard already stores. The HTTP client sends the token; a 401 clears the session and opens the sign-in page. Gate buttons with the permission names from the map.
Check: login with curl returns a token; one list route answers 401 without it and 200 with it; a user without the write permission gets 403 from that write route.
4. Client layer and query hooks, one resource at a time
One API module per resource (list, get, create, update, delete), typed from the request bodies in the map. Then query keys, a list query that passes the route's pagination and filter params, and mutations that invalidate the resource's keys.
Check: npx tsc --noEmit passes with no new errors.
5. One list page per resource
Use the dashboard's table component. Columns come from the response fields, pagination and filters from the list route's query params. Show create, edit and delete only to users with those permissions. Add the page to the navigation.
Check: signed in, the page shows the same total as the list route returns to curl.
6. One form per resource
Fields are the create body's fields; required ones are marked * in the map. Validate with
the form library the dashboard already uses (react-hook-form with zod if it has none) and
show the API's 400 field errors on the matching fields.
Check: an empty required field shows an error and sends no request; a valid submit answers 201 and the new row appears in the list.
7. Verify
Run the type check, lint and next build. Repeat step 3's curl checks for every resource,
plus one write with an unknown field and one with a required field missing.
Check: the build passes and both bad writes answer 400. A 500 is an API bug: report it.
Rules
- No secret in a
NEXT_PUBLIC_variable: the browser can read every one of them. - Hiding a button is not access control. The API must answer 403 as well.
- Add one resource, check it, then start the next.
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.

