Need Informations about code reviewing for XSS

Hello everyone, i was working on multiple XSS labs on HTB Academy and portswigger academy and i was wondering how i can improve my " code reviewing skills " to find XSS. Because i saw payloads like this one :


And i was wondering how you can find this type of thing manually, how i can learn to craft efficient payloads by hand :slight_smile: ( in any programming languages )

Thanks to anyone who can help me to understand more about this ^^