KernelGen Skills User Guide#
This section introduces how to use VSCode (and Copilot), Claude Code, and OpenClaw to connect to the KernelGen Operator Development MCP Toolkit and use KernelGen Skills to generate Kernels generally.
Regarding generating Kernels for FlagGems or vLLM project, optimizing Kernels, and specializing Kernels across hardware platforms use cases, see KernelGen Skills Use Cases.
Prerequisites#
Agent client versions:
Claude Code version 2.1 and later
OpenClaw version 2026.3.2 and later
VSCode with Github Copilot activated
Environment preparations:
Preinstall the
torch,triton, andpytestpackages to enable Kernel testing across different hardware platforms. For Huawei Ascend, installtorch_npuin addition to the standardtorchpackage.Preinstall FlagTree.
Connect Claude Code to KernelGen Operator Development MCP Toolkit and load skills#
Use Claude Code to connect to KernelGen Operator Development MCP Toolkit#
Prerequisites#
Use Claude Code version 2.1 and later
Learn Claude Code settings: https://code.claude.com/docs/en/settings#.
Steps#
To connect Claude Code to the KernelGen Operator Development MCP Toolkit, perform the following steps:
Use the Server-Sent Events (SSE) protocol and Bear authentication to register the KernelGen Operator Development MCP Toolkit with Claude Code:
Option 1 (Recommended): Send a prompt to connect to the KernelGen Operator Development MCP Toolkit, for example:
Based on the Claude Code configuration documentation: https://code.claude.com/docs/en/mcp, connect to the MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the claude.json file.Based on the VSCode documentation: https://code.visualstudio.com/docs/copilot/customization/mcp-servers, configure the kernelgen MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the mcp.json file.
Option 2 : Use the following command:
claude mcp add --transport sse kernelgen-mcp https://kernelgen.flagos.io/sse/ --header "Authorization: Bearer <your KernelGen Token>"
Option 3: Manually modify the configuration file.
Option A: Add JSON configuration to the
.claude.jsonfile{ "projects": { "/root/projects/my-project": { "mcpServers": { "kernelgen-mcp": { "type": "sse", "url": "https://kernelgen.flagos.io/sse", "headers": { "Authorization": "Bearer <your KernelGen Token>" } } } } } }
Option B:Create
mcp.jsonfile, and add JSON configuration.{ "mcpServers": { "kernelgen_mcp": { "url": "http://kernelgen.flagos.io/sse", "headers": { "Authorization": "Bearer <your KernelGen Token>" } } } }
Verify KernelGen Operator Development MCP Toolkit connection:
Option 1: Use prompt
Please verify the kernelgen mcp connection is successful.
Option 2: Use command
/mcp
Setup skills#
Setup
kernelgen-flagosunified skill:Option 1 (Recommended): Send a prompt to setup the
kernelgen-flagosunified skill, including all sub-skills, for example:Setup kernelgen-flagos skills from https://github.com/flagos-ai/skills/tree/main/skills/kernelgen-flagos.
Option 2: Command setup
npx skills add flagos-ai/skills --skill kernelgen-flagos -a claude-code
Note
npx requires npm version 5.2.0 or higher. If npm is missing or your version is outdated, please run
npm -vto check your current version and update it.Option 3: Manual setup
Create a folder named skills within your project and add the skill file.
You can go to https://github.com/flagos-ai/skills/tree/main/skills/kernelgen-flagos to clone the skills. Download this skill file and add it to your skills folder.
mkdir -p .claude/skills git clone https://github.com/flagos-ai/skills/ cp -r skills/skills/kernelgen-flagos/ .claude/skills/
After setting up skills, restart the Claude Code with Control+C.
Verify the skills are setup:
Option 1: Use prompt:
Please verify if the kernelgen-flagos skills are working correctly.Option 2: Use command “/”, if kernelgen-flagos is listed, the skills are setup.
Connect OpenClaw to KernelGen Operator Development MCP Toolkit and load skills#
Send a prompt to connect to the KernelGen Operator Development MCP Toolkit, for example:
Based on the Claude Code configuration documentation: https://code.claude.com/docs/en/mcp, connect to the MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the claude.json file.Based on the VSCode documentation: https://code.visualstudio.com/docs/copilot/customization/mcp-servers, configure the kernelgen MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the mcp.json file.
Send a prompt to restart OpenClaw, since the previous step adds the KernelGen Operator Development MCP Toolkit as a MCP server to the
openclaw.jsonconfiguration file.Send a prompt to setup the kernelgen-flagos unified skill, including all sub-skills, for example:
Setup kernelgen-flagos skills from <https://github.com/flagos-ai/skills/tree/main/skills/kernelgen-flagos>.Send a prompt to OpenClaw:
Convert the skills to OpenClaw compatible skills and install again.Verify skills are successfully setup:
Please verify if the kernelgen-flagos skills are working correctly.
Connect VSCode and Github Copilot to KernelGen Operator Development MCP Toolkit and load skills#
Send a prompt to connect to the KernelGen Operator Development MCP Toolkit, for example:
Based on the Claude Code configuration documentation: https://code.claude.com/docs/en/mcp, connect to the MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the claude.json file.Based on the VSCode documentation: https://code.visualstudio.com/docs/copilot/customization/mcp-servers, configure the kernelgen MCP. The MCP URL is https://kernelgen.flagos.io/sse, and the token is <your KernelGen Token>. Configure this in the mcp.json file.
Start KernelGen Operator Development MCP Toolkit:
Press Ctrl+Shift+P to open the command palette, type and search for “MCP: List Servers”, then press Enter to display a list of all MCP servers currently configured in VSCode along with their running status.
Select “kernelgen-mcp” and “Start Server”.
Verify KernelGen Operator Development MCP Toolkit connection, send a prompt:
Please verify the kernelgen mcp connection is successful.Send a prompt to setup the kernelgen-flagos unified skill, including all sub-skills, for example:
Setup kernelgen-flagos skills from <https://github.com/flagos-ai/skills/tree/main/skills/kernelgen-flagos>.Verify skills are successfully setup:
Please verify if the kernelgen-flagos skills are working correctly.
Generate an operator generally#
To generate an operator, a typical prompt should include the following mandatory and optional elements: Operator name(mandatory), task description (mandatory), input parameters and data type, output parameters and data type, testing devices, and the number of iterations of operator optimization.
You can use one of the following methods to invoke the kernelgen-flagos skill and generate an operator:
Option 1: Use the slash command and prompt
/kernelgen-flagos Generate the ReLU operator. The classification is pointwise. There is 1 input parameter: input: torch. Tensor, the input tensor, which can be of any shape and data type, usually floating-point type, and requires the application of the ReLU activation function. There is 1 output. Output: torch. Tensor, the output tensor after ReLU activation, with the same shape as input, and the logic is max(0, input), i.e., all negative values become 0, and positive values remain unchanged. Use MetaX.
Option 2: Completely use prompt
Use kernelgen-flagos to generate the ReLU operator. The classification is pointwise. There is 1 input parameter: input: torch. Tensor, the input tensor, which can be of any shape and data type, usually floating-point type, and requires the application of the ReLU activation function. There is 1 output. Output: torch. Tensor, the output tensor after ReLU activation, with the same shape as input, and the logic is max(0, input), i.e., all negative values become 0, and positive values remain unchanged. Use MetaX.
Regarding which hardware platforms you can generate operators for, see Supported Hardware Platforms.
Regarding generating Kernels for FlagGems or vLLM project, optimizing Kernels, and specializing Kernels across hardware platforms use cases, see KernelGen Skills Use Cases.