"thinking ability" you can say.
The phrase you want to avoid is "of thinking" as in "ability of thinking".
"of doing" is an odd phrasing. Forget about using it.
Indeed, there are Rules Fred Q, and too many to apply to English Speech and Writing by the practice of memorizing all the Rules and then applying them.
That is why that I recommend to students of English that they study some simple English sentence constructions and phrases as are found in simple Nursery Rhymes and Songs.
Many of these are provided for students in my "Notebook" entries.
First, you must develop the habit of repeating English phrases and sentences in simple form, then you can repeat them from memory. This is how American children, for example, learn English.
I know that in some foreign countries, the prevailing assumption is that English consists of Grammatical Rules. That is an errant assumption. The Rules of Grammar were not developed for English until the scholars gathered to translate the King James Bible, published in England in 1611. Prior to that, people constructed English sentences without knowledge of Grammatical Rules at all.
However, if you want to learn all the rules of English Grammar as a means of acquiring English, all I can say is good luck to you.