Codex Review C++ Resource Ownership with RAII
Use modern C++ ownership types to clarify local lifetimes and verify small changes with existing tests.
中文Install in Codex
Use a local C++17 or newer project, its build command, and tests around the affected function.
- Copy the pinned `docs/ja-JP/skills/cpp-coding-standards/` directory into `.agents/skills/cpp-coding-standards/` in the project.
- Identify the class and resource lifetime in Codex and ask it to distinguish owning references from borrowed access.
Example task
Review a buffer owned only by a local `ReportBuffer`. Propose a small move to `std::unique_ptr` and check the existing error path.What to check
The ownership is explicit, scope exit destroys the owned object on failure, and tests preserve visible behavior.
Original SKILL.md on GitHub · Updated
Frequently asked question
When is `std::shared_ptr` appropriate?
Use shared ownership when several independent owners really share the lifetime. Start by identifying who is responsible for release.