Trial and error. That's like the only way to learn anything that doesn't have a tutorial (note: this is a piece of advice not only for coding, but for life overall).
For Essentials (and for other things like sports or writing or arts), start small, make small edits, and as your confidence and knowledge grow, you will be able to do bigger projects.
I suggest you start with new items / abilities / moves. These are the easy things that require few edits, and are easy to test debug, and revert. But they will still allow you to get familiar with how the battles work.
Don't worry to much about making a clean code, for now just worry about making a code that works.
Making a Pokémon not leave the party is part of the easy things to do. I suggest you look at the function pbStorePokemon, and study how it's used in Essentials. Maybe it's not this function that you'll have to change, maybe it's one of its dependencies, but it's a starting point.
Whatever you do, backup your code before edits. Imagine you break something: you're screwed.