The way I want to go about writing code is by building up a library of things I've done before and copying the things I've done before into new projects. The most straightforward way to do this is to look through your own previous source repos.
I am kinda badly fucked on doing this by the fact that Bitbucket banned all my repos for the crime of using hg circa 2020, and then this year I started moving the repos I had just finished moving to github to codeberg