Knowledge > Runbooks > Content Ops > Regenerate Stub Illustrations
Regenerate Stub Illustrations
Identify and regenerate illustrations that are incomplete, too short, or contain placeholder content. Stubs degrade search quality and user experience.
Prerequisites
- Supabase MCP or direct DB access
- Access to
sermon-illustrations/scripts/directory - Claude CLI (
claude -p) available in the shell - Sufficient Claude Max quota for batch generation
What Is a Stub?
A stub is an illustration that:
- Has fewer than 150 words in the
contentfield - Contains placeholder text (e.g., "[PLACEHOLDER]", "TODO", "..." as the body)
- Has a title but empty or near-empty content
- Has
is_public = falsebut was not intentionally hidden
Steps
-
Identify stubs by content length:
SELECTid,title,scripture_reference,theological_lens_id,length(content) AS char_count,LEFT(content, 100) AS preview,created_atFROM unified_rag_contentWHERE category = 'illustration'AND (length(content) < 300OR content LIKE '%[PLACEHOLDER]%'OR content LIKE '%TODO%')ORDER BY char_count ASCLIMIT 50; -
Export stub IDs and metadata to a working list:
SELECT id, title, scripture_reference, theological_lens_id, topic_tagsFROM unified_rag_contentWHERE category = 'illustration'AND length(content) < 300ORDER BY created_at ASC; -
Navigate to the scripts directory:
cd /c/dev/sermon-illustrations -
Unset Claude CLI env vars before running any script that spawns
claude -p:unset CLAUDE_CODE_ENTRYPOINTunset CLAUDECODE -
Run the stub regeneration script:
node scripts/regenerate-stubs.js --dry-runReview the dry-run output first. Confirm the script is targeting the correct stub IDs and using the correct prompts.
-
Run without dry-run to generate content:
node scripts/regenerate-stubs.js --limit 20Process in batches of 20 to manage Claude CLI rate limits and allow quality review between runs.
-
Review generated content before updating the database:
- Read a representative sample (at least 20%).
- Check for theological accuracy, appropriate length, no hallucinated scripture references.
- Confirm the illustration relates to its stated scripture reference.
-
Update approved stubs in the database:
UPDATE unified_rag_contentSET content = '[regenerated content]',is_public = true,updated_at = now()WHERE id = '[stub-uuid]';Or use the script's
--updateflag if it writes directly to Supabase. -
Repeat for remaining stubs in batches until the stub queue is clear.
Batch Size Guidance
| Total Stubs | Recommended Batch Size | Estimated Time |
|---|---|---|
| < 50 | Run all at once | 10–20 min |
| 50–200 | Batches of 25 | 1–2 hours |
| 200+ | Batches of 50 per session | Multiple sessions |
Verification
After regenerating:
SELECT COUNT(*) AS remaining_stubs
FROM unified_rag_content
WHERE category = 'illustration'
AND length(content) < 300;
Target: zero remaining stubs. Spot-check 5–10 regenerated illustrations on the ITW site by searching for their scripture reference or topic.
See Also
- add-illustrations.md — add entirely new illustrations
- audit-content.md — broader content quality audit
- generate-by-scripture.md — generate targeted content for specific passages