Knockout was designed with the Model-View-ViewModel (MVVM) pattern in mind. While it is possible to develop applications using Knockout and other design patterns, sticking to MVVM will produce a natural alignment between Knockout and your own code.
The separation of concerns is the key here. Don't introduce view concepts such as DOM elements or CSS classes into your viewmodel; these belong in the HTML. Limit or avoid business logic and inline binding functions in your view; these belong as properties or functions in your viewmodel. Keeping these two separated makes it possible for the work to be divided and parallelized, allows the viewmodel to be reusable, and makes it possible to unit test the viewmodel.