antfu
ما الذي تفعله
تمنح هذه المهارة الذكاء الاصطناعي مجموعة من عادات الكود واختيارات الأدوات لمشاريع JavaScript وTypeScript. وهي للمطورين الذين يريدون إعداد مشاريعهم الجديدة بطريقة نظيفة ومتسقة.
متى تستخدمها
- ✓عندما تبدأ مشروع TypeScript جديدًا وتريد إعدادًا نظيفًا وقياسيًا.
- ✓عندما تريد تقسيم الكود إلى ملفات واضحة مع فصل الأنواع.
- ✓عندما تحتاج إلى مساعدة في اختيار أدوات التدقيق أو النشر أو المستودعات الأحادية.
رابط المهارة
https://github.com/antfu/skills/blob/main/skills/antfu/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أعد إعداد مشروع مكتبة TypeScript جديد باستخدام أعراف حديثة ونظيفة.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يتبع الوكيل توجيهات مكتوبة عن تنظيم الملفات والتعامل مع الأنواع وملاحظات وقت التشغيل والأدوات، ويستخدم مشروع بداية مرجعيًا كنموذج.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Reference template: antfu/starter-ts. When scaffolding a new TypeScript project, mirror its
package.jsonscripts,eslint.config.js,knip.json,tsdown.config.tsand workflows rather than inventing a new layout.
Coding Practices
Code Organization
- Single responsibility: Each source file should have a clear, focused scope/purpose
- Split large files: Break files when they become large or handle too many concerns
- Type separation: Always separate types and interfaces into
types.tsortypes/*.ts - Constants extraction: Move constants to a dedicated
constants.tsfile
Runtime Environment
- Prefer isomorphic code: Write runtime-agnostic code that works in Node, browser, and workers whenever possible
- Clear runtime indicators: When code is environment-specific, add a comment at the top of the file:
// @env node
// @env browser
TypeScript
- Explicit return types: Declare return types explicitly when possible
- Avoid complex inline types: Extract complex types into dedicated
typeorinterfacedeclarations
Explicitness
Favor explicit, traceable code over implicit "magic". A reader (human or agent) should be able to follow where every name comes from without running tooling.
- Explicit imports: Prefer explicit
importstatements. Avoid auto-imports — when a framework provides them (e.g. Nuxt/Nitro), turn them off for new projects (see app-development). - No path aliases by default: Use relative imports (
./foo,../bar). Only use path aliases (@/,~/,#imports, etc.) when they are already configured in the project; don't introduce new ones for greenfield code.
Comments
- Avoid unnecessary comments: Code should be self-explanatory
- Explain "why" not "how": Comments should describe the reasoning or intent, not what the code does
Testing (Vitest)
- Test files:
foo.ts→foo.test.ts(same directory) - Use
describe/itAPI (nottest) - Use
toMatchSnapshotfor complex outputs - Use
toMatchFileSnapshotwith explicit path for language-specific snapshots
Tooling Choices
@antfu/ni Commands
| Command | Description |
|---|---|
ni |
Install dependencies |
ni <pkg> / ni -D <pkg> |
Add dependency / dev dependency |
nr <script> |
Run script |
nu |
Upgrade dependencies |
nun <pkg> |
Uninstall dependency |
nci |
Clean install (pnpm i --frozen-lockfile) |
nlx <pkg> |
Execute package (npx) |
Checking npm Package Versions
Use fast-npm-meta to look up the latest version of a package — it queries a small metadata endpoint instead of downloading the full registry payload (which can be megabytes per package).
nlx fast-npm-meta version vite # 7.3.1
nlx fast-npm-meta version "nuxt@^3.5" # 3.5.22 — range-aware
nlx fast-npm-meta version vite nuxt vue # multiple at once
nlx fast-npm-meta version vite --json # JSON for scripting
nlx fast-npm-meta full vite # full version list + dist-tags
Prefer this over npm view <pkg> version when you only need the latest version, and over reading package.json from the registry directly.
TypeScript Config
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
}
ESLint Setup
// eslint.config.js
import antfu from '@antfu/eslint-config'
export default antfu({
type: 'lib', // or 'app' (default)
pnpm: true, // enforce pnpm catalogs in package.json
antislop: true, // flag redundant/duplicated AI-style code, ban explicit `any`
})
Always enable antislop: true. It requires eslint-plugin-slop and eslint-plugin-sonarjs as dev dependencies.
For detailed configuration options: antfu-eslint-config
Knip
Use Knip to catch unused files, exports and dependencies — the linter only sees one file at a time.
// knip.json
{
"$schema": "https://unpkg.com/knip@6/schema.json",
"project": ["src/**/*.ts"],
"ignoreDependencies": []
}
Fix what Knip reports by deleting; only add to ignoreDependencies for tools invoked outside `p
الأسئلة الشائعة
هل تعمل فقط مع مشاريع Anthony Fu؟
لا، هي مجموعة من الأعراف يستطيع أي شخص تطبيقها على مشاريع JavaScript وTypeScript.
هل تعمل مع كود المتصفح والخادم؟
نعم، تفضّل الكود الذي يعمل على Node والمتصفحات وWorkers، وتعلّم الملفات التي تعمل في مكان واحد فقط.
هل تغطي نشر المكتبات؟
نعم، تغطي نشر المكتبات وإعداد المستودعات الأحادية.
التفاصيل
الوصف الأصلي من المؤلف
Anthony Fu's opinionated tooling and conventions for JavaScript/TypeScript projects. Use when setting up new projects, configuring ESLint/Prettier alternatives, monorepos, library publishing, or when the user mentions Anthony Fu's preferences.
repo: antfu/skills
الشعبية
- نجوم GitHub
- 6.0k
- الترتيب
- #14439
- الترخيص
- MIT
- آخر تحديث
- 30/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
antfu-create-pr
6.0kيساعد وكيلك على فتح طلب سحب واضح على GitHub من فرعك، مع ملخص بسيط لما تغيّر ولماذا.
antfu-issue-triage
6.0kيساعد وكيلك على فرز قضايا GitHub وطلبات السحب المفتوحة، فيكشف المكرر والمُصلَح، ثم يسألك قبل أن يتصرف.
antfu-query
6.0kيسألك وكيلك خطوة بخطوة عن خطة أو فكرة، حتى يتفقا على فهم واضح ومُختبَر.
antfu-simplify
6.0kيساعد وكيلك على تقليص تغييرات الكود إلى أصغر نسخة صحيحة، بإزالة الأجزاء غير الضرورية.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.