شعار Dont Repeat Yourself

Dont Repeat Yourself

المجتمع
marekkirejczyk
dont-repeat-yourself

Find every concept implemented more than once in a scope (a repository, a PR, a directory, a concept) and give it one well-tested implementation. Identical copies are extracted automatically; behaviour differences and high-stakes code are brought to you for a decision at the end.

نظرة عامة

الناشرmarekkirejczyk
المستودعskills
اسم المهارةdont-repeat-yourself
النجوم
157
التفريعات
1
الملفات المرفقة
1
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 1

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها marekkirejczyk على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Dont Repeat Yourself في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/marekkirejczyk/skills/tree/main/skills/dont-repeat-yourself
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/marekkirejczyk/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/dont-repeat-yourself .claude/skills/dont-repeat-yourself
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Dont Repeat Yourself في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Dont Repeat Yourself تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Dont Repeat Yourself بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Don't repeat yourself

Find every concept implemented more than once in a scope and give it one well-tested implementation. Arguments: $ARGUMENTS. If your agent does not fill that in, take them from the user's message.

The scope is what the user names: the repository, a PR or branch, a directory, a file, a module, or a concept ("everything about dates"). With no scope given, use the whole repository.

For a PR, compare its new code against the whole repository:

  • A helper already exists: the PR's code reuses it.
  • The PR adds a second copy and no helper exists: extract it and replace both copies, even if the older one is outside the PR.
  • Other copies outside the PR: report them and leave them.

Run phase 1 from start to finish without asking for approval. Phase 2 is the only time you ask the user anything.

Goal

Each concept has one implementation, so a change to it is a change in one place.

You are done when all of these hold:

  1. Every unit in scope is inventoried, and every cluster of copies has been compared.
  2. Every cluster is resolved: extracted, left for a stated reason, or decided by the user.
  3. Every extraction is complete: all its call sites use the shared code, and the old copies are gone.
  4. Helpers live together: the local helpers on a shared module's subject have moved into it.

What counts as a duplicate

A cluster is two or more implementations of one concept. Look for the intention, not matching text: three ways of writing "today / yesterday / a minute ago" are one cluster. Inline blocks count as well as named helpers, and so do route types that describe the same contract.

  • Non-trivial logic: two copies are enough.
  • A one- or two-line expression: three or more copies.
  • A pure pass-through wrapper is a duplicate of what it wraps: remove it and call the wrapped code directly.

Work mainly within one layer. Across layers, extract only pure functions, placed where the project's dependency rules allow. Other cross-layer duplication is report-only, because the fix is moving a rule, which is a different change.

Rules

These hold after every round. A round that breaks one is undone.

  1. Semantics stay the same, except where the user approves unifying a behaviour in phase 2.
  2. Lint, type checks, build and tests pass, using the project's own commands. They must pass before you start: if they fail, stop and report it.
  3. Callers' tests stay as they are, except for shared test helpers and fixtures, and expected values in a unification the user approved. Expected values stay written out in each test.
  4. External contracts keep working: published package exports, public API routes and fields, database tables and columns, serialized keys, event names, environment variables, config keys and CLI flags. A replaced published helper stays as a thin export of the new one.

Identical behaviour

Copies are identical only if you have compared every branch and found the same result for each of:

  • boundaries, rounding and units
  • empty, null and invalid input
  • time zones, locale and text
  • errors thrown or swallowed
  • side effects, their order, and logging

Any difference, however small, means the cluster goes to phase 2.

Extractions

  • A pure function wherever possible, named for its concept.
  • In the nearest existing module for that subject, or a new module named for the subject when none fits. Generic utils or helpers modules are never the destination.
  • With its own test file, using examples taken from every former call site, written before the call sites move. Those examples prove each site's nuances survived.

Moving helpers together

When an extraction creates or extends a module, look through every file that extraction touched. Move local helpers about the module's subject into it, even those with a single caller. A helper bound to its caller's private state stays, and so do helpers on other subjects.

A move is phase 1 work, in its own commit, separate from the extraction. Existing tests move with the helper. Add direct tests for a non-trivial helper that has none.

Phase 1: extract what is safe

  1. Baseline. On a new branch, run lint, type checks, build and tests, and record the results. Done when all pass.
  2. Inventory. Write one line of intent for every function, type and notable inline block in scope, grouped by layer. Use a subagent per layer where your agent has them. Done when every unit in scope has a line.
  3. Cluster. Compare intents within each layer, then pure functions across layers. For each cluster, list its call sites and every behavioural difference. Sort each cluster into one of:
    • Extract now: clearly one concept, behaviour identical, outside high-stakes code.
    • Ask: any behavioural difference; copies that match but may be separate concepts (a request type and a database row type); or anything in high-stakes code, even when identical: money, auth and permissions, data migrations, concurrency or locking.
    • Report only: cross-layer duplication that isn't a shareable pure function.
  4. Extract in rounds. One cluster per round: tests first, then the shared code, then every call site, then delete the old copies. Run the checks and commit. If a check goes red, undo the round and move the cluster to Ask. Leave the branch unpushed. Done when every Extract now cluster is applied.
  5. Move helpers, as above.
  6. Sweep. Search the scope again for each extracted concept. Done when no copy remains and all checks pass.

Phase 2: ask

Present every Ask cluster in one batch, as numbered items, each with:

  • the call sites, as file:line
  • the shared intention
  • every exact difference
  • the proposed function signature
  • your recommendation: unify on one behaviour (say which), keep the differences as options, or leave separate

Recommend leaving separate when keeping the differences would take more than 2–3 options.

Apply the user's answers in the same session, one commit per cluster, under the same rules and test-first order. A cluster the user does not answer stays as it is.

Report

  • Clusters extracted, helpers moved, wrappers removed, and copies deleted.
  • Decisions the user made, and every caller whose behaviour changed because of one.
  • Clusters left, and why.
  • Report-only cross-layer duplication, and copies outside a PR scope.
  • Check results before and after.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Dont Repeat Yourself؟

Find every concept implemented more than once in a scope (a repository, a PR, a directory, a concept) and give it one well-tested implementation. Identical copies are extracted automatically; behaviour differences and high-stakes code are brought to you for a decision at the end.

لماذا تستخدم Dont Repeat Yourself على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Dont Repeat Yourself عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Dont Repeat Yourself في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/marekkirejczyk/skills/tree/main/skills/dont-repeat-yourself. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Dont Repeat Yourself؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Dont Repeat Yourself؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Dont Repeat Yourself معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Dont Repeat Yourself مجانية؟

نعم. نشرها marekkirejczyk على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇