Prompt hacks aka make the best coding out of GPT

THIS WILL BE CONSTANT WORK IN PROGRESS

I've been using a paid subscription to ChatGPT Plus since May 2023 and I'm still happy with the usage. It's one of those tools you have to master to get most of the time spent with it. There are a lot of benefits to use it, of course there are also negative aspects and bugs. Some of them can be mitigated, and that's the purpose of the current post.

Disclaimer / Context of use 🧾

  • I'm ChatGPT mostly for scripts and each conversation is focused on singular topics, i.e single-file codebases if possible.
  • I don't use Open API Keys and I'm not interested to use OpenAI directly. I've been on a paid plan for OpenAI and was charged way too much for my needs. I advise anyone to use ChatGPT Plus which remain to this day worth it and good enough both for personal and professional.
  • This article was not written nor reviewed by AI/ChatGPT.

Lessons learned - Do βœ…

  • Shorten your expectations. Timebox your interactions with ChatGPT. If it takes longer than you expect to reach a solution, stop and do your homework instead, debugging yourself or simplify the problem to solve or take a break...
  • Test after each change. ChatGPT will make you lose faith by repeating the same mistakes, by removing sensitive code, by providing incomplete solutions, always verify.
  • Before running or committing anything generated by ChatGPT, always compare with the previous situation you had. Git diff the result of changes. If you have any doubt about a specific change, submit the git diff to ChatGPT for review and ask for explanations while also explaining why you have doubt (failing tests, errors at runtime, weird code removal, ...).
  • Tell ChatGPT to always decouple code in functions.
  • Instruct to use minimalist code, and avoid comments in code, respect your specific style (if you provide examples), instruct to write the code that takes the least amount of lines and space and to avoid long functions.
  • Divide to conquer: Keep one conversation per problem. Once done with the problem, validate the solution (test!), commit locally, and delete or archive the conversation to keep your Chat history clean from everything you don't need.
  • Take steps: Try to limit ChatGPT's attention to one single file or one single function at a time.
  • If you have lot of work you expect ChatGPT to perform for you, be patient and request one change at a time, then review the code diff and then the outcome, and only if it's validated, commit and move to the next step. ChatGPT sucks at multitasking. Keep the rest of your TODO list somewhere else to keep track of what remains to be requested from ChatGPT.
  • You will have a cleaner Chat if you take this habit:
    • Ask something from ChatGPT.
    • ChatGPT will answer you something, whatever it is, you will likely want to correct ChatGPT. Refrain yourself and do this instead: cancel what ChatGPT is doing, edit your last input to be more precise and re-submit it, ChatGPT will replace its unhelpful response with something more clever. And you will improve the overall quality of the discussion.
  • You will be given better results on popular topics than on niche topics / technologies.
  • Ask to only output the code that require change, e.g add this at the end of your prompt :
    just output the function(s) needing change
  • Ask to not change the existing comments, login logic, variables values in the code that is not impacted by the change.
  • If you really want to multitask, open multiple ChatGPT sessions (browser tabs) in parallel, each focused on distinct changes, so you can multitask while ChatGPT stays focused on single tasks πŸ™‚
  • One change at a time. If ChatGPT keeps making error, step back, restart from to the latest stable version of your code, and ask to make minimal changes, step by step, while you validate each increment.
  • When happy with your changes, ask ChatGPT to improve its performance or clean the code or keep it minimal.
  • When debugging your code with ChatGPT, provide stack traces, inputs, outputs and even the copy of the code that seems buggy (based on the stack trace).
  • Be suspicious if ChatGPT changes your code way too much or introduce weird changes to dependencies. Always review, check, investigate.
  • ChatGPT will likely be interesting to use only for writing very small and boring scripts to batch automate some tasks. But you are responsible for the whole, do not forget that. And test. And understand the code. Make it easy to understand and debug. If you can't explain it, rewrite.
  • ChatGPT could be good at documenting tasks or at writing tests, but for working on complex code it will mostly get 70% of the results then will suck your time and patience.

Lessons learned - Avoid ❌

  • Don't trust ChatGPT outputs. OpenAI is known for dreaming and also tends to complexify solutions to simple problems.
  • Don't run nor commit anything generated by ChatGPT that you don't understand and always compare ChatGPT's solution with what you had before.
  • Don't ask too many improvements or bug fixes at once or be prepared to deal with many new errors and regressions.
  • Don't keep conversations for too long, as all the initial context will likely be forgotten about by ChatGPT and you will suffer, also it will cause a lot of scrolling and augment the size of the web page which will be slower to load and will likely crash your browser tab at some point.
  • Don't switch context / files / problems in the same conversation. It's a waste of time and you will suffer later when trying to source specific content or make sense of anything.
  • Don't share secrets/passwords with ChatGPT.
  • Don't waste your time when the LLM seems confused or unable to solve your problem. Either reshape your problem statement or restart from the latest known stable state, ideally in a new conversation. Be confident in your own abilities. Don't be too dependent on any LLM. I once wasted a whole evening and night trying to get ChatGPT to write the solution for me then trying to use it to fix the problems it caused, I was too lazy to code something by myself from the start.
  • Don't expect ChatGPT to be as efficient on big codebases and complex problems as it is on small scripts and simple problems. So use it more often for the latter and keep the fun of solving the big problems yourself.
  • Don't expect ChatGPT to understand a single thing you do nor why he generates his code. it's a dumb machine without creativity built in. It has to be treated as such and with caution.
  • When trying to help you fixing problems caused by its previous solutions, ChatGPT may enter and endless loop of replacing one solution with another, without understanding the context. Before copy pasting anything from ChatGPT, make your own investigation and check the logs of the apps that do not behave as expected, before touching the code. If you find interesting logs, then provide those to ChatGPT or make your own investigation. Do not depend on ChatGPT for too much grunt and research work. You are better than that.
  • Don't expect ChatGPT to run well and fast on huge bloated scripts. That should encourage you to decouple your code into functions and modules and specialized files/modules/components/...

Relevant references

  • The 70% problem: Hard truths about AI-assisted coding (substack.com)
  • ChatGPT could be used to address the fact that solving some problems is costly in term of engineering. This XKCD meme below should be likely made obsolete if LLMs are used to provide the programs to automate the tasks. For instance when faced with some painful work, I rather use LLM to write me a script to tackle the task. It will be faster than me on some occasions, which itself help removing the need for manual work for tedious tasks, also help removing the need to prompt LLM in the future for that same task, since the script is already provided.
Automation (by XKCD)

Legend: "I spend a lot of time on this task. I should write a program automating it!"

via https://xkcd.com/1319/

is It Worth the Time? (by XKCD)

Legend: "How long can you work on making a routine task more efficient before you're spending more time than you save? (across five years)"

via https://xkcd.com/1205/

Extras

  • If you lose focus on the ChatGPT session in your browser, it's likely the calculation process will interrupt.
  • ChatGPT seems stuck at generating the output ? Refreshing the page might be enough, in other cases ChatGPT might automatically continue the generation or will show a button you can hit to force this action.
  • I recommend trying ollama so you can work offline and without feeding all your sensitive data into OpenAI.

Thank you πŸ™‚


Emails productivity tricks

I hate managing my mail inbox, and I guess I'm not the only one here. Usually my inbox is for bills, paperwork, to-dos, and so on and anyway most of the items will require me to lose time at something I don't value.

Anyway I'm trying to keep it tidy and nice to open and here are some of the habits I'm using to manage the load of documents.

Automate

Most of the emails with attachment and invoice somewhere in the object/title and sent to my accounting software running in the clouds. Other emails can just be automatically archived under some conditions.

Label everything

This is likely nothing new, but getting the discipline to achieve this in the long run is what matters. In Gmail I often use the "Filter similar items" to automatically label similar emails.

Labeling alone is a nice trick which gets even more powerful with colors and emojis.

When I added this new label for dealing with my automated research of places, I've been creating this "housing" label with a 🏠️ emoji, and placed it under the πŸ—οΈ projects label for now.

Colorize

Green for good things, orange for what things that can drain money or energy.
For instance paid invoices and refund are in green and unpaid invoices, fines, taxes are in orange/red.

With those labels and colors, because I rely a lot on visual memory, I can get a good sense of my priorities without having to spend much time in my Inbox by reading emails titles.

Delete handled items

Once something is done, there is no point to keep it nor archive it, unless it's something I'm really too afraid to lose for now, then I can archive it so the email can be found later.

Delegate

My time is not more valuable than other people time, but I do value some things more than others, and I try to focus on what matters for me and delegate other emails if possible, for instance I ignore some emails sent to our company because I know my partner handles those specific ones. If I'm not sure my partner is dealing with something, I'm just forwarding the email with a communication for her.

Unsubscribe

I almost forgot that must-know trick, which is quite underrated and no so commonly used among family members, which is a pity. Whenever you receive recurrent emails you have no time to read, just unsubscribe from them, even if they make it difficult sometimes.

No newsletter please

I prefer to get news by RSS on my Miniflux instance, so everything that can be turned to a RSS feed will be, and every newsletter that does not propose a RSS feed, I'll convert it to a RSS feed via https://kill-the-newsletter.com/, and if the blog I want to subscribe to is banning such automation, I'll use RSS-Bridge to generate a RSS feed by scrapping the content of their blog.

Snooze

Sometimes there is nothing you can do with an email, yet. For instance it's the tracking number of a delivery package, and the package won't be there before 3 days. Or it's a very detailed email for your hotel or event booking for in a few months in the future. In such cases I just snooze such emails for a future date.

Dark mode

I try to make my emails boring and so reduce the anxiety they cause me, and for this Gmail proposes a Dark mode. If that's not enough you can also try some extensions that turn Grayscale / Monochrome mode on. For instance on Brave (Chrome based browser) I'm using this one below.

Don’t bookmark

I've made the mistake many times through years.

Recently I've talked about the struggle of trying to keep up with too much content and manage it and I'm starting with shrinking my 21K bookmarks to a list of essentials resources, taking inspiration from this method for purging them.

I'm using my Gimli axe with the intent of getting rid of the whole problem. Here is my run book for the task.

  • For every image, webcomic etc found in my bookmarks : save it on disk or forget.
  • For every dead link, see if original content exists on https://web.archive.org or https://archive.is/ or forget it.
  • For every shortened link, go to https://urlex.org/ and expand them, then see if those are still worth.
  • Yet about shortened link... ⚠️ NEVER use short links - Refuse to short link anything. Short links die. I've learned hardly to say goodbye to hundred of my bookmarks because the domains that served those links were long gone, but on some social media any link you share is converted automatically by the platform, this is hell. Fortunately you can probably find most of them via https://web.archive.org/ Best time to do it is now !
  • For every YouTube video, if you don't remember why you, just forget it, or plan to watch it in your agenda. Don't add it to watch it later.
  • For every link to tools, discussions, product release notes/changelogs, forums, issues, bugs, tutorials, except if those are very very special, they probably address problems for your past. Forget them.
  • For every direct link to TV Show, movie, book pages, if you still consider consuming that content, get a copy of it, then forget about the link.
  • For every link to a super tool / app / code snippet : install and use the app if still worth it, add the snippets to your favorites if still relevant, otherwise forget it. Tools change. Problems stay the same.
  • For every link to a blog, newsfeed, either subscribe to the blog (RSS, Newsletter or Convert the newsletter to RSS, ...) or forget it.
  • Important content will find you.
  • You fill still find important content in the future.
  • Try to keep only links to content that might be relevant years from now. If possible just backup those pages somewhere along with your other backups, so they do not disappear. But just in case, also archive them for others through https://web.archive.org or https://archive.is/.
  • if a long article is worth keeping, why not taking some notes about it for later ? Or blogging about it ? Instead of just saving it for the eternity ?
  • I'll continue this exercise and try to save all my important ones to /links and clean other places like my Git repo, my Wallabag, etc.. I've migrated everything from Wallabag to Shaarli by November, 2024.
  • If you don't take care of this, the obsolescence of the web is gonna taking care of that for you. I mean your favorite images, videos, sites, will long be gone by the time you read again those bookmarks.
  • Have higher standards before bookmarking anything.

Click to Shrink

This morning Saturday I spent hours scrolling in my RSS feeds, napalm mode, marking tons of content as won't ever read. This made me wanna share my struggles with FOMO and attempts to fix.

Cap Limits

Years ago, a colleague was telling me he left Spotify for Apple Music because of the 10,000 song limit. I had no need of having to keep this much music at the same time. In fact, I do often listen to the same songs, even if the songs change. I regularly delete stuff from my library and make room for new ones.

But a decade ago I was in his shoes, collecting my likes and dislikes on TasteKid (wikiless) and making sure all my favorites TV shows, movie, book, comics, music bands were saved, so TasteKid would recommend me cool stuff. Until it went crazy. I complained to support and they told me I hit a cap limit and they cannot recommend more content beyond that cap limit. Shit. It feels terrible as a user to be punished by your product for using it too well.

I had an account on SensCritique (wikiless) until recent years and I contributed a lot to their knowledge base, lists of contents, until they block my account because I was not making perfect submissions and they had to fix some of them. Is that a reason to block me ? I politely asked for unblocking my account but they insisted the ban should be of one month. I requested a full export of my data (thank you GDPR) then deleted my account and contributions and never went back.

It's painful to contribute the internet and be banned because of imperfection. It used to be a more welcoming place. I fear to depend on external services because of this kind of politics or cap limit. Anyway, that's why I also self host my content and services so I cannot blame anyone else for failures.

Brain, you kill me

When I find an article I like, I often fall in the trap of opening all the cross linked articles. Which make me open too many tabs that I really don't have much time to browse right now so I save them for later in Shaarli Wallabag. I had to install Tab Limiter (browser extension for Chrome) and force myself to a limit of 10-20 tabs per window/profile but it's hard when you have ADHD. I did that after reading about people with similar issues (Reddit - It seems impossible to get rid of my 1000 tabs habit).

I recently stopped bookmarking stuff in my Git repository (or at least slowing it down), I instead switched to saving links into Shaarli, Tapas, Wallabag and Obsidian daily notes, telling myself lies like bookmarking is worth it. I was regularly feeling overwhelmed with newsletter and FOMO so I opted for RSS feeds that curate content from my favorite authors and publishers but that brings its own issues as I exceed my capacity of how much content I'm capable of curating on a given day. Curating content and links is not suitable in 2024 and something better is needed. Recently I did the math and realized that from Shaarli, Wallabag, Gitea and others in total I have recently collected 11K links among my main bookmarking places. If I dig deeper and go collect links from my Twitter archives, my 10 years old bookmarks and links from my Obsidian notes, it sums to 20K. That's a big number I really need to cut into 1K maximum. Which I'm trying at /links.

Brain, you kill them

No tool will solve it; it's not a tool issue. One just can't digest so much content. If it's too late and you already succumbed to opening 10K tabs and notes and windows and you have started too many "watch later" challenges, let me present your friend, Gimli !

Imagine the open tabs, newsfeeds, information sources, lists, open windows, unfinished stuff, etc as the Ring used by Sauron in LOTR. Then act like Gimli, throw an axe at the problem. If you are strong enough, you can just quickly solve this.

It's really satisfying to delete stuff and decide never to read them. Rather than bookmark them for later and never read them, just delete stuff. Delete lines from your codebase. Delete branches of unfinished work. Close tabs. Delete "might be useful later" apps from your mobile phone. Uninstall browser extensions you rarely use. Archive emails that pollute your Inbox. Do you really need those daily emails from 20 newsletters ? Do you ever read them ? Do you really need to read the whole Hacker News ? You know there exist summaries ? Do you really need to read that whole article ? There exist ChatGPT summarizers that work in your browser, or you could simply jump to the article's comments section or look if any HN user already commented on that article. If you prefer to rely on your own judgment, just have a look at the intro and conclusion of any article you are about to read, and from there decide if you are interested to read more.

You think you need to bookmark everything and organize them, but most of those websites will be gone soon or later or will be behind paywalls. Save the few that really matter to you, using SingleFile extension for instance, if possible on your storage as we don't know if search engines or archiving websites will keep caching those pages nor if they will still exist in a few years from now.

Most of the long articles I've ever read could be summarized with a simple meme (image), they really are a perfect fit for the purpose of sharing a concept. That's also why webcomics are so powerful, like XKCD, it's minimalist and speaks to everyone. It might be the same for tons of those videos, podcasts you wanna consume. If you are regularly battling against your inbox, newsfeeds etc, it's time to use that axe and unsubscribe from this spam which is one of my productivity tricks, look here for more.

Look busy, be free

You have a limited time, your body has its own constraints and you can't grow new body parts to extend your capacity. You don't need to do more, but probably to do less and be more focused. For this, you need to give yourself more time. Think again about the cap limits. In past years, people have migrated away from Facebook, nowadays they migrate away from Twitter. Tools don't last. Social networks don't last. Content don't last. Instead old content disappear to make room for better old ones. Hopefully. There are websites other than Facebook and Instagram. Not overloaded with ads. Interesting and quieter ones. And we definitely need more calm while social networks are keeping us busy, VOD platforms push infinite content to us and email inboxes never feel empty. And we also need to replace most of the too popular platforms that succumbed to enshittification (wikiless).

You don't need to track 300 RSS feeds, 1/10 of that should suffice. While I write this, I went from 330 RSS feeds to 270 in about a week. I've noticed I'm really super excited about the content from maybe 5 of them, and enthusiastic/curious about maybe 25 RSS feeds in total. Speaking of that, I'm sharing a subset of those RSS feeds in my /links page.

You don't need to be present on every social media platform, 1 or 2 should suffice. Or none. After leaving Twitter and LinkedIn, I was mostly present on Mastodon (which I'm leaving too by March 2024) and I deactivated Instagram but I read every publication of my partner thanks to Instagram feeds provided by Picuki. Some websites allow you to easily backup your data before closing your account, I do keep backups in Dropbox. If not ready to close those accounts, deactivate the ones that pollute you and see if you can live a while without spying on random strangers and friends on internet. Because yes, maybe you shouldn't maintain a false sense of friendship with every influencer.

For similar reasons, I tend to archive WhatsApp conversations and unsubscribe from social accounts from time to time. If I don't recall why I follow an account or why the fuck I'm in this WhatsApp group, I better leaving it. It can be done in a polite manner of course, but the idea is to focus on your wellbeing.

No need for 10K songs on Spotify, I stick to 2K for a few years and in only a few days, I went to 1K, then 100 songs, then 30 songs. They come and go. No need to follow hundred of accounts, if a ten should suffice.

I started to use the axe in my 5K bookmarks and remove all that is not absolutely needed. It's easy once you are inspired by some tricks.

Numbers have spoken

Kill, destroy, eliminate, declutter, triage !

If triage is difficult, use the axe and destroy the whole problem. I've quit several social platforms (LinkedIn, Twitter, Instagram, Facebook, daily.dev, Discord, ...) and then the FOMO goes away completely as well as the anxiety caused by having to keep up with tons of relationships on those social media. Dunbar's number (wikiless) explains you cannot keep up with so many people on so many platforms. The most cited number is 150, personally I put it way lower for me, maybe 1/5 or 1/10 of it.

I bet I have said it all. I'll continue to shrink and use minimalism to guide me (wikiless).

So what should we do instead ? I'll explain this further in another post. But TLDR; is you make something useful with your dreams and time. You shall create. Play music, draw web comics, share stories, make your own website, make your own art, software, your own place on the internet and in the world. You lack inspiration for a blog post or website ideas ? Let this guide you or this other one.

OK COOL... But this is just how things work, isn't ?

No wonder you don't have time if you keep scrolling social media, dramatic news, or if you accept every fucking social event invite from friends and family. Focus on what matters, say no. And even if you still lack time, it should not be an excuse.

In a former life, I was telling my overworking colleagues about making time for things that matter to you. They baffled. The thing is it's not because you work 14 hours a day you will be more productive than someone doing deep work for about 2 hours a day. Sometimes all is required to fix a problem is not more work but a good nap / break.

Credits : Julia Evans

Sometimes you really need to make time, it can imply some arrangement with your family or to setup unconventional work schedules but if that allows you to make something you have fun doing, why not ? When you are done with that, other people will surely react but who cares ?

But this was helpful

In order to do things useful for you and joyful for you, no need to chase the infinite self optimization which is toxic in itself and make you feel never achieving anything. You don't need to be 1% every day. It's difficult to improve every day and you will feel guilty by not reaching the goal. Instead, try to stay away from bad habits. Instead of focusing on developing new ones constantly, develop anti habits to kill the bad ones. Be also very wary of the self development guides that exploit your guilt for their business. You can chase infinite advices from random internet places or closed ones, but that's also something to be critical of.

Ironically, you should be also wary of this very article you read. I'm writing it for myself first, because it helps me clarify my mind. It's good if it helps you, but it's first and mainly targeted at me, like most influencers and authors write first for themselves or at least based on their own experience. In general, be wary of advice.

All content is not equal and because some advice exists does not mean it applies to you. So don't feel guilty of not following all trends and coaches. You can also make your own adventure.

Is it the end ?

Hopefully if you get me right, it's just the beginning, the start of living your life and stop letting everyone else's agenda control yours. There is also no urge to act now. First, slow down. Don't feel guilty of doing less, saying no, relax in your bed. If you reduce the noise and negativity, don't immediately go compensate with new projects. If you don't feel energized to start decluttering, at least take a break. Think about it. When was the last time you took a day off or had fun starting a useless project ? Do you have time for your hobbies ? Do you feel tired or exhausted ?

Use the axe.

Shrink it all.

Or go play your favorite game.

Related reads


Quick Bugs, Slow Fixes

The 🐒 engineer has good guts but often seems slow compared to the 🐰 engineer.

The 🐰 engineer is quick at decision and gives impression of progress to the product owner often disappointed with the slow pace of change of the 🐒.

The 🐒 is busy battle testing the draft he's about to integrate in the product, suddenly he finds out the new bugs were introduced recently by the 🐰, and decides to postpone his work while focusing on debugging the shit.

In the meantime, the customer complains because of the new bugs introduced in latest release by the 🐰 engineer.

The product owner is worried and decides fixing this bug is a priority.

  • The 🐒 engineer was already investigating the bug and proposes a fix.
  • The 🐰 engineer cannot wait for the 🐒 to fix the bug and already merges new changes in the stable branch so the new release will not only be bug free but also deliver new quality shit.
  • The 🐒 is busy integrating and retesting all the new changes made by the 🐰 as it seems those changes includes critical changes of the core authentication layer and library updates that had nothing to do with the features the 🐰 was working on.
  • 🐰 lacks time for testing for side effects, so his changes bring bugs πŸ’©, whatever, at least code is delivered, whether it works, that is someone else's problem (🐒 of course).
  • The 🐰 becomes impatient at the slow 🐒 and decides to create a hotfix πŸ’₯ and deliver his changes to production.

The customer is still unhappy 😠.

Ignoring the new bugs, the product owner finds it's time for 🐒 to deliver things too, but is happy the 🐰 is done.

The 🐒 will be busy with kids at home while also thinking about all new bugs caused by 🐰.
The 🐰 thinks and claims 🐒 is not delivering and working enough hours.
The 🐒 is tortured with this lack of teamwork and with all the shit πŸ’© that is being merged in the codebase by the 🐰.
The 🐰 says it's time to hire more people and he knows other 🐰 who can help and it would be nice if the 🐒 worked more like 🐰 is doing.

The 🐒 suggests to focus on quality and teamwork and slow down but the 🐰 and the product owner look at him suspiciously.

The product owner suggests the 🐒 to consider leaving the team if he's not happy with the way things are. Because in the end, speed and working long hours are important even if results are not perfect.

🀦 "fuck this shit". A few weeks later, 🐒 has left.

The 🐒 is working in a good team nowadays 🀲, where testing is a thing βœ…, quality is under control πŸ‘Œ, documentation matters ✍️, and collaboration is a foundation 🀲πŸ’ͺ.

Related

How the situation should be managed instead by the PO / Lead.

https://workchronicles.substack.com/p/comic-be-like-bob-he-works-long-hours

Don't be like the 🐰-> See broken window theory.