
Self Modifying Code
- 5 installs
- 4.4k repo stars
- Updated August 2, 2026
- builderio/agent-native
self-modifying-code is an agent-native framework skill describing how an agent can safely edit the app's own source code across a tiered modification taxonomy.
About
A skill for the agent-native framework covering how an agent can safely modify the app's own source code. A developer follows it when the agent needs to edit components, routes, styles, or scripts, or when designing an app to be agent-editable. It sets a tiered taxonomy of what to modify and a git-checkpoint plus typecheck/lint safety pattern.
- Defines a 4-tier modification taxonomy from data files to off-limits secrets/framework
- Prescribes a git checkpoint pattern with pnpm typecheck && pnpm lint before source edits
- Recommends exposing UI state via data-* attributes and window.__appState for editability
Self Modifying Code by the numbers
- 5 all-time installs (skills.sh)
- Ranked #13,035 of 16,556 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 3, 2026 (Skillselion catalog sync)
self-modifying-code capabilities & compatibility
- Capabilities
- refactoring · code review
- Use cases
- refactoring
What self-modifying-code says it does
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.
Before modifying source code (Tier 2+), create a rollback point:
Don't modify `.env` files or files containing secrets
npx skills add https://github.com/builderio/agent-native --skill self-modifying-codeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 5 |
|---|---|
| repo stars | ★ 4.4k |
| Last updated | August 2, 2026 |
| Repository | builderio/agent-native ↗ |
What it does
Guide the agent to safely edit an app's own components, routes, styles, or scripts with rollback checkpoints.
Who is it for?
Designing an app the agent can change and defining what edits are safe versus off-limits.
Skip if: Editing .env files, secrets, or @agent-native/core package internals.
When should I use this skill?
The agent needs to edit components, routes, styles, or scripts, or when designing UI for agent editability.
What you get
Agent source edits are tiered, checkpointed, and verified with typecheck and lint before landing.
By the numbers
- Defines a 4-tier modification taxonomy
- Lists a 5-step git checkpoint pattern
Files
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/core internals | Never modify these |
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).
Don't
- Don't modify
.envfiles or files containing secrets - Don't modify
@agent-native/corepackage internals - Don't modify
.agents/skills/orAGENTS.mdunless explicitly requested - Don't skip the typecheck/lint step after editing source code
- Don't make source changes without a git checkpoint to roll back to
Related Skills
- files-as-database — Tier 1 modifications (data files) are the safest and most common
- scripts — The agent can create or modify scripts to add new capabilities
- delegate-to-agent — Self-modification requests come through the agent chat
- sse-file-watcher — Source and data file edits trigger SSE events to update the UI