editing-agents-md
Fungsinya
Skill ini membantu Anda memilih apa yang masuk ke berkas instruksi yang dibaca alat coding AI di awal setiap sesi. Ditujukan untuk siapa saja yang memelihara berkas tersebut dan ingin agar berkasnya singkat dan bermanfaat.
Kapan dipakai
- βSaat Anda ingin menambahkan aturan baru ke berkas AGENTS.md atau CLAUDE.md.
- βSaat sebuah aturan terus dilanggar dan ada yang menyarankan untuk menuliskannya.
- βSaat berkas instruksi sudah terlalu panjang dan perlu dipangkas.
Link skill
https://github.com/PostHog/posthog/blob/master/.agents/skills/editing-agents-md/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
βBantu saya memutuskan apakah aturan ini layak masuk ke CLAUDE.md saya, dan tulis ulang agar AI mengikutinya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill ini terlebih dahulu menanyakan apakah mekanisme lain, seperti linter atau tes, dapat menegakkan aturan tersebut. Aturan hanya disimpan di berkas jika tidak ada cara lain yang lebih baik, lalu ditulis ulang agar jelas.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Editing AGENTS.md
The root AGENTS.md loads in full at the start of every session, in every tool that reads it.
A line you add is paid for by every task in the repo, forever, whether or not that task touches the subject.
So the question is never "is this true?" β it is "is this worth loading into every session?"
Two findings set the frame:
- Adding a context file raises inference cost by over 20% on average, and does not reliably raise task success (2602.11988). A second study measured the opposite sign on runtime and tokens (2601.20404). The evidence is mixed, which argues for a small sharp file rather than no file.
- File size, instruction position, file architecture, and contradictions between adjacent files each produced no detectable effect on whether an agent follows a rule, across 1,650 sessions (2605.10039).
Read the second one carefully, because it kills a whole class of proposals. Moving a section higher "so the agent sees it" is churn against a null result. Do not reorder for attention. Reorder only when a heading makes a rule easier for a human to find or cite.
1. Does this belong in the file at all?
Work down this ladder and stop at the first rung that fits. It is the same ladder AGENTS.md states for itself.
| Rung | Mechanism | Use when |
|---|---|---|
| 1 | Linter β ruff, oxlint, semgrep (.semgrep/rules/devex/) |
The violation is a code pattern a matcher can see |
| 2 | lint-staged / pre-commit | It needs the file list or the working tree, not the AST |
| 3 | Skill (.agents/skills/) |
It applies to one kind of task, not every task |
| 4 | A rule in AGENTS.md | None of the above can carry it |
Rung 4 is the last resort, not the default.
A convention that a semgrep rule could catch belongs in .semgrep/rules/devex/ β read its README for the severity choice and the WARNING-to-ERROR ratchet.
Put the migration playbook in the rule's message: field, because that is what an author actually reads when it fires.
Rung 3 is the one people skip most. If a rule only matters while merging a PR, writing a migration, or building a workflow, it belongs in that skill, where it loads on demand and can be ten times longer.
2. Check the six smells
Measured across 100 popular repositories (2606.15828). Prevalence in brackets.
- Lint leakage [62%] β the rule restates what a linter already blocks. This is the most common failure by a wide margin. Do not delete the reasoning, but cut it to the reason plus the rule id, and tag it. CI is the check; the prose is only the why.
- Context bloat [42%] β content that does not apply to most sessions. Environment-specific setup, product documentation, anything a
docs/page should hold. Target is under 200 lines. - Skill leakage [35%] β task-specific instructions sitting in the always-loaded file instead of a skill.
- Conflicting instructions [28%] β two rules that disagree, often because one aged. Grep for the other statement before you add yours.
- Init fossilization [24%] β text nobody has reviewed since it was generated. If you are editing near a stale rule, verify it still holds and fix it in the same diff.
- Blind references [16%] β a link with no statement of what it holds and when to read it. Every link needs a "read this when β¦" clause, or an agent has no basis to spend a tool call on it.
3. Write the rule as an invariant, not an instruction
The file is read by authors and reviewers alike. An invariant serves both; an instruction has to be translated.
- Say what must be true: "Every tenant-data model must have
team_id." - Not what to do: "Remember to add
team_idwhen you make a model."
Be specific and imperative. A vague preference changes nothing.
"Use uv pip, never pip" works. "We prefer uv" does not.
Name the trigger the rule fires on, so a reader scanning a diff knows when it applies.
Keep to the repo's prose conventions: ASD-STE100 Simplified Technical English, active voice, one
Pertanyaan umum
Mengapa tidak memasukkan semua aturan ke dalam berkas?
Setiap baris dimuat di setiap sesi, sehingga berkas yang panjang menambah biaya dan tidak selalu membantu AI mengikuti aturan. Berkas yang singkat dan tegas lebih efektif.
Apakah ini juga berlaku untuk berkas CLAUDE.md?
Ya. Saran yang sama berlaku untuk AGENTS.md dan CLAUDE.md, karena keduanya dimuat di awal setiap sesi.
Haruskah saya memindahkan aturan ke bagian atas berkas agar AI melihatnya?
Biasanya tidak. Riset di balik skill ini menemukan bahwa posisi tidak secara andal mengubah apakah agent mengikuti aturan, sehingga urutan hanya diubah untuk membantu orang menemukan bagian tertentu.
Detail
Deskripsi asli dari pembuat
Decide whether a rule belongs in an AGENTS.md / CLAUDE.md file, and write it so it holds. Use before adding, editing, or removing any instruction in a root or nested AGENTS.md, when a convention keeps getting broken and someone proposes documenting it, when reviewing a diff that touches one, or when a file has grown and needs a trim. Carries the enforcement-tag convention (`[lint: <id>]` / `[review]`), the six configuration smells to check against, and the size budget. Trigger terms: AGENTS.md, CLAUDE.md, agent instructions, context file, add a rule, document this convention, the file is too l
repo: PostHog/posthog
Popularitas
- Bintang GitHub
- 41k
- Peringkat
- #6813
- 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.
formatting-slack-messages
41kMembantu agent Anda membuat pesan, modal, dan layar beranda Slack yang jelas dengan tata letak yang tepat, diperiksa sesuai aturan Slack terkini.
Skill serupa
add-model-provider
394kMemungkinkan agent Anda menghubungkan penyedia model AI baru ke OpenClaw dengan perintah pengaturan yang aman, menjaga kunci API tetap di luar teks biasa, dan menjalankan uji langsung.
acp-router
394kMembantu agent Anda mengirim tugas ke asisten pemrograman seperti Claude Code atau Cursor lewat OpenClaw, sehingga pekerjaan dijalankan di alat tersebut.
browser-automation
394kMengajari agent Anda mengendalikan halaman web langkah demi langkah, termasuk login, tab, dan pemulihan saat halaman berhenti merespons.