Know what you want to accomplish, but take some time to break the problem down into smaller problems. Behavior Driven Development (BDD) and to a lesser extent, Test Driven Development (TDD) can help with thinking about likely input and desired output and help you avoid tight coupling and side-effects.
Don't start from scratch if you don't have to. Look for a reposity manager which has packages that other people have written and actively develop and maintain.
- Node and Javascript: npm via https://www.npmjs.com/
- Python: pip via https://pypi.org/
- Java and Scala: maven via https://mvnrepository.com/
- .NET: https://www.nuget.org/
- MacOS: https://brew.sh/
- Windows: https://chocolatey.org/
- (Almost) Everything: https://libraries.io/
Look at number of downloads, how aften it is updated, how long it has been around, Github stars and so on to see if it likely to be actively maintained. Otherwise you might need to fork the reposity on Github and maintain it yourself at some point.