About flink-udf
A development skill for building and deploying custom Apache Flink functions in Java. It guides implementation by function type and deployment target, and requires confirmation of the deployment plan before resource-changing actions.
Key features
- 01Distinguish Scalar UDF, UDTF, and PTF
- 02Choose guides for Confluent Cloud or local Docker
- 03Guide code generation, JAR packaging, and deployment
- 04Cover Flink SQL and Table API invocation
- 05Require plan approval before resource changes
Use cases
- 01Add custom scalar calculations to Flink SQL
- 02Expand input into multiple output rows
- 03Build table processing with state and timers
- 04Deploy and register a function in Flink
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ confluentinc/ agent-skills --skill flink-udfAfter installing, type/flink-udfin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
evals/evals.jsonreferences/confluent-cloud-setup.mddependencies-confluent-cloud.mddependencies-local.mdlocal-docker-setup.mdptf-java-confluent-cloud.mdptf-java-local.mdudf-udtf-java-confluent-cloud.mdudf-udtf-java-local.mdDetails
From the project READMEFlink User-Defined Functions (UDFs)
Build and deploy custom functions in Java for Apache Flink to extend SQL and Table API capabilities with custom logic.
Function Types
Before proceeding, identify which type of function the user needs:
- Scalar UDF: Maps input values to a single output value (e.g., custom hash, string manipulation, calculations)
- User-Defined Table Function (UDTF): Maps input to multiple output rows (e.g., split strings, explode arrays)
- Process Table Function (PTF): Advanced stateful processing with N-to-M semantics, managed state, and timers (e.g., windowing, deduplication, state machines)
Gather Requirements
Ask the user these questions to determine the implementation path (if not already clear from context):
- Deployment target: Confluent Cloud or local Docker?
- Infrastructure: Deploy new infrastructure (Kafka + Flink) or use existing?
- Invocation method: Flink SQL or Table API?
Route to Implementation Guide
Based on the answers above, read the appropriate reference file:
Confluent Cloud Deployment
- Scalar UDF or UDTF → Read
references/udf-udtf-java-confluent-cloud.md - Process Table Function (PTF) → Read
references/ptf-java-confluent-cloud.md
If infrastructure setup is needed, also read references/confluent-cloud-setup.md first.
Local Docker Deployment
- Scalar UDF or UDTF → Read
references/udf-udtf-java-local.md - Process Table Function (PTF) → Read
references/ptf-java-local.md
If infrastructure setup is needed, also read references/local-docker-setup.md first.
Implementation Workflow
After reading the appropriate reference:
- Set up infrastructure (if needed)
- Generate boilerplate code for the function
- Implement the business logic
- Build and package the JAR
- Confirm the deployment plan with the user. Before any resource-modifying call (
confluent flink artifact create,docker cpinto a running container,CREATE FUNCTION, etc.), present the plan and wait for explicit approval. Show:- Artifact name and JAR path
- Function name to register
- Target environment (Confluent Cloud env + compute pool ID, or local Docker container name)
- The exact commands and SQL that will run Do not proceed to steps 6–7 until the user confirms.
- Deploy the artifact
- Register the function in Flink
- Test the function with sample data
- Provide usage examples (SQL or Table API)
Keep code scaffolding concise and focused on the user's specific requirements. Avoid over-engineering.