Generated banner for Doca Argp
Generated logo for Doca Argp

Doca Argp

NVIDIAOfficialCreated by NVIDIA

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • Medium risk

From the author

Use this skill for hands-on DOCA Arg Parser CLI work on a shipped sample or new DOCA-using app — adding / removing / renaming flags; wiring `doca_argp_init` → register params → `doca_argp_start` → `doca_argp_destroy` in order; picking a parameter type from the full public enum (`DOCA_ARGP_TYPE_STRING`, `_INT`, `_BOOLEAN`, `_DEVICE`, `_DEVICE_REP`, `_DOUBLE` — six values, not three); preserving the built-in DOCA flags (`-h` `-v` `-l` `--sdk-log-level` `--log-filter` `-j`/`--json`, NOT `--json-config`); `--device` is per-program; or debugging `DOCA_ERROR_BAD_STATE` / `INVALID_VALUE` / `NOT_SUPPORTED` / `IO_FAILED` from `doca_argp_*`. Trigger on implicit phrasings: "add a custom flag to a DOCA sample", "should I use getopt here", "BAD_STATE registering a new param", "my JSON config key is rejected", or "my sample's --json is ignored". Refuse and route elsewhere for variadic-flag / subcommand / shell-completion features, DOCA Core context, or DOCA Log internals.
— the description by NVIDIA

AutoGineer summary

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

This skill provides technical guidance for developers working with the DOCA Arg Parser library. It covers the lifecycle management of CLI parameters, including registration, initialization, and destruction, as well as the use of standard DOCA flags and JSON configuration files. It is designed for developers modifying existing DOCA samples or building new applications that require a consistent CLI interface. The skill includes debugging support for common Arg Parser errors and ensures proper integration with the DOCA SDK environment.

What it does

  • Guides the registration and lifecycle management of CLI parameters using doca_argp.
  • Provides instructions for integrating standard DOCA flags and JSON configuration files.
  • Offers debugging strategies for common Arg Parser errors like BAD_STATE or INVALID_VALUE.
  • Ensures consistent CLI behavior across DOCA-using applications.
  • Assists in verifying the presence and version of the doca-argp library via pkg-config.

When to use it

  • When adding, removing, or renaming CLI flags in a DOCA-based application.
  • When wiring the doca_argp initialization and destruction lifecycle in a main() function.
  • When troubleshooting parameter registration order or type-mismatch errors.
  • When implementing JSON-based configuration for complex CLI inputs.
  • When ensuring a new application adheres to the standard DOCA CLI surface.

Advantages

  • Maintains consistency with standard DOCA CLI patterns.
  • Reduces development time by providing clear lifecycle and registration workflows.
  • Helps avoid common pitfalls like incorrect parameter registration order.
  • Provides a structured approach to debugging library-specific errors.
  • Integrates seamlessly with existing DOCA sample code structures.

Usage examples

“How do I add a custom flag to a DOCA sample?”
The agent provides the steps to register a typed parameter using doca_argp_param_set_* before calling doca_argp_start, ensuring the sample retains its standard CLI flags.
“Why does doca_argp_param_set_* return BAD_STATE?”
The agent explains the lifecycle requirement, confirming if the registration call was made after doca_argp_start, and provides the correct initialization order.
“Can I drive a sample from a JSON file?”
The agent guides the user on utilizing the --json flag to point to a configuration file, avoiding the need for long command-line arguments.
“My --my-flag value is rejected as INVALID_VALUE.”
The agent helps verify the parameter type declaration against the provided value, ensuring it matches the expected DOCA_ARGP_TYPE enum.

Install

  1. Download the skill as a ZIP:

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

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

Documentation by NVIDIA

DOCA Arg Parser

Examples

  • "Add a custom flag to a DOCA sample." — this is in scope. Register a typed doca_argp param; do not drop to getopt.

  • "BAD_STATE registering a new param." — check init → register → start order before changing the flag type.

Instructions

Follow Loading order below. Open the tasks companion for configure / register / debug. Open the capabilities companion for the public param types. Do not open every companion file.

Where to start: This skill assumes DOCA is already installed and the user is doing hands-on CLI work on a DOCA sample or new DOCA-using app. Open the tasks companion if the user wants to do something (configure / build / modify / run / test / debug); open the capabilities companion when the question is what can the Arg Parser express on this version. If the user has not installed DOCA yet, route to doca-setup/SKILL.md first. If the user is about to rewrite a sample's CLI with getopt / argparse / custom parsing instead of reusing the Arg Parser, read the load-bearing rule in the capabilities companion before any code change.

Example questions this skill answers well

The CLASSES of Arg Parser questions this skill is built to answer, each with one worked example. The agent should treat the class as the load-bearing piece — the worked example is a single instance.

  • "How do I add a new flag to a DOCA sample without breaking the standard CLI?" — worked example: "add --my-flag to /opt/mellanox/doca/samples/doca_dma/dma_local_copy/ so the sample still accepts --device <PCI> and --sdk-log-level <level> the same way it did before". Answered by the reuse-the-Arg-Parser rule in the capabilities companion

    • the register-before-start workflow in the tasks companion.

  • "Why does doca_argp_param_set_* return BAD_STATE on my second call?" — worked example: "registering a new param after doca_argp_start has already parsed argv". Answered by the lifecycle order in the capabilities companion

    • the error-taxonomy row in the capabilities companion for DOCA_ERROR_BAD_STATE.

  • "Can I drive a sample from a JSON file instead of a long command line?" — worked example: "point a sample at ./my-config.json so the operator does not have to type out ten flags every time". Answered by the --json <path> integration in the capabilities companion

    • the JSON-config-file workflow in the tasks companion and the tasks companion.

  • "My --my-flag X value is rejected as INVALID_VALUE — why?" — worked example: "declared the param as int but passed --my-flag 0x40". Answered by the parameter-type table in the capabilities companion

    • the type-mismatch row in the capabilities companion.

  • "Is doca-argp even on my installed DOCA?" — worked example: "a colleague's sample mentions doca-argp but I want to confirm before I depend on it". Answered by the presence

    • version-detection rule in the capabilities companion, which cross-links the canonical detection chain in doca-version/SKILL.md.

  • "Should I use doca-argp here, or is this case actually outside its scope?" — worked example: "writing a host-side CLI tool that never calls a doca_* symbol". Answered by the path-selection rule in the capabilities companion Use doca-argp when … / Do not use doca-argp when … bullets.

Audience

This skill serves external developers building or modifying DOCA-using applications — i.e., users whose code already calls doca_* (directly in C/C++, or through FFI/bindings from another language) and who need the standard DOCA CLI surface so operators of the resulting binary do not have to relearn how to invoke each sample. It is not for NVIDIA developers contributing to the Arg Parser library itself.

Language scope. DOCA Arg Parser ships as a C library with pkg-config module name doca-argp. The shipped samples are written in C. C and C++ consumers are the canonical case; the worked examples in the tasks companion assume that path. Other-language consumers (Rust, Go, Python, …) consume the same *.so through FFI or language-specific bindings; the skill's contribution in that case is to keep the lifecycle, parameter-type, JSON-config, standard-flag-surface, and error-taxonomy guidance language-neutral, and to route the agent to the public C ABI as the authoritative surface that any wrapper will eventually call.

When to load this skill

Load this skill when the user is doing hands-on DOCA Arg Parser work, in any language. Concretely:

  • Adding, removing, or renaming a CLI flag on a shipped DOCA sample or on a new app that wants to share the standard DOCA CLI surface (--device <PCI>, --representor <name>, --rep-list, --json <path>, --sdk-log-level <level>).

  • Wiring doca_argp_init / doca_argp_start / doca_argp_destroy into a main(), including the register-before-start lifecycle and the cleanup-on-exit contract.

  • Registering a doca_argp_param (short name, long name, value callback, description for --help) with a parameter type drawn from the six-value public enum: string, int, boolean, device, device representor, or double. A JSON config file is an input surface for those parameters, not a parameter type.

  • Reading complex configurations from a JSON file via the shared --json <path> flag instead of expanding the command line.

  • Confirming the build- and runtime-side Arg Parser version on the user's install (pkg-config --exists doca-argp, pkg-config --modversion doca-argp) before depending on it.

  • Debugging a DOCA_ERROR_* returned from a doca_argp_* call (lifecycle vs. type-mismatch vs. unknown JSON key vs. unreadable file).

  • Designing or extending non-C bindings (Rust, Go, Python, …) that wrap the Arg Parser C ABI — for the lifecycle, parameter-type, JSON-config, and standard-flag rules the wrapper must honor.

Do not load this skill for general DOCA orientation, install of DOCA itself, or non-Arg-Parser library questions. For those, use doca-public-knowledge-map/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 Arg-Parser-specific material lives in two companion files:

  • the capabilities companion — what the Arg Parser can express on this version: the param-registration model, the small set of public parameter types, the standard DOCA CLI surface every sample shares, the --json <path> file integration, the register-before-start lifecycle, the Arg Parser error taxonomy (mapped onto the cross-library DOCA_ERROR_* set), the observability surface (the --help output and the DOCA Log channel), and the safety / path-selection policy (when reusing doca-argp is mandatory; when a language-native parser is the right answer).

  • the tasks companion — step-by-step workflows for the six in-scope Arg Parser verbs: configure, build, modify, run, test, debug. Plus a Deferred task verbs block that points out-of-scope questions at the right next skill.

The skill assumes a host or BlueField where DOCA is already installed at the standard location. It does not cover installing DOCA — that path goes through doca-setup/SKILL.md.

What this skill deliberately does not ship

This skill is agent guidance, not a samples or templates bundle. To keep the boundary clean, it deliberately does not contain — and pull requests should not add:

  • Pre-written DOCA Arg Parser usage code, in any language. The verified Arg Parser usage is the *_main.c file in every shipped DOCA sample at /opt/mellanox/doca/samples/<library>/<sample>/. The agent's job is to route the user to that file and prescribe a minimum-diff modification on it via the universal modify-a-sample workflow in doca-programming-guide/SKILL.md, layered with the Arg-Parser-specific overrides in the tasks companion.

  • Standalone build manifests (meson.build, CMakeLists.txt, Cargo.toml, …) 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-argp 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 in scope.

  2. For the param-registration model, parameter types, the standard DOCA CLI surface, the --json <path> rule, the register-before-start lifecycle, error taxonomy, observability, and the path-selection / safety policy, see the capabilities companion.

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

Both companion files cross-link to each other, doca-version/SKILL.md for the canonical version-handling rules, and doca-public-knowledge-map/SKILL.md whenever the right answer is "look it up in the public docs or the installed package layout" rather than "Arg-Parser-specific guidance".

  • doca-public-knowledge-map/SKILL.md — the routing table for every public DOCA documentation source and the on-disk layout of an installed DOCA package. The Arg Parser URL is https://docs.nvidia.com/doca/sdk/DOCA-Arg-Parser/index.html; the canonical on-disk usage example is any sample's *_main.c under /opt/mellanox/doca/samples/.

  • doca-setup/SKILL.md — env preparation, install verification, and the I have no install yet path with the public NGC DOCA container. This skill assumes its preconditions are satisfied.

  • doca-version/SKILL.md — canonical DOCA version-handling rules. This skill's ## Version compatibility cross-links the four-way match rule and adds the Arg-Parser-specific presence-check overlay.

  • doca-structured-tools-contract/SKILL.md — the bundle's structured-tools precedence rule (detect / prefer / fall back / report). The Command appendix in the tasks companion honors this contract.

  • doca-programming-guide/SKILL.md — general DOCA programming patterns shared by every library: the canonical pkg-config + meson build pattern, the universal modify-a-shipped-sample first-app workflow, the universal lifecycle, the cross-library DOCA_ERROR_* taxonomy, and the program-side debug order. This skill layers Arg-Parser specifics on top.

  • doca-debug/SKILL.md — the cross-cutting debug ladder (install / version / build / link / runtime / program / driver). Arg-Parser-specific debug (lifecycle violations, type-mismatch on a registered param, unknown JSON key) overlays on top of that ladder.

Files

CAPABILITIES.md

DOCA Arg Parser capabilities, version overlay, errors, observability, safety

Where to start: Pick the H2 anchor that matches your question (param model / parameter types / standard CLI surface / JSON config / version / errors / safety) and read that section end-to-end. The tables in each section are the load-bearing content; the prose around them is interpretation.

Read this file when the loader sent you here from SKILL.md. For the how of executing each pattern (the verbs configure / build / modify / run / test / debug), jump to TASKS.md. For the canonical DOCA version-handling rules that this skill layers an Arg-Parser overlay on top of, see doca-version/SKILL.md.

Pattern overview

Every Arg Parser question this skill teaches resolves into one of FIVE patterns. The patterns are CLASSES — they apply across every DOCA release and every sample, not just the worked examples shown.

PatternWhen it applies (class shape)Where the substance lives
1. Reuse, do not rewriteThe user is modifying a shipped DOCA sample's CLI (adding / removing / renaming a flag) and is tempted to swap the Arg Parser for getopt / argparse / hand-rolled parsing## Capabilities and modes reuse rule + TASKS.md ## modify
2. Register before startNew params are registered against the Arg Parser instance BEFORE doca_argp_start parses argv; registering after parse is the most common first-app failure## Capabilities and modes lifecycle table + TASKS.md ## configure
3. Pick the parameter typeChoose from the six-value public enum (string, int, boolean, device, device representor, double); JSON config is a separate input surface, not a type## Capabilities and modes parameter-type table + TASKS.md ## modify
4. Inherit the standard CLI surfaceKeep --device, --representor, --rep-list, --json (-j), --sdk-log-level working the same way they do in the sibling samples; users learn one CLI for all of DOCA## Capabilities and modes standard-surface table + TASKS.md ## modify
5. Diagnose an Arg Parser errorMap symptom (BAD_STATE, INVALID_VALUE, NOT_SUPPORTED, IO_FAILED) to root cause without leaving the Arg Parser layer prematurely## Error taxonomy + TASKS.md ## debug

Two cross-cutting rules that apply to every pattern above:

  • The shipped sample's *_main.c is the canonical reference, every time. doca-argp does not ship its own dedicated sample tree; instead, every DOCA sample's *_main.c (under /opt/mellanox/doca/samples/<library>/<sample>/) is a working, version-matched Arg Parser usage. Quote the installed file, not a remembered API shape.

  • The standard CLI surface is the user's mental model, not a stylistic preference. When a user invokes any DOCA sample, they expect --device, --representor (or --rep-list), --json (-j), and --sdk-log-level to behave the same way as in the sibling samples. Adding a flag on top of that surface is fine; replacing the surface breaks the cross-sample mental model and is a regression.

Capabilities and modes

DOCA Arg Parser is a small, foundational CPU-side library. It has no hardware accelerator behind it, no DOCA Core context, and no progress engine — it owns parsing, not execution. On top of that small surface, it layers a param-registration lifecycle, a small parameter-type set, the shared DOCA standard flag surface, and the JSON-config file integration.

The Arg Parser lifecycle. Every consumer follows the same register-before-start order. The agent must not invent steps; the public surface is closed.

StepCallWhat it doesOrder constraint
Initdoca_argp_init(<program-name>, <user-config>)Creates the per-process Arg Parser instance; allocates the default standard-flag setMust be the FIRST doca_argp_* call in the program
Registerdoca_argp_param_create → doca_argp_param_set_* (short name, long name, value-callback, description, type) → doca_argp_register_paramAdds one doca_argp_param to the instance for each app-specific flagMust happen AFTER doca_argp_init and BEFORE doca_argp_start; registration after start returns BAD_STATE
Start (parse)doca_argp_start(argc, argv)Walks argv (and any --json <path> / -j <path> file), calls each matching param's value-callback with the parsed value, fails fast on the first invalid valueRuns ONCE per process; a second _start returns BAD_STATE
Destroydoca_argp_destroy()Frees the per-process instance and every registered doca_argp_paramShould pair with _init on every exit path, including error paths

Parameter types. The full public enum doca_argp_type the Arg Parser exposes. Picking the right one is what makes argv validation and JSON-config validation Just Work. The enum has six real values (DOCA_ARGP_TYPE_STRING, DOCA_ARGP_TYPE_INT, DOCA_ARGP_TYPE_BOOLEAN, DOCA_ARGP_TYPE_DEVICE, DOCA_ARGP_TYPE_DEVICE_REP, DOCA_ARGP_TYPE_DOUBLE) — do not silently omit the latter three.

Type (enum)Argv shapeJSON shapeTypical use
DOCA_ARGP_TYPE_STRING--my-flag VALUE"my-flag": "VALUE"File paths, free-form strings
DOCA_ARGP_TYPE_INT--my-flag 1234"my-flag": 1234Queue depth, message size cap, max-num-tasks
DOCA_ARGP_TYPE_BOOLEAN--my-flag (presence sets true)"my-flag": trueEnable a code path that is off by default
DOCA_ARGP_TYPE_DEVICE--my-flag pci/<BDF>[,devargs]"my-flag": {"type": "pci", "identifier": "<BDF>"} (optional "devargs")A device flag whose value the Arg Parser opens as a doca_dev for you (e.g. --device pci/0000:03:00.0) — preferred over hand-rolling the device open via DOCA_ARGP_TYPE_STRING
DOCA_ARGP_TYPE_DEVICE_REP--my-flag pci/<BDF>,<rep>[,devargs]"my-flag": {"type": "pci", "identifier": "<BDF>,<rep>"} (optional "devargs")A representor flag whose value the Arg Parser opens as a doca_dev_rep for you (e.g. --representor pci/08:00.0,pf0vf1) — DPU-side counterpart to _TYPE_DEVICE
DOCA_ARGP_TYPE_DOUBLE--my-flag 12.5"my-flag": 12.5Floating-point knobs (e.g. timeouts in seconds, fractional caps)
JSON config file (special, not a type)--json /path/to/file.json (or -j)n/a (this IS the JSON file)Drive any of the above from a file instead of expanding argv. The real flag is --json / -j, NOT --json-config — do not invent the longer name.

The standard DOCA CLI surface. doca_argp_init registers a fixed set of built-in DOCA flags (printed under "DOCA Flags" by --help) so the user learns ONE CLI for all of DOCA. Device / representor flags (e.g. --device, --representor) are NOT built-in: each program registers its own, typically as DOCA_ARGP_TYPE_DEVICE / _DEVICE_REP (syntax pci/<BDF>[,devargs]; representor pci/<BDF>,pf0vf1). Modifications must preserve this surface.

FlagValue typeMeaning
-h / --helpBool flagPrint the help synopsis (DOCA Flags + Program Flags) and exit
-v / --versionBool flagPrint program version information and exit
-l <N> / --log-level <N>Numeric level: 10=DISABLE, 20=CRITICAL, 30=ERROR, 40=WARNING, 50=INFO, 60=DEBUG, 70=TRACESet the program (app-side) DOCA Log level for this run
--json <path> / -j <path>String (path to a JSON file)Read parameter values from a JSON file instead of expanding argv. The flag is registered as --json (-j) by the library itself (the public registration entry point is doca_argp_register_param); there is no --json-config flag.
--sdk-log-level <N>Numeric level, same 10-70 scale (e.g. 60 = DEBUG)Set the SDK-side DOCA Log threshold for this run
--log-filter <list>String (comma-separated module names)Filter logs from specific modules

JSON-config integration. The --json <path> flag (also short-form -j <path>; the long name is --json, NOT --json-config) is not optional cosmetic detail — shipped samples with non-trivial configurations expect operators to drive them from a file (the command line becomes unreadable past ~5 flags). The JSON keys match the registered long names; the JSON value types match the registered parameter types; an unknown JSON key fails with DOCA_ERROR_NOT_SUPPORTED (pedantic parsing) per ## Error taxonomy.

Path selection — when doca-argp is the right answer. This is a small library, but its scope is sharp. Walk this rule before recommending the Arg Parser path.

Use doca-argp when …Do not use doca-argp when …
Modifying a shipped DOCA sample's CLI (add / remove / rename a flag) — reusing the Arg Parser keeps the sample's CLI consistent with every sibling sampleThe program never calls a doca_* symbol — there is no DOCA-side interaction to begin with, so a language-native CLI parser is the right answer (and avoids dragging in libdoca-argp for no benefit)
Building a new DOCA-using app that wants operators to learn the standard --device / --representor / --json (-j) / --sdk-log-level CLI conventions instead of inventing a fresh oneThe user genuinely needs a POSIX getopt feature the Arg Parser does not cover (e.g. optional-argument optional-value forms) — and is willing to accept the cost of breaking sample-CLI consistency for that specific need; even then, prefer layering doca-argp + the extra parser, not replacing it
Driving a complex configuration from a JSON file (--json <path> / -j <path>) — the file format and key validation come for freeThe CLI surface is interactive (REPL, prompt loop) — that is not what an arg parser is for; reach for a TUI / REPL library instead

Version compatibility

For the canonical DOCA version-detection chain, the four-way match rule, NGC container semantics, and the headers-win-over-docs rule, see doca-version/SKILL.md. The body lives there; this skill does not duplicate it.

The Arg-Parser-specific overlay is:

  • Presence is the first check; version is the second. doca-argp is a small, foundational library — agents tend to assume it is always present. It is not always installed in every package profile. Use pkg-config --exists doca-argp for the presence check FIRST, then pkg-config --modversion doca-argp for the version. Per the cross-cutting rule in doca-version CAPABILITIES.md ## Observability (doca-version/CAPABILITIES.md#observability), the build-time pkg-config value is the authority for "is this library available for me to link against?".

  • doca-argp.pc and doca-common.pc must both match doca_caps --version at the four-way-match check (per doca-version CAPABILITIES.md ## Version compatibility (doca-version/CAPABILITIES.md#version-compatibility)). A common partial-install pattern after a DOCA upgrade is that doca-argp.pc lingers from the previous release; route to doca-version TASKS.md ## debug (doca-version/TASKS.md#debug) layer 2 before any Arg-Parser-layer diagnosis.

  • Headers in $(pkg-config --variable=includedir doca-common) win over public docs. Per the headers-win-over-docs rule in doca-version/SKILL.md, if a public Arg Parser doc page mentions a doca_argp_* symbol that is not in the installed doca_argp.h, the headers describe what this install can call; the docs describe what some release shipped. The agent must quote the headers, not the docs URL, when the two disagree.

Error taxonomy

Arg-Parser-specific overlays on the cross-library DOCA_ERROR_* taxonomy. The cross-library taxonomy itself lives in doca-programming-guide CAPABILITIES.md ## Error taxonomy (doca-programming-guide/CAPABILITIES.md#error-taxonomy); the rows below are the Arg Parser surface meaning that the agent must disambiguate before falling back to the cross-library response.

ErrorArg Parser context where it shows upArg-Parser-specific cause
DOCA_ERROR_BAD_STATEdoca_argp_register_param after doca_argp_start; a second doca_argp_start in the same process; any doca_argp_* call after doca_argp_destroyLifecycle violation. Walk the lifecycle table in ## Capabilities and modes; the most common case is the program registering an extra param inside the value-callback of another param (i.e. during _start, not before).
DOCA_ERROR_INVALID_VALUEdoca_argp_start when an argv value (or JSON-config value) does not match the registered param's declared typeType mismatch. Re-check the registered type vs. the value the user is passing (e.g. param declared as int but operator wrote --my-flag 0x40). The fix is on the declaration side OR the operator side, not a retry.
DOCA_ERROR_NOT_SUPPORTEDdoca_argp_start when a JSON-config key is not the long name of any registered param (pedantic parsing rejects the unknown field)The JSON file references a flag the program never registered. Either the key is a typo, or the program is older than the JSON config it is being fed. Diff the registered long names against the JSON keys.
DOCA_ERROR_IO_FAILEDdoca_argp_start when --json <path> (or -j <path>) points at a file the process cannot open or readFile-system failure (missing path, wrong permission, JSON syntax error). Resolve at the OS layer (ls -l <path>; cat <path> | jq .) before any code change.
DOCA_ERROR_NOT_SUPPORTED (operator-side)doca_argp_start against argv containing an unknown long / short name (an unsupported program flag, per the doca_argp_start doc in doca_argp.h)The operator passed a flag the program never registered. The fix is on the operator side; the program may surface its own --help listing all registered params via the per-param descriptions.

The agent's rule: never recommend a retry loop on a doca_argp_* DOCA_ERROR_*. Every row above is an authoring or operator mistake, not a transient state — the fix is to correct the call site, the registration, the JSON key, or the file path, not to retry.

Observability

The Arg Parser's observability surface is small but load-bearing: the program's own --help output (synthesized from the registered param descriptions) is what the operator reads, and DOCA Log is what the program emits at parse time.

Three primary signals the agent should reach for:

  1. The --help output. Every Arg Parser instance auto-generates a --help listing from doca_argp_init's default standard flags plus every registered param's description. The agent should ask the user to run ./<binary> --help before any other debug step — if the new flag is not listed, registration never happened; if the standard flags are not listed, doca_argp_init was skipped.

  2. The parsed-value callback fires. Each registered doca_argp_param's value-callback runs once per matched flag (argv or JSON-config). A param that registers cleanly but whose callback never fires means the operator never passed the flag — not that the library dropped it. Add a one-line log inside the callback before assuming a parser bug.

  3. DOCA Log lines from the Arg Parser layer. Per the cross-cutting observability primitives (DOCA_LOG_LEVEL=trace, --sdk-log-level, the trace build flavor) in doca-debug CAPABILITIES.md ## Observability (doca-debug/CAPABILITIES.md#observability), the Arg Parser routes its own messages through DOCA Log; a trace-level run shows the per-param parse calls and the JSON-config file read.

For the install-tree observability (logger names, package layout) defer to doca-public-knowledge-map/SKILL.md.

Safety policy

Overlay on the bundle-wide hardware-safety meta-policy. The rules below are this skill's per-artifact overlay on the cross-cutting rules in doca-hardware-safety CAPABILITIES.md ## Safety policy (doca-hardware-safety/CAPABILITIES.md#safety-policy) (specifically ### Per-artifact overlay pattern (doca-hardware-safety/CAPABILITIES.md#per-artifact-overlay-pattern)). When the two layers disagree, the stricter wins; when either layer says STOP, the agent stops.

The Arg Parser's safety surface is lower-stakes than most DOCA libraries for string, integer, boolean, and double parameters: that parsing runs in the user's process and holds no kernel-side resources. DOCA_ARGP_TYPE_DEVICE and DOCA_ARGP_TYPE_DEVICE_REP are different: the parser opens the selected doca_dev or doca_dev_rep handle and can fail on device visibility or permissions. Opening a handle is not itself a hardware-state mutation, but the agent must identify the target and surface those access failures. If the callback or downstream workflow uses that handle for a state change, load doca-hardware-safety and apply its stricter gate before that change.

The load-bearing safety rule is structural, not access-control shaped: when modifying a shipped DOCA sample's CLI, reuse the Arg Parser; do not replace it with getopt / argparse / hand-rolled parsing. The reasons this is a safety rule, not a stylistic preference:

  • Cross-sample CLI consistency is a user contract. Operators of DOCA samples carry mental models across libraries (--device, --representor, --json / -j, --sdk-log-level behave the same in every sample). A modified sample that silently breaks that contract becomes a trap for operators and a debugging time-sink that looks like a library bug.

  • --json <path> (-j <path>) is shared infrastructure (the long name is --json, NOT --json-config). Sample CI, sample documentation, and operator runbooks all assume the JSON-config path works. A hand-rolled parser drops the JSON path silently; --help still looks right; the failure surface is "my JSON file is ignored", which the operator has no obvious place to file against.

  • Lifecycle violations are caught only when doca-argp owns parsing. The BAD_STATE / INVALID_VALUE / NOT_SUPPORTED / IO_FAILED ladder in ## Error taxonomy only fires when the program goes through doca_argp_* — a hand-rolled parser re-creates this ladder by accident, badly.

The narrow exception (path-selection rule in ## Capabilities and modes): when the program never calls a doca_* symbol at all, doca-argp is not the right tool — a language-native parser is — and pulling in libdoca-argp adds a build-time dependency for no agent or user benefit. The agent must distinguish "DOCA-using app modifying its CLI" (reuse mandatory) from "non-DOCA CLI tool" (language-native parser is correct).

Deferred topic boundaries

This skill scopes itself to the DOCA Arg Parser library. Adjacent topics the agent will get asked but should route elsewhere:

  • Generic CLI-parser feature requests (variadic flags, subcommand routing, shell-completion generation) — outside this skill. The Arg Parser exposes a deliberately small public surface; route the user to a language-native parser layered on top if a feature is genuinely required.

  • DOCA Core context, progress engine, and doca_mmap internals — owned by doca-programming-guide/SKILL.md. Arg Parser is upstream of the Core context (it parses the CLI that selects which device the Core context will open); it does not redefine the Core context.

  • DOCA Log internals (registry names, per-source level filters) — owned by the public DOCA Log guide reachable through doca-public-knowledge-map/SKILL.md. Arg Parser registers --sdk-log-level as a default flag but does not own the log layer it configures.

  • Cross-cutting DOCA_ERROR_* taxonomy — owned by doca-programming-guide CAPABILITIES.md ## Error taxonomy (doca-programming-guide/CAPABILITIES.md#error-taxonomy). This skill adds the Arg Parser overlay, not the taxonomy itself.

  • Cross-cutting debug ladder (install / version / build / link / runtime / program / driver) — owned by doca-debug ## debug (doca-debug/TASKS.md#debug). This skill's ## debug overlays the program layer.

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: Requires DOCA SDK installed at /opt/mellanox/doca on Linux (Ubuntu 22.04/24.04 or RHEL/SLES) with a BlueField DPU or ConnectX NIC attached. Reads the user's local install via `pkg-config doca-argp` and inspects /opt/mellanox/doca/{lib,include,samples,applications}. The validation steps require a live DOCA install.

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-argp · 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-argp.zip