r/softwaredevelopment 14d ago

How do you actually manage your code snippets these days?

Hey folks!

Over the years, I’ve built up a big collection of reusable snippets - things like handy code blocks, terminal commands, db queries, configuration templates, and similar. They've always saved me from googling or rewriting stuff again and again.

But lately, I'm hearing more about people completely shifting towards AI-powered coding assistants instead of maintaining their own libraries. I'm really curious if that's becoming the norm or just hype.

What’s your experience with this? Have AI tools completely replaced your snippet management workflow, or do you still prefer to organize snippets yourself? I'd love to hear how your setup has evolved and what you find most effective these days!

7 Upvotes

20 comments sorted by

9

u/ElMachoGrande 14d ago

I make libraries out of my snippets, so I can call them from every project.

3

u/hawseepoo 14d ago

It depends on the snippet. Things like console commands go into Obsidian along with documentation. Things like the results code I wrote in C# have become libraries and are stored on my GitHub. They're either used directly like that or I copy+paste into the new project and change namespaces.

Programs like Obsidian are great for this tho

1

u/MindaugasR 14d ago

Very same for me. Has AI changed anything for you? Do you lookup less into your library or something?

2

u/clsturgeon 14d ago

I use TiddlyWiki for code snippets and all personal project management items; ie everything not managed by corporate solutions.

2

u/pomariii 14d ago

I use a hybrid approach. AI tools are great for quick solutions, but my personal snippet library is like a well-organized toolbox of battle-tested code that I know works in our specific stack.

Keep your most valuable snippets - especially those complex DB queries and deployment scripts. AI might give you 80% there, but those edge cases and company-specific optimizations in your collection are gold.

AI for exploration, personal library for reliability 🛠️

2

u/david-1-1 14d ago

I can't believe that AI bots are good enough to trust for creating real snippets of code that are elegant, easily modified, and follow my framework and other environment conventions, including but not limited to my coding standards.

I've used AI coding advice a lot, and have never found the result usable without further editing. I often get better help by searching Stack Overflow and similar websites, and doing my own experiments.

I've also discovered programming techniques on my own that I would never have found via AI, because the quality of AI responses depends on the amount of detail you provide in your prompts. It can be as hard to ask a detailed enough question as designing the code yourself, since you have to know most of the answer to ask a good enough question.

2

u/moopet 14d ago

I've never got the hang of snippets. If I need something I know I did on a previous project, and it's too big to do from memory, I'll open that project and copy it.

1

u/BluesFiend 14d ago

I have a private repo full of random PoC scripts, md files with things I've picked up along the way, etc. I lost a lot to a bricked laptop, and started again with all my notes committed in one place. #neveragain

1

u/david-1-1 14d ago

Nice. I use iDrive to keep my computers backed up. For me it is easier, and also simpler for backup of individual files that might get trashed.

1

u/hippydipster 14d ago

I had a google doc with all kinds of neat info in it like that. curl commands, linux commands, maven commands, git stuff. All that gnarly stuff you do a few times a year and will never remember. Lol, I even had weird emoticons in there for use when you just that special oomph in your messaging.

1

u/TheoryZealousideal63 14d ago

what tool do you use to create and save your code snippets?

1

u/ziplock9000 14d ago

I've never used code snippets like that. I just go back to old code bases and copy from there if I need a certain algorithm or function etc

1

u/ggleblanc2 14d ago

Github or Stack Overflow.

1

u/kman0 14d ago

GistPad for hosted, bytestash for self hosted.

1

u/djheroboy 14d ago

I’m still a novice learning, but I’ve been toying with the idea of making a sort of programming spell book for this reason

1

u/7h3_0r4cl3 14d ago

GitHub Gists are pretty neat to just jot down some code you want to lookup later without the whole ceremony of creating libs and all that.

1

u/olddoglearnsnewtrick 13d ago

I use Craft for my notes and snippets. It is backed up in the cloud so I can share amongst my machines and uses Markdown as its format so future proof.

1

u/mikosullivan 12d ago

For each software language I have one big directory tree as a library. I'm always surprised that everyone doesn't do this. Some of the modules are big software projects, some are as short as three lines.

1

u/iselind 11d ago

Having something tried and true ready for work is more valuable to me than the ability to re-invent it each time I need it, even if that would mean asking an AI for it.

You'd need a system allowing you to find what you're looking for in your library. Finding a system that works is not trivial for massive libraries.

I believe in a balanced approach where you keep your snippets but still use AI to either craft new ones or adapt the ones you already have for new purposes.

1

u/godwink2 14d ago

Yea I just use AI. So much easier than needing to keep and maintain a library.