clickhouse-autoresearch-campaign
Fungsinya
Skill ini memandu agent melalui upaya terstruktur untuk mempercepat satu kueri database di ClickHouse. Skill ini untuk insinyur yang ingin menguji banyak perubahan kueri dengan aman, sambil mencatat hasilnya di sepanjang jalan.
Kapan dipakai
- βSaat Anda ingin membuat satu kueri ClickHouse lebih cepat melalui percobaan berulang yang terukur.
- βSaat Anda ingin setiap eksperimen kueri disimpan di cabang git sendiri.
- βSaat Anda ingin catatan waktu dasar dan pemeriksaan kebenaran untuk perubahan kueri.
Link skill
https://github.com/PostHog/posthog/blob/master/tools/query-performance-ai/query_performance_ai/sandboxed_autoresearch_agent/pi_plugin/skills/clickhouse-autoresearch-campaign/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
βKueri dasbor ClickHouse kami terlalu lambat. Bisakah Anda menjalankan kampanye optimasi di cabang sendiri dan menyimpan catatan setiap upaya?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menyiapkan cabang dan ruang kerja khusus, mengukur titik awal, lalu mencoba berbagai ide satu per satu. Agent memastikan hasilnya tetap benar dan meninjau rangkaian percobaan yang berhenti menunjukkan perbaikan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
ClickHouse Autoresearch Campaign
This skill packages the orchestration for optimizing one ClickHouse query on one git branch.
Required reads
Before taking action, read orchestration.md (sibling of this file) completely. Treat it as the operating contract.
Preconditions
This skill assumes:
pi-autoresearchis installed and its tools are available- the current directory is a git repository
- you have a target query or enough context to identify one
- the operator will provide or help configure
.clickhouse-autoresearch/adapter.json
Branch rule
One campaign = one git branch.
If the current branch is not a dedicated campaign branch yet, create one before initializing the workspace.
Workspace rule
Use a single workspace at:
.clickhouse-autoresearch/
The branch is the campaign boundary. The workspace is just the artifact layout.
If autoresearch.config.json exists in the current working directory, read its workingDir field and use that path as the workspace instead of the default above. Automated orchestrators (for example PostHog's run_campaign.py) initialize the workspace at /tmp/autoresearch-campaign/ and write the config alongside it.
Pre-initialized workspace detection
Before doing anything in the Setup sequence, check whether the workspace has already been prepared by an external orchestrator. If the resolved workspace contains all of:
adapter.jsonbaseline/metrics.jsonquery/original.sql
β¦then the workspace is pre-initialized. In that case:
- Skip the entire Setup sequence (steps 1β6). Do not ask the operator for a target query, connection details, or anything else β the orchestrator has already supplied them.
- Jump directly to step 7 of the Setup sequence (read the baseline and seed the first lanes and hypotheses), then continue with steps 8β9 and the normal campaign loop.
- Operate headlessly: at no point prompt the operator for input. If a decision requires judgment, apply the skill's default guidance and record the choice in
state.json/autoresearch.md.
Only fall back to the interactive Setup sequence below when the workspace is empty or partially initialized.
Adapter capabilities (what you can and cannot run)
Campaign queries flow through the adapter configured in adapter.json. Every campaign script (ch_capture_baseline.py, ch_run_candidate.py, any ad-hoc probe) ultimately submits SQL through this adapter, and the adapter enforces what ClickHouse sees.
When adapter.json has type: "coordinator", your SQL is routed to whichever ClickHouse the host-side coordinator is pointed at β typically a read-only test cluster or a local dev ClickHouse. Either way the cluster runs SQL under a profile that pins readonly = 2, so writes (INSERT, ALTER, CREATE, OPTIMIZE, SYSTEM, TRUNCATE, DROP, ATTACH, DETACH) will fail with a ClickHouse error. Read GET /v1/info (or check autoresearch.md β the coordinator's prompt addendum is prepended there) before issuing any predicate that depends on a specific team_id: the prompt addendum tells you which team_id the target cluster has data for, and you must rewrite team_id predicates to match it. For experiments treat every read-only statement form as available:
SELECT β¦β arbitrary subqueries, CTEs, joinsWITH β¦ SELECT β¦EXPLAIN β¦β every variant ClickHouse supports. Use them before proposing rewrites:EXPLAIN SELECT β¦(default: PLAN)EXPLAIN AST SELECT β¦EXPLAIN SYNTAX SELECT β¦EXPLAIN QUERY TREE SELECT β¦(post-analyzer logical tree; invaluable on modern ClickHouse)EXPLAIN PIPELINE SELECT β¦β processor-level pipeline, headers, expressionsEXPLAIN ESTIMATE SELECT β¦β per-part row/mark estimates before executionEXPLAIN PLAN indexes = 1, actions = 1, json = 1 SELECT β¦β primary-key and skip-index use, JSON for machine parsingEXPLAIN TABLE OVERRIDE β¦
SHOW β¦βSHOW CREATE TABLE events,SHOW COLUMNS FROM events,SHOW INDEX FROM events,SHOW SETTINGS ILIKE '%mark_cache%', etc.DESCRIBE/DESC β¦
Timeout: every submission is wrapped with SETTINGS max_execution_time = 60. Keep ad-hoc probes short. If the target query itself routinely exceeds 60s, use range narrowing (see Setup step 6) and only then start the campaign.
Cluster scoping: depends on the coordinator's target. The prompt addendum prepended to autoresearch.md tells you which team_id the target cluster has data for and ask
Pertanyaan umum
Apakah perlu cabang git sendiri?
Ya. Setiap kampanye bekerja di satu cabang git khusus, yang menjadi batas pekerjaan.
Apakah ia memeriksa hasil kueri tetap benar?
Ya. Pemeriksaan kebenaran berjalan bersama tes waktu, sehingga kueri yang lebih cepat tetap harus mengembalikan jawaban yang benar.
Alat apa yang dibutuhkan?
Skill ini bergantung pada alat pi-autoresearch yang sudah terpasang dan pada file konfigurasi untuk adapter target.
Detail
Deskripsi asli dari pembuat
Run a ClickHouse query optimization campaign on one git branch using pi-autoresearch, dynamic lanes and hypotheses, baseline result capture, correctness checks, and stagnation-aware lane/campaign review.
repo: PostHog/posthog
Popularitas
- Bintang GitHub
- 41k
- Peringkat
- #6984
- Lisensi
- β
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
depot-ci
41kMembantu agent Anda menyiapkan dan menjalankan alur kerja Depot CI, alternatif GitHub Actions, termasuk memigrasikan alur kerja yang ada dan membaca log eksekusi.
depot-container-builds
41kMembantu agent Anda membangun image Docker di builder jarak jauh Depot, termasuk image multi-platform, pengiriman ke registry, dan perbaikan kegagalan build.
depot-github-runners
41kMembantu agent Anda memindahkan job GitHub Actions ke runner yang dikelola Depot, memilih ukuran dan label runner, serta memecahkan masalah pengaturan runner.
editing-agents-md
41kMembantu agent Anda memutuskan apakah sebuah aturan layak masuk ke berkas AGENTS.md atau CLAUDE.md, dan menulisnya agar tetap dipatuhi tanpa membuat berkas membengkak.
Skill serupa
api-connector-builder
280kMembuat agent Anda membangun koneksi API baru mengikuti pola yang sudah ada. Gunakan saat ingin menambah integrasi lagi tanpa membuat cara baru.
api-design
280kMembantu agent Anda merancang REST API sesuai praktik terbaik. Berguna untuk mengatur cara API berkomunikasi, menampilkan error, dan mengorganisasi data.
backend-patterns
280kMembantu agent Anda dengan pola arsitektur sisi server dan optimasi database. Berguna untuk membangun atau meninjau kode yang berjalan di server.