editing-agents-md
ما الذي تفعله
تساعدك هذه المهارة على اختيار ما يُكتب في ملفات التعليمات التي تقرؤها أدوات البرمجة بالذكاء الاصطناعي عند بداية كل جلسة. وهي مناسبة لمن يحافظ على هذه الملفات ويريدها قصيرة ومفيدة.
متى تستخدمها
- ✓عندما تريد إضافة قاعدة جديدة إلى ملف AGENTS.md أو CLAUDE.md.
- ✓عندما تُكسر قاعدة مراراً، ويقترح أحدهم كتابتها في الملف.
- ✓عندما يطول ملف التعليمات ويحتاج إلى تقليص.
رابط المهارة
https://github.com/PostHog/posthog/blob/master/.agents/skills/editing-agents-md/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“ساعدني في تحديد ما إذا كانت هذه القاعدة تنتمي إلى ملف CLAUDE.md، وأعد كتابتها كي يلتزم بها الذكاء الاصطناعي.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تسأل المهارة أولاً إن كانت آلية أخرى، مثل أداة الفحص أو الاختبار، تستطيع فرض القاعدة. وتُبقي القاعدة في الملف فقط إذا لم يوجد ما هو أفضل، وتعيد كتابتها بوضوح.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من 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
الأسئلة الشائعة
لماذا لا نضع كل القواعد في الملف؟
كل سطر يُحمَّل في كل جلسة، فالملفات الطويلة تزيد التكلفة ولا تساعد دائماً الذكاء الاصطناعي على اتباع القواعد. الملفات القصيرة والمحكمة أفضل.
هل تنطبق هذه النصيحة على ملفات CLAUDE.md أيضاً؟
نعم. تنطبق النصيحة نفسها على AGENTS.md وCLAUDE.md، لأن كليهما يُحمَّل في بداية كل جلسة.
هل أنقل القاعدة إلى أعلى الملف كي يراها الذكاء الاصطناعي؟
عادةً لا. أظهرت الأبحاث التي تقوم عليها المهارة أن الموضع لم يغيّر بشكل موثوق التزام الوكيل بالقاعدة، لذلك لا تُعيد الترتيب إلا لتسهيل إيجاد القسم.
التفاصيل
الوصف الأصلي من المؤلف
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
الشعبية
- نجوم GitHub
- 41k
- الترتيب
- #6813
- الترخيص
- —
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
depot-ci
41kيساعد وكيلك على إعداد سير عمل Depot CI وتشغيله، وهو بديل لـ GitHub Actions، بما في ذلك نقل سير العمل الحالي وقراءة سجلات التشغيل.
depot-container-builds
41kيساعد وكيلك على بناء صور Docker على بُنّاة Depot البعيدين، بما في ذلك الصور متعددة المنصات والدفع إلى السجلات وإصلاح أخطاء البناء.
depot-github-runners
41kيساعد وكيلك على نقل مهام GitHub Actions إلى مشغّلات Depot المُدارة، واختيار أحجامها وتسمياتها، وإصلاح مشاكل إعدادها.
formatting-slack-messages
41kيساعد وكيلك على بناء رسائل Slack ونوافذ الحوار وشاشات الصفحة الرئيسية بتخطيط واضح، ومراجعتها وفق قواعد Slack الحالية.
مهارات مشابهة
add-model-provider
394kتتيح لوكيلك ربط مزوّد نموذج ذكاء اصطناعي جديد بـ OpenClaw باستخدام أوامر إعداد آمنة، وإبقاء مفاتيح API خارج النص العادي، وإجراء اختبار حي.
acp-router
394kيساعد وكيلك على إرسال مهمة إلى مساعد برمجة مثل Claude Code أو Cursor عبر OpenClaw، فيعمل العمل داخل تلك الأداة.
browser-automation
394kتعلّم وكيلك التحكم في صفحات الويب خطوة بخطوة، بما في ذلك تسجيل الدخول والتبويبات والتعافي عندما تتوقف الصفحة عن الاستجابة.