I was told that while speaking people generally use perfect instead of preterite. Is it also common for modal verbs? Which is used in which cases?
Ich konnte ...
Ich habe gekonnt ...
Well, this question is not that easy to answer. I don't know of any research which states a clear answer to this question.
Anyway. I agree to what has been said in comments: modal verbs are usually used in simple past. But present perfect is not uncommon. You will not only find a lot of examples on the Internet but also hear that in colloquial conversations.
I can't tell if there's any rule of thumb to figure out in which cases one might tend to simple past or present perfect. In many cases both versions are fine:
Ich mochte ihn vom ersten Moment an nicht.
Ich habe ihn vom ersten Moment an nicht gemocht.
Note that in this sentence the modal verb is a full verb. In cases you combine the modal verb with another verb you have to use the infinitive:
Ich musste ihm helfen.
Ich habe ihm helfen müssen.
Again, both sentences are equally fine.
Without any reliable source, I'd say that the present perfect infinitive structure is less often used in comparison to present perfect with a modal verb as full verb, i.e. my first example with mögen is likely said in perfect tense whereas the latter example with müssen is usually given in simple past tense.(*)
But this is just based on my personal impression and others might disagree.
Last but not least a side note to your incomplete example. Adding the unspecific object "es" to your example sentences, both sentences are absolute fine and even quite frequently used.
Ich konnte es.
Ich habe es gekonnt.
But you cannot start a sentence with "Ich habe gekonnt ...", except for "gekonnt" being an adjective.
(*) This is not restricted to the given examples.