SuperAPI AI Directory

news-summary

Writing & research

View repository

Updated 10-16 15:11

About this skill

News Search Summary Skill

An intelligent news search and summarization tool that helps you quickly obtain and analyze the latest news.

Core Features

1. Search News

  • Ask the user for the search topic
  • Search 12-25 related news items from the past 3-5 days
  • Search tool: Prefer WebSearch; when unavailable, use Brave Search MCP
  • Brave Search limit: after each call, must sleep 1 seconds to prevent rate limiting
  • Search optimization:
    • Use multiple keyword combinations for searching
    • Search in batches to ensure sufficient results
    • Automatic deduplication (title/URL)
    • If results are fewer than 12, expand the time range or keywords

2. Analyze News

For each news item, extract:

  • Title
  • Source website
  • Publish time
  • Authority assessment (high/medium/low)
  • Summary (100-200 characters)
  • Original link

3. Generate HTML Page

  • Output directory:<当前工作目录>/news-summary/<timestamp>_<topic>/
    • Through pwd get the absolute path of the current working directory
    • <timestamp> Format:YYYYMMDD_HHMM(e.g.:20260111_1145), ensuring each search has a unique directory
    • <topic> Extract keywords from the user query (e.g.:AI、deepseek), when unable to extract, use news
    • Example:/path/to/work/news-summary/20260111_1145_AI/
  • File name:news_summary_<topic>.html
  • AI interpretation directory:<当前工作目录>/news-summary/<timestamp>_<topic>/analysis/
  • Interpretation file name:news_analysis_<newsId>.md
  • Page features:
    • Beautiful responsive design
    • Card-style news display
    • Each news item includes: title, source, time, authority label, summary
    • Two buttons: "View Original" and "AI Interpretation"
    • Must be included before:<script src="/news-ai.js"></script>

4. AI Interpretation Feature

  • Server: Node.js HTTP server (lib/server.js, port 3456)
  • Real AI analysis: Generate in-depth interpretation through Claude Code CLI
  • Output format: complete HTML page
    • Storage location:<工作目录>/news-summary/<timestamp_topic>/analysis/news_analysis_<id>.html
    • Contains complete HTML structure (,,, etc.)
    • Uses modern CSS styles, responsive design
    • Color theme uses #667eea and #764ba2 gradient
    • Contains complete structure including news information, analysis content, footer copyright, etc.
  • Custom Prompt: After clicking the "AI Interpretation" button, you can enter a custom analysis angle
  • Blocking and timeout:
    • Display a loading modal during generation
    • Automatically abort after a 120-second timeout
  • File management:
    • Generated: display "View AI Interpretation" and "Delete Interpretation" buttons
    • Not generated: display "AI Interpretation" button
    • Supports deletion and regeneration
  • Service endpoint:
    • GET /check-analysis?newsId=<id>&timestamp=<timestamp_topic> - Check whether the interpretation file exists
    • POST /analyze - Generate AI interpretation (supports customPrompt, outputs complete HTML)
    • DELETE /delete-analysis?newsId=<id>&timestamp=<timestamp_topic> - Delete interpretation
    • GET /view-analysis?newsId=<id>&timestamp=<timestamp_topic> - View interpretation (directly returns HTML)
    • GET /news-summary/<timestamp_topic>/<filename> - Static file service
    • GET /news-ai.js - Frontend script

5. Restart the server and open the browser

  • Steps to restart the server(must be executed after each generation):
    1. Check whether port 3456 is occupied:
      • Windows: netstat -ano | findstr 3456
      • macOS/Linux: lsof -ti:3456 or netstat -ano | grep 3456
    2. If the port is occupied, stop the old server:
      • Windows: taskkill /F /PID <进程ID>
      • macOS/Linux: kill -9 <进程ID>
    3. Restart the server:
      • Windows: start /B node <skill目录>/lib/server.js
      • macOS/Linux: node <skill目录>/lib/server.js &
    4. Wait 2 seconds to ensure the server has started
    5. Verify startup: visit http://localhost:3456/news-ai.js should return JavaScript code
  • After generating the HTML, open the browser via HTTP
  • Browser command:
    • Windows: Start-Process "http://localhost:3456/news-summary/<timestamp_topic>/news_summary_<topic>.html"
    • macOS: open "http://localhost:3456/news-summary/<timestamp_topic>/news_summary_<topic>.html"
    • Linux: xdg-open "http://localhost:3456/news-summary/<timestamp_topic>/news_summary_<topic>.html"
  • Important: must be accessed via HTTP, cannot use the file:// protocol

Workflow

  1. Ask the user for the search topic
  2. Generate a unique identifier:
    • Extract keywords from the query as <topic>(if unable to extract, use news)
    • Generate timestamp:<timestamp> = YYYYMMDD_HHMM format
    • Combine as:<timestamp>_<topic>(e.g.:20260111_1145_AI)
  3. Search news (WebSearch preferred; Brave Search requires a 1-second interval)
  4. Analyze and organize news information
  5. Get the current working directory: use the Bash command pwd to get the absolute path
  6. Create directory:<当前工作目录>/news-summary/<timestamp>_<topic>/
  7. Generate HTML:
    • File path:<当前工作目录>/news-summary/<timestamp>_<topic>/news_summary_<topic>.html
    • Must be added before:<script src="/news-ai.js"></script>
    • Each news card must include data attributes (data-news-id, data-news-url, data-news-source, data-news-time)
  8. Restart the server:
    • Check whether port 3456 is occupied
    • If occupied, stop the old server
    • Start a new server:node <skill目录>/lib/server.js &
    • Wait 2 seconds and verify
  9. Open the browser:http://localhost:3456/news-summary/<timestamp>_<topic>/news_summary_<topic>.html

HTML template requirements

  • Modern and clean design, responsive layout
  • Card-style news display
  • Each news card must include data attributes:
    • data-news-id: news ID (0, 1, 2...)
    • data-news-url: original link
    • data-news-source: source
    • data-news-time: publish time
    • data-news-title: news title
    • data-news-summary: news summary
  • Authority labels: high (green), medium (yellow), low (gray)
  • Relative time display (e.g.: 2 days ago)
  • Must be introduced before:<script src="/news-ai.js"></script>(use absolute path)
  • Initially only includes the "View original" button, the AI interpretation button is dynamically added by news-ai.js after the page loads

Notes

  • Use absolute paths (via pwd to get the current working directory)
  • Create the necessary directory structure
  • Handle network request failures
  • Verify the reliability of news sources
  • Must be included in the HTML <script src="/news-ai.js"></script>, otherwise the AI interpretation feature is unavailable
  • Timestamp format: must use YYYYMMDD_HHMM format, ensuring each search has a unique directory
  • The server must be restarted: the server must be restarted after each news generation to ensure WORK_DIR points to the current working directory