AgentSkillsCN

press-format

使用press-ndjson-search搜索新闻稿,并格式化结果以供博客文章引用。生成可由PressReferences组件展示的press_references.json文件。

SKILL.md
--- frontmatter
name: press-format
description: Search press releases using press-ndjson-search and format results for blog post references. Generates press_references.json files that can be displayed with the PressReferences component.

Press Format Skill

Overview

The press-format skill searches the emv-pers press release dataset and formats results as blog-ready JSON files. It's a wrapper around the press-ndjson-search tool that adds formatting and file management for the data-blog system.

When to Use ✅

  • User wants to add press release citations to a blog post
  • User asks to "find relevant press releases" for a specific topic
  • User wants to generate press_references.json for a blog analysis

How It Works

  1. Searches the press.normalized.ndjson dataset using the press-ndjson-search script
  2. Formats results into blog-friendly JSON structure
  3. Saves to embuild-analyses/analyses/<slug>/results/press_references.json
  4. Returns summary of results found

Usage

Command Line

bash
python3 .github/press-format/scripts/format_press.py \
  --query "vergunningen" \
  --slug "vergunningen-aanvragen" \
  --limit 5

# Publish a copy to embuild-analyses/public/press-references (useful for dev server)
python3 .github/press-format/scripts/format_press.py \
  --query "faillissementen" \
  --slug "faillissementen" \
  --limit 5 \
  --publish

# Publish any existing results in the repo to public/press-references (local convenience)
python3 .github/press-format/scripts/format_press.py \
  --publish-existing

This command scans `embuild-analyses/analyses/*/results/press_references.json` and copies any found files to `embuild-analyses/public/press-references/<slug>.json` for serving in the dev server.

Parameters

  • --query (required): Search query
    • Supports quoted phrases: "exact phrase"
    • Supports OR operator: vergunning|PFAS
    • Case-insensitive
  • --slug (required): Blog analysis slug (e.g., vergunningen-aanvragen)
  • --limit (optional): Maximum results (default: 10)
  • --start-date (optional): Start date filter (YYYY-MM-DD)
  • --end-date (optional): End date filter (YYYY-MM-DD)

Examples

bash
# Basic search
python3 .github/press-format/scripts/format_press.py \
  --query "vergunningen" \
  --slug "vergunningen-aanvragen" \
  --limit 5

# Search with date range
python3 .github/press-format/scripts/format_press.py \
  --query "PFAS" \
  --slug "vergunningen-aanvragen" \
  --start-date 2025-01-01 \
  --end-date 2025-12-31

# Complex query with OR operator
python3 .github/press-format/scripts/format_press.py \
  --query "vergunning|PFAS" \
  --slug "vergunningen-aanvragen" \
  --limit 10

Output Format

Creates embuild-analyses/analyses/<slug>/results/press_references.json:

json
{
  "query": "vergunningen",
  "generated_at": "2026-01-19T10:30:00Z",
  "references": [
    {
      "id": "6d5e44b6...",
      "title": "Bouwsector opgelucht over PFAS-initiatief",
      "date": "2025-06-20",
      "url": "https://www.embuildvlaanderen.be/press-room/...",
      "excerpt": "Verbatim quote from the press release..."
    }
  ]
}

Using in Blog Posts

After generating the JSON file, add the component to your MDX:

mdx
---
title: Your Blog Post
...
---

import { PressReferences } from "@/components/analyses/shared/PressReferences"

... blog content ...

<PressReferences slug="vergunningen-aanvragen" />

Component Props

The PressReferences component accepts:

  • slug (required): Analysis slug to load data from
  • title (optional): Section title (default: "Gerelateerde persberichten")
  • showYear (optional): Group by year (default: false)
  • maxExcerptLength (optional): Excerpt truncation (default: 200)

Programmatic Usage

From Python code:

python
from press_format import format_press_references

data = format_press_references(
    query="vergunningen",
    slug="vergunningen-aanvragen",
    limit=5
)

print(f"Found {len(data['references'])} references")

Installation (Optional)

To use as a command globally:

bash
cd .github/press-format
./install.sh

Then use:

bash
press-format --query "vergunningen" --slug "vergunningen-aanvragen" --limit 5

Dependencies

Requires:

  • Python 3.8+
  • emv-pers repository cloned to ~/pyprojects/emv-pers
  • press-ndjson-search script at ~/pyprojects/emv-pers/.github/press-ndjson-search/scripts/search_ndjson.py
  • Press data file at ~/pyprojects/emv-pers/press.normalized.ndjson

Error Handling

The script validates:

  • Search script exists
  • Press data file exists
  • Query returns valid results
  • Output directory can be created

Common errors:

  • FileNotFoundError: emv-pers repository not found or missing files
  • subprocess.CalledProcessError: Search script failed (invalid query, etc.)

LLM/Agent Instructions

When a user asks to add press references to a blog:

  1. Ask for the search query if not provided
  2. Run the press-format script with appropriate parameters
  3. Verify the JSON file was created
  4. Add the <PressReferences /> component to the blog's content.mdx
  5. Suggest viewing the results in the dev server

Example workflow:

code
User: "Add relevant press releases about permits to the vergunningen-aanvragen blog"