Skip to main content
ClaudeWave
EN, English
Slash Command215 repo starsupdated 4mo ago

test

This command runs colcon tests for a ROS 2 workspace, either across all packages or filtered to a single package with optional pytest or gtest filters. It parses test results to display pass, fail, and skip counts with elapsed time, lists the first three failures when applicable, and offers quick remediation options including re-running with verbose output or launching tests directly in pytest or gtest. Use it to validate workspace builds and isolate failing tests during development.

Install in Claude Code
Copy
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/harunkurtdev/ros2-claude-code-template/HEAD/.claude/commands/test.md -o ~/.claude/commands/test.md
Then start a new Claude Code session; the slash command loads automatically.

test.md

Run tests in the current ROS 2 workspace.

Argument handling (`$ARGUMENTS`):
* Empty → `colcon test --event-handlers console_cohesion+`
* First token = package name →
  `colcon test --packages-select <pkg> --event-handlers console_direct+`
  followed by `colcon test-result --verbose --test-result-base build/<pkg>`.
* If a pytest filter (`-k ...`) or gtest filter is given as the second
  argument, pass it via `--pytest-args` / `--ctest-args` accordingly.

After every run:
1. `colcon test-result --all` and parse the summary.
2. Print a one-liner like
   `"148 passed, 0 failed, 2 skipped (12m13s) — see log/latest_test/"`.
3. On any failure, list the first 3 failing test IDs and offer to:
   * Re-run with `--event-handlers console_direct+` for full output.
   * Drop into pytest directly:
     `pytest src/<pkg>/test/test_foo.py -k 'name'`.
   * Drop into gtest binary directly:
     `./build/<pkg>/test_foo --gtest_filter='Bar.*' --gtest_repeat=5`.

Never claim "tests pass" without showing counts and `colcon test`'s
exit code. If linting / formatting tests were skipped, mention it.
behaviortree_node_creationSkill

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).

behaviortree-reviewerSubagent

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.

buildSlash Command

Build the colcon workspace (optionally a single package) and report the outcome.

clean-arch-architectSubagent

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.

commandsSkill

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.

ecs-architectSubagent

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.

extending_claude_configSkill

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).

gz-buildSkill

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.