Weekend Creative Challenge: Roast My Code
Paste a code snippet, Bedrock roasts it like Meeh, then gives one real tip. Lambda + API Gateway + Bedrock. Fun, and dev audience loves it.
Vision & What the App Does
Every developer has pasted code into a friend's DMs hoping for validation and instead gotten silence, or worse, a screenshot with laughing emojis. Roast My Code turns that moment into the whole point of the app.
You paste a code snippet. The app runs it through Amazon Bedrock, prompted to respond as a strict, slightly theatrical CS professor who has seen too many
for loops nested inside while loops and has run out of patience. It roasts your variable names, your indentation, your suspicious use of global state — whatever's actually wrong with the snippet, delivered with maximum sass. Then, because roasting without teaching is just bullying, it closes with exactly one real, actionable tip: the single highest-impact fix for that snippet.The creative output here isn't an image or a poem — it's comedic writing grounded in genuine code review. That's the fun part: the AI has to actually understand the code well enough to roast it accurately, or the joke falls flat. Bad roasts are boring; specific roasts are funny. That constraint pushed most of the prompt engineering effort.
How I Built It
I started with the simplest possible shape: a single input box, a submit button, and a response panel. No auth, no history, no database — a weekend project doesn't need state, it needs to work and be fun in under a minute.
Frontend: A static HTML/JS page hosted on S3, styled to look like a strict grading rubric — red pen aesthetic, a little chalkboard texture. Kept it to one file to avoid build tooling eating weekend hours.
Backend: API Gateway receives the code snippet via POST, triggers a Lambda function, which calls Bedrock with a system prompt defining the "strict professor" persona and a two-part output contract: roast first, one tip last, always in that order, always separated so the frontend could style them differently.
Key decisions:
- Chose Bedrock over a raw model API to stay inside the Free Tier credits and avoid managing API keys client-side.
- Kept the persona instructions in the Lambda function rather than hardcoding them in the frontend, so I could iterate on the tone without redeploying the static site.
- Capped input length in the frontend to avoid accidentally roasting someone's entire repo (and blowing through tokens).
Challenges: The biggest one was tone control. Early prompts either played it too safe (generic "great effort!" energy, no actual roast) or went too far (mean rather than funny). I fixed this by giving the model explicit examples of the target tone — specific, gramatically savage but never actually insulting the person, only the code — and by explicitly instructing it to always ground jokes in something real about the snippet rather than generic dev humor.
The second challenge was Lambda cold starts adding a couple of seconds of dead air before the roast appeared, which killed the comedic timing. Added a lightweight loading state on the frontend ("grading in progress...") to turn dead time into part of the bit instead of a bug.
AWS Services Used / Architecture Overview
- Amazon S3 — static hosting for the frontend
- Amazon API Gateway — REST endpoint accepting the code snippet
- AWS Lambda — request handling and prompt orchestration
- Amazon Bedrock (Claude/Nova) — the roast + tip generation
User (browser) | vS3 static site ---> API Gateway ---> Lambda ---> Bedrock | v Roast + tip returned
Simple, stateless, and entirely inside AWS Free Tier limits.
What I Learned
This was my first time wiring Bedrock into a Lambda function end-to-end, and the biggest lesson was how much prompt structure matters for consistency — without a strict output contract, responses varied wildly in format, which broke the frontend rendering. Adding explicit delimiters between the roast and the tip fixed that instantly.
I also got more comfortable with API Gateway's request/response mapping, and with keeping a weekend project scoped tightly enough to actually finish — the temptation to add history, sharing, or auth was real, and resisting it is what got this shipped.
Link to App / Repo
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article