شعار Git Cleanup

Git Cleanup

مؤسسة
SpecterOps
git-cleanup

Repository hygiene — prune merged/stale branches, detect orphans, repo health checks. Use when cleaning up branches, checking repo health, or scanning projects.

نظرة عامة

الناشرSpecterOps
المستودعskills
اسم المهارةgit-cleanup
النجوم
706
التفريعات
80
الملفات المرفقة
3
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

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

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

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

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

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

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

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

التثبيت

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

1

التثبيت في TypingMind

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

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/SpecterOps/skills/tree/main/plugins/workflows-development/skills/git-cleanup
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

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

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

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

استخدمها في TypingMind

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

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

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

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

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

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

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

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

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

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

Git Repository Cleanup

Repository hygiene: prune branches, detect stale work, and check repo health.

Parse the user's input to determine the action:

  • $git-cleanup or $git-cleanup branches — find and prune merged/stale branches
  • $git-cleanup stale [days] — branches with no commits in N days (default 30)
  • $git-cleanup health — large files, dangling refs, worktrees, repo size
  • $git-cleanup all — scan all git repos under ~/Projects/

Prerequisites

  1. Verify we're in a git repository (git rev-parse --is-inside-work-tree) — except for all action which scans directories
  2. If not in a git repo (and not using all), tell the user and stop

Protected Branches

The following branches are NEVER suggested for deletion: main, master, develop

Action: branches (default)

  1. Fetch latest remote state: git fetch --prune
  2. Identify the default branch (git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null or fall back to main/master)
  3. Find merged branches:
    • git branch --merged <default> — local branches already merged into default
    • Exclude protected branches and current branch
  4. Find branches with deleted remotes:
    • git branch -vv — look for [origin/...: gone] entries
  5. Present findings as a dry-run preview:
    • List branches that can be safely deleted (merged)
    • List branches whose remote is gone
    • Show last commit date and message for each
  6. Ask the user which branches to delete (or "all listed")
  7. On confirmation, delete with git branch -d <branch> (safe delete)
  8. If a branch fails -d (unmerged), warn the user and offer -D with explicit explanation that commits may be lost — only proceed with user confirmation

Action: stale [days]

  1. Default to 30 days if no argument provided
  2. For each local branch (excluding protected branches):
    • Get last commit date: git log -1 --format='%ci' <branch>
    • Calculate age in days
  3. List branches older than the threshold, sorted by age (oldest first)
  4. Show for each: branch name, last commit date, last commit message, age in days
  5. Present as dry-run preview — ask before deleting
  6. On confirmation, use git branch -d first; offer -D only with warning if unmerged

Action: health

Run a comprehensive repository health check:

  1. Repository size:

    • .git directory size: du -sh .git
    • Working tree size: du -sh . --exclude=.git (or equivalent)
    • Object count: git count-objects -vH
  2. Large files (top 10 by size in history):

    • git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print $3, $4}' | sort -rn | head -10
    • Flag files over 10MB
  3. Dangling objects:

    • git fsck --no-reflogs 2>&1 — look for dangling commits, blobs, trees
    • Report count and suggest git gc if significant
  4. Worktrees:

    • git worktree list — show active worktrees
  5. Remote status:

    • git remote -v — list remotes
    • Check if local is ahead/behind remote
  6. Stale tracking branches:

    • git remote prune origin --dry-run — branches that would be pruned
  7. Present findings with recommendations

  8. If cleanup is recommended (gc, prune), show the commands but always ask before running them

Action: all

  1. Find all git repositories under ~/Projects/:
    • find ~/Projects -maxdepth 3 -name .git -type d
  2. For each repository found: a. Show repo name and path b. Run the branches check (merged + gone remotes) c. Show summary: N merged branches, M gone-remote branches
  3. Per-repo confirmation — ask before deleting branches in each repo
  4. Show overall summary at the end

Safety Rules

  1. Never delete without confirmation — always preview first
  2. Never delete protected branches (main, master, develop)
  3. Never git push origin --delete on protected branches
  4. Never run git gc without asking
  5. Always preview first — every action starts as a dry run
  6. Per-repo confirmation for all — don't batch-delete across repos
  7. Use git branch -d (safe delete) first; only offer -D with explicit warning

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

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

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

ماذا تفعل مهارة الذكاء الاصطناعي Git Cleanup؟

Repository hygiene — prune merged/stale branches, detect orphans, repo health checks. Use when cleaning up branches, checking repo health, or scanning projects.

لماذا تستخدم Git Cleanup على TypingMind؟

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

كيف أثبّت Git Cleanup في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/SpecterOps/skills/tree/main/plugins/workflows-development/skills/git-cleanup. يقرأ TypingMind ملف SKILL.md الخاص بها، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Git Cleanup؟

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

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Git Cleanup؟

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

هل مهارة الذكاء الاصطناعي Git Cleanup مجانية؟

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

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

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

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

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

عرض الكل

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

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