LLMs are extremely helpful instruments, particularly for programmers. I actually use LLMs each single day, and may’t think about a world with out them. Nevertheless, there are a number of explicit methods you may make the most of to attain even larger outcomes with LLMs.
I’ve lined a number of completely different methods in earlier articles, resembling:
- Utilizing Slash instructions
- Using plan mode
- Repeatedly updating brokers.md
On this article, I’ll cowl how one can leverage few-shot prompting to have your LLMs carry out even higher.
Why use few-shot prompting
Firstly, I need to cowl why it is best to make the most of few-shot prompting. Few-shot prompting is extremely helpful as a result of it permits you to present the LLM your intent with out having to explicitly write the intent out in your immediate.
For instance, let’s say you need a web site finished in a selected manner, much like a earlier web site you made. And with out few-shot prompting, you might attempt to describe the earlier web site you need replicated and have the LLM create that new web site. Nevertheless, this may seemingly result in a number of ambiguity in your immediate, the place the LLM has to make some assumptions. Thus, you’ll seemingly not obtain the outcome you’re on the lookout for.
If as a substitute you present the LLM with the precise codebase, or a minimum of some screenshots of your earlier web site, and easily ask it to copy the web site, you’ll obtain significantly better outcomes. This primarily removes all ambiguity out of your immediate and helps the LLM obtain a lot larger outcomes.
I’m arguing for the truth that it is best to use this few-shot prompting approach in the whole lot you do. So long as it’s not the primary time you’re engaged on a process, all the time consult with a few of your earlier work for the way the LLM ought to do one thing. For instance:
- Making advertising and marketing materials? -> present the LLM your earlier work
- Including a brand new function to your app? -> present the LLM your earlier options
- Creating new slash instructions? -> present the LLM the way you structured your earlier slash instructions
I virtually assure you that by referring to your earlier work and displaying the LLM tips on how to do one thing not solely within the immediate, however in precise implementation, you’ll obtain a lot larger outcomes.

implement few-shot prompting
Now I need to talk about tips on how to implement few-shot prompting. Few-shot prompting isn’t one thing you may all the time implement. Some duties are merely new, and it’s very laborious to make the most of or leverage earlier work that you just’ve finished as a result of the brand new work merely isn’t comparable sufficient.
That is utterly effective and one thing it is best to settle for. Nevertheless, it is best to all the time search for alternatives to leverage few-shot prompting. Firstly, I’ll talk about how it is best to set up your work to extend the floor space for few-shot prompting alternatives, and I’ll then present you tips on how to do few-shot prompting in observe, utilizing examples.
Additionally, take a look at my article Get the Most out of Claude Code!
Organizing your work
Firstly, it’s vital that you just set up all of your work in accessible folders in your laptop. Personally, I retailer virtually the whole lot I do inside a programming principal folder. I then have a folder construction of the code repositories I’m usually working in. One other folder consisting of some private initiatives I’m accessing typically. One other folder with the advertising and marketing materials I’m engaged on, resembling LinkedIn posts and short-form movies, and one other folder for all the displays I’m holding on AI.
Now, each time I begin a brand new process, my first job is all the time to determine which folder this work belongs to. On the whole, organizing work like that is simply common laptop organizing hygiene. Nevertheless, being organized like this makes it a lot easier to make the most of few-shot prompting sooner or later. I simply all the time advocate spending a while determining the place your work belongs to start with so that you could make the most of it on a later event.
Moreover, it is best to all the time be committing your work to GitHub. The explanation for that is that it permits you to retailer all of your progress and offers you with a model historical past. So if one thing occurs to your laptop, otherwise you make modifications you need to revert, you may simply revert them utilizing Git.
Moreover, if you happen to don’t have data of utilizing Git, it’s not likely a difficulty, as you may merely use an LLM to work together with Git for you. You don’t actually should work together with Git in any respect your self.
Few-shot prompting in motion
Now, assuming you’ve organized your work correctly, it’s time to start out benefiting from few-shot prompting. The idea of few-shot prompting is fairly easy. Everytime you begin new work, you merely consult with a folder or file of earlier work that you really want the pc to both replicate or comply with the identical styling or comparable.
I believe it’s best if I present you, if I describe some particular examples of how I exploit few-shot prompting in observe.
Writing code
In all probability the commonest use case for me when few-shot prompting is writing code. Let’s say I need to implement a GitHub Actions validation script in a brand new repository. I primarily by no means ask Claude Code to give you this script from scratch. As an alternative, I merely inform Claude Code, “This script exists in folder X, replicate or duplicate the script precisely within the repository I’m presently engaged on. Nevertheless, simply make this one change the place you don’t run the a part of the validation script”.
This has two principal advantages. For one, I’m virtually sure I’ll get the GitHub Actions validation script I’m anticipating, as a result of I do know it’s working within the different repository. Moreover that is nice as a result of despite the fact that I’m copying over the script from one other repository, I’m nonetheless in a position to make modifications. And on this instance, the change was that I don’t need to run the complete validation script. I need to skip one a part of it on this new repository.
Claude Code is nice at coping with these sorts of duties, the place you inform it to copy another piece of code after which make a number of custom-made modifications. Which is why this works so nicely.
Creating advertising and marketing materials
One other quite common use case I’ve for few-shot prompting is creating advertising and marketing materials. Creating recent advertising and marketing materials is usually a time-consuming process. You need to, for instance, create model new displays or carousel views for use on LinkedIn.
Moreover, it’s usually laborious to explain your actual preferences on the subject of displays. You may want a selected type of font type or a selected type of alignment of textual content and pictures in your displays. That is merely laborious to explain in pure language, nevertheless it’s very clear to the mannequin if you happen to present it an instance of how this textual content font is or how textual content and pictures are aligned out of your earlier work.
Thus, once I’m making a brand new presentation these days, I all the time present Claude Code my earlier displays and inform it the issues I need to change from these earlier displays. The issues I need to change are usually the precise content material of the presentation, after all, the place I describe every web page in my presentation to as a lot element as attainable. That is, after all, vital to maintain the content material yours and never AI-generated.
Moreover, I merely iterate so much with Claude Code. I advised it to make me an preliminary draft of the presentation. I then evaluate the draft, transcribe all the modifications I need modified by way of MacWhisper whereas reviewing the presentation, and have the AI make a second draft. I’ll then proceed like this till I’m proud of the presentation.
Slash instructions
Creating slash instructions can be one thing I do on a reasonably common foundation. Slash instructions are primarily saved prompts which you could have with the code that permits you to entry prompts quickly. I usually have slash instructions for instructions like making a pull request to dev, making a pull request to principal, simplifying code, or operating a PR evaluate.
Nevertheless, I usually need my slash instructions to comply with a selected type of construction. The construction is a markdown construction with a number of factors that I usually share throughout my completely different slash instructions. Thus, displaying Claude Code my earlier slash instructions makes the era of latest slash instructions so much easier, quicker, and extra prone to comply with the preferences I’ve.
Conclusion
On this article, I’ve mentioned tips on how to leverage few-shot prompting to attain the most effective outcomes along with your LLMs. Lively utilization of few-shot prompting by displaying the LLM examples of your earlier work could make your LLM way more environment friendly to your use circumstances. I like to recommend all the time striving to make use of few-shot prompting everytime you work with LLMs to attain the most effective outcomes. One of the best a part of few-shot prompting is that it will get higher the extra work you do. The extra work you do, the extra earlier examples you need to present the LLM, and the higher it can carry out based on your preferences, which is what makes it such an ideal approach.
👉 My free eBook and Webinar:
🚀 10x Your Engineering with LLMs (Free 3-Day Electronic mail Course)
📚 Get my free Imaginative and prescient Language Fashions book
💻 My webinar on Imaginative and prescient Language Fashions
👉 Discover me on socials:
💌 Substack
Additionally, take a look at my article Get the Most out of Claude Code.
















