|
| 1 | +--- |
| 2 | +name: pgweekly-blog-generation |
| 3 | +description: Generates technical blog posts from PostgreSQL mailing list threads for the pgweekly digest. Use when the user wants to write a blog post from a thread, generate a blog, convert a mailing list discussion to a post, or mentions thread ID/URL with blog/blog post intent. |
| 4 | +--- |
| 5 | + |
| 6 | +# PostgreSQL Weekly Blog Generation |
| 7 | + |
| 8 | +Generates English and Chinese technical blog posts from PostgreSQL mailing list discussions. Applied when the user provides a thread ID/URL and wants a blog post. |
| 9 | + |
| 10 | +## Quick Workflow |
| 11 | + |
| 12 | +1. **Fetch** thread data (required; do not skip): run the fetch script so that the thread HTML, Markdown, and **all patch attachments** are downloaded and saved under `data/threads/`: |
| 13 | + ```bash |
| 14 | + python3 tools/fetch_data.py --thread-id "{THREAD_ID_OR_URL}" |
| 15 | + ``` |
| 16 | + This creates `data/threads/YYYY-MM-DD/<sanitized-thread-id>/` and downloads every `.patch` (and other allowed attachments) into `data/threads/YYYY-MM-DD/<sanitized-thread-id>/attachments/`. Always run this step before writing the blog. |
| 17 | + |
| 18 | +2. **Locate** fetched content in `data/threads/YYYY-MM-DD/<thread-id>/`: |
| 19 | + - `thread.html` - Original HTML |
| 20 | + - `thread.md` - Converted Markdown |
| 21 | + - `metadata.txt` - Thread info (use for year/week) |
| 22 | + - `attachments/` - **Downloaded patches** (e.g. `.patch` files from the mailing list) |
| 23 | + - `attachments.txt` - List of downloaded attachment filenames |
| 24 | + |
| 25 | +3. **Analyze** content: |
| 26 | + - If multiple patch versions (v1, v2, v3...), run `diff -u` between versions to explain evolution |
| 27 | + - Identify main topic, key decisions, reviewer feedback |
| 28 | + |
| 29 | +4. **Generate** TWO blog posts with this structure: |
| 30 | + - Clear title (topic-based) |
| 31 | + - Introduction (context, why it matters) |
| 32 | + - Technical Analysis (key points, code/patch highlights, evolution) |
| 33 | + - Community Insights (reviewer feedback, issues resolved) |
| 34 | + - Technical Details (implementation, edge cases, performance) |
| 35 | + - Current Status (patch/discussion state) |
| 36 | + - Conclusion (summary, implications) |
| 37 | + |
| 38 | +5. **Save** both versions: |
| 39 | + - English: `src/en/{year}/{week}/{descriptive-filename}.md` |
| 40 | + - Chinese: `src/cn/{year}/{week}/{descriptive-filename}.md` |
| 41 | + - Filename: kebab-case from main topic (e.g. `planner-count-optimization`) |
| 42 | + |
| 43 | +6. **Update** SUMMARY.md: |
| 44 | + - Add entries under both `# 🇬🇧 English` and `# 🇨🇳 中文` |
| 45 | + - Follow existing hierarchy: year → week → link to article |
| 46 | + - Create `src/en/{year}/{week}/README.md` and `src/cn/{year}/{week}/README.md` if missing |
| 47 | + |
| 48 | +## Year/Week |
| 49 | + |
| 50 | +Determine from `metadata.txt` (thread date) or use current date. Use ISO week number (e.g. 06 for week 6). |
| 51 | + |
| 52 | +## Writing Guidelines |
| 53 | + |
| 54 | +| Version | Style | |
| 55 | +|---------|-------| |
| 56 | +| English | Professional technical writing, clear explanations | |
| 57 | +| Chinese | Professional 中文 technical writing, natural terminology (不要直译) | |
| 58 | +| Both | Code blocks with syntax highlighting; links to docs/references | |
| 59 | + |
| 60 | +## SUMMARY.md Format |
| 61 | + |
| 62 | +```markdown |
| 63 | +# 🇬🇧 English |
| 64 | +- [2026](./en/2026/README.md) |
| 65 | + - [Week 06](./en/2026/06/README.md) |
| 66 | + - [Article Title](./en/2026/06/article-filename.md) |
| 67 | + |
| 68 | +# 🇨🇳 中文 |
| 69 | +- [2026](./cn/2026/README.md) |
| 70 | + - [第 06 周](./cn/2026/06/README.md) |
| 71 | + - [中文标题](./cn/2026/06/article-filename.md) |
| 72 | +``` |
| 73 | + |
| 74 | +## Data directory (threads and patches) |
| 75 | + |
| 76 | +All thread data, including **downloaded patches**, is stored under `data/threads/`: |
| 77 | + |
| 78 | +- **Base path:** `data/threads/` (configurable via `--output-dir`; default is `data/threads`). |
| 79 | +- **Per-thread directory:** `data/threads/YYYY-MM-DD/<sanitized-thread-id>/`, where `YYYY-MM-DD` is the **fetch date** (the day the script was run). |
| 80 | +- **Patches:** The fetch script downloads every attachment (e.g. `.patch`, `.txt`) from the thread into `data/threads/YYYY-MM-DD/<sanitized-thread-id>/attachments/`. Use these files when analyzing patch evolution or citing code changes. |
| 81 | + |
| 82 | +Do not generate a blog from a thread without first running `fetch_data.py` so that the thread and its patches are present under `data/threads/`. |
| 83 | + |
| 84 | +## Minimal Trigger |
| 85 | + |
| 86 | +User says: "Generate a blog from this thread: [URL/ID]" → run workflow above. |
| 87 | + |
| 88 | +For advanced options, batch processing, or custom structure, see [BLOG_GENERATION_PROMPT.md](../../BLOG_GENERATION_PROMPT.md). |
0 commit comments