Assalaamu 'alaikum
Imam Shafi’i stipulated as the requirements of the mujtahid:
لا يحلّ لأحد أن يفتي في دين الله إلا رجلا عارف بكتاب الله بناسخه ومنسوخه ومحكمه ومتشابهه وتأويله وتنزيله ومكيه ومدنيه وما أريد به, ويكون بعد ذلك بصير بحديث رسول الله صلى الله عليه وسلم وبالناسخ والمنسوخ ويعرف من الحديث ما عرف من القرآن, ويكون بصيرا باللغة بصيرا بالشعر وما يحتاج إليه للسنة القرآن, ويستعمل هذا مع الإنصاف, ويكون بعد هذا مشرفا على اختلاف أهل الأمصار وتكون له قريحة بعد هذا, فإذا كان هذا فله أن يتكلم ويفتي في الحلال والحرام, وإذا لم يكن هكذا, فليس له أن يفتي.
It is not permitted for anyone to give fatwa in the religion of Allah except a man who knows the Book of Allah, what is abrogated of it and what abrogates it, and what is unambiguous and clear and what is ambiguous and unclear, and what is has an explanation other than its literal meaning, and what the circumstances surrounding the revelation of the individual ayats, what was revealed at Makkah and what was revealed at Medinah, and what it means. After that, he must be knowledgeable about the sayings of the Messenger of Allah (on whom be grace and glory from Allah), what is abrogated of it and what abrogates it, and he should know about the hadith what he knows about the Qur’an [that is, the different types of statements of like general and specific and literal and figurative and so on some of which he indicated above and which number twenty in all according to our ulama], and after that he must have mastery of the Arabic language, and be knowledgeable about poetry [the pre-Islamic and early poetry which is authoritative in defining the meaning of the words and expressions used in the Qur’an and hadith] and what is needed [from it ] for the [explanation of the language of] Qur’an and the sunnah, and he should use it [that is, adduce it as reference or authority] impartially. In addition [to the foregoing requirements] he should be apprised of the differences of opinion among the authorities of the different cities; furthermore, he should possess natural genius (qarihah / قريحة). So if that is the case[ that is, if a person possesses the above-mentioned qualifications], he may speak about, and give juridical decision (fatwa) concerning what is lawful and what is unlawful; otherwise, he must not give decisions (fatwa).
Wa salam