One way we can write better shared code is to make the "shape" of the code communicate how it is intended to be used.
In C++, this can be as simple as having proper const-correctness or declaring the correct mix of copy, move, and assignment operations for your class.
But there's a principle I like to call "implicit code contract" that you can apply throughout your code that will make it a lot more usable and maintainable (remember that "someone else using my code" could be you in two years).