skills/web-dev/web-api/SKILL.md
REST + GraphQL + tRPC API design: OpenAPI 3.1, auth JWT/OAuth2, rate limiting, pagination
npx skillsauth add alphaonedev/openclaw-graph web-apiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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.
openapi-generator CLI with flags like --input spec.yaml --generator spring.const typeDefs = gqlquery { users };.export const appRouter = router({ hello: publicProcedure.query(() => 'world') });.$WEB_API_JWT_SECRET for token signing.express-rate-limit with options { windowMs: 15*60*1000, max: 100 }.query { users(first: 10, after: "cursor") }.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.
openclaw run web-api --cluster web-dev --action generate --format openapi to create an OpenAPI spec file.POST /api/v1/login with body { "username": "user", "password": "pass" } and header Authorization: Bearer $WEB_API_JWT_TOKEN.app.use(express.json()); app.get('/api/items', (req, res) => res.json(items));.const server = new ApolloServer({ typeDefs, resolvers }); server.listen();.openapi: 3.1.0 info: title: API paths: /users: get: parameters: - name: page in: query schema: type: integer.import { initTRPC } from '@trpc/server'; const t = initTRPC.create(); export const router = t.router({});.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.
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.
tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui