OpenParable
Skip to content
← Back to skills

Add Adminapi Endpoint

Development
add-adminapi-endpoint

Add Adminapi Endpoint is an Agent Skill for development published in the talkincode/toughradius repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Add a group of Admin REST endpoints in the management backend (TR-F012). Use when a feature needs management APIs such as create/read/update/delete.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/talkincode/toughradius/blob/HEAD/.agents/skills/add-adminapi-endpoint/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/add-adminapi-endpoint, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Skill: Add Admin REST Endpoints

Feature ID: TR-F012 | Milestone: M2 and others

When to use

When adding a group of REST endpoints to the management backend.

Pre-research

view internal/adminapi/adminapi.go        # Init() registration entry
view internal/adminapi/nodes.go           # standard CRUD reference
view internal/adminapi/helpers.go         # parsePagination / filter helpers
view internal/adminapi/responses.go       # unified responses
view internal/adminapi/authz.go           # requireAdmin() and other authz

Implementation steps

  1. New file internal/adminapi/<feature>.go, package adminapi.
  2. Request structs: define the payload with validate tags (reference nodePayload).
  3. register function:
    func register<Feature>Routes() {
        webserver.ApiGET("/<path>", list<Feature>)
        webserver.ApiPOST("/<path>", create<Feature>, requireAdmin())
        webserver.ApiPUT("/<path>/:id", update<Feature>, requireAdmin())
        webserver.ApiDELETE("/<path>/:id", delete<Feature>, requireAdmin())
    }
    
  4. Register in Init: add register<Feature>Routes() to Init() in adminapi.go.
  5. Data access: always use app.GDB(); never inject *gorm.DB.
  6. Shared conventions: reuse pagination, filtering, validation, authz, unified responses, and error handling.

Acceptance

  • Add <feature>_test.go covering CRUD and authz failure
  • go test ./internal/adminapi/... passes
  • golangci-lint run passes
  • If the frontend is involved, pair with ../add-react-admin-resource/SKILL.md
  • PR references TR-F012 and the milestone ID