rest-to-graphql
Convert REST API routes to a GraphQL schema. Use when migrating APIs or adding a GraphQL layer.
Why use this skill?
Instantly convert your REST API routes into a full GraphQL schema. Automate your migration, generate TypeScript types, and build a modern BFF layer.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/lxgicstudios/rest-to-graphqlWhat This Skill Does
The rest-to-graphql skill is a specialized developer utility designed to bridge the gap between legacy RESTful architectures and modern GraphQL interfaces. By analyzing your existing API route definitions—such as Express or similar Node.js route patterns—it automates the complex task of schema creation. The skill parses your endpoints to identify resources, request parameters, and response structures, automatically mapping them to GraphQL types, queries, and mutations. Beyond mere structural mapping, it provides TypeScript type generation and optional resolver stubs that bridge your existing REST handlers. This allows developers to add a GraphQL layer to their existing services without manually rewriting logic or dealing with tedious schema definitions.
Installation
To integrate this skill into your workflow, use the OpenClaw CLI:
clawhub install openclaw/skills/skills/lxgicstudios/rest-to-graphql
No manual configuration is required. Once installed, ensure you are running a Node.js 18+ environment. You can trigger the core functionality via your terminal using the npx command as documented in the skill details: npx ai-rest-to-graphql ./src/routes.
Use Cases
This skill is perfect for teams undergoing a modernization effort. If you have a mature REST API but wish to leverage GraphQL's efficiency, this tool eliminates the manual overhead of building the layer from scratch. It is also ideal for building a Backend-for-Frontend (BFF) layer over microservices, where you need a unified API surface. Furthermore, it serves as a powerful learning tool for developers to see how their specific data models translate into GraphQL schemas.
Example Prompts
- "Convert my existing routes in ./src/api/v1 to a GraphQL schema file and include resolver stubs for the existing controllers."
- "Generate a GraphQL schema for my user and order resources from my REST route folder and export them to schema.graphql."
- "Analyze my REST API in ./server/routes and provide the TypeScript types for all GraphQL mutations, wrapping the existing REST endpoints as a datasource."
Tips & Limitations
- Incremental Migration: Avoid converting the entire API surface at once. Start with your core high-traffic resources to ensure the mapping aligns with your expectations.
- Relationship Mapping: While the tool does an excellent job of inferring basic types, it may require manual refinement for complex relational data (e.g., deeply nested objects or recursive types).
- BFF Approach: Rather than replacing your REST services, consider using the --wrap-rest flag to keep your existing handlers as the source of truth, treating GraphQL as a presentation layer.
- Review Generated Code: Always perform a quick sanity check on generated resolver stubs to ensure that the request parameters match your underlying business logic.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-lxgicstudios-rest-to-graphql": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, file-write
Related Skills
script-gen
Generate package.json scripts with AI. Use when setting up npm scripts.
email-template-gen
Generate responsive email templates. Use when building transactional emails.
branch-namer
Generate descriptive git branch names from plain English. Use when you need a branch name that follows conventions.
cloudflare-gen
Generate Cloudflare Workers configuration and code. Use when building on the edge.
adr-writer
Generate Architecture Decision Records with AI. Use when documenting technical decisions.