The title question is very broad, varied, and difficult. It depends.
For anything that is not a small script or small, obvious and obviously scoped takes, you can't assess at first glance.
So for a project/task/extension like you wrote it's a matter of:
Is there docs or guide specifically for what I want to do/add? If yes, the expectation is it is viable and reasonably doable with low risk.
If there is no guide the assessment is already an exploration and analysis. How is the project structured, is there docs for it or my concerns, where do I expect it as to go and what does it have to touch, what's the risks of issues and unknown difficulties and efforts. The next step would already be prototyping, and then implementing. Both of which can be started with a "let's see" and timebox approach where you remain mindful of when known or invested effort or risk increases and you can stop or rethink.