self-modifying-code
Skill này làm gì
Skill này giải thích cách agent có thể thay đổi các component và kiểu dáng của ứng dụng, và những file cấu hình, framework nào nằm ngoài giới hạn. Skill dành cho lập trình viên thiết kế một ứng dụng mà agent được kỳ vọng sẽ tự chỉnh sửa.
Khi nào nên dùng
- ✓Khi bạn thiết kế một ứng dụng mà agent được kỳ vọng tự thay đổi.
- ✓Khi bạn quyết định một file có an toàn để agent chỉnh sửa hay không.
- ✓Khi agent bị cám dỗ sửa file cấu hình, file môi trường hoặc package framework.
Liên kết skill
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/self-modifying-code/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Cho phép agent thay đổi bố cục của trang này, nhưng đảm bảo nó không chạm vào cài đặt hoặc file môi trường của tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Các thay đổi được nhóm theo tầng. Dữ liệu và file nguồn được phép với kiểm tra, cấu hình cần phê duyệt, còn bí mật và package framework không bao giờ được sửa.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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, orpatchedDependenciesthat target any@agent-native/*packagepnpm 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:
- Commit or stash current state
- Make the edit
- Run
pnpm typecheck && pnpm lint - If verification fails → revert with
git checkout -- <file> - 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
.envfiles or files containing secrets - Don't modify
@agent-native/core,@agent-native/dispatch, or other@agent-native/*package internals (including undernode_modules) - Don't confuse readable package source with app-owned code: use
customizing-agent-nativeandagent-native ejectfor supported ownership transfer - Don't use
pnpm patch/pnpm patch-commit, commitpatches/artifacts, or addpnpm.patchedDependenciesto "make the app run" after a version bump - Don't add
pnpm.overrides/patchedDependencies/resolutionsfor@agent-native/*to paper over a broken upgrade - Don't invent local
Câu hỏi thường gặp
Agent có sửa được file .env không?
Không. File môi trường nằm trong tầng bị cấm.
Những kiểm tra nào chạy sau khi sửa code nguồn?
Skill nói nên chạy typecheck và lint sau khi sửa nguồn.
Ai phê duyệt thay đổi cấu hình?
Người dùng phải đưa ra phê duyệt rõ ràng trước khi file package hoặc cấu hình build được thay đổi.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 7.6k
- Vị trí xếp hạng
- #13181
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
design-exploration
7.6kGiúp agent của bạn khám phá nhiều hướng thiết kế giao diện song song, để bạn chọn một hướng rồi tinh chỉnh thiết kế đã chọn.
visual-edit
7.6kGiúp agent của bạn mở một ứng dụng cục bộ đang chạy trong trình chỉnh sửa trực quan, để bạn xem và sửa các màn hình thật cùng nhau.
turn-into-app
7.6kBiến quy trình, bảng tính hoặc dự án thành ứng dụng trực quan có màn hình đầy đủ dữ liệu, với agent làm việc phía sau các điều khiển.
visual-plan
7.6kBiến một kế hoạch viết bằng văn bản thuần thành kế hoạch trực quan tương tác, có sơ đồ, bản đồ file, đoạn code và các câu hỏi còn mở.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.