Skip to content

Commit 65c2ae4

Browse files
committed
add a verify step to ensure all patch set versions are downloaded
1 parent f757401 commit 65c2ae4

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed

.cursor/skills/pgweekly-blog-generation/SKILL.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ Generates English and Chinese technical blog posts from PostgreSQL mailing list
2222
- `attachments/` - **Downloaded patches** (e.g. `.patch` files from the mailing list)
2323
- `attachments.txt` - List of downloaded attachment filenames
2424

25-
3. **Analyze** content:
25+
3. **Verify** all patch set versions are downloaded (required before analyze):
26+
- Read `thread.md` and `thread.html` to identify all patch versions referenced in the thread (e.g. v1, v2, v3, v4, v5…; also patterns like `0001-`, `0002-` in patch series)
27+
- List files in `attachments/` and compare: every referenced version must have a corresponding downloaded file
28+
- If any referenced version is missing:
29+
- Run `python3 tools/fetch_data.py --thread-dir "data/threads/YYYY-MM-DD/<thread-id>"` to retry downloading missing attachments
30+
- If still missing, do not proceed with analysis; report the missing versions and ask the user to verify the thread or manually add the patches
31+
- Only proceed to analyze/generate once all referenced patch versions are present in `attachments/`
32+
33+
4. **Analyze** content:
2634
- If multiple patch versions (v1, v2, v3...), run `diff -u` between versions to explain evolution
2735
- Identify main topic, key decisions, reviewer feedback
2836

29-
4. **Generate** TWO blog posts with this structure:
37+
5. **Generate** TWO blog posts with this structure:
3038
- Clear title (topic-based)
3139
- Introduction (context, why it matters)
3240
- Technical Analysis (key points, code/patch highlights, evolution)
@@ -35,12 +43,12 @@ Generates English and Chinese technical blog posts from PostgreSQL mailing list
3543
- Current Status (patch/discussion state)
3644
- Conclusion (summary, implications)
3745

38-
5. **Save** both versions:
46+
6. **Save** both versions:
3947
- English: `src/en/{year}/{week}/{descriptive-filename}.md`
4048
- Chinese: `src/cn/{year}/{week}/{descriptive-filename}.md`
4149
- Filename: kebab-case from main topic (e.g. `planner-count-optimization`)
4250

43-
6. **Update** SUMMARY.md and year READMEs:
51+
7. **Update** SUMMARY.md and year READMEs:
4452
- Add entries under both `# 🇬🇧 English` and `# 🇨🇳 中文`
4553
- Follow existing hierarchy: year → week → link to article
4654
- **Put the new week/article at the top** (newest first): insert the new week immediately after the year line, so the latest week appears first in the list.

BLOG_GENERATION_PROMPT.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ I need you to act as a PostgreSQL expert and technical writer to generate a high
1919
- Run: `python3 tools/fetch_data.py --thread-id "{THREAD_ID_OR_URL}"`
2020
- This will download the HTML, convert to Markdown, and save attachments
2121
22-
2. **Analyze the content:**
22+
2. **Verify all patch set versions are downloaded:**
23+
- Identify all patch versions referenced in the thread (v1, v2, v3…; or 0001-, 0002- in patch series)
24+
- Ensure every referenced version exists in `attachments/`
25+
- If any are missing, run `python3 tools/fetch_data.py --thread-dir "data/threads/YYYY-MM-DD/<thread-id>"` to retry; do not proceed until all are present
26+
27+
3. **Analyze the content:**
2328
- Read the converted Markdown file in `data/threads/YYYY-MM-DD/<thread-id>/thread.md`
2429
- Review the original HTML if you need more context
2530
- Check the `attachments/` folder for any patch files
2631
- If there are multiple patch versions (v1, v2, v3, etc.), use `diff` to understand what changed between versions
2732
28-
3. **Generate a technical blog post with:**
33+
4. **Generate a technical blog post with:**
2934
- **Clear title:** Based on the main topic discussed
3035
- **Introduction:** Brief context and why this matters
3136
- **Technical Analysis:**
@@ -42,12 +47,12 @@ I need you to act as a PostgreSQL expert and technical writer to generate a high
4247
- **Current Status:** Where the patch/discussion stands
4348
- **Conclusion:** Summary and implications for PostgreSQL users
4449
45-
4. **Write TWO versions (English and Chinese):**
50+
5. **Write TWO versions (English and Chinese):**
4651
- **English version:** Professional technical writing style, clear explanations
4752
- **Chinese version:** Professional Chinese technical writing, natural terminology
4853
- **Both versions:** Code blocks with proper syntax highlighting, links to documentation
4954
50-
5. **Save the blogs:**
55+
6. **Save the blogs:**
5156
- Determine the appropriate year and week number based on the thread date or current date
5257
- Generate a descriptive filename based on the content
5358
- **Create directories if needed and save TWO files:**
@@ -80,13 +85,17 @@ Act as a PostgreSQL core developer and technical writer. Generate a comprehensiv
8085
**Step 1: Data Collection**
8186
Run: `python3 tools/fetch_data.py --thread-id "{THREAD_ID_OR_URL}"`
8287
83-
**Step 2: Content Analysis**
88+
**Step 2: Verify Patch Versions**
89+
- Identify all patch versions referenced in the thread (v1, v2, v3…; 0001-, 0002-…)
90+
- Ensure every referenced version exists in `attachments/`; if any missing, run `python3 tools/fetch_data.py --thread-dir "data/threads/YYYY-MM-DD/<thread-id>"` and do not proceed until all are present
91+
92+
**Step 3: Content Analysis**
8493
Review:
8594
- Markdown content: `data/threads/*/thread.md`
8695
- Patches in: `data/threads/*/attachments/`
8796
- For multiple patch versions, run: `diff -u v1-*.patch v2-*.patch` to see evolution
8897
89-
**Step 3: Blog Structure**
98+
**Step 4: Blog Structure**
9099
91100
Create a blog with these sections:
92101
@@ -153,7 +162,7 @@ For each major version:
153162
- Related documentation
154163
- Previous related discussions (if mentioned)
155164
156-
**Step 4: File Management**
165+
**Step 5: File Management**
157166
- Determine year and week: [Calculate from thread date or today's date]
158167
- Create paths: `src/en/{year}/{week}/` and `src/cn/{year}/{week}/`
159168
- Filename: [Generate from main topic, lowercase-with-hyphens]
@@ -191,16 +200,17 @@ For faster processing:
191200
Generate a PostgreSQL technical blog from this thread: {THREAD_ID_OR_URL}
192201
193202
1. Fetch: `python3 tools/fetch_data.py --thread-id "{THREAD_ID_OR_URL}"`
194-
2. Read the Markdown content and patches
195-
3. Compare patch versions if multiple exist (use diff)
196-
4. Write a technical blog covering:
203+
2. Verify all patch set versions referenced in the thread are downloaded; retry with `--thread-dir` if any are missing; do not proceed until all are present
204+
3. Read the Markdown content and patches
205+
4. Compare patch versions if multiple exist (use diff)
206+
5. Write a technical blog covering:
197207
- What problem is being solved
198208
- How the solution works
199209
- Key discussion points
200210
- Patch evolution (if applicable)
201211
- Current status
202-
5. Save to: `src/{year}/{appropriate-week}/{descriptive-name}.md`
203-
6. Update `src/SUMMARY.md`
212+
6. Save to: `src/{year}/{appropriate-week}/{descriptive-name}.md`
213+
7. Update `src/SUMMARY.md`
204214
205215
Write as a PostgreSQL expert. Focus on technical accuracy and clarity.
206216
```
@@ -250,11 +260,12 @@ I have {N} PostgreSQL mailing list threads to convert into blog posts. Process t
250260
251261
For each thread:
252262
1. Fetch data: `python3 tools/fetch_data.py --thread-id "{THREAD_ID}"`
253-
2. Generate TWO versions of the technical blog post (English and Chinese)
254-
3. Save to appropriate year/week directories:
263+
2. Verify all patch set versions referenced in the thread are downloaded; retry with `--thread-dir` if needed; do not proceed until all are present
264+
3. Generate TWO versions of the technical blog post (English and Chinese)
265+
4. Save to appropriate year/week directories:
255266
- English: `src/en/{year}/{week}/{filename}.md`
256267
- Chinese: `src/cn/{year}/{week}/{filename}.md`
257-
4. Update `src/SUMMARY.md` in both language sections
268+
5. Update `src/SUMMARY.md` in both language sections
258269
259270
After all are done, provide a summary of:
260271
- Blogs created

0 commit comments

Comments
 (0)