build
The build slash command compiles a ROS 2 workspace using colcon, supporting full workspace builds or single-package builds with optional arguments. Use it during development to compile your workspace from its root directory, with automatic symlink installation, RelWithDebInfo build type for CMake packages, and detailed error reporting on build failures.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/harunkurtdev/ros2-claude-code-template/HEAD/.claude/commands/build.md -o ~/.claude/commands/build.mdbuild.md
Build the current ROS 2 workspace from its root (the directory that contains `src/`, `install/`, `build/`, `log/` — if you are in a package subdir, `cd` up until you find that root). Argument handling (`$ARGUMENTS`): * If empty: `colcon build --symlink-install --event-handlers console_cohesion+` * If the first token does **not** start with `-`, treat it as a package name: `colcon build --symlink-install --packages-up-to <pkg> $REST` * If the first token starts with `-`, pass everything through verbatim. Always: * Use `--symlink-install` unless the user passes `--no-symlink`. * Use `RelWithDebInfo` for CMake packages unless overridden: `--cmake-args ' -DCMAKE_BUILD_TYPE=RelWithDebInfo'`. * On failure, show the last ~40 lines of the failing package's `log/latest_build/<pkg>/stderr.log` so the user can see the real error. * On success, remind the user to source the overlay: `source install/setup.bash`. Do **not** wipe `build/`, `install/`, `log/` automatically. If a configure-time problem looks stale, ask whether to clean first.
Scaffold a Behavior Tree leaf node — plain BehaviorTree.CPP (SyncActionNode / StatefulActionNode / ConditionNode) or a BehaviorTree.ROS2 wrapper (RosActionNode / RosServiceNode / RosTopicPubNode / RosTopicSubNode) — with ports, factory/plugin registration, and XML v4 usage. Trigger when the user asks to write a behavior-tree node (not Nav 2-specific).
Use proactively before opening a PR that adds or changes BehaviorTree.CPP nodes or BehaviorTree.ROS2 wrappers (RosActionNode/RosServiceNode/RosTopicPub/SubNode, TreeExecutionServer). Reviews a diff against BT.CPP v4 conventions — node base-class choice, non-blocking ticks, ports/blackboard typing, factory/plugin registration, XML v4, and the ROS 2 wrapper contract. Returns a punch list with file:line anchors, not a rewrite.
Use when a design decision touches Clean Architecture boundaries in a ROS 2 project — which layer a new behaviour belongs to, whether a port belongs in domain or application, whether a new node should be lifecycle-managed, whether to compose nodes or split packages. Returns an architectural recommendation with trade-offs, not implementation.
Author a new skill under .claude/skills/<name>/SKILL.md with valid frontmatter, following the template conventions, and index it in CLAUDE.md + README.md.
Use when a design decision touches the gz-sim ECS — where new state should live, which system phase should write it, how to avoid coupling, whether to add a component vs. a member variable, whether a new system should be split or merged with an existing one. Returns an architectural recommendation with trade-offs, not implementation.
Author a new asset for this .claude/ template — a rule, skill, slash command, or sub-agent — following the project's conventions and wiring it into the CLAUDE.md / README.md indexes. Trigger when the user wants to add or extend a command, skill, agent, or rule (make the template itself extensible).
Configure and build gz-sim from source using either CMake/Ninja directly or a colcon workspace. Trigger when the user asks to build, recompile, configure, or set up the gz-sim binary tree.
Summarize commits on the current branch (vs origin/main) into a Changelog-style bullet list ready to paste into Changelog.md.