From hpx-dev
Generates the complete scaffolding (C++ source, header, `bind.cpp` registration, CMake update, Python wrapper package, tests, and optional benchmarks) for a new HPX algorithm binding in HPyX. Use when the user asks to "add a new binding", "scaffold a binding", "create an HPX wrapper", "add hpx::for_each binding", "add hpx::reduce binding", "wrap a new HPX algorithm", "add a new HPX feature to HPyX", or provides a specific HPX feature name and wants end-to-end scaffolding.
How this skill is triggered — by the user, by Claude, or both
Slash command
/hpx-dev:add-bindingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Determine which HPX C++ API to wrap. If the user provided a feature name, look it up in the HPX source:
Determine which HPX C++ API to wrap. If the user provided a feature name, look it up in the HPX source:
vendor/hpx/libs/core/algorithms/ — Parallel algorithms (for_each, reduce, sort, etc.)
vendor/hpx/libs/core/futures/ — Future combinators (when_all, when_any)
vendor/hpx/libs/core/synchronization/ — Synchronization primitives (latch, barrier)
Search for the HPX header and understand the C++ API signature, template parameters, and execution policy support.
Checklist:
Create src/<feature_name>.cpp with:
#include <nanobind/nanobind.h>
// Include appropriate HPX and Nanobind headers
#include <hpx/algorithm.hpp>
namespace nb = nanobind;
namespace <feature_name> {
// Implementation following HPyX patterns:
// - Pure C++ operations: no GIL management needed
// - Python callbacks: use nb::gil_scoped_acquire
// - Return futures: use hpx::launch::deferred pattern
} // namespace <feature_name>
Create src/<feature_name>.hpp with declarations.
Add to src/bind.cpp:
#include "<feature_name>.hpp" at the topm.def(...) calls inside NB_MODULE(_core, m) blockAdd src/<feature_name>.cpp to the nanobind_add_module() call. If the feature requires additional HPX components, add them to target_link_libraries.
Validation checkpoint: run pixi run build and verify _core.so compiles before proceeding to the Python wrapper.
Create the Python package:
src/hpyx/<feature_name>/
├── __init__.py # Re-exports the public API
└── _<feature_name>.py # Implementation with type hints and docstrings
The Python wrapper should:
hpyx._coreNotImplementedError for unimplemented execution policiesUpdate src/hpyx/__init__.py to import and export the new module.
Create tests/test_<feature_name>.py with:
Validation checkpoint: run pixi run test tests/test_<feature_name>.py and confirm all tests pass before committing.
Create benchmarks/test_bench_<feature_name>.py with:
After scaffolding, verify all files are created:
src/<feature_name>.cpp — C++ implementationsrc/<feature_name>.hpp — C++ headersrc/bind.cpp — Updated with new bindingsCMakeLists.txt — Updated with new source filesrc/hpyx/<feature_name>/__init__.py — Python packagesrc/hpyx/<feature_name>/_<feature_name>.py — Python wrappersrc/hpyx/__init__.py — Updated exportstests/test_<feature_name>.py — Test suitebenchmarks/test_bench_<feature_name>.py — Benchmarks (optional)Study these existing files as templates:
src/algorithms.cpp (dot1d)src/futures.cpp (hpx_async)src/bind.cpp (bind_hpx_future)src/hpyx/futures/_submit.pybenchmarks/test_bench_hpx_linalg.pyProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
npx claudepluginhub uw-ssec/hpyx --plugin hpx-dev