← ClaudeAtlas

fused-udfslisted

Comprehensive guide for writing Fused User Defined Functions (UDFs). Use when helping users create, optimize, or debug UDFs, including function structure, parameter handling, performance optimization, agent-friendly design, and security best practices.
fusedio/skills · ★ 4 · Code & Development · score 65
Install: claude install-skill fusedio/skills
# Writing Fused UDFs Reference docs.fused.io for the most up-to-date information. **📖 References:** [UDF Writing Guide](https://docs.fused.io/guide/working-with-udfs/writing-udfs/) | [UDF Best Practices](https://docs.fused.io/user-guide/best-practices/udf-best-practices/) | [Getting Started](https://docs.fused.io/guide/getting-started/first-udf-basics/) ## Function Structure & Decorators ### Basic UDF Pattern ```python @fused.udf def udf(bounds: fused.types.Bounds = None, name: str = "Fused"): import pandas as pd return pd.DataFrame({'message': [f'Hello {name}!']}) ``` > **All imports must be inside the UDF function body.** Unlike regular Python, imports at module level are not executed — only the decorated function runs in the Fused runtime. Put every `import` statement inside `def udf(...)`: > > ```python > # ✗ Wrong — module-level import, will not be available > import pandas as pd > > @fused.udf > def udf(): > return pd.DataFrame(...) # NameError: pd not defined > > # ✓ Correct > @fused.udf > def udf(): > import pandas as pd > return pd.DataFrame(...) > ``` ### @fused.udf Parameters - `cache_max_age`: Control caching duration (`"30s"`, `"10m"`, `"24h"`, `"7d"`). Use `cache_max_age=0` if it is important that the UDF always be rerun, for example if it reads something that will not be part of the cache key. The cache key will be the parameters it is called with. > **`cache_max_age=0` is mandatory for UDFs with side effects.** If a UDF creates a N