Before his compositions were rediscovered, JS Bach was not known as a composer (as CPE Bach was) but as one of the foremost improvisers and performers of his time.
What is known about JS Bach's improvisational technique?
Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
At that time, improvisation was a common practice. Actually, when keyboard instruments started to be used, its music was not even written. Everything was improvised. Keyboard music started as accompaniment for choirs, etc. Therefore, the keyboard performer would often rely on a voice score or whatever and improvise a second voice or whatever from that. When they started to notate music for keyboard, they didn't have a proper way to do it.
This feels like ancient ages to us, but for Bach it was not that far away. Bach and his contemporaries come from that tradition. Bach was probably able to improvise the kind of music that he wrote, since composition and performance was not detached as it is today. Bach would probably be able to improvise a little invention on the clavichord, or a complete fugue on the organ, or a continuo accompaniment for a soloist, a Choral preludium from a Choral, also transpose an accompaniment for a singer... He would probably improvise pretty much the same kind of stuff that he wrote on paper, only that, perhaps, without the formal strictness and complexity of the written works. In fact, many works or parts of works written by Bach may come from improvisations that he later wrote down and elaborated.
As a latecomer to this discussion I would like to share some of my own experience and discoveries on my journey as an organ improviser. If composing can be compared to the authoring of a piece of literature such as a novel or poem, improvising is more akin to conversation or an off-the-cuff speech. The first principle is to acquire the musical language -in this case - of J.S.Bach in the same way that he studied the musical language of Vivaldi, Buxtehude and others. Bach's Preludes and Toccatas provide excellent examples of figuration that you can try over simple chord progressions of, say up to eight bars long. It also helps to be able to do this in all major and minor keys. Try clothing a hymn or chorale in the same way with a toccata figure. This is only for starters. Don't forget that Bach is now seen as one of the greatest of Baroque musicians. If your efforts are even vaguely recognisable as being derived from Bach's style your are doing well. Good luck! - Wilmarc
We may not know from recordings how JS Bach improvised but we can make some guesses. Bach played the organ in churches and so we might rightfully guess that the current practice of European church organists had its origin in the corpus of practice of Bach's time. I've answered this possible practice here:
Does improvisation in the classical idiom differ significantly from jazz and folk improvisation?