Short Prompt Yields Perfect Agentic Update for Newsletter Beats

Prompt Claude to clone blog repo as reference, mimic Atom feed logic to add annotated 'beats' to blog-to-newsletter tool, and test via local server + rodney—produces exact SQL UNION PR needed.

Prompt Patterns That Communicate Complexity Efficiently

To update the blog-to-newsletter tool—a static HTML/JS app that queries a Datasette instance for blog content and formats it for Substack pasting—use these agent instructions for precise changes without verbose explanations:

  • Clone reference repo to /tmp: Clone simonw/simonwillisonblog from github to /tmp for reference. This lets the agent (Claude Code) inspect the Django blog's schema and logic for the new "beats" content type (external posts like OSS releases or museum visits from niche-museums.com), avoiding commit pollution since /tmp is transient.
  • Target specific file and mimic proven logic: Update blog-to-newsletter.html to include beats that have descriptions - similar to how the Atom everything feed on the blog works. Pinpointing the 200+ file repo and referencing the site's Atom feed (which filters beats with note commentary) transfers filtering rules (coalesce(note, '') != '' and is_draft = 0) implicitly.
  • Embed self-validation: Run it with python -m http.server and use 'uvx rodney --help' to test it - compare what shows up in the newsletter with what's on the homepage of https://simonwillison.net. Forces agent to serve statically (avoids fetch issues), use browser automation via rodney (whose --help teaches usage), and verify against live homepage beats—ensuring production-like accuracy.

This deceptively short prompt (~50 words) leverages reference code as a "powerful shortcut" for complex concepts, producing a targeted PR in one shot.

Precise SQL and Data Mapping from Agent Reasoning

The agent extended the content-fetching SQL query with a UNION clause for beats:

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...

It derived beat_type mappings (e.g., formal names) by reading the blog's Django ORM models (blog/models.py#L545-L551), ensuring JSON output matches existing post/story formats for seamless newsletter rendering. Only annotated, non-draft beats appear, filtering uninteresting auto-imports like minor OSS dot-releases—mirroring Atom feed curation for higher engagement.

Trade-offs and Validation Wins

Reference cloning risks over-reliance on external code but cuts prompt length dramatically vs. manual schema description. Local testing catches edge cases like data-fetch failures over file:// vs. http://, building agent confidence. Result: Exact PR (#268 in simonw/tools) with no regressions, deployable immediately—proving agentic patterns scale small updates reliably while hoarding reusable blog logic.

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

5798 input / 2019 output tokens in 13341ms

© 2026 Edge