This post by Martin Fowler describes his approach to integrating refactoring into the software development lifecycle. The short version, borrowed from Robert Martin, is to "always leave the code behind in a better state than you found it". Another way I like to think about it is that you can approach a new feature by thinking about what changes you would need to make to your architecture to make the new feature trivial. You make those changes, and then implement the trivial feature. The result is that you regularly exercise the flexibility of your code base, making change easier.