self-modifying-code
What it does
This skill explains how an agent may change an app's own components and styles, and which config and framework files are off limits. It is for developers designing an app that the agent is expected to edit.
When to use it
- βWhen you design an app that the agent is expected to change itself.
- βWhen you are deciding whether a file is safe for the agent to edit.
- βWhen the agent is tempted to edit config, environment files, or framework packages.
Skill link
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/self-modifying-code/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βLet the agent change the layout of this page, but make sure it does not touch my settings or environment files.β
5 new skills a week. 1 minute to read.
How it works
Changes are grouped into tiers. Data and source files are allowed with checks, config needs approval, and secrets and framework packages are never modified.
Technical content (original SKILL.md)
Original text by the author, straight from 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, 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
FAQ
Can the agent edit .env files?
No. Environment files are in the off-limits tier.
What checks run after source code changes?
The skill says to run typecheck and lint after source edits.
Who approves config changes?
The user must give explicit approval before package or build config files are changed.
Details
Original description by the author
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
Popularity
- GitHub stars
- 7.6k
- Ranking position
- #13181
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
design-exploration
7.6kHelps your agent explore several UI design directions side by side, let you pick one, and then refine the chosen design.
visual-edit
7.6kHelps your agent open a running local app in a visual editor so you can review and edit its real screens together.
turn-into-app
7.6kTurns a workflow, spreadsheet or project into a polished visual app, with populated screens and an agent working behind the controls.
visual-plan
7.6kTurns a plain text plan into an interactive visual plan with diagrams, file maps, code snippets and open questions.
Similar skills
add-model-provider
394kLets your agent connect a new AI model provider to OpenClaw using safe setup commands, keep API keys out of plain text, and run a live test.
acp-router
394kHelps your agent send a task to a coding assistant such as Claude Code or Cursor through OpenClaw, so the work runs in that tool.
browser-automation
394kTeaches your agent to control web pages step by step, including logins, tabs, and recovery when a page stops responding.