derive-client
Fungsinya
Skill ini merekam apa yang dikirim dan diterima situs web saat Anda memakainya, lalu menulis skrip atau alat kecil yang membuat permintaan yang sama secara langsung. Skill ini ditujukan untuk orang yang sering mengulang tugas yang sama di situs web.
Kapan dipakai
- βSaat Anda ingin memakai data sebuah situs web tanpa membuka browser setiap kali.
- βSaat Anda diminta membangun CLI untuk situs yang tidak punya API resmi.
- βSaat Anda perlu melihat endpoint internal mana yang dipakai sebuah situs web.
Link skill
https://github.com/vercel-labs/agent-browser/blob/main/skill-data/derive-client/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βPantau saya mencari penerbangan di situs ini sekali, lalu buatkan skrip yang melakukan pencarian yang sama untuk saya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Browser menyimpan file HAR berisi permintaan jaringan saat Anda memakai situs. AI mempelajari permintaan itu, lalu menulis klien yang memanggil endpoint secara langsung.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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 allembeds binary bodies too (base64);--content nonedisables 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-specificx-*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.jsonfor 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, orx-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
Pertanyaan umum
Apakah saya harus login sebelum merekam?
Ya. Skill ini menyarankan login sebelum perekaman dimulai agar kredensial tidak ikut tersimpan di file.
Apakah klien yang dibuat diuji?
Ya. Skill ini menyebutkan setiap endpoint harus dipanggil sungguhan sebelum pekerjaan dinyatakan selesai.
Apakah saya masih butuh browser setelah perekaman?
Tidak. Skill ini menyebutkan klien tidak memerlukan browser setelah perekaman pertama.
Detail
Deskripsi asli dari pembuat
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.
Popularitas
- Bintang GitHub
- 45k
- Peringkat
- #6357
- Lisensi
- Apache-2.0
- Diperbarui
- 1/11/2026
Komentar
- β¦
Skill lain dari repositori ini
technical-writer
45kMengajari agent Anda menulis dan menyunting dokumentasi pengembang, seperti panduan, referensi API, dan halaman pemecahan masalah, dengan struktur yang jelas.
agentcore
45kMembantu agent Anda menjalankan otomatisasi browser di cloud AWS Bedrock AgentCore memakai login AWS Anda, dengan perintah yang sama seperti Chrome lokal.
core
45kMengajari agent Anda mengendalikan browser web lewat snapshot dan referensi elemen, untuk membuka halaman, mengklik, mengisi formulir, dan membaca konten.
dogfood
45kMengajari agent Anda menguji aplikasi web dengan menjelajahinya, lalu menulis laporan bug dengan tangkapan layar dan langkah reproduksi untuk setiap masalah.
Skill serupa
tavily
394kMembantu agent Anda mencari di web dengan Tavily dan mengambil teks dari halaman web tertentu, dengan opsi kedalaman, domain, dan tanggal.
blogwatcher
394kMemungkinkan agent Anda mengikuti blog dan feed RSS atau Atom, memeriksanya untuk artikel baru, dan menandai artikel yang sudah Anda baca.
data-scraper-agent
280kMembantu agent mengumpulkan data otomatis dari sumber publik. Bisa dijadwalkan, memperkaya informasi, dan menyimpan hasil. Berguna untuk memantau data online.