Why am I wasting time here at 3:00 AM when I should be deliver my work tomorrow? ??
I just can't get in the freaking flow.
So I said the most important thing is to focus on the user facing things the most.
Things that impact the users the most.
We should ensure everything the user expects and our site/app promises to do, actually works; and it works flawlessly.
We need to provide the content and the actions around that content:
<body> <header> <nav> <a href="/home">Home</a> <a href="/contact">Contact</a> ... </nav> </header> <article> <h1>Article Title</h1> <div>Article content...</div> <a href="/edit/123">Edit</a> <a href="/delete/123">Delete</a> </article> </body>
We need to register and implement handlers for every possible action the user might take, whether it's the events in the browser, or the http requests in the server.
In short, user wants to do his desired action and get immediate feedback. That's all we need to do. We can worry about code cleaning and optimization later, after we've implemented a good portion of the required features.
So just drafting a recipe to quickly get into the flow:
This is it. Now you have a new feature or bug fix that makes both your client and your users more happy than before. It's time to go back to step 1 and repeat until you realize than you've did enough real work and provided enough value, to start optimizing your code a bit to make your life easier as a developer and code maintainer.