new-component

Scaffolds gz-sim ECS component headers with CMake wiring and ComponentFactory registration.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/three1324/yeonjinautomotive --skill new-component-three1324
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-component
Source: https://github.com/three1324/yeonjinautomotive/tree/main/.claude/skills/new-component
Command: npx skills add https://github.com/three1324/yeonjinautomotive --skill new-component-three1324

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding a new component to gz-sim involves several easy-to-miss steps: creating a header-only wrapper around the Component template, choosing a unique tag class, deciding on serialization, registering with ComponentFactory, and updating the CMake header list. This Skill walks through each decision and provides copy-ready templates so nothing is forgotten. ## Core Features & Use Cases - Decision checklist: Guides the choice of data type, whether serialization is needed, and whether Cmd/Reset companion components are required. - Header templates: Provides ready-to-adapt C++ templates for both plain components and components with custom serializers using gz::msgs types. - Build and test plumbing: Covers adding the header to include/gz/sim/components/CMakeLists.txt, writing component tests, and updating Migration.md for public API changes. - Use Case: When implementing a new physics feature that needs per-entity state, use this Skill to generate the component header, register it for logging and replay, and wire it into the build correctly on the first attempt. ## Quick Start Ask the assistant to add a new gz-sim component that stores a double value and needs to be logged and replayed.

Frequently Asked Questions about new-component

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new component in gz-sim?

Create a header in include/gz/sim/components/ defining a Component<T, Tag> alias with a unique tag class, add GZ_SIM_REGISTER_COMPONENT if it needs serialization, and list the header in the components CMakeLists.txt so it gets installed.

How to register a gz-sim component for serialization and replay?

Use the GZ_SIM_REGISTER_COMPONENT macro with a unique string name and the component type. For custom data types, also define a Serializer<T> with Serialize and Deserialize methods and pass it as the third template argument to Component.

Why do gz-sim components need a unique tag class?

The tag class distinguishes components that share the same underlying data type. Two components declared with the same tag collapse into a single component type, so reusing an existing tag silently merges distinct data fields.

When should a gz-sim component have Cmd and Reset variants?

Add Cmd and Reset variants when the component represents physical state that physics writes. The Cmd component carries user-to-physics commands, while the Reset component stores a snapshot used by the Reset() mechanism.

Does a new gz-sim component need a dedicated test?

Trivial typedef components do not need their own test. Add a Foo_TEST.cc under src/components only for non-trivial behavior like operator== or a custom serializer, and a round-trip test if the component is logged or replayed.