udf-writer

udf-writer is a skill for Claude Code, Codex from taosdata/agent-skills. It costs 66 tokens per session (2,128 once invoked), scanned A, original, MIT.

A Chinese-language skill for developing and debugging TDengine user-defined functions, which are custom database functions written in C, C++, or Python.

In plain words
What is it for?
Use it to create scalar or aggregate functions, generate source code, compile C functions, register them with SQL, and test them.
Why use it?
It helps developers handle the code, compilation, registration, and testing details required for TDengine functions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument; mentions Codex.

Good fit Use it to create scalar or aggregate functions, generate source code, compile C functions, register them with SQL, and test them.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/taosdata/agent-skills/udf-writer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add taosdata/agent-skills --skill udf-writer
Clone the repo
git clone --depth 1 https://github.com/taosdata/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for udf-writer

README.md
[![agentmods](https://agentmods.dev/badge/skills/taosdata/agent-skills/udf-writer/github.svg)](https://agentmods.dev/skills/taosdata/agent-skills/udf-writer)
Your own site
<a href="https://agentmods.dev/skills/taosdata/agent-skills/udf-writer"><img src="https://agentmods.dev/badge/skills/taosdata/agent-skills/udf-writer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for udf-writer

Your own site · 80×15
<a href="https://agentmods.dev/skills/taosdata/agent-skills/udf-writer"><img src="https://agentmods.dev/badge/skills/taosdata/agent-skills/udf-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,128 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00066 $0.02128
Opus 5 $0.00033 $0.01064
Sonnet 5 $0.00013 $0.00426
Haiku 4.5 $0.00007 $0.00213

Measured 9d ago against content hash 75c8f38e1e90, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

udf-writer scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sk --max-time 3 -X POST \
skills/udf-writer/SKILL.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TDengine UDF 编写辅助 (udf-writer)

何时使用 (When to use)

当用户需要为 TDengine 编写、调试、加载或部署用户自定义函数(UDF)时,触发此技能。 触发关键词写一个 UDF编写自定义函数TDengine UDF 编写创建 UDF

输入 (Input)

  • 核心输入
    • UDF 的功能描述(如:自定义字符串拼接、特定数学运算、高级滤波计算等)。
    • UDF 运行时使用的编程语言(C/C++ 或 Python)。
    • 函数类型:
      • 标量函数(Scalar Function,即单行输入单行输出,如 CREATE FUNCTION)。
      • 聚合函数(User Defined Aggregate Function, UDAF,即多行输入单行输出)。
    • 预期输入的数据列及其 TDengine 数据类型。
    • 预期的返回值数据类型。
  • 澄清策略
    • 如果未指定语言,默认推荐使用 C 语言,因为 C UDF 在服务端拥有更高的计算性能。
    • 如果输入输出的数据类型不明确,必须先向用户确认其对应的 TDengine 数据类型(例如 INTDOUBLEVARCHAR 等)。

输出 (Output)

  1. 符合 TDengine 官方规范的 UDF 源代码

    • C 语言:提供完整的 .c 源码,包含头文件 #include <taosudf.h>,以及对输入数据的空值处理和状态管理。
    • Python 语言:提供符合 Python UDF 接口标准的 .py 脚本。
  2. 编译指导

    • 对于 C 语言,提供对应的编译命令(如 gcc -shared -fPIC -o myudf.so myudf.c)。
  3. 加载与注册 SQL 语句

    • 给出加载 UDF 的 SQL 语句,例如:

      CREATE FUNCTION udf_name AS "udf_path" OUTPUTTYPE output_type;
      
  4. 验证说明

    • 提供一份测试该 UDF 的 SQL 样例(例如 SELECT udf_name(col) FROM tb;)。

特殊业务函数默认约定 (Special Business Function Conventions)

为了降低前端展示和快速演示时的提示词要求,针对工艺指标偏差实时判定/质量判定 UDF,若用户指令中仅指定生成此功能而未提供详细参数,默认使用以下设计约定:

  • 函数名evaluate_quality_deviation (C 语言标量 UDF)
  • 输入参数:共四个,均为 DOUBLE 类型列:
    • 实际检测值:val
    • 工艺标准靶值:target
    • 允许波动的警告偏差范围:warn_limit
    • 控制极限偏差范围:ctrl_limit
  • 返回值/输出类型INT 类型的状态码(0 - 正常合格,1 - 轻微偏差预警,2 - 严重超差报警)。
  • 逻辑规则
    • 状态码判定逻辑:
      • |val - target| <= warn_limit 时,返回 0
      • warn_limit < |val - target| <= ctrl_limit 时,返回 1
      • |val - target| > ctrl_limit 时,返回 2
    • 空值防范:注意处理好空值情况,当任意参数为 Null 时输出 Null(即返回 Null 指示器)。
    • 数据块循环:必须确保符合 TDengine 标量 UDF 数据块循环处理逻辑。

安全 (Safety)

  • 内存安全:在 C 语言 UDF 中,必须保证分配的内存得到释放,杜绝内存泄漏,同时严禁发生越界写入等操作,以防引起 TDengine 服务端进程(taosd)崩溃。
  • 输入校验:在 UDF 代码内必须对传入参数的空指针、空值(Null Value/Null Indicator)进行验证。
  • 无破坏性操作:UDF 运行在服务端环境,不允许在 UDF 内部调用破坏系统环境的 shell 命令或进行敏感文件读写。

Read the full file on GitHub · 141 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 141 lines · 66 tokens per session scan A 75c8f38e1e90

Subscribe to this mod's changes

udf-writer is a skill published in the GitHub repository taosdata/agent-skills (3 stars, last pushed 2d ago), licensed MIT. It adds 66 tokens to every session and 2,128 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.