본문으로 건너뛰기
Skillpedia
웹 스크레이핑45k · #6357

derive-client

하는 일

사이트를 사용하는 동안 보내고 받는 요청을 기록하고, 같은 요청을 직접 보내는 작은 스크립트나 도구를 작성합니다. 같은 웹 작업을 자주 반복하는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓브라우저를 열지 않고 매번 웹사이트 데이터를 쓰고 싶을 때.
  • ✓공식 API가 없는 사이트를 위한 CLI를 만들어 달라는 요청을 받았을 때.
  • ✓웹사이트가 사용하는 내부 엔드포인트를 확인해야 하는 경우.

스킬 링크

https://github.com/vercel-labs/agent-browser/blob/main/skill-data/derive-client/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/derive-client/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제가 이 사이트에서 항공편을 검색하는 것을 한 번 지켜본 뒤, 같은 검색을 대신 해 주는 스크립트를 만들어 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

녹화 중에 브라우저가 HAR 파일에 네트워크 요청을 저장합니다. AI는 그 요청을 분석한 뒤, 엔드포인트를 직접 호출하는 클라이언트를 작성합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Derive an API client from a recorded session

Driving a browser is the right tool for the first visit and the wrong tool for the hundredth. This skill records a site's network traffic once while you use it, then turns the captured requests into a standalone client (script, CLI, or library) that talks to the site's internal API directly.

The recording alone contains everything needed: agent-browser embeds text response bodies (JSON/HTML/JS) in the HAR by default, so endpoint shapes can be studied offline after the browser is closed.

Workflow

1. Record     Start HAR capture, drive the flows you want in the client
2. Identify   Find the real API endpoints among the noise
3. Extract    Pull request shapes, response schemas, and auth material
4. Generate   Write the client, one function per flow
5. Verify     Call every endpoint for real before declaring done

1. Record

agent-browser network har start          # embeds text response bodies by default
# ... drive the site: search, open a detail page, paginate, etc. ...
agent-browser network har stop /tmp/site.har
  • Exercise every flow the client should support, and run each one at least twice with different inputs (two search terms, two detail pages). Diffing the recorded URLs reveals which parts are parameters.
  • If the site needs login, log in before starting the HAR so credentials don't land in the recording unnecessarily. The session cookies are exported separately in step 3.
  • --content all embeds binary bodies too (base64); --content none disables embedding. Per-body cap is 2 MB.

While the session is still open, agent-browser network requests and network request <id> give the same data interactively — but only the HAR survives navigation and browser close, so prefer it for anything multi-page.

2. Identify endpoints

Query the HAR with jq:

# All JSON API calls: method, URL, status
jq -r '.log.entries[]
  | select(.response.content.mimeType | test("json"))
  | "\(.request.method) \(.response.status) \(.request.url)"' /tmp/site.har

Ignore analytics and infrastructure noise: telemetry endpoints (/collect, /track, /beacon, /log), third-party domains (google-analytics, segment, sentry, datadog, intercom, hotjar), and static assets. The real API is usually first-party, JSON, and correlates with the actions you performed.

3. Extract shapes and auth

# Full detail for one endpoint: request headers, POST body, response body
jq '.log.entries[] | select(.request.url | test("api/search"))
  | {request: {method: .request.method, headers: .request.headers,
     postData: .request.postData.text},
     response: .response.content.text}' /tmp/site.har
  • Response schema: read .response.content.text — this is the real payload, use it to derive types.
  • Auth: compare request headers across endpoints. Look for authorization, cookie, x-csrf-token, x-api-key, and site-specific x-* headers. Replay only the ones that matter — test by omission in step 5.
  • Cookies: export the live session with agent-browser cookies get --json > cookies.json for the client to load at runtime. Never hardcode cookie values into generated source.

4. Generate the client

  • One function per recorded flow (search(query), getItem(id)), typed from the observed response bodies.
  • Auth material (cookies, bearer tokens) loads from a file or environment variable, with a clear error telling the user to re-run the browser login when it expires.
  • Reproduce the headers the API actually requires — some sites 403 without a matching user-agent, referer, or x-requested-with.
  • Keep pagination, sort, and filter parameters that appeared in the recorded query strings as function options.

5. Verify

Call every generated function against the live API and compare the response shape with the recording. Common failures:

Symptom Cause Fix
401/403 Expired or missing session Re-login via agent-browser, re-export cookies
403/419 on writes CSRF token is per-session or per-form Fetch the token endpoint first, or keep that flow browser-driven
Works then breaks Signed/expiring request params Fall back to the browser for that step; derive the rest
Different shape than HAR A/B tests or geo-dependent responses Re-record and treat the union as optional fields

Caveats

  • Internal APIs are unversioned and change without notice — keep the HAR so
자주 묻는 질문

녹화하기 전에 로그인해야 하나요?

예. 자격 증명이 파일에 남지 않도록 녹화를 시작하기 전에 로그인하라고 스킬이 제안합니다.

만든 클라이언트는 테스트하나요?

예. 스킬은 작업이 끝났다고 선언하기 전에 모든 엔드포인트를 실제로 호출해야 한다고 말합니다.

녹화 후에도 브라우저가 필요한가요?

아니요. 스킬에 따르면 처음 녹화한 뒤에는 클라이언트가 브라우저를 필요로 하지 않습니다.

상세 정보

작성자의 원본 설명

Reverse-engineer a website's internal API by recording browser traffic into a HAR file, then generate a standalone client or CLI that calls the endpoints directly, with no browser needed after the first recording. Use when asked to "derive a client", "build a CLI for <site>", "reverse engineer this site's API", "record network requests", "turn this site into an API", or when the same site will be automated repeatedly and direct HTTP calls would beat driving the browser every time.

repo: vercel-labs/agent-browser

인기도

GitHub 스타
45k
순위
#6357
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬