Implement RAII patterns

Implement RAII patterns in C++ — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
A game object needs to maintain a texture handle and must free it when the object is destroyed, but…
A game object needs to maintain a texture handle and must free it when the object is destroyed, but game code currently leaks textures when exceptions occur during initialization. Implement an RAII wrapper that acquires the texture in its constructor and releases it in the destructor, and replace existing manual acquire/release calls so texture lifetime is exception-safe. Verify with a fail-in-constructor test.

Improve — make it easier to accept

+
Before I push the RAII wrapper for texture handles, make review simple: show a minimal example of…
Before I push the RAII wrapper for texture handles, make review simple: show a minimal example of acquiring a texture with the wrapper and how it behaves when an exception is thrown during object construction, include the destructor’s single responsibility comment, and mark places where manual calls must be removed. Flag any API changes that will require small call-site edits.

Decide — diagnose the stuck moment

+
A level loader threw halfway through creating actors and several textures leaked. I suspect manual…

Textures leaked when an exception was thrown during object setup.

A level loader threw halfway through creating actors and several textures leaked. I suspect manual release calls are scattered and not exception-safe. I don’t know which constructors might throw or which call sites depend on the old manual lifetime. Advise whether I should introduce a lightweight RAII handle class and replace all manual calls in one pass, or wrap constructors with try/catch and clean up on error. Which minimizes risk and how to implement the chosen patch safely?

Become — change the pattern

+
Over multiple modules, resource leaks happen whenever constructors throw because we rely on manual…

We repeatedly leak resources when exceptions interrupt initialization.

Over multiple modules, resource leaks happen whenever constructors throw because we rely on manual release across many call sites. Where are we losing time and credibility, and what habit should we change? Recommend adopting RAII as a default for all external resources, require constructors to either complete or be noexcept with clear cleanup, and provide a short migration plan and a lint rule to flag manual release patterns.

Next to this one

Other programming language work people do in C++.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.