IMO Maintainable code relies on 2 things: Readbility and Documentation.
How these are achieved is the matter of entire libraries worth of books, and everyone has a different opinion. Style guides are nice, but it is perfectly possible to follow every single rule in a style guide, and still write unmaintainable spaghetti-code, because readbility goes beyond what code and comments look like.
It is easily as (if not more) important, how code is organised. I suggest watching https://www.youtube.com/watch?v=5ZKvwuZSiyc for a good example.
So unfortunately, I do not know a simple answer to your question, I can only tell you what worked for me so far:
1. Try the simple solution first
2. Beware of premature optimization and do not optimize until performance was measured
3. Write Documentation while/before the implementation. At the very least keep a "dev-diary" outlining the code in broad strokes.
4. Beware of premature imposition of structure. Build a few parts that fit together, and impose structure (modules, classes) when it becomes apparent that they are justified.
5. Name things well. Not every variable needs to be `ThingOfThingAggragatorWallabaloogaMessengerFactory", and neither should there be a global named `f_zT`. If it has local scope and is obvious from context, single-letter names are okay.
6. It matters less what style is used, as long as it is used consistently (usually within a team)
7. Avoid tiny dependencies. I don't need a library for something I can write at 3AM with no coffee in my system (left-pad anyone?)
Those are some of the rules I try to adhere to. Not all of them will work in every scenario, none of them are set in stone. As outlined above, maintainability in code is a tricky and unsolved topic.