Generate ONEX nodes via automated code generation with ContractInferencer and LLM-powered business logic
Resources
3Install
npx skillscat add omninode-ai/omniclaude/generate-node Install via the SkillsCat registry.
Generate ONEX Node
Fully automated ONEX node generation using the omniclaude codegen system. Generates complete, production-ready nodes with contracts, infrastructure code, business logic, and tests.
๐จ CRITICAL: ALWAYS DISPATCH TO POLYMORPHIC AGENT
DO NOT run generation scripts directly. When this skill is invoked, you MUST dispatch to a polymorphic-agent.
โ WRONG - Running scripts directly:
Bash(${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "Create PostgreSQL CRUD Effect")
Bash(${CLAUDE_PLUGIN_ROOT}/skills/generate-node/regenerate src/nodes/my_node)โ CORRECT - Dispatch to polymorphic-agent:
Task(
subagent_type="onex:polymorphic-agent",
description="Generate PostgreSQL CRUD Effect node",
prompt="Generate an ONEX node with the following requirements:
Description: Create a PostgreSQL CRUD Effect node for user management
Node Type: Effect
Use the generate-node skill:
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate 'Create PostgreSQL CRUD Effect node for user management with async operations'
Options available:
- --output-dir ./generated_nodes (default)
- --node-type effect|compute|reducer|orchestrator
- --enable-intelligence (default)
- --enable-quorum (multi-model validation)
After generation:
1. Verify the generated contract YAML
2. Check the business logic implementation
3. Run the generated tests
4. Report any issues found"
)WHY: Polymorphic agents have full ONEX capabilities, intelligence integration, quality gates, and proper observability. Running scripts directly bypasses all of this.
What It Does
The codegen system provides 100% automated node generation through an event-driven workflow:
- ContractInferencer - Analyzes requirements and generates ONEX v2.0 contract YAML (5-10s with LLM)
- HybridStrategy - Generates infrastructure code from templates (~50ms with Jinja2)
- BusinessLogicGenerator - Generates complete business logic (5-15s with LLM)
- Validation - Runs comprehensive tests and quality checks (~100ms)
Total Time: 10-25 seconds per node, ZERO manual work โจ
When to Use
- Creating new ONEX Effect nodes (API interactions, external systems)
- Creating new ONEX Compute nodes (data processing, business logic)
- Creating new ONEX Reducer nodes (state management, aggregation)
- Creating new ONEX Orchestrator nodes (workflow coordination)
- Regenerating nodes with updated patterns and best practices
Usage
Generate New Node (From Prompt)
Use the Bash tool to execute:
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "<PROMPT>" [OPTIONS]Regenerate Existing Node (From Code)
To regenerate an existing node (useful for applying updated patterns or refactoring):
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/regenerate <NODE_DIR> [OPTIONS]The regenerate script intelligently extracts a generation prompt by:
- First, checking for README.md and extracting description
- If no README, analyzing all Python code files with Z.ai to extract purpose and functionality
- Then, calling the generate skill with the extracted prompt
Arguments
PROMPT- Natural language description of the node (required)--output-dir- Output directory for generated files (default: ./generated_nodes)--node-type- Node type hint: effect|orchestrator|reducer|compute (optional, auto-inferred)--interactive- Enable interactive checkpoints for validation--enable-intelligence- Use RAG intelligence gathering (enabled by default)--disable-intelligence- Disable RAG intelligence gathering--enable-quorum- Use AI quorum validation (multi-model consensus)--timeout- Timeout in seconds (default: 300 = 5 minutes)
Examples
Generate New Nodes:
# Basic usage - generate PostgreSQL CRUD Effect
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "Create PostgreSQL CRUD Effect node"
# With custom output directory
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "Create ML inference Orchestrator" --output-dir ./my_nodes
# With node type hint and interactive mode
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "Create metrics aggregation Reducer" --node-type reducer --interactive
# With intelligence disabled (faster, less context)
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "Create simple logger Effect" --disable-intelligence
# With AI quorum validation (multi-model consensus)
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "Create payment processing Orchestrator" --enable-quorumRegenerate Existing Nodes:
# Regenerate node from existing code (extracts prompt automatically)
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/regenerate src/omniclaude/nodes/llm_effect/v1_0_0/llm_effect_llm
# Regenerate with custom output directory
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/regenerate nodes/my_node --output-dir ./regenerated
# Regenerate with interactive mode
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/regenerate ../other_repo/nodes/custom_node --interactive
# Regenerate from node with README.md (fast - no Z.ai call)
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/regenerate nodes/well_documented_node
# Regenerate from node without README (uses Z.ai code analysis)
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/regenerate nodes/legacy_node --enable-intelligenceOutput
The skill generates a complete ONEX node with:
generated_nodes/
โโโ <node_name>/
โโโ contract.yaml # ONEX v2.0 contract specification
โโโ node.py # Main node implementation
โโโ models/ # Pydantic models
โ โโโ model_input.py
โ โโโ model_output.py
โ โโโ model_intent.py
โโโ __init__.py # Package initialization
โโโ README.md # Node documentation
โโโ tests/ # Unit tests (optional)
โโโ test_node.pySuccess Output Example
๐ Generating ONEX node...
Correlation ID: 550e8400-e29b-41d4-a716-446655440000
Prompt: Create PostgreSQL CRUD Effect node
Output: ./generated_nodes
[Progress updates via Kafka events...]
โ
Generation complete!
Duration: 18.3s
Quality Score: 0.95
Files Generated: 8
Generated files:
- ./generated_nodes/postgresql_crud_effect/contract.yaml
- ./generated_nodes/postgresql_crud_effect/node.py
- ./generated_nodes/postgresql_crud_effect/models/model_input.py
- ./generated_nodes/postgresql_crud_effect/models/model_output.py
- ./generated_nodes/postgresql_crud_effect/models/model_intent.py
- ./generated_nodes/postgresql_crud_effect/__init__.py
- ./generated_nodes/postgresql_crud_effect/README.md
- ./generated_nodes/postgresql_crud_effect/tests/test_node.pyArchitecture
The codegen uses event-driven orchestration via Kafka:
CLI (omninode-generate)
โ (publishes event)
Kafka Topic: node.generation.requested
โ (consumed by)
Code Generation Workflow
โโ ContractInferencer (AST + LLM inference)
โโ HybridStrategy (Jinja2 templates)
โโ BusinessLogicGenerator (LLM code generation)
โโ Validation (pytest + quality checks)
โ (publishes progress events)
Kafka Progress Topics
โ (consumed by)
CLI Progress Display
โ
Generated FilesPerformance Metrics
| Component | Time | Automation Level |
|---|---|---|
| ContractInferencer | 5-10s | 100% (LLM-based) |
| Jinja2 Templates | ~50ms | 100% (Template-based) |
| BusinessLogicGenerator | 5-15s | 100% (LLM-based) |
| Validation | ~100ms | 100% (Automated tests) |
| TOTAL | 10-25s | 100% AUTOMATED |
Manual work eliminated: 45 min โ 0 min per node = 100% time savings ๐ฏ
Z.ai Integration (Regenerate Mode)
When regenerating nodes without README.md files, the skill uses Z.ai LLM API to analyze code and extract generation prompts:
How It Works:
- Collects all Python files from the node directory
- Sends code to Z.ai with a system prompt asking to analyze the node
- Z.ai extracts: node type, functionality, operations, integrations, features
- Returns a concise 1-2 sentence generation prompt
- Uses extracted prompt to regenerate the node with updated patterns
API Configuration:
- Endpoint:
https://api.z.ai/api/anthropic(Anthropic-compatible) - Model:
glm-4-flash(fast, cost-effective) - configurable viaZAI_MODELenv var - API Key: Set
ZAI_API_KEYin.envfile - Cost: ~$0.01 per regeneration (typical node analysis)
Performance:
- With README: <1s (no API call needed)
- Without README: 3-5s (includes Z.ai API call for code analysis)
- Accuracy: 95%+ prompt extraction quality
Fallback Strategy:
- Try README.md extraction first (fastest)
- If no README or extraction fails โ Z.ai code analysis
- If Z.ai fails โ error with helpful message
Prerequisites
Required Infrastructure (running on your configured host):
- PostgreSQL (port 5436) - For workflow state persistence
- Kafka/Redpanda (port 9092/19092) - For event-driven orchestration
- Consul (port 28500) - For service discovery
Environment Variables (in ~/.omnibase/.env):
POSTGRES_HOST=<postgres-host>
POSTGRES_PORT=5436
POSTGRES_DATABASE=omnibase_infra
POSTGRES_USER=postgres
POSTGRES_PASSWORD=<set_in_env>
KAFKA_BOOTSTRAP_SERVERS=omninode-bridge-redpanda:9092 # Docker services
# OR
KAFKA_BOOTSTRAP_SERVERS=<kafka-bootstrap-servers>:9092 # Host scripts
ZAI_API_KEY=<your_key> # For LLM-powered generation and code analysis
ZAI_ENDPOINT=https://api.z.ai/api/anthropic # Optional, defaults to Z.ai
ZAI_MODEL=glm-4-flash # Optional, defaults to glm-4-flashFor Regenerate Mode (analyzing existing code):
# Required
ZAI_API_KEY=<your_key> # Z.ai API key for code analysis
# Optional
ZAI_ENDPOINT=https://api.z.ai/api/anthropic # Override endpoint
ZAI_MODEL=glm-4-flash # Override model (glm-4-flash, glm-4-plus, etc.)Working Directory: Must be run from within the omniclaude repository.
Error Handling
The skill provides comprehensive error handling:
- Empty prompt: Returns error with helpful message
- Invalid output directory: Validates path and prevents path traversal
- Timeout exceeded: Cancels workflow and reports partial results
- Kafka connection failure: Provides diagnostic information
- Generation failure: Returns detailed error with correlation ID for debugging
Common Pitfalls Avoided
โ Manual contract writing - ContractInferencer does it automatically
โ Template boilerplate - HybridStrategy generates infrastructure
โ Manual business logic - BusinessLogicGenerator writes working code
โ Missing tests - Validation ensures quality
โ
100% automated - From prompt to production-ready code
โ
Event-driven - Real-time progress tracking via Kafka
โ
High quality - LLM-powered with validation and quality checks
โ
Fast - 10-25s total generation time
Skills Location
Claude Code Access: ${CLAUDE_PLUGIN_ROOT}/skills/generate-node/
Executable: ${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate
Repository: omniclaude
Integration with Other Tools
This skill integrates with:
- ContractInferencer - AST parsing and contract generation
- HybridStrategy - Template-based code generation
- BusinessLogicGenerator - LLM-powered business logic
- Kafka Event Bus - Real-time progress tracking
- PostgreSQL - Workflow state persistence
- OmniIntelligence - RAG-enhanced context gathering (optional)
Node Types Reference
Effect Nodes:
- External API interactions (REST, GraphQL, gRPC)
- Database operations (CRUD, queries)
- Message queue publishing/consuming
- File system operations
- Third-party service integrations
Compute Nodes:
- Data transformations and processing
- Business logic execution
- Algorithm implementation
- Calculations and analytics
- Data validation and sanitization
Reducer Nodes:
- State aggregation and management
- Data persistence and caching
- Stream reduction and windowing
- Metrics collection and rollup
- Event sourcing and replay
Orchestrator Nodes:
- Multi-step workflow coordination
- Service composition and routing
- Saga pattern implementation
- Distributed transaction management
- Event-driven choreography
Debugging
If generation fails or produces unexpected results:
# Check Kafka connection
curl http://<redpanda-console-host>:8080 # Redpanda Console
# Check PostgreSQL connection
psql -h <your-infrastructure-host> -p 5436 -U postgres -d omnibase_infra
# View generation events in Kafka
kcat -C -b <kafka-bootstrap-servers>:9092 -t node.generation.requested
# Check correlation ID in logs
grep "<correlation_id>" /path/to/logs
# Run with shorter timeout for debugging
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "Test node" --timeout 60Advanced Usage
Batch Generation
Generate multiple nodes programmatically:
# Generate multiple related nodes
for node_desc in "User CRUD Effect" "Auth Middleware Effect" "Session Reducer"; do
${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate "$node_desc" --output-dir ./my_service_nodes
doneCustom Workflow Integration
# Python integration example
import subprocess
import json
def generate_node(prompt: str, output_dir: str = "./generated_nodes"):
result = subprocess.run(
["${CLAUDE_PLUGIN_ROOT}/skills/generate-node/generate", prompt, "--output-dir", output_dir],
capture_output=True,
text=True
)
return result.returncode == 0Quality Assurance
Generated nodes include:
- โ ONEX v2.0 compliant contracts
- โ Type-safe Pydantic models
- โ Comprehensive error handling
- โ Logging and observability
- โ Circuit breaker patterns (where applicable)
- โ Retry logic (where applicable)
- โ Input validation
- โ Documentation (README, docstrings)
- โ Unit tests (optional)
Quality Score: 0.0-1.0 based on:
- Contract completeness and correctness
- Code quality and type safety
- Test coverage
- Documentation quality
- ONEX compliance
See Also
- ContractInferencer Documentation:
docs/codegen/CONTRACT_INFERENCER.md - HybridStrategy Guide:
docs/codegen/HYBRID_STRATEGY.md - ONEX v2.0 Specification:
docs/architecture/ONEX_V2_SPECIFICATION.md - Node Development Guide:
docs/guides/NODE_DEVELOPMENT_GUIDE.md