| name | gold-standards |
| description | Kailash Rust gold standards โ imports, params, error handling, NO mocking Tier 2/3, security. |
Kailash Gold Standards - Mandatory Best Practices
Mandatory best practices and standards for all Kailash Rust SDK development. These are required patterns that must be followed.
Reference Documentation
Code Organization
- gold-absolute-imports -- Use absolute crate paths (
use kailash_core::...), group imports (std, external, workspace), no wildcards
- gold-parameter-passing -- 4-parameter connection format, result access via
result.results["node_id"]["field"]
Testing Standards
- gold-mocking-policy -- NO mocking in Tiers 2-3, trait-based doubles in Tier 1 only
- gold-testing -- 4-tier strategy, real infrastructure, feature-gated, deterministic
- gold-test-creation -- TDD, one assertion focus per test, AAA pattern, snake_case names
Error Handling
- gold-error-handling -- Always
Result<T, E>, use ? operator, thiserror domain errors, no silent swallowing
Workflow and Node Design
- gold-workflow-design -- Always
builder.build(®istry)? before execution, 4-parameter connect()
- gold-custom-nodes --
Node trait, input_params()/output_params(), Pin<Box<dyn Future>>, NodeError
Security and Documentation
Quick Reference: 8 Critical Standards
| # | Standard | DO | DO NOT |
|---|
| 1 | Imports | use kailash_core::{WorkflowBuilder, Runtime}; | use kailash_core::*; |
| 2 | NO MOCKING (Tier 2-3) | Real DB via dotenvy + DATABASE_URL | mockall::automock in integration tests |
| 3 | 4-param connections | connect("src", "output", "tgt", "input") | connect("src", "tgt") |
| 4 | build() before execute | let wf = builder.build(®istry)?; | runtime.execute(&builder, inputs) |
| 5 | Error handling | .ok_or(NodeError::MissingInput{..})? | .unwrap() in production |
| 6 | Secrets | std::env::var("API_KEY") | let api_key = "sk-..."; |
| 7 | TDD | Write test first, then implement | Implement first, add tests later |
| 8 | Explicit errors | match result { Ok(..) => .., Err(..) => .. } | let _ = result; |
Compliance Checklists
Before Every Commit
Before Every PR
Before Every Release
Enforcement
cargo test --workspace && cargo clippy --workspace -- -D warnings && cargo fmt --all --check && cargo audit && cargo test --doc --workspace
Related Skills
Support
reviewer -- Code review after changes
security-reviewer -- Security audit before commits
testing-specialist -- Testing compliance