web-api
REST + GraphQL + tRPC API design: OpenAPI 3.1, auth JWT/OAuth2, rate limiting, pagination
What this skill does
# web-api
## Purpose
This skill enables OpenClaw to design and implement web APIs using REST, GraphQL, and tRPC, focusing on OpenAPI 3.1 specifications, JWT/OAuth2 authentication, rate limiting, and pagination. Use it to generate secure, scalable API blueprints and code snippets for web applications.
## When to Use
Apply this skill when building backend services that require API endpoints, such as creating a user authentication system or fetching paginated data. Use it for projects involving RESTful architectures, GraphQL queries, or tRPC procedures, especially if you need to enforce rate limits or handle authentication.
## Key Capabilities
- Design REST APIs with OpenAPI 3.1: Generate schemas using `openapi-generator` CLI with flags like `--input spec.yaml --generator spring`.
- Implement GraphQL APIs: Define schemas with types and resolvers, e.g., using Apollo Server config: `const typeDefs = gql`query { users }`;`.
- Handle tRPC procedures: Create typed endpoints, e.g., `export const appRouter = router({ hello: publicProcedure.query(() => 'world') });`.
- Authentication: Enforce JWT or OAuth2 via middleware; set env var `$WEB_API_JWT_SECRET` for token signing.
- Rate limiting: Apply limits using libraries like `express-rate-limit` with options `{ windowMs: 15*60*1000, max: 100 }`.
- Pagination: Implement cursor-based or offset pagination in queries, e.g., `query { users(first: 10, after: "cursor") }`.
## Usage Patterns
To design a REST API, invoke this skill with: `openclaw run web-api --design rest --spec openapi.yaml`. For GraphQL, use: `openclaw run web-api --type graphql --schema schema.graphql`. Always include auth by setting `$WEB_API_OAUTH_CLIENT_ID` and `$WEB_API_OAUTH_CLIENT_SECRET`. For tRPC, specify: `openclaw run web-api --type trpc --router path/to/router.ts`. Include rate limiting by adding `--rate-limit 100:15m`. Example 1: To create a paginated user endpoint, run `openclaw run web-api --design rest --endpoint /users --paginate offset:10` then integrate the generated code. Example 2: For a secured GraphQL query, use `openclaw run web-api --type graphql --auth jwt --query "query { protectedData }"`, which outputs a resolver with JWT validation.
## Common Commands/API
- CLI Command: `openclaw run web-api --cluster web-dev --action generate --format openapi` to create an OpenAPI spec file.
- API Endpoint: Simulate requests like `POST /api/v1/login` with body `{ "username": "user", "password": "pass" }` and header `Authorization: Bearer $WEB_API_JWT_TOKEN`.
- Code Snippet: For REST server setup: `app.use(express.json()); app.get('/api/items', (req, res) => res.json(items));`.
- Code Snippet: For GraphQL: `const server = new ApolloServer({ typeDefs, resolvers }); server.listen();`.
- Config Format: Use YAML for OpenAPI, e.g., `openapi: 3.1.0 info: title: API paths: /users: get: parameters: - name: page in: query schema: type: integer`.
- tRPC Example: `import { initTRPC } from '@trpc/server'; const t = initTRPC.create(); export const router = t.router({});`.
## Integration Notes
Integrate this skill with other OpenClaw skills by chaining commands, e.g., `openclaw run web-api --output code.js; openclaw run database --import code.js`. For auth, ensure `$WEB_API_API_KEY` is set in your environment before running. Use it with frontend skills by exporting APIs as JSON schemas for React components. Handle dependencies by installing via `npm install express graphql @trpc/server`, and configure rate limiting in the generated code with `app.use(rateLimit({ max: 100 }));`. Test integrations with tools like Postman by importing the OpenAPI spec.
## Error Handling
When errors occur, check for common issues like invalid JWTs by catching exceptions: `try { jwt.verify(token, process.env.WEB_API_JWT_SECRET); } catch (err) { res.status(401).send('Invalid token'); }`. For rate limiting, return 429 responses with a retry-after header. Use OpenClaw's error logging: `openclaw log error --message "API rate limit exceeded" --skill web-api`. Parse API errors from responses, e.g., if status is 400, extract the error body like `{ error: 'Bad request' }`. Always wrap API calls in try-catch blocks and use env vars for sensitive data to avoid exposure.
## Graph Relationships
- Related to: "frontend" skill for UI-to-API integration.
- Connected to: "database" skill for querying data sources in APIs.
- Links with: "auth" skill for shared JWT/OAuth2 implementations.
- Associated with: "deployment" skill for hosting API servers.
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.