Skip to content

Commit 6cf997b

Browse files
committed
feat: use skills
1 parent 6f46046 commit 6cf997b

3 files changed

Lines changed: 103 additions & 10 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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).

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,21 @@ This command will:
7575

7676
### Step 3: Generate Blog with Cursor Agent
7777

78-
**Option A: Using Quick Prompt (Recommended)**
78+
This project includes an **agent skill** (`.cursor/skills/pgweekly-blog-generation/`) so Cursor automatically knows how to generate blogs. Use any of these:
7979

80-
1. Open `QUICK_PROMPT.txt`
81-
2. Replace both instances of `PASTE_YOUR_THREAD_ID_HERE` with your thread ID/URL
82-
3. Copy the entire content
83-
4. Paste into Cursor Agent chat
84-
5. Hit Enter and let the agent work!
80+
**Option A: Simple (Skill-aware)**
8581

86-
**Option B: Natural Language**
87-
88-
Simply tell Cursor Agent:
82+
Just say:
8983
```
90-
Generate a blog from this PostgreSQL thread: [paste your thread ID/URL]
84+
Generate a blog from this thread: [paste your thread ID/URL]
9185
```
86+
The agent will fetch, analyze, and generate both English and Chinese posts automatically.
87+
88+
**Option B: Using Quick Prompt**
89+
90+
1. Open `QUICK_PROMPT.txt`
91+
2. Replace both instances of `PASTE_YOUR_THREAD_ID_HERE` with your thread ID/URL
92+
3. Copy the entire content and paste into Cursor Agent chat
9293

9394
**Option C: Advanced Control**
9495

src/SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- [Week 03](./en/2026/03/README.md)
1414
- [Extended Statistics Import/Export Functions](./en/2026/03/extended-statistics-import-functions.md)
1515
- [pg_plan_advice: Query Plan Control](./en/2026/03/pg-plan-advice.md)
16+
- [Week 07](./en/2026/07/README.md)
17+
- [Reducing LEFT JOIN to ANTI JOIN: A Planner Optimization for "WHERE col IS NULL"](./en/2026/07/anti-join-left-join-optimization.md)
1618

1719
---
1820

@@ -29,3 +31,5 @@
2931
- [第 03 周](./cn/2026/03/README.md)
3032
- [扩展统计信息导入/导出功能](./cn/2026/03/extended-statistics-import-functions.md)
3133
- [pg_plan_advice:查询计划控制](./cn/2026/03/pg-plan-advice.md)
34+
- [第 07 周](./cn/2026/07/README.md)
35+
- [将 LEFT JOIN 归约为 ANTI JOIN:针对 "WHERE col IS NULL" 的规划器优化](./cn/2026/07/anti-join-left-join-optimization.md)

0 commit comments

Comments
 (0)