shader-programming
Writing and optimizing GLSL or HLSL shaders for real-time graphics rendering in game engines.
What this skill does
## Purpose
This skill allows OpenClaw to generate, optimize, and debug GLSL or HLSL shaders for real-time graphics in game engines. It focuses on tasks like writing vertex, fragment, or compute shaders, ensuring compatibility with APIs like OpenGL, Vulkan, or DirectX.
## When to Use
Use this skill when users request custom shaders for visual effects, performance tweaks, or integration with game engines. Specifically:
- Optimizing shaders for mobile games to reduce GPU load (e.g., minimizing texture samples).
- Creating advanced effects like water rendering or post-processing in tools like Unity or Unreal.
- Debugging shader code during game development iterations.
## Key Capabilities
- Generate complete GLSL/HLSL code snippets based on user specs (e.g., shader type, inputs, outputs).
- Optimize shaders by analyzing and modifying code for better performance, such as reducing instructions or using precision qualifiers.
- Debug common issues like compilation errors or runtime artifacts by suggesting fixes.
- Support shader versions like GLSL 330 or HLSL 5.0, with checks for hardware compatibility.
## Usage Patterns
To invoke this skill in OpenClaw, use the command: `openclaw execute shader-programming --task <task-type> --input <details>`. Always specify the shader language (e.g., --lang glsl) and target platform (e.g., --platform vulkan). For code generation, provide a JSON config like: {"type": "vertex", "inputs": ["position", "normal"], "outputs": ["gl_Position"]}. Follow this pattern:
- Start with a clear task: e.g., `openclaw execute shader-programming --task generate --lang hlsl --input '{"features": ["lighting"]}'`.
- For optimization, pipe existing code: e.g., echo "existing shader code" | openclaw execute shader-programming --task optimize --lang glsl.
- If authentication is needed (e.g., for external compilers), set $OPENCLAW_API_KEY in your environment before running commands.
## Common Commands/API
Use these OpenClaw-integrated commands for shader tasks:
- Compile GLSL shaders: Run `glslangValidator -V -o output.spv input.vert` via OpenClaw's subprocess, e.g., `openclaw execute shader-programming --subprocess "glslangValidator -V -o myShader.spv myShader.vert"`.
- Compile HLSL shaders: Use `fxc /T vs_5_0 /E MainVS /Fo compiled.bin input.hlsl`, invoked as `openclaw execute shader-programming --subprocess "fxc /T vs_5_0 /E MainVS /Fo output.bin input.hlsl"`.
- API endpoints: POST to OpenClaw's /api/shader/generate with JSON payload, e.g., curl -H "Authorization: Bearer $OPENCLAW_API_KEY" -d '{"lang": "glsl", "type": "fragment"}' https://api.openclaw.com/api/shader/generate.
- Config formats: Use JSON for inputs, e.g., {"shader": {"version": "330", "precision": "highp float"}}. For error checks, include flags like --validate in commands, e.g., `openclaw execute shader-programming --task validate --input "shader code" --flags "--validate"`.
## Integration Notes
Integrate this skill by embedding generated shaders into your project workflow. For Unity, save GLSL/HLSL files in the Assets/Shaders directory and reference them in materials. In Unreal, use the .usf format for HLSL. Always wrap OpenClaw calls in a script, e.g., in Python: import subprocess; subprocess.run(["openclaw", "execute", "shader-programming", "--task", "generate", "--lang", "glsl"]). For cross-engine compatibility, specify profiles in configs (e.g., {"profile": "gles3"} for mobile). If using external tools, ensure $OPENCLAW_API_KEY is set for authenticated API calls to avoid failures.
## Error Handling
Handle shader errors by parsing compiler output. For GLSL, check glslangValidator logs for patterns like "ERROR: 0:5: 'undeclared identifier'", then suggest fixes, e.g., add missing variables. In code: try { subprocess.run(["glslangValidator", "-V", "input.vert"]) } catch e { print(e.stderr); if "syntax error" in e.stderr: return "Fix line 5 with correct syntax" }. For HLSL, fxc errors like "error X3004: undeclared identifier" require redeclaring variables. Use OpenClaw's built-in validation: `openclaw execute shader-programming --task debug --input "shader code"`, which returns JSON like {"errors": ["Line 10: missing semicolon"]}. Always log errors with timestamps and retry with corrected inputs.
## Concrete Usage Examples
1. Generate a basic GLSL vertex shader for a simple 3D object: Use `openclaw execute shader-programming --task generate --lang glsl --input '{"type": "vertex", "inputs": ["vec3 position"]}'`. This produces: attribute vec3 aPosition; void main() { gl_Position = vec4(aPosition, 1.0); }
2. Optimize an existing HLSL fragment shader for performance: Run `openclaw execute shader-programming --task optimize --lang hlsl --input "float4 PSMain(float2 uv : TEXCOORD) : SV_Target { return float4(uv, 0.0, 1.0); }"`. Output might be: float4 PSMain(float2 uv : TEXCOORD) : SV_Target { return float4(uv.x, uv.y, 0.0, 1.0); } // Optimized by inlining.
## Graph Relationships
- Related to: game-dev cluster (e.g., shares nodes with graphics-programming for rendering pipelines).
- Links to: graphics-programming (for broader API integration), rendering-engines (for engine-specific shader hooks), and performance-optimization (for shader tuning techniques).
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.