editing-agents-md
Was er macht
Dieser Skill hilft dir auszuwählen, was in die Anweisungsdateien gehört, die KI-Coding-Werkzeuge zu Beginn jeder Sitzung lesen. Er richtet sich an Menschen, die diese Dateien pflegen und kurz und hilfreich halten wollen.
Wann du ihn nutzt
- ✓Wenn du eine neue Regel in eine AGENTS.md- oder CLAUDE.md-Datei aufnehmen willst.
- ✓Wenn eine Regel immer wieder missachtet wird und jemand vorschlägt, sie aufzuschreiben.
- ✓Wenn eine Anweisungsdatei zu lang geworden ist und gekürzt werden muss.
Link zum Skill
https://github.com/PostHog/posthog/blob/master/.agents/skills/editing-agents-md/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Hilf mir zu entscheiden, ob diese Regel in meine CLAUDE.md gehört, und formuliere sie so um, dass die KI sie befolgt.”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Zuerst fragt der Skill, ob ein anderer Mechanismus wie ein Linter oder ein Test die Regel durchsetzen könnte. Die Regel bleibt nur in der Datei, wenn nichts Besseres passt, und sie wird klar umformuliert.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von 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
Häufige Fragen
Warum nicht einfach jede Regel in die Datei schreiben?
Jede Zeile wird in jede Sitzung geladen. Lange Dateien kosten deshalb mehr und helfen nicht immer, Regeln einzuhalten. Kurze, prägnante Dateien funktionieren besser.
Gilt das auch für CLAUDE.md-Dateien?
Ja. Der gleiche Rat gilt für AGENTS.md und CLAUDE.md, weil beide zu Beginn jeder Sitzung geladen werden.
Sollte ich eine Regel nach oben im Dokument verschieben, damit die KI sie sieht?
Meist nicht. Die Forschung hinter diesem Skill zeigt, dass die Position nicht zuverlässig ändert, ob ein Agent eine Regel befolgt. Sortiere nur um, damit Menschen einen Abschnitt schneller finden.
Details
Originalbeschreibung des Autors
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
Beliebtheit
- GitHub-Sterne
- 41k
- Platz im Ranking
- #6813
- Lizenz
- —
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
depot-ci
41kBringt deinem Agenten bei, Depot-CI-Workflows einzurichten, bestehende Workflows zu migrieren und Laufprotokolle auszuwerten.
depot-container-builds
41kHilft deinem Agenten, Docker-Images auf Depot-Remote-Buildern zu bauen, mit Multi-Plattform-Images, Registry-Push und Fehlerbehebung.
depot-github-runners
41kLässt deinen Agenten GitHub-Actions-Jobs auf Depot-Runnern laufen, mit passender Runner-Größe und Labels, und hilft bei Einrichtungsfehlern.
formatting-slack-messages
41kHilft deinem Agenten, klare Slack-Nachrichten, Modals und Startseiten mit dem richtigen Layout zu bauen und gegen die aktuellen Regeln von Slack zu prüfen.
Ähnliche Skills
add-model-provider
394kLässt deinen Agenten einen neuen KI-Modellanbieter mit sicheren Befehlen an OpenClaw anbinden, API-Schlüssel nicht im Klartext speichern und einen Live-Test starten.
acp-router
394kHilft deinem Agenten, eine Aufgabe über OpenClaw an einen Coding-Assistenten wie Claude Code oder Cursor zu senden, damit die Arbeit in diesem Tool läuft.
browser-automation
394kBringt deinem Agenten bei, Webseiten Schritt für Schritt zu steuern, einschließlich Anmeldungen, Tabs und Wiederherstellung, wenn eine Seite nicht mehr reagiert.