DuckDB Extension Development
Overview
Use this skill to implement and maintain DuckDB extensions with a predictable workflow: configure/build, run DuckDB SQL tests, keep extension metadata/versioning aligned, and ship binaries through CI.
Workflow
- Confirm extension wiring.
- Build with the repo's supported flow.
- Run unit/integration SQL tests.
- Validate extension packaging/distribution config.
- Prepare release artifacts and compatibility notes.
1) Confirm wiring first
Check these files before changing code:
extension_config.cmaketo ensureduckdb_extension_load(<name> ...)is correct.CMakeLists.txtto verify sources, include paths, and third-party link logic.Makefileand CI makefiles for canonical build/test targets.test/unit_tests/*.testandtest/integration_tests/*.testfor expected behavior.
2) Follow DuckDB extension build conventions
Prefer the extension-template/extension-ci-tools pattern:
- Keep extension metadata in
extension_config.cmake. - Use CMake for both loadable and static extension targets where needed.
- Keep platform-specific dependency resolution explicit.
- Avoid one-off local scripts for core build orchestration when existing make/CI targets already define behavior.
3) Testing best practices
- Run fast unit tests first (no external DB dependency).
- Run integration tests in containerized environments for external systems.
- Keep SQL logic tests close to DuckDB's
sqllogicteststyle and isolate regressions with focused files. - When adding pushdown/type behavior, add direct tests for predicate/projection/type mapping, not only broad end-to-end tests.
4) Local evaluation checklist for duckdb-oracle
For /home/cody/code/other/duckdb-oracle:
- Build wiring looks correct:
extension_config.cmakeloadsoracle. - CMake integrates OCI detection and links OCI/OpenSSL in both static/loadable targets.
- Build/test ergonomics are good:
Makefilehasrelease,test,integration,tidy-check,configure_ci. - Release process is documented in
docs/RELEASE.mdwith tag-driven GitHub Actions flow. - Improvement opportunity: document signed-extension path and long-term upgrade strategy against DuckDB release cadence in one place.
DuckDB best-practice guardrails
- Keep extension changes aligned to the targeted DuckDB branch/version matrix.
- Prefer reproducible CI/container builds over host-specific assumptions.
- Keep compatibility notes explicit for each DuckDB version line.
- Test both functional correctness and extension loading/install experience.
Learn more (official)
- DuckDB extension template: https://github.com/duckdb/extension-template
- DuckDB extension distribution overview: https://duckdb.org/docs/stable/extensions/extension_distribution
- Community extensions: https://duckdb.org/community_extensions/list_of_extensions
- Extension CI tools: https://github.com/duckdb/extension-ci-tools
- C API extension loading reference: https://duckdb.org/docs/stable/clients/c/api.html
微信扫一扫