new-workspace
The `/new-workspace` command scaffolds a complete ROS 2 colcon workspace with standard directory structure, configuration files, and seed packages. Use it to initialize a new robot project by specifying a workspace path and optional project prefix, which creates src/ directories, .gitignore, README with build instructions, .claude/ configuration, and three foundational packages (interfaces, core, and bringup) in dependency order.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/harunkurtdev/ros2-claude-code-template/HEAD/.claude/commands/new-workspace.md -o ~/.claude/commands/new-workspace.mdnew-workspace.md
Create a brand-new, ready-to-build ROS 2 workspace.
Argument handling (`$ARGUMENTS`):
1. `<workspace_path>` — where to create it (e.g. `~/my_robot_ws`)
(required).
2. `[project_prefix]` — package name prefix (e.g. `acme`). If missing,
derive from the workspace folder name or ask.
If anything is unclear (path already exists, prefix), ask before acting.
Process:
1. Read the `new_ros2_workspace` skill end to end.
2. Verify `<workspace_path>` does not already contain a `src/`.
3. Create the layout: `<ws>/src`, `.gitignore` (build/ install/ log/),
top-level `README.md` with the build/source/test commands; `git init`
(ask first).
4. Copy this template's `.claude/` into the new workspace root so the
slash commands work there (skip if creating inside the template repo).
5. Seed packages in dependency order, delegating to the
`new_ros2_package` skill / `/new-package`:
* `<prefix>_interfaces` (ament_cmake) — only if custom msgs are needed.
* `<prefix>_core` (Clean Architecture, language per user).
* `<prefix>_bringup` (ament_python) — top-level launch/config.
6. Print:
* the tree that was created,
* `cd <ws> && colcon build --symlink-install && source install/setup.bash`,
* the follow-up commands for the project's domain
(`/new-vda5050-connector`, `/new-controller`, `/new-bt-node`, …).
Do **not** run `colcon build` automatically — let the user review first.
Confirm workspace name/path and project prefix before scaffolding.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.
Build the colcon workspace (optionally a single package) and report the outcome.
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.