generate-code-stub
Create code stubs for functions, classes, or methods in various languages based on detailed descriptions and optional file context.
Instructions
Generates a code stub (function, class, etc.) in a specified language based on a description. Can optionally use content from a file (relative path) as context.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
classProperties | No | For classes: list of properties with names, optional types, and descriptions. | |
contextFilePath | No | Optional relative path to a file whose content should be used as additional context. | |
description | Yes | Detailed description of what the stub should do, including its purpose, parameters, return values, or properties. | |
language | Yes | The programming language for the stub (e.g., 'typescript', 'python', 'javascript') | |
methods | No | For classes/interfaces: list of method signatures with names and descriptions. | |
name | Yes | The name of the function, class, interface, etc. | |
parameters | No | For functions/methods: list of parameters with names, optional types, and descriptions. | |
returnType | No | For functions/methods: the expected return type string. | |
stubType | Yes | The type of code structure to generate (function, class, etc.) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"classProperties": {
"description": "For classes: list of properties with names, optional types, and descriptions.",
"items": {
"$ref": "#/properties/parameters/items"
},
"type": "array"
},
"contextFilePath": {
"description": "Optional relative path to a file whose content should be used as additional context.",
"type": "string"
},
"description": {
"description": "Detailed description of what the stub should do, including its purpose, parameters, return values, or properties.",
"minLength": 1,
"type": "string"
},
"language": {
"description": "The programming language for the stub (e.g., 'typescript', 'python', 'javascript')",
"minLength": 1,
"type": "string"
},
"methods": {
"description": "For classes/interfaces: list of method signatures with names and descriptions.",
"items": {
"additionalProperties": false,
"description": "Represents a class method signature",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"type": "array"
},
"name": {
"description": "The name of the function, class, interface, etc.",
"minLength": 1,
"type": "string"
},
"parameters": {
"description": "For functions/methods: list of parameters with names, optional types, and descriptions.",
"items": {
"additionalProperties": false,
"description": "Represents a function parameter or class property",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"type": "array"
},
"returnType": {
"description": "For functions/methods: the expected return type string.",
"type": "string"
},
"stubType": {
"description": "The type of code structure to generate (function, class, etc.)",
"enum": [
"function",
"class",
"interface",
"method",
"module"
],
"type": "string"
}
},
"required": [
"language",
"stubType",
"name",
"description"
],
"type": "object"
}