Agentic Prompt Perfectly Adds Beats to Newsletter Tool

Clone a reference repo to /tmp, mimic existing Atom feed logic for beats with descriptions, and test via python -m http.server plus uvx rodney --help to validate changes—yielding exact SQL UNION and beat type mappings.

Prompt Patterns for Reference-Driven Changes

To communicate complex logic to coding agents without verbose explanations, clone a reference GitHub repo to /tmp—ensuring it informs the agent without contaminating the target commit. For simonw/tools/blog-to-newsletter.html, reference simonw/simonwillisonblog (the blog's Django source) to implicitly share beats schema: beats import from external sources but gain prominence via added 'note' commentary, filtering drafts (is_draft=0) and empty notes (coalesce(note, '') != '').

Specify the exact file to edit amid 200+ HTML apps, and direct imitation of proven features: "include beats that have descriptions - similar to how the Atom everything feed on the blog works." This leverages existing Atom feed logic distinguishing annotated beats, avoiding redundant description while agents derive details from the cloned repo's Django ORM (e.g., beat_type definitions at blog/models.py#L545-L551).

Self-Validation Through Embedded Testing

Instruct agents to verify changes actively: run python -m http.server (avoids file:// fetch issues for data-driven apps), execute uvx rodney --help (browser automation tool whose help output teaches usage), and compare newsletter output to https://simonwillison.net homepage. This confirms beats appear correctly alongside blog posts, matching recent annotated content like releases or museums from niche-museums.com.

These steps enable single-shot success: Claude Code produced PR #268 adding a precise SQL UNION:

union all
select
  id,
  'beat' as type, title, created, slug,
  'No HTML' as html, json_object(
    'created', date(created),
    'beat_type', beat_type,
    'title', title,
    'url', url,
    'commentary', commentary,
    'note', note
  ) as json, url as external_url
from blog_beat
where coalesce(note, '') != '' and is_draft = 0
union all

Plus frontend mapping:

const beatTypeDisplay = {
  release: 'Release', til: 'TIL', til_update: 'TIL updated',
  research: 'Research', tool: 'Tool', museum: 'Museum'
};

Why This Scales for Production Tools

blog-to-newsletter fetches from Datasette at datasette.simonwillison.net, formats as clipboard-ready HTML for Substack (simonw.substack.com)—now extended to beats without breaking existing post/story handling. Reference cloning shortcuts prompts for schema-heavy tasks; testing loops catch UI/data mismatches early. Apply to your tools: prioritize annotated/high-value items via existing filters, validate against live pages, and use ephemeral /tmp clones to keep agents focused.

Summarized by x-ai/grok-4.1-fast via openrouter

5943 input / 2112 output tokens in 17504ms

© 2026 Edge