Skillpedia
الوكلاء7.6k · #13181

self-modifying-code

ما الذي تفعله

تشرح هذه المهارة كيف يجوز للوكيل تغيير مكونات التطبيق وأنماطه، وأي ملفات إعداد وإطار تبقى خارج الحدود. وهي مخصصة للمطورين الذين يصممون تطبيقاً يُتوقع من الوكيل تعديله.

متى تستخدمها

  • ✓عندما تصمم تطبيقاً يُتوقع أن يغيّره الوكيل بنفسه.
  • ✓عندما تقرر إن كان الملف آمناً لتعديل الوكيل.
  • ✓عندما يكون الوكيل مغرياً بتعديل ملفات الإعداد أو البيئة أو حزم الإطار.

رابط المهارة

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/self-modifying-code/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/self-modifying-code/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“اسمح للوكيل بتغيير تخطيط هذه الصفحة، لكن تأكد من أنه لا يلمس إعداداتي أو ملفات البيئة.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تُقسم التغييرات إلى مستويات. البيانات وملفات المصدر مسموحة مع فحوصات، والإعدادات تحتاج إلى موافقة، والأسرار وحزم الإطار لا تُعدّل أبداً.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Self-Modifying Code

Rule

The agent can edit the app's own source code — components, routes, styles, scripts. This is a feature, not a bug. Design your app expecting this.

Why

An agent-native app isn't just an app the agent can use — it's an app the agent can change. The agent can fix bugs, add features, adjust styles, and restructure code. This makes the agent a true collaborator, not just an operator.

Modification Taxonomy

Not all modifications are equal. Use this to decide what level of care is needed:

Tier What Examples After modifying
1: Data Files in data/ JSON state, generated content, markdown Nothing — these are routine
2: Source App code Components, routes, styles, scripts Run pnpm typecheck && pnpm lint
3: Config Project config package.json, tsconfig.json, vite.config.* Ask for explicit approval first
4: Off limits Secrets and framework .env, @agent-native/* packages & overrides Never modify these

Tier 4 includes all of the following — not only editing package source:

  • Files under node_modules/@agent-native/* (core, dispatch, scheduling, …)
  • pnpm.overrides, overrides, resolutions, or patchedDependencies that target any @agent-native/* package
  • pnpm patch, pnpm patch-commit, or local package patch artifacts for any dependency
  • Invented "dispatch/core behavior" shims meant to paper over a version skew or failed upgrade

This does not prohibit intentional app-owned UI customization. When public props and composition are insufficient, the customizing-agent-native skill uses agent-native eject to transfer the smallest supported unit from the installed package into the app. The ejected unit must keep public runtime contracts and must not replace Core auth, DB, actions, agent execution, or transport behavior. Manual copying is only the fallback described by an unknown third-party package's add-style blueprint.

When an older branch needs current packages, use agent-native upgrade (see the upgrade-agent-native skill). If upgrade or typecheck fails, fix app code or stop and ask — do not patch the framework.

Git Checkpoint Pattern

Before modifying source code (Tier 2+), create a rollback point:

  1. Commit or stash current state
  2. Make the edit
  3. Run pnpm typecheck && pnpm lint
  4. If verification fails → revert with git checkout -- <file>
  5. If verification passes → continue

This ensures the agent can experiment without breaking the app.

Designing for Agent Editability

Make your app easy for the agent to understand and modify:

Expose UI state via data-* attributes so the agent knows what's selected:

const el = document.documentElement;
el.dataset.currentView = view;
el.dataset.selectedId = selectedItem?.id || "";

Expose richer context via window.__appState for complex state:

(window as any).__appState = {
  selectedId: id,
  currentLayout: layout,
  itemCount: items.length,
};

Use configuration-driven rendering — Extract visual decisions (colors, layouts, sizes) into JSON config files in data/. The agent can modify the config (Tier 1) instead of the component source (Tier 2).

Keep localized copy in catalogs — When editing visible UI copy, labels, toasts, empty states, prompts, or formatting, update the English source catalog. Read the optional internationalization skill and update additional catalogs only when translations.locales in agent-native.config.ts includes them.

Don't

  • Don't modify .env files or files containing secrets
  • Don't modify @agent-native/core, @agent-native/dispatch, or other @agent-native/* package internals (including under node_modules)
  • Don't confuse readable package source with app-owned code: use customizing-agent-native and agent-native eject for supported ownership transfer
  • Don't use pnpm patch / pnpm patch-commit, commit patches/ artifacts, or add pnpm.patchedDependencies to "make the app run" after a version bump
  • Don't add pnpm.overrides / patchedDependencies / resolutions for @agent-native/* to paper over a broken upgrade
  • Don't invent local
الأسئلة الشائعة

هل يستطيع الوكيل تعديل ملفات .env؟

لا. ملفات البيئة في المستوى الممنوع.

ما الفحوصات التي تعمل بعد تغييرات كود المصدر؟

تنص المهارة على تشغيل فحص الأنواع والتدقيق بعد تعديلات المصدر.

من يوافق على تغييرات الإعدادات؟

يجب أن يعطي المستخدم موافقة صريحة قبل تغيير ملفات حزم الإعداد أو البناء.

التفاصيل

الوصف الأصلي من المؤلف

Tiers, checkpoints, and off-limits paths for an agent editing the app's own source. Use when designing UI for agent editability, deciding whether a file is safe for the agent to change, or when tempted to patch config, `.env`, or an `@agent-native/*` package. Do not load it for ordinary source edits.

repo: BuilderIO/agent-native

الشعبية

نجوم GitHub
7.6k
الترتيب
#13181
الترخيص
MIT
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة