Takeaways of integrating GenAI into my daily work
I recall my first moments interacting with ChatGPT… like many others, I was amazed and immediately shared it with my peers.
Shortly after its release, however, “prompt engineering” became a thing and my reaction was:
Really? Are we going there now?
More than ever, I found myself skeptical and more recently, I had a similar reaction when I heard about “vibe coding”.
Vibe coding represents a new trend in software development where developers use plain language (often voice) to guide their programming process. While some see it as simply letting AI tools generate code through iterative prompting, there’s more nuance to using it effectively.
I decided to give it a real shot and take the integration of GenAI in my daily work to the next level. I found some more formalized resources on using GenAI for software engineering and spent some time coding more intensively with AI assistance, writing prompts and building applications.
To my surprise, it works much better than expected - particularly in generating boilerplate code, suggesting design patterns, and helping with documentation. It will change the way I develop for sure. In this post, I’ll share my three main takeaways on effectively integrating GenAI into a professional development workflow, focusing on practical strategies that maintain code quality while leveraging AI’s capabilities.
Be very specific about what you want
When working with GenAI, clarity is your best friend. Instead of asking for “write some code to handle this” specify exactly what you need. This precision leads to more accurate and useful responses.
Typically, I’ll ask the LLM to write some code and specify:
- the frameworks I’m using as a constraint
- input contents / formats and expected output and format
- design paradigm to implement in
- any potential edge cases that should be considered
- additional code for logging, error handling, etc.
- coding style and guideline for variable names, functions etc.
For example, here’s a basic prompt that will give you some output:
Write me some template code for a training a sklearn model
You will definitely get some useful output. But now, imagine using this more detailed prompt:
Write some code to train a sklearn model.
- Your code should start from a dataframe with the following columns: feature_1, feature_2, feature_3 and target.
- The target is a binary variable.
- Feature 1 is numeric
- Feature 2 is a binary variable
- Feature 3 is a categorical variable with 10 categories
- The code should include a train_test_split with 20% of the data for testing.
- Use sklearn’s pipeline feature
- Feature transformations:
- Standard scaling for numeric features
- One-hot encoding for binary features
- For categorical features, top 3 most frequent categories are kept, all others are grouped into “other”
- Selected model for classification: Logistic regression
Needless to say, the second prompt is likely to be much more useful and will save you significant time in iterations or debugging.
Unless you don’t know - then brainstorm
Sometimes you don’t have a specific idea about what you want. In that case, use GenAI as a brainstorming partner to explore different approaches, design patterns, or framework choices. Let it suggest multiple solutions, then evaluate them based on your specific needs. This collaborative approach can help you discover better solutions than you might have considered on your own.
For example, you can ask:
My codebase contains duplicate code for summarizing multiple types of dataframes (polars, pandas, spark, duckdb, …). Currently, I have functions for each separate framework that creates a dataframe summary, a json output. Ideally I would have deduplicated code, just one function that works with all frameworks and ensures consistent output format across frameworks.
Suggest some improved design possibilities with pros and cons that will limit the duplication in code.
As a result, the LLM returns code snippets and pros and cons of the different approaches. Based on iterations and thorough analysis, chances are you will find improved solutions for your problem and most importantly, learn from it.
One of the pitfalls here is that the LLM will return what you are asking for. So before blindly going into iterations, ask yourself “am I asking for the right question?”. In the example above, the LLM was quite eager to suggest following solutions:
- Abstract Factory Pattern with Framework-Specific Implementations
- Strategy Pattern with Common Interface
- Adapter Pattern for Framework Compatibility
- Factory Method for Creating Appropriate Summarizer
However, maybe, a better solution could be the codebase to use a single library rather than having code for each framework. This is not something the LLM will come up with and is something you need to know. The key is to use the LLM’s suggestions as a starting point for deeper architectural thinking.
Delegate the boring stuff
Let GenAI handle the repetitive tasks that don’t require extensive thinking.
Generate boilerplate code
Create module skeletons, class templates, and common code patterns. This works especially well for very popular libraries. For instance, I’ve had excellent results with creating ML code for scikit-learn, REST APIs with Flask and FastAPI, and webapps with streamlit.
Write documentation
Add descriptive inline comments about what the code does to even more structured module documentation in standardised frameworks departing from just the code.
Create tests
Generate both test code and test data, particularly effective for unit tests where requirements are well-defined. Integration and system tests still need more human touch.
Refactoring
Restructure code like converting notebooks to modules, extracting functions, or improving code organization. It’s especially helpful when migrating code between different versions of libraries or frameworks.
Conclusion
The key is finding the right balance between leveraging AI’s capabilities and maintaining human expertise where it matters most. As we move forward, the integration of GenAI in our daily work will be a key skill for developers, in addition, knowing when to use it and when not to will be as important as ever.