Fishtown Analytics has a good set of recommendations I think we should all read through and consider: https://github.com/fishtown-analytics/corp/blob/master/dbt_coding_conventions.md
The article has advice for organizing refs and CTEs.
Here's a quote I particularly like from the article:
DO NOT OPTIMIZE FOR A SMALLER NUMBER OF LINES OF CODE. NEWLINES ARE CHEAP, BRAIN TIME IS EXPENSIVE