agentleFS
gocronx-teamgocronx-team/gocron/.agents/skills/api-feature/SKILL.md

api-feature

Skill808 starsChanged 3 months agoMITView on GitHub

Implement or review an end-to-end gocron HTTP API change. Use when adding or changing Gin routes, handlers, request or response payloads, authorization, audit behavior, frontend API clients, API types, OpenAPI-style documentation, or API tests.

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 6 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep the route, authorization rule, handler, frontend client, types, translations, documentation, and tests as one change.

    line 8
  2. Very specific:

    When the contract changes, preserve both deployment orders: an N frontend/client must tolerate an N-1 backend, and an N backend must serve …

    line 13
  3. Distinctive:

    Keep routes, methods, accepted requests, response fields and types, status codes, pagination, and SSE event contracts stable.

    line 16
  4. Very specific:

    Never repurpose an existing field or error code.

    line 21
  5. Distinctive:

    Do not return or retain unbounded task output/logs.

    line 33
  6. Distinctive:

    Search path allowlists and permission maps before adding a route.

    line 45
  7. Very specific:

    Use the appropriate HTTP method.

    line 52
  8. Distinctive:

    Use transactions for multi-write operations.

    line 58
  9. Very specific:

    Update the frontend API wrapper and src/types/api/api.d.ts when the UI uses the endpoint.

    line 60
  10. Very specific:

    Add both Chinese and English strings when user-visible text changes: backend internal/modules/i18n/{zh_cn,en_us}.go, frontend …

    line 62
  11. Very specific:

    Update docs/zh/guide/api.md for a public API contract.

    line 65
  12. Distinctive:

    Add focused tests for:

    line 70
  13. Very specific:

    Run the changed router package with race detection, then relevant service/model tests.

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Build a gocron API feature

Keep the route, authorization rule, handler, frontend client, types, translations, documentation, and tests as one change.

Compatibility invariants

  • When the contract changes, preserve both deployment orders: an N frontend/client must tolerate an N-1 backend, and an N backend must serve N-1 frontends/clients.
  • Keep routes, methods, accepted requests, response fields and types, status codes, pagination, and SSE event contracts stable. New response fields must be optional; new request fields must have compatible defaults.
  • Detect new server capabilities before depending on them. If N-1 lacks an endpoint, field, or stream behavior, retain a safe legacy path or hide it.
  • Never repurpose an existing field or error code. Breaking contracts require explicit approval, a major version, and migration/rollout/rollback plans.

Performance invariants

  • Bound every collection response and expensive input. Require pagination, maximum page sizes, upload/body limits, and bounded filters where applicable.
  • Prevent N+1 queries and per-row remote calls. Capture query counts for list endpoints and inspect query plans for new filters, sorting, or joins.
  • For polling and SSE, bound connection/resource use, clean up on disconnect, avoid per-client database polling where sharing is safe, and apply backpressure or a documented drop/coalescing policy.
  • Do not return or retain unbounded task output/logs. Use paging, cursors, bounded chunks, or streaming with cancellation.
  • Benchmark materially affected high-traffic or high-volume endpoints with representative data and report applicable metrics.

Trace the existing path

  • Inspect neighboring registrations in internal/routers/routers.go, handlers under internal/routers, models/services called by the handler, and the matching frontend module under web/gocronx-admin/src/api.
  • Identify every middleware applied to the route group. Classify the endpoint as public, authenticated, admin-only, API-token accessible, or agent-facing.
  • Search path allowlists and permission maps before adding a route. Never make an endpoint public merely to make a request succeed.
  • Preserve the response conventions in internal/routers/base. Do not expose raw database, filesystem, command, provider, or secret errors to clients.

Implement the complete contract

  • Use the appropriate HTTP method. Mutating operations must not use GET.
  • Bind into an explicit request type, validate required fields and bounds, and reject unknown or dangerous input where the existing API pattern permits.
  • Enforce authorization server-side before loading or mutating protected data. For resource ids, verify access to the resource rather than only validating that the caller is logged in.
  • Use transactions for multi-write operations. Add an audit event for security-sensitive or administrative mutations following existing patterns.
  • Update the frontend API wrapper and src/types/api/api.d.ts when the UI uses the endpoint. Keep backend and frontend field names/types aligned.
  • Add both Chinese and English strings when user-visible text changes: backend internal/modules/i18n/{zh_cn,en_us}.go, frontend src/locales/langs/{zh,en}.json.
  • Update docs/zh/guide/api.md for a public API contract. Include auth, parameters, example response, error behavior, and compatibility impact.

Test risk, not just success

Add focused tests for:

  • valid requests and stable response shape;
  • missing, malformed, boundary, and nonexistent-resource input;
  • unauthenticated and unauthorized callers;
  • ownership or tenant boundary where applicable;
  • duplicate submissions or retry behavior for mutations;
  • secret/error redaction for sensitive endpoints.
  • N-1 requests/responses and both frontend/backend deployment orders when the feature crosses that boundary.

Run the changed router package with race detection, then relevant service/model tests. Run frontend type checking when the contract is consumed by the UI. Finally invoke $verify before committing.

Report the route and method, authorization class, contract changes, backward compatibility, tests added, performance evidence when relevant, and any documentation or i18n files intentionally left unchanged.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.