改善
Kaizen  · Today I Learned by Ville Säävuori

Weeknotes 2024/48 - AI Tools And Astro 5.0

It’s been a while since I wrote any weeknotes; it’s the usual story of life coming in the way. The old site also needed some love and I didn’t have the energy touch it. This week I’ve been playing with the new Astro v5 (which was in beta until today) and was able to kill two issues with one stone.

Files To Claude

The second iteration of Claude 3.5 properly kickstarted my usage of LLM tools in my daily workflow. After testing out all kinds of possible tools I’ve found Claude.ai to be the most effective for my use, especially when combined with the projects feature.

I now create a Claude project for any software project I’m working on, and shovel it as much information as I can for better context and output quality. The results are nothing but amazing. Most of the time Claude is able to help me in a way that I can straight up copy some (almost) production quality code back to the project or fir an issue I had with code or tests or some tooling with just few questions. When Claude has enough context, the chats are typically very short and the process is very fast. And on the other hand, if it doesn’t seem to figure it out, I can bail out quite fast as well.

The main helper for this workflow is a tool I wrote (with Claude) based on this files-to-claude script by Jeff Triplett. I added some simple preferences and globbing to my script which makes is very easy to just add .claude_project directory to the project and then stuff everything I want to put in the Claude.ai project there. Every time I change the code significantly, I re-run my claude script and copy the resulting project.xml to the Claude.ai project. (The obvious improvement here would be Anthropic to offer an API to do this but it works manually as well.)

There’s only one downside of this workflow; it makes Claude think its answers quite a bit longer. If it usually answers in less than a second, when it has a reasonable amount of context in the project, all responses take several seconds. But as I would typically be spending minutes if not hours to do the tasks I’m asking Claude for help, I don’t really mind the few seconds of waiting.

I will definitely package this better in the future but for now here’s the gist of the v0: https://gist.github.com/Uninen/2515d89755f681f374355e6ee687f9c3

Revisiting Astro

For the past four years I’ve been trying to figure out the best way to build the new frontend to my Slipmat.io service. Originally the very first versionof the site was just static Django templates, which was simple but made adding dynamic features hard. All of the later versions were variations of a Vue SPA app which made the development of any dynamic features easy but everything else hard. It also meant that I lost all the SEO mojo as there were no SSR.

Astro wasn’t around yet when I first started to ponder about this. But now it is and it’s awesome. This past week I built the first working version of the new Slipmat frontend site with the latest v5 Astro. Because it runs on Cloudflare Pages and loads zero JavaScript by default it’s insanely fast. Well of course it is because it’s mostly just serving static html pages from edge servers! Mostly.

And now we get to the good part; with Astro I can add export const prerender = false to a page template which instucts Astro to let Cloudflare render the page in the fly. This means I can use fully dynamic Vue apps but still get the fantastic SEO thanks to server rendering! I basically get the best parts of good ole Django-like server-rendered templates plus a static site, all in one fully typed and extremely well engineered tool. The fully typed DX is just fantastic.

I’ve just scratched the surface here myself but I’m surely going to write more about this as there’s so much cool things one can do with this setup.

Oh, and yes, maybe I’ll write more about this as well but I did also fully rebuild this TIL site with Astro as well! I spent a weekend converting the old site fron Hugo and so far I’m absolutely loving the end result; much simpler and 100x better DX for my use case.