File contents GraphQL TypeScript Generator Skill
Product Plan
One-Sentence Description
Automatically generates TypeScript types from GraphQL schema files with CLI integration for developers and AI agents.
Core Capabilities
Convert GraphQL schema (.graphql, .gql) files to TypeScript interfaces and types
Generate client-side TypeScript types for GraphQL queries and mutations
Provide command-line interface for direct file processing
Handle complex GraphQL types including unions, interfaces, and enums
Validate GraphQL schemas before TypeScript generation
Integrate with OpenClaw agent workflows for automation
Support batch processing of multiple schema files
Out of Scope
GraphQL server implementation
Database schema management
Runtime GraphQL client code generation
Documentation generation beyond type definitions
Performance optimization for very large schemas
Custom code formatting beyond TypeScript standards
Integration with specific frameworks (React, Angular, etc.)
Trigger Scenarios
"Generate TypeScript types from this GraphQL schema"
"Create TypeScript interfaces from GraphQL schema file"
"Convert .graphql file to TypeScript types"
"Auto-generate types for my GraphQL API"
"Generate client types from GraphQL schema"
"Transform GraphQL schema to TypeScript"
Required Resources
scripts/ : Contains the main TypeScript generation logic and CLI entry point
references/ : GraphQL schema examples and test cases
assets/ : CLI help text, configuration templates, and documentation assets
Key Files
scripts/index.ts : Main CLI entry point
scripts/generator.ts : Core type generation logic
scripts/cli.ts : Command-line interface implementation
scripts/utils.ts : Utility functions for GraphQL parsing
references/sample.graphql : Example GraphQL schema for testing
references/test-schema.graphql : Complex test case with various GraphQL features
assets/README.md : User documentation
assets/package.json : Skill package configuration
assets/tsconfig.json : TypeScript configuration for the skill
assets/cli-help.txt : CLI help text and usage examples
Acceptance Criteria
Skill correctly processes simple GraphQL schemas and generates valid TypeScript types
Skill handles complex GraphQL features (unions, interfaces, enums)
CLI interface accepts schema file paths and outputs TypeScript files
Error handling for invalid GraphQL schemas
Integration with OpenClaw agent workflows for automated processing
Documentation includes usage examples and troubleshooting
Test cases pass for all sample GraphQL schemas
Generated TypeScript types are immediately usable in TypeScript projects
Architecture Overview
Directory Layout
├── scripts/
│ ├── index.ts # CLI entry point
│ ├── generator.ts # Type generation logic (Unions, Interfaces, Enums)
│ ├── cli.ts # Command-line argument parsing
│ └── utils.ts # GraphQL parsing utilities
├── references/
│ ├── sample.graphql # Basic schema example
│ └── test-schema.graphql # Complex test cases
├── assets/
│ ├── README.md # User documentation
│ ├── package.json # Skill package metadata
│ ├── tsconfig.json # TypeScript config
│ └── cli-help.txt # CLI usage examples
Scripts Design
scripts/index.ts
Language: TypeScript
Inputs: argv (script arguments via CLI)
Outputs: Generates TypeScript files in output directory
Core Logic: Parses CLI args → Loads schema → Calls generator.ts → Writes output
scripts/generator.ts
Language: TypeScript
Inputs: GraphQL schema AST (parsed from file)
Outputs: TypeScript interfaces, types
Core Logic: Type transformation rules for:
Scalar types → TS primitives
Object types → TS interfaces
Union types → Discriminated unions
Enum types → TS enum
scripts/cli.ts
Language: TypeScript
Inputs: Raw command-line arguments
Outputs: Processed schema file paths
Core Logic: Argument validation → Schema file reading → Result routing
scripts/utils.ts
Language: TypeScript
Inputs: Raw GraphQL text
Outputs: Parsed AST
Core Logic: GraphQL parser implementation with error handling
References Design
references/sample.graphql
Content: Basic schema with Query/Mutation
Usage: Demonstration for new users
references/test-schema.graphql
Content: Features unions, interfaces, nested enums
Usage: Testing boundary cases during development
Data Flow
CLI receives schema path via arguments
cli.ts validates and loads schema file
utils.ts parses schema to AST
generator.ts processes AST using transformation rules
Outputs TypeScript files to dist/ directory
Integration Points
Agent Workflow Example:
User requests: "Generate types from schema at /docs/api.graphql"
Agent triggers CLI via exec "graphql-ts-generator /docs/api.graphql"
CLI processes schema, calls generator logic
Generated .ts files returned to agent as attachment
Agent presents files to user in chat interface
CLI Automation:
Agent can schedule batch processing
"Generate types for all .graphql in /schemas/" → exec "graphql-ts-generator /schemas/*.graphql"
Usage Instructions
Installation
npm install -g graphql-ts-generator
Basic Usage
# Generate types from a single schema file
graphql-ts-generator schema.graphql
# Generate types and specify output directory
graphql-ts-generator schema.graphql --output dist/
# Process multiple schema files
graphql-ts-generator "schemas/*.graphql"
Options
-o, --output <dir>: Output directory for generated TypeScript files (default: ./generated)
-f, --format <style>: Code formatting style (default: standard)
-v, --verbose: Enable verbose logging
--no-validate: Skip schema validation (not recommended)
-h, --help: Show help message
Output
The generator produces TypeScript files containing:
Interfaces for GraphQL object types
Type aliases for GraphQL unions
Enums for GraphQL enums
Proper nullability handling (TypeScript | null)
Integration with OpenClaw
This skill integrates seamlessly with OpenClaw agent workflows. Trigger via:
Direct CLI execution in agent sessions
Scheduled batch generation jobs
Automated pipeline processing
See assets/README.md for complete documentation.
1 --- 2 name: graphql-ts-generator 3 description: Automatically generates TypeScript types from GraphQL schema files with CLI integration for developers and AI agents. 4 --- 5
6 # GraphQL TypeScript Generator Skill
7
8 ## Product Plan
9
10 ### One-Sentence Description
11 Automatically generates TypeScript types from GraphQL schema files with CLI integration for developers and AI agents.
12
13 ### Core Capabilities
14 - Convert GraphQL schema (.graphql, .gql) files to TypeScript interfaces and types
15 - Generate client-side TypeScript types for GraphQL queries and mutations
16 - Provide command-line interface for direct file processing
17 - Handle complex GraphQL types including unions, interfaces, and enums
18 - Validate GraphQL schemas before TypeScript generation
19 - Integrate with OpenClaw agent workflows for automation
20 - Support batch processing of multiple schema files
21
22 ### Out of Scope
23 - GraphQL server implementation
24 - Database schema management
25 - Runtime GraphQL client code generation
26 - Documentation generation beyond type definitions
27 - Performance optimization for very large schemas
28 - Custom code formatting beyond TypeScript standards
29 - Integration with specific frameworks (React, Angular, etc.)
30
31 ### Trigger Scenarios
32 - "Generate TypeScript types from this GraphQL schema"
33 - "Create TypeScript interfaces from GraphQL schema file"
34 - "Convert .graphql file to TypeScript types"
35 - "Auto-generate types for my GraphQL API"
36 - "Generate client types from GraphQL schema"
37 - "Transform GraphQL schema to TypeScript"
38
39 ### Required Resources
40 - **scripts/**: Contains the main TypeScript generation logic and CLI entry point
41 - **references/**: GraphQL schema examples and test cases
42 - **assets/**: CLI help text, configuration templates, and documentation assets
43
44 ### Key Files
45 - **scripts/index.ts**: Main CLI entry point
46 - **scripts/generator.ts**: Core type generation logic
47 - **scripts/cli.ts**: Command-line interface implementation
48 - **scripts/utils.ts**: Utility functions for GraphQL parsing
49 - **references/sample.graphql**: Example GraphQL schema for testing
50 - **references/test-schema.graphql**: Complex test case with various GraphQL features
51 - **assets/README.md**: User documentation
52 - **assets/package.json**: Skill package configuration
53 - **assets/tsconfig.json**: TypeScript configuration for the skill
54 - **assets/cli-help.txt**: CLI help text and usage examples
55
56 ### Acceptance Criteria
57 - Skill correctly processes simple GraphQL schemas and generates valid TypeScript types
58 - Skill handles complex GraphQL features (unions, interfaces, enums)
59 - CLI interface accepts schema file paths and outputs TypeScript files
60 - Error handling for invalid GraphQL schemas
61 - Integration with OpenClaw agent workflows for automated processing
62 - Documentation includes usage examples and troubleshooting
63 - Test cases pass for all sample GraphQL schemas
64 - Generated TypeScript types are immediately usable in TypeScript projects
65
66 ## Architecture Overview
67
68 ### Directory Layout
69 ```
70 ├── scripts/
71 │ ├── index.ts # CLI entry point
72 │ ├── generator.ts # Type generation logic (Unions, Interfaces, Enums)
73 │ ├── cli.ts # Command-line argument parsing
74 │ └── utils.ts # GraphQL parsing utilities
75 ├── references/
76 │ ├── sample.graphql # Basic schema example
77 │ └── test-schema.graphql # Complex test cases
78 ├── assets/
79 │ ├── README.md # User documentation
80 │ ├── package.json # Skill package metadata
81 │ ├── tsconfig.json # TypeScript config
82 │ └── cli-help.txt # CLI usage examples
83 ```
84
85 ### Scripts Design
86
87 #### `scripts/index.ts`
88 - Language: TypeScript
89 - Inputs: `argv` (script arguments via CLI)
90 - Outputs: Generates TypeScript files in output directory
91 - Core Logic: Parses CLI args → Loads schema → Calls `generator.ts` → Writes output
92
93 #### `scripts/generator.ts`
94 - Language: TypeScript
95 - Inputs: GraphQL schema AST (parsed from file)
96 - Outputs: TypeScript interfaces, types
97 - Core Logic: Type transformation rules for:
98 - Scalar types → TS primitives
99 - Object types → TS interfaces
100 - Union types → Discriminated unions
101 - Enum types → TS enum
102
103 #### `scripts/cli.ts`
104 - Language: TypeScript
105 - Inputs: Raw command-line arguments
106 - Outputs: Processed schema file paths
107 - Core Logic: Argument validation → Schema file reading → Result routing
108
109 #### `scripts/utils.ts`
110 - Language: TypeScript
111 - Inputs: Raw GraphQL text
112 - Outputs: Parsed AST
113 - Core Logic: GraphQL parser implementation with error handling
114
115 ### References Design
116
117 #### `references/sample.graphql`
118 - Content: Basic schema with Query/Mutation
119 - Usage: Demonstration for new users
120
121 #### `references/test-schema.graphql`
122 - Content: Features unions, interfaces, nested enums
123 - Usage: Testing boundary cases during development
124
125 ### Data Flow
126 1. CLI receives schema path via arguments
127 2. `cli.ts` validates and loads schema file
128 3. `utils.ts` parses schema to AST
129 4. `generator.ts` processes AST using transformation rules
130 5. Outputs TypeScript files to `dist/` directory
131
132 ### Integration Points
133
134 #### Agent Workflow Example:
135 1. User requests: "Generate types from schema at /docs/api.graphql"
136 2. Agent triggers CLI via `exec "graphql-ts-generator /docs/api.graphql"`
137 3. CLI processes schema, calls generator logic
138 4. Generated .ts files returned to agent as attachment
139 5. Agent presents files to user in chat interface
140
141 #### CLI Automation:
142 - Agent can schedule batch processing
143 - "Generate types for all .graphql in /schemas/" → `exec "graphql-ts-generator /schemas/*.graphql"`
144
145 ## Usage Instructions
146
147 ### Installation
148 ```bash
149 npm install -g graphql-ts-generator
150 ```
151
152 ### Basic Usage
153 ```bash
154 # Generate types from a single schema file
155 graphql-ts-generator schema.graphql
156
157 # Generate types and specify output directory
158 graphql-ts-generator schema.graphql --output dist/
159
160 # Process multiple schema files
161 graphql-ts-generator "schemas/*.graphql"
162 ```
163
164 ### Options
165 - `-o, --output <dir>`: Output directory for generated TypeScript files (default: `./generated`)
166 - `-f, --format <style>`: Code formatting style (default: standard)
167 - `-v, --verbose`: Enable verbose logging
168 - `--no-validate`: Skip schema validation (not recommended)
169 - `-h, --help`: Show help message
170
171 ### Output
172 The generator produces TypeScript files containing:
173 - Interfaces for GraphQL object types
174 - Type aliases for GraphQL unions
175 - Enums for GraphQL enums
176 - Proper nullability handling (TypeScript `| null`)
177
178 ### Integration with OpenClaw
179 This skill integrates seamlessly with OpenClaw agent workflows. Trigger via:
180 - Direct CLI execution in agent sessions
181 - Scheduled batch generation jobs
182 - Automated pipeline processing
183
184 See `assets/README.md` for complete documentation.
johnalbertini14-glitch/openclaw-skills/tree/main/skills/martinforsulu/neo-graphql-ts-generator commit 190aca6aa0
Frequently asked questions How do I install the GRAPHQL TS Generator skill? Run npx skillmds@latest add johnalbertini14-glitch/graphql-ts-generator in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the GRAPHQL TS Generator skill do? Automatically generates TypeScript types from GraphQL schema files with CLI integration for developers and AI agents. It is listed under Integrations & APIs on SkillMD.
Is GRAPHQL TS Generator safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: executes scripts. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with GRAPHQL TS Generator? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is GRAPHQL TS Generator free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published GRAPHQL TS Generator? johnalbertini14-glitch (@johnalbertini14-glitch) published this skill. Their other Agent Skills are listed on their SkillMD profile.