This is a starting page for all relevant KWin documentation, most of which is stored in SVN or on external WWW pages.
Refer to the KWin section of the KDE Community Wiki.
The libkdecorations library shipped with KWin allows developing new third-party window decorations in C++.
A simpler (but less powerful) alternative is to create a theme for one of the existing themable decorations:
The libkwineffects library shipped with KWin allows developing new KWin compositing effects (known as "desktop effects" to users) in C++.
KWin's default Alt + Tab window switcher can be customized with new layouts written in QML.