lint
The lint command runs ROS 2 code quality checks across a workspace using pre-commit hooks and ament linters including uncrustify, cpplint, flake8, pep257, xmllint, and copyright validation. Use it to enforce coding standards on changed files, all files, or a specific file list before committing code to maintain consistency across C++, Python, and XML source files.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/harunkurtdev/ros2-claude-code-template/HEAD/.claude/commands/lint.md -o ~/.claude/commands/lint.mdlint.md
Lint the workspace. Argument handling (`$ARGUMENTS`): * Empty → only changed-vs-main: `pre-commit run --from-ref origin/main --to-ref HEAD` * `--all` → `pre-commit run --all-files` * Else treat as a space-separated file list: `pre-commit run --files $ARGUMENTS` For ament-specific checks (when `pre-commit` is not configured for a package), run the relevant tools directly: | File kind | Command | |-----------|---------| | C++ | `ament_uncrustify --reformat <files>` then `ament_cpplint <files>` | | Python | `ament_flake8 <files>` then `ament_pep257 <files>` | | XML / launch / package.xml | `ament_xmllint <files>` | | Any source| `ament_copyright <files>` | Rules: * Never pass `--no-verify` or `--no-ament-copyright`. If a hook fails, fix the root cause. * If a formatter auto-fixed a file, tell the user explicitly so they can stage the change. * For C++ packages with a compile DB, also offer to run: `clang-tidy -p build/<pkg> <files>`. End with a one-line summary: `"3 files, 0 issues, 2 auto-fixed"`.
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.