by joegibbs · 1y ago · 0 comments
When writing React:
- Default export a React component.
- Use Tailwind for styling, no import needed.
- All NPM libraries are available to use.
- Use shadcn/ui for basic components (eg. `import { Card, CardContent } from
"@/components/ui/card"` or `import { Button } from "@/components/ui/button"`),
lucide-react for icons, and recharts for charts.
- Code should be production-ready with a minimal, clean aesthetic.
- Follow these style guides:
- Varied font sizes (eg., xl for headlines, base for text).
- Framer Motion for animations.
- Grid-based layouts to avoid clutter.
- 2xl rounded corners, soft shadows for cards/buttons.
- Adequate padding (at least p-2).
- Consider adding a filter/sort control, search input, or dropdown menu for >organization.
That's twelve lines and 182 tokens just for writing React. Lots for Python too. Why these two specifically? Is there some research that shows people want to write React apps with Python backends a lot? I would've assumed that it wouldn't need to be included in every system prompt and you'd just attach it depending on the user's request, perhaps using the smallest model so that it can attach a bunch of different coding guidelines for every language. Is it worth it because of caching?Both answers are in the prompt itself: the python stuff is all in the section instructing the model on using its python interpreter tool, which it uses for a variety of tasks (a lot of it is defining tasks it should use that tool for and libraries and approaches it should use for those tasks, as well as some about how it should write python in general when using the tool.)
And the react stuff is because React is the preferred method of building live-previewable web UI (It can also use vanilla HTML for that, but React is explicitly, per the prompt, preferred.)
This isn't the system prompt for a general purpose coding tool that uses the model, its the system prompt for the consumer focused app, and the things you are asking about aren't instructions for writing code where code is the deliverable to the end user, but for writing code that is part of how it uses key built-in tools that are part of that app experience.
Obviously, the size of the community was always a factor when deciding on a technology (I would love to write gleam backends but I won't subject my colleagues to that), but it seems like LLM use proliferation widens and cements the gap between the most popular choice and the others.
They can also embed a lot of this stuff as part of post training, but putting it in the sys prompt vs. others probably has it's reasons found in their testing.
It does keep chucking shadcn in when I haven't used it too. And different font sizes.
I wonder if we'll all end up converging on what the LLM tuners prefer.
And I assume React will be for the interactive rendering in Canvas (which was a fast follow of Claude making its coding feature use JS rather than Python) https://help.openai.com/en/articles/9930697-what-is-the-canv...
To avoid sounding like I'm claiming this because it's my stack of choice: I'm more partial to node.js /w TypeScript or even Golang, but that's because I want some amount of typing in my back-end.
Also yes - caching will help immensely.
(Which, in my opinion has two reasons: 1. That you can fix and redeploy frontend code much faster than apps or cartridges, which led to a “meh will fix it later” attitude and 2. That JavaScript didn’t have a proper module system from the start)