Web research

From phuetz/code-buddy · View interactive version

Web research is an AI agent skill from the GitHub repository phuetz/code-buddy. Autonomous multi-source web research: fetch several web pages, extract their main content, and synthesize a cited Markdown brief. Use whenever the user wants to research a topic, gather and compare sources, or produce a referenced write-up from the web.

How to use this skill

Skill file

Autonomous web research → cited Markdown brief

Gather information from several web pages and synthesize a cited Markdown

brief. This composes the other skills: it fetches with the bundled libraries

(lean, zero install), and for JS-heavy pages it hands off to the web-automate

skill (Playwright); you can also feed local files through doc-ingest.

Work in visible steps and never fabricate — every claim must trace to a

fetched source.

Backends

web-automate skill to render with Playwright and grab the DOM text.

Workflow (one step at a time)

  1. Plan: write the research question and a short list of candidate URLs (or

use web-automate to scrape a search-results page for links first).

  1. Fetch + extract each source: a short Python script (heredoc via bash)

that downloads the page, strips script/style/nav, and keeps the main text

— print each source's URL + a length so progress is visible.

  1. Synthesize: write a Markdown brief that answers the question, with **inline

citations [n] mapped to a numbered Sources** list of the URLs. Note

disagreements between sources rather than averaging them away.

  1. Verify: assert at least one source returned text and the brief is

non-empty; save it to a .md path.

  1. Report the saved brief path and a one-line takeaway.

Conventions

aborting the whole run.

for bypassing paywalls or access controls.

Example — fetch + extract several sources

python3 - <<'PY'
import urllib.request, ssl
from bs4 import BeautifulSoup

URLS = [
    "https://example.com",
    # add the real candidate URLs here
]
ctx = ssl.create_default_context()
docs = []
for url in URLS:
    try:
        req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0 (research)"})
        html = urllib.request.urlopen(req, timeout=20, context=ctx).read().decode("utf-8", "replace")
    except Exception as e:
        print(f"skip {url}: {e}"); continue
    soup = BeautifulSoup(html, "lxml")
    for tag in soup(["script", "style", "noscript", "nav", "footer", "header"]):
        tag.decompose()
    text = " ".join(soup.get_text(" ", strip=True).split())
    title = soup.title.get_text(strip=True) if soup.title else url
    docs.append({"url": url, "title": title, "text": text})
    print(f"[{len(text)} chars] {title} — {url}")

assert docs, "no sources fetched"
# → now write the cited Markdown brief from `docs` and save it to research-brief.md
PY

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.