Source profileQuality 91/100

modu-ai/moai-adk/.claude/skills/moai-ref-api-patterns/SKILL.md

moai-ref-api-patterns

REST/GraphQL API design patterns, error handling conventions, and input validation reference for backend development. Agent-extending skill that amplifies backend domain work (spawned via Agent(general-purpose) with backend instructions) with production-grade API patterns. Use when designing APIs, implementing endpoints, or reviewing backend code. NOT for: frontend development, DevOps, database schema design, security audits.

Source repository stars
1,186
Declared platforms
0
Static risk flags
0
Last source update
2026-08-25
Source checked
2026-08-25

Decision brief

What it does: where it fits

REST/GraphQL API design patterns, error handling conventions, and input validation reference for backend development. Agent-extending skill that amplifies backend domain work (spawned via Agent(general-purpose) with backend instructions) with production-grade API patterns.

Best for

  • Use when designing APIs, implementing endpoints, or reviewing backend code.

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/modu-ai/moai-adk --skill ".claude/skills/moai-ref-api-patterns"
Safe inspection promptEditorial

Inspect the Agent Skill "moai-ref-api-patterns" from https://github.com/modu-ai/moai-adk/blob/a739d04b40e64f9ca7852b66c8fd6edc927a25aa/.claude/skills/moai-ref-api-patterns/SKILL.md at commit a739d04b40e64f9ca7852b66c8fd6edc927a25aa. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Verification

    [ ] All endpoints follow consistent naming convention (nouns, plurals, nested resources)

    [ ] All endpoints follow consistent naming convention (nouns, plurals, nested resources)[ ] Error responses use a standard format with machine-readable error code[ ] List endpoints implement pagination with documented limits
  2. 02

    Target Spawn

    Backend domain work spawned via Agent(general-purpose) with backend instructions - Applies these patterns directly to API implementation and review.

    Backend domain work spawned via Agent(general-purpose) with backend instructions - Applies these patterns directly to API implementation and review.
  3. 03

    RESTful API Design Conventions

    Review the “RESTful API Design Conventions” section in the pinned source before continuing.

    Review and apply the “RESTful API Design Conventions” source section.
  4. 04

    HTTP Status Code Guide

    Review the “HTTP Status Code Guide” section in the pinned source before continuing.

    Review and apply the “HTTP Status Code Guide” source section.
  5. 05

    Error Response Format

    Rules: - Never expose stack traces or internal details in production - Always include requestid for traceability - Use consistent error codes (ENUM, not free text) - Login failures: "Invalid email or password" (never reveal which)

    Never expose stack traces or internal details in productionAlways include requestid for traceabilityUse consistent error codes (ENUM, not free text)

Permission review

Static risk signals and limitations

No configured static risk pattern was detected

This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score91/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars1,186SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
modu-ai/moai-adk
Skill path
.claude/skills/moai-ref-api-patterns/SKILL.md
Commit
a739d04b40e64f9ca7852b66c8fd6edc927a25aa
License
Apache-2.0
Collected
2026-08-25
Default branch
main
View the original SKILL.md

API Patterns Reference

Target Spawn

Backend domain work spawned via Agent(general-purpose) with backend instructions - Applies these patterns directly to API implementation and review.

RESTful API Design Conventions

PrincipleConventionExample
Resource NamingPlural nouns, lowercase, kebab-case/api/v1/user-profiles
CollectionGET returns array with paginationGET /users?page=1&limit=20
Single ResourceGET returns objectGET /users/{id}
CreatePOST to collectionPOST /users
Update (full)PUT to resourcePUT /users/{id}
Update (partial)PATCH to resourcePATCH /users/{id}
DeleteDELETE to resourceDELETE /users/{id}
Nested ResourcesMax 2 levels deep/users/{id}/posts
FilteringQuery params?status=active&role=admin
SortingSort param?sort=-created_at,name
VersioningURL prefix/api/v1/, /api/v2/

HTTP Status Code Guide

CategoryCodeWhen to Use
Success200 OKSuccessful GET, PUT, PATCH, DELETE
Success201 CreatedSuccessful POST (resource created)
Success204 No ContentSuccessful DELETE (no body)
Client Error400 Bad RequestMalformed request, validation failure
Client Error401 UnauthorizedMissing or invalid authentication
Client Error403 ForbiddenAuthenticated but not authorized
Client Error404 Not FoundResource does not exist
Client Error409 ConflictResource state conflict (duplicate)
Client Error422 UnprocessableValid syntax but semantic error
Client Error429 Too ManyRate limit exceeded
Server Error500 InternalUnexpected server error
Server Error503 Service UnavailableMaintenance or overload

Error Response Format

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Input validation failed",
    "details": [
      {"field": "email", "message": "Must be a valid email address"},
      {"field": "age", "message": "Must be between 0 and 150"}
    ],
    "request_id": "req_abc123"
  }
}

Rules:

  • Never expose stack traces or internal details in production
  • Always include request_id for traceability
  • Use consistent error codes (ENUM, not free text)
  • Login failures: "Invalid email or password" (never reveal which)

Pagination Pattern

{
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "total_pages": 8,
    "has_next": true,
    "has_prev": false
  }
}

For cursor-based (large datasets):

{
  "data": [...],
  "cursor": {
    "next": "eyJpZCI6MTAwfQ==",
    "has_more": true
  }
}

Input Validation Checklist

ValidationMethodTool
Type validationSchema validationZod, Joi, pydantic, Go validator
Length limitsMin/max constraintsSchema min/max
Pattern matchingRegexEmail, URL, phone patterns
Range validationNumber/date boundsmin/max values
EnumerationAllowed valuesenum types
SQL InjectionParameterized queriesORM (Prisma, GORM, SQLAlchemy)
XSSHTML escapingTemplate engines, DOMPurify
Path TraversalPath normalizationfilepath.Clean + whitelist

Rate Limiting Strategy

TargetLimitKey
Auth endpoints5 req/minIP
General API100 req/minUser token
File upload10 req/hourUser token
Public API30 req/minIP

Response headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After (on 429).

API Versioning Strategy

StrategyUse CaseExample
URL prefixMost APIs/api/v1/users
HeaderInternal APIsAccept: application/vnd.api+json; version=2
Query paramSimple APIs/users?version=2

Breaking changes that require version bump:

  • Removing or renaming fields
  • Changing field types
  • Removing endpoints
  • Changing authentication methods

Non-breaking changes (no version bump needed):

  • Adding new optional fields
  • Adding new endpoints
  • Adding new query parameters

Common Rationalizations

RationalizationReality
"REST naming conventions are just aesthetics"Consistent resource naming is how clients discover and predict endpoints. Inconsistency multiplies documentation burden.
"GraphQL solves over-fetching, so I do not need to design response shapes"GraphQL shifts complexity to the resolver layer. Poorly designed schemas create N+1 queries and authorization gaps.
"Error codes are internal details, clients just need the message"Clients need machine-readable error codes for programmatic handling. Messages are for humans, codes are for code.
"PATCH and PUT are interchangeable"PATCH applies partial updates; PUT replaces the entire resource. Using them incorrectly breaks idempotency expectations.
"I will version the API when it becomes necessary"Versioning after breaking changes forces emergency migrations. Plan versioning from the first release.

Hyrum's Law: Every observable API behavior will eventually be depended on by clients. Undocumented response fields, error formats, and timing characteristics become implicit contracts.

Red Flags

  • API returns different error formats across endpoints
  • Resource names use verbs instead of nouns (e.g., /getUser instead of /users/:id)
  • No pagination on list endpoints that can return unbounded results
  • Breaking change deployed without API version bump
  • GraphQL schema allows unbounded depth or circular queries without limits

Verification

  • All endpoints follow consistent naming convention (nouns, plurals, nested resources)
  • Error responses use a standard format with machine-readable error code
  • List endpoints implement pagination with documented limits
  • API versioning strategy present and enforced (URL path, header, or query param)
  • Breaking vs non-breaking change classification documented for recent changes
  • Input validation returns 400 with specific field-level error details

Frequently asked questions

What to verify before installation and use

What does the moai-ref-api-patterns source document cover?

REST/GraphQL API design patterns, error handling conventions, and input validation reference for backend development. Agent-extending skill that amplifies backend domain work (spawned via Agent(general-purpose) with backend instructions) with production-grade API patterns.

How do I install moai-ref-api-patterns?

The source record exposes this install command: npx skills add https://github.com/modu-ai/moai-adk --skill ".claude/skills/moai-ref-api-patterns". Inspect the command and pinned source before running it.

Alternatives

Compare before choosing

Computed 10045,511

coreyhaines31/marketingskills

ab-testing

When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program

Computed 100147

oaustegard/claude-skills

featuring

Generate hierarchical _FEATURES.md files that describe what a codebase DOES from a user/consumer perspective, anchored to source symbols via tree-sitting. Supports large complex codebases through feature-driven decomposition into sub-feature files. Uses a multi-pass synthesis: orientation → detail → overview rewrite. Use when someone says "what does this do", "document features", "feature inventory", "_FEATURES.md", or needs to understand a codebase's purpose before modifying it. Complements tre

Computed 1008

narrative-io/narrative-skills-marketplace

design-analysis

Translate a fuzzy analytical question into a rigorous investigation plan. Interrogates the ask, grounds the plan in the available data dictionary, applies analytical best practices, and produces a structured brief of query specifications for a downstream query-writing skill. Plans, does not write SQL. Use when: "why did X drop", "is there a relationship between A and B", "who are our highest-value customers", "what's driving the change in Y", "investigate this trend", "design an analysis for", "

Computed 1007

event4u-app/agent-config

existing-ui-audit

Use BEFORE writing or editing any non-trivial UI — inventories components, design tokens, shadcn primitives, and reusable patterns into state.ui_audit. Hard gate for the ui directive set.