Generated banner for Doca Programming Guide
Generated logo for Doca Programming Guide

Doca Programming Guide

NVIDIAOfficialCreated by NVIDIA

  • Skill
  • Guidelines
  • Software development
  • Apache-2.0
  • Medium risk

From the author

Use this skill when the user is writing their first DOCA app or asking a library-agnostic programming question — picking a shipped sample to copy and modify, wiring pkg-config + meson (or FFI from Rust / Go / Python against the public C ABI), walking the Core lifecycle (create → configure → start → connect → use → stop → destroy), or decoding a DOCA_ERROR_*. Trigger on implicit phrasing: "write my first DOCA program", "meson line for doca_rdma_*", "DOCA_ERROR_BAD_STATE on first call", "call DOCA from Rust", "built clean but nothing on the wire". Refuse install / hugepages / pkg-config (doca-setup), docs or version lookup (doca-public-knowledge-map), and library-internal API work (matching library skill).
— the description by NVIDIA

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a standardized approach for developers to program against NVIDIA DOCA libraries. It focuses on library-agnostic workflows, including the canonical build process using pkg-config and meson, the universal DOCA object lifecycle (create, configure, start, connect, use, stop, destroy), and cross-library error handling. It is designed for developers who have already set up their environment and are ready to write, build, or debug their own DOCA-based applications. The skill emphasizes using existing shipped samples as a foundation for new projects and provides guidance for both C/C++ developers and those using FFI/bindings from other languages.

What it does

  • Provides the canonical build pattern for DOCA applications using pkg-config and meson.
  • Defines the universal lifecycle for all DOCA objects.
  • Explains the cross-library DOCA_ERROR_* taxonomy and debugging ladder.
  • Outlines the workflow for deriving custom applications from shipped samples.
  • Offers guidance on language-neutral programming patterns for FFI and bindings.
  • Establishes a program-side safety policy and observability surface.

When to use it

  • When you are ready to write your first DOCA application after the environment is set up.
  • When you need to understand the standard lifecycle of a DOCA object.
  • When you encounter a DOCA_ERROR_* and need to debug it.
  • When you need to integrate DOCA libraries into a project using FFI or language bindings.
  • When you want to build a DOCA program using the canonical meson and pkg-config workflow.

Advantages

  • Standardizes the development workflow across different DOCA libraries.
  • Reduces development time by leveraging existing shipped samples.
  • Provides a clear, library-agnostic path for debugging and error handling.
  • Supports both native C/C++ development and FFI-based integration.
  • Ensures consistent application structure and lifecycle management.

Usage examples

“How do I write my first DOCA program?”
The agent will guide you through selecting a shipped sample, modifying it for your needs, and using the canonical build pattern to compile your application.
“What is the correct lifecycle for a DOCA object?”
The agent will explain the required sequence: create, configure, start, connect, use, stop, and destroy.
“My code returned DOCA_ERROR_BAD_STATE, what should I do?”
The agent will help you interpret the error using the cross-library taxonomy and guide you through the program-class debug ladder.
“How do I compile a program that calls doca_rdma functions?”
The agent will provide the necessary pkg-config and meson build lines required to link against the DOCA RDMA library.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/nvidia/doca-programming-guide/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip doca-programming-guide.zip -d .agents/skills

Documentation by NVIDIA

DOCA programming guide

Examples

  • "How do I write my first DOCA program?" — copy a shipped sample and follow the modify workflow, then the canonical pkg-config + meson build. Docker / NGC can compile and link; runtime needs a real BlueField or ConnectX.

  • "What's the lifecycle every DOCA object follows?" — create → configure → start → connect → use → stop → destroy. Configuration finishes before start.

Instructions

Follow Loading order below. Open the tasks companion for how-to and the capabilities companion for coverage. Do not open every companion file.

Where to start: Read ## Audience to confirm the user is consuming DOCA, not contributing to it. Then jump to the H2 that matches the verb (## modify for first-app derivation, ## build for the canonical build pattern, ## test for the test loop, ## debug for the program-class debug ladder). Docker / NGC is the build half, not the runtime half. The NGC container can compile and link. Flow pipe creation, RDMA QP ops, and any call that needs a doca_dev on a port need a real BlueField or ConnectX. Do not promise the app will work entirely inside docker.

Example questions this skill answers well

These are the CLASSES of program-class questions the skill is built to answer, each with one worked example. Library-specific overlays (Flow / DMS / Caps / …) live in the matching library skill; this skill answers the library-agnostic shape.

  • "How do I write my first DOCA program for <any library>?" — worked example: "I have docker; help me build my first DOCA Flow app." Answered by the modify-a-shipped-sample workflow in

    modify plus the canonical build

    pattern in ## build. Say that docker / NGC builds and links, but runtime needs a real NIC or DPU.

  • "What's the right build line for any DOCA library?" — worked example: "How do I compile a program that calls doca_rdma_*?" Answered by the pkg-config doca-<library> pattern in

    build (C/C++ Track 1) and the

    FFI/bindings pattern in Track 2.

  • "What's the lifecycle every DOCA object follows?" — worked example: "What's the right order of doca_flow_pipe_* calls in my program?" Answered by the Core order create → configure → start → connect → use → stop → destroy in ## Capabilities and modes (cfg-create / init implement configure and finish before start).

  • "DOCA_ERROR_* came back — what does it mean and what do I do?" — worked example: "My code got DOCA_ERROR_BAD_STATE." Answered by the cross-library doca_error_get_descr() rule in

    Error taxonomy

    • the program-class debug order in

    debug.

  • "My program built and started, but does nothing on the wire." — worked example: "My Flow program runs cleanly but no traffic is matched." Answered by the validate-before-commit rule in

    Safety policy

    and the layered program-class debug ladder in

    debug.

  • "What does <language> consumer of DOCA look like (FFI / bindings)?" — worked example: "How do I call DOCA Comch from Rust without writing C?" Answered by Track 2 of

    build (FFI against the public C

    ABI) and the language-neutral lifecycle in

    Capabilities and modes.

  • "How should I classify and build all the shipped DOCA samples and applications? What's the difference between a sample and an application?" — worked example: "I tried to build all DOCA apps and some failed — which ones are real regressions vs missing optional stacks?" Answered by the sample-vs-application model and the category / dependency / skip-vs-fail taxonomy in

    sample-and-app-categorization,

    which separates "the SDK is broken" from "the optional GPU / RMAX / MPI stack is not on this BlueField".

If the question is env-class (install / build env / hugepages / devices), route to doca-setup/SKILL.md. If it is library-specific (Flow pipe topology, RDMA QP setup, DMS service deploy), layer the matching library skill on top.

Audience

This skill serves external developers building applications that consume DOCA libraries — i.e., users whose code calls one or more doca_<library>_* symbols (directly in C/C++, or through FFI / bindings from another language). It is programming with DOCA, not programming of DOCA: it is not for NVIDIA developers contributing to DOCA itself, and it does not assume access to the DOCA source tree, internal NVIDIA tooling, or any non-public information. The only inputs it ever points the agent at are the ones any external user has: the public docs at docs.nvidia.com/doca/sdk/, the public catalog at catalog.ngc.nvidia.com, the public GitHub repos under github.com/NVIDIA / github.com/NVIDIA-DOCA, the public developer forum, and the on-disk /opt/mellanox/doca tree that the public DOCA install (or the public NGC DOCA container, nvcr.io/nvidia/doca/doca) puts on the user's host. Where to find and how to install questions are routed elsewhere — see Related skills below.

Language scope. DOCA itself is a C library family; every shipped sample in /opt/mellanox/doca/samples/ and every shipped reference application in /opt/mellanox/doca/applications/ is C. C and C++ consumers are the canonical case for every prescriptive workflow in this skill. Other-language consumers (Rust, Go, Python, …) consume the same *.so libraries through FFI or language-specific bindings against the public C ABI; the skill keeps the lifecycle, capability, error, observability, and safety guidance language-neutral, and routes the language-specific build / FFI work back to the consumer's own toolchain without authoring wrappers.

When to load this skill

Load this skill when the user has DOCA installed and the env-class preconditions are already satisfied (i.e., doca-setup/SKILL.md has produced a clean install where pkg-config doca-<library> resolves, hugepages are mounted, and devices are visible), and is now asking a question about how to actually program against DOCA in a library-agnostic way:

  • Understanding what DOCA's pieces are (libraries, apps, services, tools) and which side of the wire they run on.

  • The canonical pkg-config + meson build pattern any DOCA application follows, regardless of which library it consumes.

  • The universal derive a custom first application from a shipped sample workflow that every library skill extends with library-specific overrides — moved here from doca-setup because it is a programming verb, not an env verb.

  • The universal DOCA Core lifecycle (create → configure (including permissions and task set_conf) → start → connect → use → stop → destroy) and how it manifests across libraries. Configuration MUST finish before doca_ctx_start(). Connect is its own step after start; do not write connect/use as one token.

  • The general DOCA_ERROR_* pattern, doca_error_t, and doca_error_get_descr() — the cross-library shape, not Flow- or RDMA-specific overlays.

  • The validate-before-commit rule and the program-side safety policy that every library skill inherits.

  • Programming patterns that apply to consumers in any language (C/C++ directly, FFI / bindings for Rust / Go / Python / …) — the skill keeps the patterns language-neutral and points the agent at the public C ABI as the authoritative surface.

Do not load this skill for:

  • "Is my install healthy? Why does pkg-config not find doca-flow? How do I mount hugepages? I don't have DOCA installed yet — can I use a container?" — env-class questions belong in doca-setup/SKILL.md, which owns install verification, env preparation, env-class debugging, and the no-install → NGC container fallback path for any user on macOS, Windows, or Linux without DOCA.

  • "What is DOCA? Where is the Flow programming guide? Which package do I install?" — routing / orientation questions belong in doca-public-knowledge-map/SKILL.md.

  • "How do I construct a Flow pipe / set up an RDMA queue / use Comch to send a message?" — library-internal API questions belong in the matching library skill (e.g. doca-flow/SKILL.md).

What this skill provides

This is a thin loader. The body keeps only the orientation needed to pick the right next file. The substantive material lives in two companion files:

  • the capabilities companion — what every DOCA program looks like in the abstract: the shape of DOCA (host / DPU / switch, libraries / apps / services / tools, build flavor selection rationale), the universal program lifecycle, the unified version-compat rule that applies to any program linking DOCA, the cross-library DOCA_ERROR_* taxonomy, the program-side observability surface (DOCA logging, capability snapshots), and the program-side safety policy that every library skill inherits.

  • the tasks companion — step-by-step workflows for the six in-scope programming verbs: configure, build, modify, run, test, debug. The ## modify verb owns the universal derive a custom first app from a sample pattern that every DOCA library skill extends with library-specific overrides; the ## build verb owns the canonical pkg-config doca-<library> build pattern in two language tracks (C/C++ direct, non-C via FFI).

This skill assumes doca-setup/SKILL.md has already produced a clean install. It does not cover env preparation; that is doca-setup's job, including the no-install → NGC container (nvcr.io/nvidia/doca/doca) fallback for users on macOS, Windows, or Linux without DOCA.

What this skill deliberately does not ship

This skill is agent guidance, not a samples or templates bundle. It deliberately does not contain — and pull requests should not add:

  • Pre-written DOCA application source code, in any language. This includes C / C++ files, Rust crates, Go packages, Python modules, and wrapper code for any other language. The DOCA API surface evolves between releases and code written from documentation prose cannot be verified without compiling / linking / FFI-loading it against the live library on a real install. The verified DOCA application source code is the shipped C samples on the user's installed system; the agent's job is to route the user to that file and prescribe a minimum-diff modification on it (## modify) — for C/C++ users — or to route non-C users to the public C ABI surface that their bindings will call (## build Track 2), not to author the wrapper.

  • Standalone build manifests (meson.build, CMakeLists.txt, Cargo.toml, setup.py, go.mod, …) parked inside the skill. The agent constructs the build manifest in the user's project directory against the user's installed DOCA, where pkg-config --modversion doca-<library> is the source of truth.

  • A samples/, bindings/, or reference/ subtree of any kind. A mock or incomplete artifact in this skill's tree, even one labeled "reference", is misleading: users will read it as buildable.

Loading order

  1. Read this skill first to confirm the user's question is a programming-class question (not env, not routing, not library-API).

  2. For the DOCA shape, the universal lifecycle, the cross-library error taxonomy, the program-side observability surface, and the safety policy that every library skill inherits, see the capabilities companion.

  3. For step-by-step programming workflows — configure, build, modify, run, test, debug — see the tasks companion.

If the user is asking for a first app in a specific library, walk through ## modify for the universal copy-and-edit pattern, then hand off to the library skill (e.g. doca-flow/SKILL.md) for the library-specific values to swap.

  • doca-public-knowledge-map/SKILL.md — public DOCA documentation routing and the on-disk layout of an installed DOCA package. This skill defers all "where is X documented", "where on disk is Y", and "how do I check the installed version" questions to the knowledge-map.

  • doca-setup/SKILL.md — env preparation, install verification, env-class debugging, and the I have no install yet procedure with the NGC container (nvcr.io/nvidia/doca/doca) as the universal Stage-1 fallback for any user on macOS, Windows, or Linux without DOCA. This skill assumes doca-setup's preconditions are already satisfied.

  • doca-flow/SKILL.md — DOCA Flow on BlueField. Extends this skill's ## modify (universal first-app derivation) with the Flow-specific list of fields to swap.

  • doca-container-deployment/SKILL.md — shipping an application that already builds: container manifests, rollout, and service-readiness verification. This skill ends once the program compiles and runs locally; it does not cover deploying it.

Files

LICENSE

Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.


                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

The author says: No DOCA install required to read this skill (it is an overlay loaded against any DOCA artifact skill); the validation steps within DO require a live DOCA install at /opt/mellanox/doca.

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
NVIDIA
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/doca-programming-guide · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download doca-programming-guide.zip