[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M699NV8JP0AE8FJ9HCR5YAVB":3,"skill-same:01M699NV8JP0AE8FJ9HCR5YAVB":88},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":52,"ownerHtmlUrl":53,"ownerBlogUrl":54,"ownerDescription":55,"updatedAt":56,"install":57,"resources":69},"01M699NV8JP0AE8FJ9HCR5YAVB","edit-app",null,"Use when the user wants to iterate on an existing generated Power Apps mobile app after \u002Fcreate-mobile-app: update Application Insights configuration, the plan, data model, native capabilities, design, screens, generated app code, and preview without restarting the full project flow. Natural-language triggers include 'the app already exists', 'edit my app', 'change this screen', and 'add a feature to this app'.","microsoft\u002Fpower-platform-skills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M699JVYJFB75D9JM70BN4H0Q",1149,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmobile-apps\u002Fskills\u002Fedit-app\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"edit app","app","edit","natural-language","design","opus","screen","apps","triggers","full","project","mobile","power","write","read","plan","capabilities","update","create","power apps","change","2026-11-10 10:12:30",false,"---\nname: edit-app\ndescription: \"Use when the user wants to iterate on an existing generated Power Apps mobile app after \u002Fcreate-mobile-app: update Application Insights configuration, the plan, data model, native capabilities, design, screens, generated app code, and preview without restarting the full project flow. Natural-language triggers include 'the app already exists', 'edit my app', 'change this screen', and 'add a feature to this app'.\"\nuser-invocable: true\nallowed-tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, Task, Skill\nmodel: opus\n---\n\n> **Plugin check**: Run `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-version.js\"` - if it outputs a message, show it to the user before proceeding.\n\n**Shared instructions: [shared-instructions.md](..\u002F..\u002Fshared\u002Fshared-instructions.md)** — read first.\n\n# Edit App (`\u002Fedit-app`)\n\nPost-generation editor for an existing mobile app. `native-app-plan.md` remains the source of truth, but the default outcome is a fixed generated app, not a plan-only diff. After the user approves the plan delta, continue into Dataverse\u002Fnative\u002Fdesign\u002Fscreen mutations, run verification, update `memory-bank.md`, and regenerate the static preview when UI changed.\n\nUse `--plan-only` only when the user explicitly asks to update planning docs without changing app code. Normal follow-up prompts in Copilot Chat Agent mode should apply the app change end to end.\n\n## Edit documentation protocol\n\nKeep two HTML files current during every edit:\n\n- `\u003Cedit-temp-dir>\u002Fedit-app-progress.html` shows the live operation checklist.\n- `docs\u002Fcreate-app-plan.html` remains the living description of the app.\n\nBoth are best-effort documentation. A rendering failure does not authorize a mutation, cancel an\napproval gate, or turn a failed verification into success.\n\n### Progress page\n\nAs soon as Step 0 resolves `working_dir`, before inferred-plan sync or the first progress write, ask\n`app-docs.js` for a namespaced directory inside the user's OS temp directory:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' temp\n```\n\nUse the returned `directory`, `progress`, `progressHtml`, and `sync` paths for the rest of the\nrun. Do not create progress files inside the project. Create `\u003Cedit-temp-dir>\u002Fedit-app-progress.json`\nwith one row per operation this edit will run.\nUse stable IDs such as `inspect`, `impact`, `plan`, `approve`, `save-plan`, `data`, `native`,\n`design`, `screens`, `verify`, `preview`, and `sync-plan`. Omit operations that do not apply.\nEach row has `id`, `label`, `status` (`pending`, `active`, `waiting`, `done`, `skipped`, or\n`failed`), and an optional `note`.\nAdd a top-level `changes` array for the Changes tab.\nKeep it empty during initial inspection.\nAfter Step 2, every entry requires `kind`, `title`, `rationale`, and optional `detail`.\nUse `kind: general` for text-only changes.\nUse structured diagram data for data-model and screen changes:\n\n```json\n{\n  \"changes\": [\n    {\n      \"kind\": \"data-model\",\n      \"title\": \"Add inspection evidence\",\n      \"detail\": \"Create a child table for photos and signatures.\",\n      \"rationale\": \"One inspection can have several evidence records with independent metadata.\",\n      \"dataModel\": {\n        \"tables\": [\n          {\n            \"name\": \"Inspection\",\n            \"columns\": [{ \"name\": \"inspectionid\", \"type\": \"guid\", \"primaryKey\": true }]\n          },\n          {\n            \"name\": \"Evidence\",\n            \"columns\": [\n              { \"name\": \"evidenceid\", \"type\": \"guid\", \"primaryKey\": true },\n              { \"name\": \"inspectionid\", \"type\": \"guid\", \"foreignKey\": true }\n            ]\n          }\n        ],\n        \"relationships\": [\n          {\n            \"from\": \"Inspection\",\n            \"to\": \"Evidence\",\n            \"cardinality\": \"one-to-many\",\n            \"label\": \"contains\"\n          }\n        ]\n      }\n    },\n    {\n      \"kind\": \"screen\",\n      \"title\": \"Add inspection detail\",\n      \"detail\": \"Add a route that shows findings and evidence.\",\n      \"rationale\": \"Inspectors need a focused review surface before updating a record.\",\n      \"screenGraph\": {\n        \"screens\": [\n          { \"id\": \"list\", \"name\": \"Inspections\", \"route\": \"\u002Finspections\" },\n          { \"id\": \"detail\", \"name\": \"Inspection detail\", \"route\": \"\u002Finspections\u002F[id]\" }\n        ],\n        \"edges\": [\n          { \"from\": \"list\", \"to\": \"detail\", \"label\": \"Select inspection\" }\n        ]\n      }\n    }\n  ]\n}\n```\n\nDerive data-model tables, columns, and relationships from the validated schema proposal.\nDerive screen nodes and edges from the updated Screen Map and Navigation Contracts.\nWhen multiple screens are shown, include every navigation edge needed to explain how the user moves\nbetween them.\nDo not hand-author Mermaid source in the payload.\n`app-docs.js` derives and renders the ER diagram or screen graph from the structured data.\nRetain the approved wording, rationale, and graph data through implementation and verification.\n\nRewrite that JSON at every numbered step boundary and run:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' progress \\\n  --json-file '\u003Cedit-temp-dir>\u002Fedit-app-progress.json'\n```\n\nEvery progress payload is a complete snapshot, not a patch.\nCarry every operation row forward and update all rows whose state changed before publishing.\nWhen the top-level phase advances, no row from an earlier phase may remain `active` or `waiting`.\nIn particular, an approval wait must show inspection and planning as complete and the approval row\nas `waiting`.\n\nThe top-level object also carries `phase`, `status`, `note`, `waiting`, and\n`devicePreviewReady`. Set the current row to `waiting` and `waiting: true` before every user\nquestion. Set completed rows to `done`; do not leave the first row active for the whole run. On\nfailure, mark the failed row and top-level status `failed`. The page keeps a phone preview on the\nright while work is active. Keep `devicePreviewReady: false` until this edit's Step 8 phone command\nsucceeds. Then set it to `true` in the final progress write, mark every applicable row settled, and\nset top-level status `done`. A QR left by an earlier run is never current-run preview evidence.\nEvery branch that ends the workflow must publish a terminal progress write. Preserve the operation's\nactual result, mark completed rows `done` or `failed`, mark rows that will not run `skipped`, clear\n`waiting`, and set the top-level status to `done` or `failed`.\n\nOpen `\u003Cedit-temp-dir>\u002Fedit-app-progress.html` once after the first write using the host's file\nopener. If no opener is available, print the absolute path. The page refreshes itself while work\nis active.\n\n### Living app plan\n\n`app-docs.js sync` accepts a structured snapshot, not a prose summary:\n\n```json\n{\n  \"appName\": \"Field inspections\",\n  \"dataPlatform\": \"dataverse\",\n  \"inferred\": false,\n  \"summary\": \"Added inspection detail and evidence capture.\",\n  \"sections\": {\n    \"requirements\": {},\n    \"architecture\": { \"dataPlatform\": \"dataverse\", \"nativeCapabilities\": [], \"connectors\": [] },\n    \"dataModel\": { \"tables\": [] },\n    \"screens\": { \"navigation\": \"\", \"list\": [] },\n    \"design\": {},\n    \"offline\": {},\n    \"trust\": {}\n  },\n  \"sectionStates\": { \"screens\": \"approved\" }\n}\n```\n\nFor an existing plan, include every section this edit changed and omit unchanged sections. Serialize\nthe complete current section after implementation; the sync command replaces that section so\nremoved screens, connectors, capabilities, and tables do not survive as stale rows. Build values\nfrom the verified app and its durable plan, not from the pre-approval proposal.\n\nWrite the payload to `\u003Cedit-temp-dir>\u002Fapp-plan-sync.json`, then run:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' sync \\\n  --json-file '\u003Cedit-temp-dir>\u002Fapp-plan-sync.json'\n```\n\nIf `docs\u002F.run-plan.json` is missing, the payload must cover every section that can be derived from\nthe app: routes and layouts for `screens`, generated models\u002Fservices and the manifest for\n`dataModel`, `power.config.json` plus generated registrations for connectors, `src\u002Fnative\u002F` and\ntemplate dependencies for native capabilities, and brand\u002Ftoken files for `design`. Mark this first\nsnapshot `inferred: true` and use the note `Plan inferred from existing app state because no prior\ncreate-run plan was present.` Unknown facts stay explicitly unknown; do not guess.\n\nUpdate `docs\u002Fcreate-app-plan.html` in the background. Do not open or focus it during `\u002Fedit-app`.\nRun the sync command after an inferred baseline is created, after approved plan sections are saved,\nand again after Step 8 verification so the page ends on the app's actual current state. Tell the\nuser when the living app plan has been updated to reflect the latest verified changes.\n\n## When to use\n\n- \"Improve the search screen to make it easier to use on mobile\"\n- \"Add loading, empty, and error states to the list screen\"\n- \"Add a detail screen for the selected record\"\n- \"Update the design to better match the company branding\"\n- \"Add a form to create a new record in Dataverse\"\n- \"Add barcode scanning and use the scanned value to search records\"\n- \"Generate a new static preview of the updated app\"\n- \"Add a `case` table to the data model\"\n- \"Replace the Drawer navigation with Tabs\"\n- \"Add `expo-camera` to the native capabilities\"\n- \"Add signature capture to approvals and store it in Dataverse\"\n- \"Generate an evidence PDF and retain it on the inspection record\"\n- \"Add a View PDF action for an HTTPS report URL\"\n- \"Reorder screens — move profile out of tabs, into a modal from the home header\"\n- \"Enable Application Insights for this app\"\n- \"Change the Application Insights resource used by this app\"\n- \"Disable Application Insights for this app\"\n\n## When NOT to use\n\n- Brand-new project → `\u002Fcreate-mobile-app`\n- Explicit implementation-only request → the matching leaf skill under\n  [app-edit-routing.md](..\u002F..\u002Fshared\u002Freferences\u002Fapp-edit-routing.md); do not infer\n  this from a short request or the absence of screen details.\n- No recognizable generated app root (`package.json` plus `app\u002F`) → stop and ask for the app\n  directory. A missing plan by itself is handled by the inferred-baseline path below.\n\n## Workflow\n\nThis skill owns direct feature requests forwarded by native, connector,\ndata-model, and design entry points. Reuse the forwarded original request,\narguments, and answers; do not ask the user to repeat them.\n\nThose entry points ask permission before invoking this full workflow. Reuse\n`entry_choice: full-integration` for the current request without repeating the\nmode question. A direct `\u002Fedit-app` invocation also needs no entry-choice menu.\nNeither authorizes mutations: keep the impact\u002Fplan gates below. Approved child\ncalls skip the entry question and return here; do not create a recursive menu.\n\nFor each child skill invocation, explicitly pass the\n[app-edit-routing.md](..\u002F..\u002Fshared\u002Freferences\u002Fapp-edit-routing.md) context:\n`MOBILE_APP_ORCHESTRATING=1`, `orchestrator: edit-app`, `working_dir`, `phase`,\nand `approved_scope`. Planning uses read-only proposals; Step 5 implementation\nuses the scope approved in Step 3 and saved in Step 4. The marker is not approval\nand must not be persisted or relied on via a previous shell export.\n\n0. Locate app + health\u002Fdrift probe → 0.5 Application Insights fast path when applicable → 1. Discover intent + inspect existing app → 1.5 Impact preview → 2. Re-plan affected sections → 3. Gate intent, plan + mutation preview → 4. Write plan diff → 5. Apply additions\u002Frefreshes → 6. Rebuild affected screens → 6.5 Unregister approved retired sources → 7. Verify + quality sweep → 8. Preview + memory-bank update + optional debug handoff\n\n---\n\n## Edit Quality Gate Policy — no quality compromise\n\nThis is a focused edit workflow, not a lighter quality bar. Reuse `\u002Fcreate-mobile-app` gates at edit scale.\n\n**Required gates by edit type:**\n\n| Edit touches | Required gates |\n|---|---|\n| Any source file | Existing-app health gate, final `npx --no-install tsc --noEmit` |\n| Dataverse\u002Fschema\u002Fconnector | Environment drift gate, data-source\u002Fschema gate, Generated Services snapshot refresh, final `tsc` |\n| Navigation\u002Froutes | Navigation\u002Flayout gate, route contract check, final `tsc` |\n| New screen | Shared scaffold gate, skeleton gate, screen-builder wave gate, style-quality sweep, route check, final `tsc` |\n| Existing screen TSX | Screen edit gate, style-quality sweep, route check when navigation changed, final `tsc` |\n| Native capability | Native allowlist gate, wrapper existence gate, final `tsc` |\n| Pure-JavaScript dependency | Approved exact-version dependency table, package-content gate, package validation, final `tsc` |\n| Design\u002Fcomponent\u002Fdensity | Design-system gate, affected-screen style sweep, final `tsc`, preview |\n| Application Insights configuration only | Valid `app.json`, provider `appConfig` wiring, final `tsc` only if `app\u002F_layout.tsx` changed |\n\n**When a gate fails:** capture full output once, classify by root cause, repair in a batch, rerun the same gate once. Do not make line-by-line fixes with `tsc` after every tiny edit. Continue only when the gate is clean or record a `BLOCKED:` \u002F `DONE_WITH_CONCERNS:` entry in `memory-bank.md`.\n\n**Hard stops:**\n\n- Do not run data-source mutations if the app root\u002Fenvironment cannot be identified.\n- Do not launch screen-builders from broken generated services, route layouts, shared code, or skeletons.\n- Do not import native wrappers in screens before `\u002Fadd-native` has generated them.\n- Do not hide unsupported native capabilities behind mocks or TODOs just to satisfy TypeScript.\n- Do not mark an edit successful if changed screens fail TypeScript, route contracts, or required validators.\n\n### Step 0 — Locate app + health\u002Fdrift probe\n\n**Telemetry checkpoint: `assess_app_health_and_drift`**\n\nBefore any project read or command, execute\n[app-working-directory.md](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fapp-working-directory.md).\nResolve the absolute `working_dir` once, bind every shell call to it with the\nfail-closed guard, and use absolute paths for file tools. Forward that same root\nto every data child; a previous `cd` or inherited launch cwd is not a handoff.\nImmediately run the edit documentation protocol's `temp` command and bind its returned\n`directory`, `progress`, `progressHtml`, and `sync` paths as `\u003Cedit-temp-dir>` values before any\ninferred-plan sync or progress write below.\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\ntest -f native-app-plan.md && echo \"OK: plan found\" || echo \"INFO: plan will be inferred\"\ntest -f package.json && echo \"OK: package found\" || echo \"ERROR: no package\"\ntest -d app && echo \"OK: app routes found\" || echo \"ERROR: no app routes\"\ntest -f memory-bank.md && echo \"OK: memory bank found\" || echo \"WARN: no memory bank\"\ngit status --short\n```\n\nIf `package.json` or `app\u002F` is missing, STOP because this is not a recognizable generated app.\nIf `native-app-plan.md` is missing, inspect the current app before asking edit questions. Build an\ninferred current-state baseline from routes\u002Flayouts, `power.config.json`, generated\nmodels\u002Fservices, `.datamodel-manifest.json`, `src\u002Fnative\u002F`, package dependencies, brand\u002Ftoken\nfiles, and `memory-bank.md` when present. Write `native-app-plan.md` with every evidenced section,\nlabel it `Inferred current-state baseline`, and mark unresolved facts as unknown. Do not run\n`\u002Fcreate-mobile-app`, invent missing business intent, or treat inference as mutation approval.\nCreate `\u003Cedit-temp-dir>\u002Fapp-plan-sync.json` from the same evidence and run the `sync` command so imported apps\nreceive `docs\u002Fcreate-app-plan.html` before planning begins.\n\nCreate the edit progress payload now with `inspect: active`, run the `progress` command, and open\n`\u003Cedit-temp-dir>\u002Fedit-app-progress.html`.\n\nRead if present:\n\n- `memory-bank.md` — project facts, target environment, visual companion flag, prior blocks\n- `.datamodel-manifest.json` — existing Dataverse tables\u002Fcolumns\n- `brand\u002Fdesign-system.md` and `brand\u002Ftokens.ts` — design constraints and token availability\n- `src\u002Fgenerated\u002Fservices\u002F*.ts` and `src\u002Fgenerated\u002Fmodels\u002F*.ts` — generated data surface\n\nRun these existing-app health checks before any mutation:\n\nThis is an inspection-only gate. Include required scaffold\u002Fprovider\u002Fservice\nrepairs in the proposed mutation scope; do not apply them before Step 3 approval.\n`--plan-only` never authorizes these repairs or any other app\u002Fcloud mutation.\n\n| Check | Action if unhealthy |\n|---|---|\n| `memory-bank.md` exists and has expected headings | If missing\u002Fcorrupt, ask whether to proceed with reduced resume safety; create\u002Fupdate only after approval |\n| `power.config.json`, `.resolved-environment.json`, and memory bank env agree | For data-source\u002Fschema edits, STOP until the user confirms the intended environment |\n| `src\u002Fcomponents\u002Findex.tsx`, `src\u002Fhooks\u002Findex.ts`, `src\u002Futils\u002Findex.ts`, `src\u002Ftokens\u002Findex.ts` exist | Restore missing shared scaffold from `shared\u002Fsamples\u002Fsrc\u002F` before screen-builder work; do not overwrite existing files |\n| `app\u002F_layout.tsx` still wraps providers and SafeAreaProvider correctly | Patch conservatively before screen work; route\u002Fsafe-area validators depend on this |\n| `src\u002Fgenerated\u002F` compiles when the edit depends on generated services | Regenerate schemas\u002Fservices first, or block before screen work |\n| `node_modules` and package scripts needed for verification exist | If missing, ask user to run install; do not pretend verification passed |\n\nIf the worktree has uncommitted changes that overlap likely edit targets, show the affected files and ask before continuing. Do not revert or stash automatically.\n\nIf the app already fails `npx --no-install tsc --noEmit`, capture the errors once. Continue only when the failures are in files this edit will touch or are generated-service drift this edit can repair; otherwise surface the pre-existing failure and ask whether to proceed. If the edit would add screens or generated services, clean the prerequisite gate before continuing.\n\n### Step 0.5 — Application Insights configuration fast path\n\nIf `--plan-only` is present, do not invoke the configuration skill or change\nApplication Insights. For a configuration-only request, report that it has no\nplan section and stop unchanged; for a mixed request, continue with only the\nrequested plan proposal.\n\nUse this fast path when the request is only to enable Application Insights, change its resource, or disable it. Application Insights is host\u002Fruntime configuration, not a connector or plan section, so do not run the planner, data-model, native, design, screen, or preview flows.\nFor a configuration-only request, use a `configure-insights` checklist row. Mark `inspect: done`\nand `configure-insights: active` before delegation.\n\nIf the request also adds or changes custom events in app screens, configure Application Insights here first, then continue through the normal edit workflow for those source changes.\n\nAll Application Insights logic lives in the dedicated `\u002Fsetup-app-insights` skill. Delegate to it rather than duplicating Azure discovery, connection-string handling, provider wiring, or privacy rules here:\n\n```\nInvoke skill: \u002Fsetup-app-insights\n\nEnvironment:\n  MOBILE_APP_ORCHESTRATING=1\n  orchestrator: edit-app\n  working_dir: \u003Cworking_dir>\n  phase: configuration\n  approved_scope: \u003Crequested configuration action; setup-app-insights owns approval>\n\nArguments:\n  --working-dir \u003Cworking_dir>\n  --action \u003Cenable|change-resource|disable>   # omit to let the skill infer + ask\n```\n\nDetermine `--action` from the request (`enable` \u002F `change-resource` \u002F `disable`); omit it if the request only says \"update Application Insights\" and let the skill ask. The skill owns the mutation preview, approval, `app.json` + `PowerAppsProvider` `appConfig` wiring, `memory-bank.md` updates, and the selection telemetry emit.\n\nHandle the return per the status protocol (AGENTS.md rule #12):\n\n- `DONE` → print the action completed. Then, if the return includes `instrumentation_offer: available` (a successful enable\u002Fchange-resource), ask the user one question, defaulting to **No**: \"Application Insights is on. Want me to add custom telemetry to your app's major operations (create \u002F update \u002F delete)?\"\n  - **Yes** → continue into the normal edit workflow (Step 1 onward) with this brief: *\"Add custom events at each successful create, update, and delete boundary for the app's main entities; emit named events through `getCustomEventsLogger` with approved scalar properties only (no operation results, payloads, form values, free text, record titles, personal identifiers, tokens, precise coordinates, nested objects, or complete URLs); use `trackScenario()` for any duration.\"* Screen-planner and screen-builder own the source edits under their existing privacy allowlist.\n  - **No** (or `instrumentation_offer: none`) → mark `configure-insights: done`, mark every remaining row `skipped`, clear `waiting`, set top-level `phase: done` and `status: done`, publish the progress page, then stop.\n- `DONE_WITH_CONCERNS` → mark `configure-insights: done`, mark every remaining row `skipped`, clear `waiting`, set top-level `phase: done` and `status: done`, include the concerns in the note, publish the progress page, surface the concerns, then stop.\n- `NEEDS_CONTEXT` → surface the question, re-invoke with the answer.\n- `BLOCKED` → mark `configure-insights: failed`, mark every remaining row `skipped`, clear `waiting`, set top-level `phase: done` and `status: failed`, publish the progress page, surface the error (usually `app.json` unusable), then stop.\n\n### Step 1 — Discover intent + inspect existing app\n\nUpdate `\u003Cedit-temp-dir>\u002Fedit-app-progress.json`: keep `inspect` active while reading the app, then mark it\n`done` once the existing routes, data surface, native wrappers, and design constraints are known.\nRun the protocol's `progress --json-file` command after each update.\n\nInfer from `$ARGUMENTS` when possible, but do not mutate files until you have a concrete edit brief. This is the mini `\u002Fcreate-mobile-app` requirements phase for one existing-app change.\n\nFirst inspect the app so questions can use real options instead of abstractions:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nfind app -name '*.tsx' -not -name '_layout.tsx' -not -name '+not-found.tsx' | sort\nls -1 src\u002Fgenerated\u002Fservices\u002F*.ts 2>\u002Fdev\u002Fnull | sed 's|src\u002Fgenerated\u002Fservices\u002F||;s|\\.ts$||'\nls -1 src\u002Fgenerated\u002Fmodels\u002F*.ts 2>\u002Fdev\u002Fnull | sed 's|src\u002Fgenerated\u002Fmodels\u002F||;s|\\.ts$||'\nfind src\u002Fnative -maxdepth 1 -type f -name '*.ts*' 2>\u002Fdev\u002Fnull | sort\n```\n\nAlso read the relevant `native-app-plan.md` sections (`## Data Model`, `## Native Capabilities`, `## Design`, `## Screens`, and `## Generated Services` if present) plus the existing TSX for any candidate screen. If `brand\u002Fdesign-system.md` exists, read it before asking design\u002Fscreen questions so the edit preserves product grammar, density, component rules, and negatives.\n\nAsk only for information that cannot be inferred from the app. If there is exactly one plausible screen\u002Ftable\u002Fservice, state the inferred choice in the mutation preview instead of asking. If there are multiple plausible choices, ask a small multiple-choice question with those real names.\n\nBuild an edit brief before Step 2:\n\n```markdown\n## Edit Brief\n- Intent: \u003Cwhat user wants to accomplish>\n- Target screens\u002Froutes: \u003Cexisting or new>\n- Data surface: \u003Cgenerated service\u002Ftable\u002Fconnector, or none>\n- Native capability: \u003Cwrapper\u002Fcontrol needed, or none>\n- Design scope: \u003Ctokens\u002Fcomponent grammar\u002Fscreen-specific, or none>\n- Plan sections to update: \u003CData Model \u002F Native Capabilities \u002F Screens \u002F Design \u002F Connectors>\n- App files likely touched: \u003Croutes\u002Flayouts\u002Fsrc\u002Fnative\u002Fsrc\u002Fgenerated\u002Fbrand\u002Fetc.>\n- Verification gates: \u003Cschema, tsc, routes, validators, preview>\n```\n\nIf the edit brief is incomplete after inspection, ask scenario-specific questions before continuing.\n\nOnly if the requested change is still unknown after inspection, ask via `AskUserQuestion`:\n\n> \"What should this app edit change?\n> (a) Data model — add\u002Fextend\u002Freuse Dataverse tables\n> (b) Native capability — camera, scanner, PDF, pen, files, secure storage\n> (c) Screens\u002Fnavigation — list, search, detail, form, tabs, states\n> (d) Design — palette, typography, components, density, brand rules\n> (e) Connector\u002Fdata source — SharePoint, Office, custom connector\n> (f) Multi-section feature — one user-visible change that needs several of the above\n> (g) Preview only\n> (h) Cancel\"\n\nAsk for a brief description only if the original request and supplied answers\nstill do not explain it. Ask one unresolved question at a time.\n\nScenario-specific questions to ask only when the answer is not already obvious:\n\n| Scenario | Required intent questions before planning |\n|---|---|\n| Search\u002Fmobile usability | Which existing search\u002Flist screen? Which fields should search cover? Should search run locally over loaded rows or query Dataverse\u002Fconnector server-side? Are filters\u002Fsort\u002Fscope needed? |\n| Loading, empty, error states | Which list screen(s)? If no list screen exists, should `\u002Fedit-app` create a new list screen or apply states to another data screen? Are there already loading\u002Fempty\u002Ferror components that should be improved rather than duplicated? |\n| Detail screen | From which source screen does the user select a record? Which table\u002Fservice is the record from? Which fields\u002Factions must appear? Should the route be push detail, modal, or formSheet? |\n| Branding\u002Fdesign | What is the brand source (brand doc, logo, URL, text description, existing app)? Is this palette-only, typography, component\u002Fdensity, or full reskin? Should all screens update or only named screens? |\n| Dataverse create form | Which Dataverse table? Existing table or new table? Which fields are required\u002Feditable? Where should the form launch from? What happens after save (back, detail, add another)? Are there lookup\u002Ffile\u002Fimage fields? |\n| Barcode\u002FQR scan search | Where should scanning live (new scanner screen, existing search screen action, form field)? What does the scanned value represent (record ID, serial number, asset tag, SKU, custom field)? Which table\u002Fservice\u002Ffield should it search? What happens on no match or multiple matches? |\n| New requirement + screen | What user workflow is being added? Who uses it? What data\u002Fnative\u002Fconnectors does it need? Where does it sit in navigation? What is success\u002Ffailure behavior? |\n| New data source | What job does the data source support? Is it structured business data (Dataverse), SharePoint list\u002Flibrary, a connector action, or another connector? Which screen(s), if any, should use it now? |\n| Remove\u002Freplace a table or integration | Remove it only from this app, or is server deletion separately intended? Which remaining screens, lookup\u002Fidentity helpers, native sync, or offline behavior still require it? Preserve server data by default. |\n| Native capability without a workflow | What should the capability do, where should users invoke it, and should the result stay local or be retained in an existing data source? |\n| Preview only | Preview all screens or only changed\u002Fkey screens? Should Visual Companion auto-open behavior be honored? |\n\nExisting-state checks before deciding to add vs edit:\n\n- For a named screen, confirm the route file exists. If it does not, ask whether to create it or choose an existing screen.\n- For list states, grep the target screen for `LoadingState`, `EmptyState`, `ErrorState`, `refreshing`, and `onRefresh`; improve missing or weak states, do not duplicate existing ones.\n- For forms, check generated service methods for `create`\u002F`update` before planning UI. If methods or table are absent, add\u002Frefresh the data model first.\n- For scanner work, check `src\u002Fnative\u002F` and the plan's Native Capabilities table for scanner\u002Fcamera wrappers before screen work.\n- For detail screens, check Navigation Contracts and existing dynamic routes before creating another `[id].tsx`.\n- For branding, check `brand\u002Fdesign-system.md`, `brand\u002Ftokens.ts`, and `tamagui.config.ts` before deciding whether TSX rebuilds are needed.\n\nUse this scenario coverage matrix for common follow-ups. The goal is one user prompt -> one orchestrated edit, not a list of commands the user must run manually.\n\n| User asks | Plan sections | Apply path | Screens \u002F verification |\n|---|---|---|---|\n| Improve search screen for mobile | Screens | `mobile-app:screen-planner` edit pass only | Rebuild the named search\u002Flist screen; run `tsc`, route check, preview |\n| Add loading, empty, and error states | Screens | Screen spec + existing TSX edit | Rebuild affected list screen; verify visible loading, empty, error, retry, refresh states |\n| Add a detail screen for selected record | Screens; Data Model only if fields\u002Fservices are missing | Update Screen Map + Navigation Contracts; run `\u002Fadd-dataverse` or `\u002Fadd-datasource` only if data surface is missing | Create route\u002Ffolder\u002Flayout as needed; build detail screen and source list\u002Fsearch navigation |\n| Update design to match company branding | Design; Screens only if component grammar\u002Fdensity changes | `\u002Fdesign-system --refresh \u003Cdimension>` or `--reskin` | Rebuild affected screens only when tokens alone are insufficient; always preview |\n| Add a form to create a new Dataverse record | Screens; Data Model if table\u002Fcolumns\u002Flookups\u002Fcreate service are missing | `\u002Fadd-dataverse --skip-planning` when schema\u002Fservice is missing | Build form route, create payload helper, parent navigation, and focus refresh; verify create\u002Fupdate payloads |\n| Add barcode scanning and use scanned value to search records | Native Capabilities, Screens; Data Model if scan target field is missing | `\u002Fadd-native barcode-scanner`; `\u002Fadd-dataverse` only if target field\u002Ftable is absent | Build scanner\u002Fsearch flow, pause\u002Flock scan callback, search via service filter, preview |\n| Add a full calendar, agenda, or scheduling view | Screens → JavaScript Dependencies | Add exact `react-native-calendars` version to the approved table, then `npm install --save-exact` before builders | Build the calendar screen with the approved pattern; no `\u002Fadd-native` or Android\u002FiOS rebuild |\n| Add a new requirement with a new screen | Usually Screens plus whichever of Data Model, Connector, Native, Design the requirement implies | Decompose into one coherent feature; apply data\u002Fconnector\u002Fnative\u002Fdesign first, then screens | Generate\u002Frefresh service snapshot, layouts, skeletons\u002Fshared code, then build affected screens |\n| Add a new data source but no screen | Connector\u002FData Source; sometimes Data Model | `\u002Fadd-datasource` when ambiguous; `\u002Fadd-sharepoint`, `\u002Fadd-connector`, or `\u002Fadd-dataverse` when clear | Refresh generated services and memory bank; no screen rebuild unless the user asked for UI |\n| Add Teams\u002Femail action or profile lookup | Connectors; Screens when consumed | `\u002Fadd-connector` after approval | Wire the action\u002Fread and its loading\u002Ferror\u002Fsuccess behavior; no Dataverse schema by default |\n| Add SQL\u002FExcel\u002FSharePoint data | Connectors, including external table\u002Flist schema; Screens when consumed | Matching connector leaf after approval | Do not add a Dataverse model just because the connector supplies tabular data |\n| Add a new table\u002Fentity but no screen | Data Model | `mobile-app:data-model-architect` -> `\u002Fadd-dataverse --skip-planning` | Refresh generated services; optionally seed sample data; no preview unless UI changed |\n| Stop using a table\u002Fconnector\u002Fflow or replace its data source | Data Model\u002FConnectors and affected Screens | Approved retirement via the matching leaf after consumer updates in Step 6 | CLI removes the app registration and regenerates services\u002Fconfig; Step 6.5 verifies remaining sources and refreshes the schema map |\n| Remove, rename, reorder, or change a screen archetype | Screens | `mobile-app:screen-planner` edit pass | Update route files\u002Flayouts\u002Fnavigation contracts; delete only approved files; run route check |\n| Generate a new static preview | None unless source is stale | `\u002Fpreview-screens` | No source edits; do not run data\u002Fnative\u002Fdesign work |\n\nOne user-visible feature may require multiple plan sections. That is allowed and expected. Multiple unrelated features in one prompt should be split: list the features, ask which to run first, and do not bundle their mutations.\n\n**Data Model is conditional.** A connector\u002Faction\u002Fnative capability does not\nautomatically require Dataverse. Reuse existing storage and schema. Plan Dataverse\nchanges only for new\u002Fchanged Dataverse tables, columns, or relationships actually\nrequired by the feature; missing generated services alone require regeneration,\nnot new schema. Keep connector operations and external table\u002Flist schemas in\n`## Connectors`. Preserve unaffected Data Model content verbatim.\n\nLoophole checks before continuing:\n\n- If the request adds UI that reads or writes data, confirm the generated service exists or add the data source before screen work. Never let screen-builders invent services.\n- If the request is ambiguous about Dataverse vs SharePoint vs another connector,\n  consult the `\u002Fadd-datasource` routing table read-only and resolve the choice\n  before approval. Execute the selected leaf only in Step 5.\n- If a screen requires a native wrapper, run `\u002Fadd-native` before screen-builders import `src\u002Fnative\u002F*`.\n- If a native capability is not shipped by the template, stop with a clear block; do not install native packages or fake support.\n- If a screen requires a pure-JavaScript library, add it with an exact version to `## Screens → ### JavaScript Dependencies`, include it in the mutation preview, and install it before screen builders run. Determine JS-only status from shipped contents, not from a package-name prefix.\n- If the request changes navigation, update route layouts and navigation contracts before spawning screen-builders.\n- If the request adds a new screen, generate any needed route folder, generated-service snapshot, shared code, and skeleton before building TSX.\n- Do not stop after writing `native-app-plan.md`. The plan update is an internal checkpoint; the app mutation and verification are the user-visible result.\n\nFor PDF\u002Fsignature requests, map the change to every affected section instead of editing only the first obvious one:\n\n| User request | Required plan updates |\n|---|---|\n| Add signature capture, sign-off, pen, ink, drawing | Native Capabilities: `pen-input`; Screens: capture, preview, cancellation, and applicable failure states; ask about retention, then update Data Model only if new\u002Fchanged Dataverse storage is required |\n| Store signed approval as Dataverse image | Data Model: Image column; Screens: normalize `data:image\u002Fpng;base64,...` before update; Native Capabilities: `pen-input` if capture is in-app |\n| Generate\u002Fexport\u002Fprint evidence PDF | Native Capabilities: `pdf-report` only when `expo-print` is present, plus `sharing` only when local share is needed and `expo-sharing` is present; Data Model: File column only if retained; Screens: generation pending\u002Ffailed\u002Fsuccess states |\n| Persist generated PDFs | Data Model: Dataverse File column or child Attachment table; Screens: create\u002Fupdate row first, then upload File bytes; Native Capabilities: `pdf-report` |\n| View\u002Fopen\u002Fpreview PDF | Native Capabilities: `native-pdf-viewer` for HTTPS URLs or local `file:\u002F\u002F` URIs when `@microsoft\u002Fpower-apps-native-pdf-viewer` 0.2.9+ is present; Screens: invalid URL and viewer failed states |\n\nIf a single PDF\u002Fsignature request requires multiple plan sections, say so and run the edit loop section-by-section. Do not write a native capability entry that references a Dataverse column or screen state that remains absent from the plan.\n\n### Step 1.5 — Impact preview (cheap abort gate)\n\n**Telemetry checkpoint: `analyze_edit_impact`**\n\nBefore showing the impact question, mark `inspect: done`, set `impact: waiting`, set top-level\n`phase: impact`, `waiting: true`, and run `progress --json-file`. If the user proceeds, change\n`impact` to `done`, set `plan: active`, clear `waiting`, and run it again. A cancellation sets the\ntop-level status to `done` with all unstarted operations `skipped`.\n\nBefore spawning architects or mutating files, show a rough impact preview and ask for proceed\u002Fedit\u002Fcancel. This mirrors `\u002Fcreate-mobile-app` Step 2c at edit scale.\n\nCompute:\n\n- **Cost tier:** Cheap (single existing screen), Medium (new route\u002Fform\u002Fdetail or one data source), Heavy (multi-screen\u002Fnav\u002Fdesign\u002Fdata\u002Fnative), Major (reskin or broad screen rebuild).\n- **Likely plan sections:** Data Model, Native Capabilities, Connectors\u002FData Sources, Design, Screens.\n- **Likely files:** exact screen\u002Flayout\u002Fnative\u002Fbrand\u002Fgenerated\u002Fmemory files when known.\n- **Likely skills\u002Fagents:** `mobile-app:data-model-architect`, `mobile-app:screen-planner`, `mobile-app:screen-builder`, `\u002Fadd-datasource`, `\u002Fadd-dataverse`, `\u002Fadd-sharepoint`, `\u002Fadd-connector`, `\u002Fadd-native`, `\u002Fdesign-system`, `\u002Fpreview-screens`, optional `\u002Fdebug-app` only when the user gives a concrete runtime symptom.\n- **Verification gates:** schema, generated services, route contracts, screen validators, preview.\n- **Main risks:** environment drift, unsupported native package, generated service missing, navigation contract change, broad design churn, stale installed plugin cache.\n\nPrint:\n\n```text\n─── Edit impact preview ─────────────────────────────\nIntent        \u003Cone sentence>\nTier          \u003Ccheap|medium|heavy|major> (~\u003Ctime range>)\nPlan          \u003Csections>\nSkills\u002Fagents \u003Clist>\nFiles         \u003Cscreen\u002Flayout\u002Fdata\u002Fnative\u002Fbrand\u002Fmemory summary>\nVerification  \u003Cgates>\nPreview       \u003Cyes\u002Fno>\nRisks         \u003Cnone or bullets>\n\nChoose:\n  (a) Proceed\n  (b) Edit intent \u002F answer more detail\n  (c) Cancel\n```\n\nIf the user chooses **edit**, return to Step 1 and refine the edit brief. If cancel, stop with no file mutations. If proceed, continue to Step 2.\n\n**If the user picks (d) Design:**\n\nRead the `\u002Fdesign-system` references to propose the Design delta without executing\nthe skill yet. Determine the dimension from the user's description:\n\n| User says | Route to |\n|---|---|\n| \"change colors\", \"palette\", \"accent\" | `\u002Fdesign-system --refresh palette` |\n| \"change fonts\", \"typography\", \"font\" | `\u002Fdesign-system --refresh typography` |\n| \"change components\", \"buttons\", \"cards\" | `\u002Fdesign-system --refresh components` |\n| \"change spacing\", \"density\", \"compact\" | `\u002Fdesign-system --refresh density` |\n| \"add rule\", \"remove rule\", \"negatives\" | `\u002Fdesign-system --refresh negatives` |\n| \"change animations\", \"motion\" | `\u002Fdesign-system --refresh motion` |\n| \"full redesign\", \"reskin\", \"new theme\" | `\u002Fdesign-system --reskin` |\n\n**One-major-change-per-prompt enforced.** If the user asks to change palette AND typography → refuse, ask which first. This matches `\u002Fdesign-system`'s own behavior.\n\nInclude runtime token\u002Fprovider wiring and any affected screens in the proposal.\nContinue through Steps 2-4 before executing `\u002Fdesign-system` in Step 5.\nDo not write brand artifacts before approval or during `--plan-only`, and do not\njump from design refresh straight to verification if screen changes are needed.\n\n### Step 2 — Re-plan affected sections\n\n**Telemetry checkpoint: `revise_affected_app_plan`**\n\nKeep `plan: active` while architects or inline planning update the affected sections. If a planner\nneeds user context, change `plan` to `waiting`, set `waiting: true`, and run the progress command\nbefore asking. Restore it to `active` after the answer.\n\nReuse the same planning primitives as `\u002Fcreate-mobile-app`, but only for the affected surfaces:\n\n| Surface | Reuse from create flow | Edit-app scope |\n|---|---|---|\n| Dataverse schema | `data-model-architect` + `\u002Fadd-dataverse` Step 8 | New\u002Fchanged tables, columns, lookups, calculated fields, generated services |\n| Connector choice | `\u002Fadd-datasource`, `\u002Fadd-sharepoint`, `\u002Fadd-connector` | New or changed external data\u002Faction surface |\n| Native capability | `\u002Fadd-native` Step 9 | New wrappers\u002Fcontrols needed by edited screens |\n| JavaScript dependency | `screen-planner` + `shared\u002Freferences\u002Fjavascript-dependency-planning.md` | Explicit package requests or established JS libraries needed by edited screens |\n| Design | `\u002Fdesign-system` Step 9b | Token refresh, reskin, density\u002Fcomponent rules |\n| Navigation | `\u002Fcreate-mobile-app` Step 10b | Changed tabs, stacks, route groups, modal\u002FformSheet presentation |\n| Service snapshot | `\u002Fcreate-mobile-app` Step 10.7 | Refresh after any data source\u002Fschema change before builders run |\n| Shared code + skeletons | `\u002Fcreate-mobile-app` Step 10.8 | New screens, changed data imports, new shared row\u002Fcard\u002Fhooks |\n| Screen implementation | `\u002Fcreate-mobile-app` Step 11 | Only affected screens, via `mobile-app:screen-builder` waves |\n| Quality sweep | `\u002Fcreate-mobile-app` Step 11.4 | Changed screen files and route layouts |\n\nRead each affected section verbatim from `native-app-plan.md` and pass it as input to the relevant read-only agent. Use the plugin namespace for every `Task` invocation.\n\nFor Dataverse schema\u002Fnew-binding work, first read and execute\n[dataverse-change-planning.md](..\u002F..\u002Fshared\u002Freferences\u002Fdataverse-change-planning.md).\nUse the requested delta and necessary dependencies, not all historical plan\nrows. The foreground obtains and validates compact evidence; the architect\nuses `Dataverse planning mode: required`, not legacy live discovery.\nNative\u002Fdesign\u002Fconnector-only edits, app-binding removals, and retained-service\nrefreshes skip this planning path and never reuse its old artifacts.\n\nBefore the first `Task`, run a silent preflight for the leaf agent you need (`mobile-app:data-model-architect`, `mobile-app:screen-planner`, or `mobile-app:screen-builder` preflight later). If the host cannot spawn agents, print once:\n\n> \"→ Planner agents unavailable in this host — running inline planning. (No action needed; this is automatic.)\"\n\nInline fallback rules:\n\n- Data Model: use the existing plan, manifest, models, and edit brief as context,\n  but ground decisions in the shared workflow's validated compact evidence.\n  Produce `_dm_section.md` and the normalized schema contract and run the same\n  decision validator as for an agent result; local files alone are not proof\n  of current server schema.\n- Screens: draft Screen Map \u002F Navigation Contracts \u002F per-screen spec changes inline using `agents\u002Fscreen-planner.md`, `shared\u002Freferences\u002Fscreen-templates.md`, and the existing screen TSX; then gate it exactly like an agent result.\n- Native Capabilities and Connectors: already handled inline by this skill.\n- Never skip approval just because a leaf agent is unavailable.\n\n| Section | Agent (read-only) | Output file |\n|---|---|---|\n| Data Model | `mobile-app:data-model-architect` | `_dm_section.md` + `.tmp\u002Fdataverse-schema-contract.json` |\n| Native Capabilities | (handled inline — no separate agent) | `_native_section.md` |\n| Screens | `mobile-app:screen-planner` | `_screens_section.md` |\n\n```\nSpawn agent: mobile-app:\u003Cagent-name>\n\nPrompt:\n  Update the existing \u003Csection-name> section based on the user's change request.\n\n  User request: \u003Cverbatim>\n  Current section content: \u003Cverbatim>\n  Working directory: \u003Cabsolute path>\n  Plugin root: ${PLUGIN_ROOT}\n  Phase: planning\n  Proposal only: \u003Ctrue for --plan-only or a planning-phase caller>\n\n  Mode: edit (preserve existing decisions where the change doesn't affect them).\n  Existing generated app must be updated after approval, so include enough detail for builders to mutate code without guessing.\n  Return the updated section as a markdown file.\n```\n\nFor the Data Model handoff, also include these fields verbatim:\n\n```text\nDataverse planning mode: required\nNormalized Dataverse foreground planning snapshot (validator input only): \u003CSNAPSHOT_PATH>\nCompact Dataverse architect evidence: \u003CARCHITECT_EVIDENCE_PATH>\nStructured schema contract output: \u003Cworking_dir>\u002F.tmp\u002Fdataverse-schema-contract.json\nScope: \u003Crequested delta and necessary dependencies; preserve unrelated rows>\nNative capabilities and connector ownership: \u003Cretained approved constraints>\n```\n\nHandle structured Dataverse context\u002Frevision signals with the shared planning\nrecovery before generic retry limits. For other signals, use `AGENTS.md`:\n`DONE` continues to output validation, `DONE_WITH_CONCERNS:` must be surfaced\nand recorded, `NEEDS_CONTEXT:` gets one clarified retry, `BLOCKED:` stops before\napp mutation, and unknown first lines are `BLOCKED: malformed agent return`.\nEvery Data Model result, including inline output, must pass the shared decision\nvalidator; `DONE` alone never authorizes Step 3.\n\nBefore Step 3, rebuild the progress payload's `changes` array from the completed affected-section\nproposals.\nEvery change must explain why it is necessary.\nFor a Data Model delta, include the affected tables, relevant columns, and relationships from the\nvalidated normalized contract so the Changes tab renders the proposed ER diagram.\nFor a Screens delta, include the affected existing and proposed screens plus their real navigation\nedges so the Changes tab renders the updated screen graph.\nRun `progress --json-file` after writing this payload and before changing `approve` to `waiting`.\n\nFor Native Capabilities (no separate agent), do it inline: read the current capability table, apply the change, regenerate the table. For PDF\u002Fpen rows, include storage\u002Foutput notes in the table or immediately below it:\n\n- `native-pdf-viewer` 0.2.9+ opens HTTPS URLs and local `file:\u002F\u002F` URIs; it does not support `content:\u002F\u002F`, `blob:`, or `http:\u002F\u002F`.\n- `pdf-report` generates a local PDF only when `expo-print` is present; local output may be opened by `native-pdf-viewer` 0.2.9+, shared with `expo-sharing` when present, or uploaded to Dataverse File storage.\n- `pen-input` returns a PNG data URI; cancellation is a non-error state; Dataverse target must be Image, File, or child Evidence\u002FSignature row.\n\nFor connector\u002Fdata-source edits, read\n[connector-planning.md](..\u002F..\u002Fshared\u002Freferences\u002Fconnector-planning.md) and the\n`\u002Fadd-datasource` routing table as reference only. Propose the `## Connectors`\ndelta with operations, external tables\u002Flist schemas, and consuming screens.\nDo not execute connector skills, create connections, or generate services in\nStep 2. Update Screens when the connector drives new screens\u002Fforms; defer the\nselected leaf to Step 5 after approval.\n\nFor removals\u002Freplacements, follow\n[data-source-removal.md](..\u002F..\u002Fshared\u002Freferences\u002Fdata-source-removal.md).\nBefore changing the plan, capture the current registration inventory and propose\nretain\u002Fadd\u002Frefresh\u002Fremoval sets. Do not interpret an omitted table as permission\nto delete it. Include non-screen consumers and offline dependencies, preserve\nserver tables\u002Frecords, and carry the approved removal set through Step 6.5.\n\n### Step 3 — Gate intent, plan + app mutation preview\n\n**Telemetry checkpoint: `approve_app_mutation_plan`**\n\nBefore asking for approval, mark `plan: done`, set `approve: waiting`, set top-level\n`phase: approval`, `waiting: true`, and run `progress --json-file`. A revision returns `plan` to\n`active`. Approval marks `approve: done`, sets `save-plan: active`, clears `waiting`, and runs the\ncommand again. Cancellation settles the page with remaining operations `skipped`.\n\nFor Dataverse planning, require exit `0` from\n`validate-dataverse-planning-decisions.js` for the current normalized contract\nand snapshot before showing this gate. Revisions repeat that check. There is\nno extra create-flow approval gate; preserve this edit's existing UX.\n\nIf this is a planning-phase handoff from another owner, return the validated\nproposal and concerns to that owner now, without saving the live plan or\nopening an implementation gate. Do not turn the caller's planning consent\ninto approval to apply the edit. A direct `--plan-only` request retains the\nexplicit plan-document approval below.\nBefore returning, mark `inspect`, `impact`, and `plan` as `done`; mark approval, save,\nimplementation, verification, preview, sync, and device rows `skipped`; clear `waiting`; set\ntop-level `phase: done`, `status: done`, and `devicePreviewReady: false`; and publish one final\nprogress write. The note must say that the validated proposal was returned to the owning workflow.\n\nShow the user a side-by-side diff (or before\u002Fafter) for every changed plan section. Also show an app mutation preview:\n\n- Edit brief: intent, target screens\u002Froutes, data\u002Fnative\u002FJavaScript\u002Fdesign dependencies, and assumptions\n- Data\u002Fschema operations to run (`\u002Fadd-dataverse --skip-planning`, connector add, native wrapper add)\n- Exact app data-source removals, consumer updates, and server data that will be preserved\n- Exact sample-data table allowlist and count\u002Fmedia policy, if requested; exclude\n  retiring tables and include required seed parents only with explicit approval.\n  An empty approved set authorizes no seed writes.\n- Screen files to create, rewrite, rename, or delete\n- Navigation\u002Flayout files to update\n- Verification commands to run\n- Whether `preview.html` will be regenerated\n\nAsk:\n\n> \"Approve this edit and apply it to the app?\n> (a) Approve and apply\n> (b) Revise — give feedback for another pass\n> (c) Cancel — discard changes\"\n\nIf revise → loop back to Step 2 with the user's notes appended. If approve → continue. If cancel → STOP, leave the plan and app untouched.\n\nIf `$ARGUMENTS` includes `--plan-only`, change option (a) to \"Approve and save plan only\" and stop after Step 4 with a clear note that the app was intentionally not changed.\n\n### Step 4 — Write plan diff\n\nKeep `save-plan: active` while writing the approved `native-app-plan.md` sections.\n\nReplace the approved section(s) in `native-app-plan.md` with the approved content (preserve all other sections verbatim). Print a unified diff so the user has a record:\n\n```\ndiff --git native-app-plan.md native-app-plan.md\n---\n+++ Section: Data Model\n- | ? Create (Tier 2) | contoso_workitem | ... |\n+ | ? Create (Tier 2) | contoso_workitem | ... |\n+ | ? Create (Tier 2) | contoso_case | Lookup → account, severity, status |\n```\n\nIf this is `--plan-only`, update `memory-bank.md` with `plan_only: true`, mark `save-plan: done`,\nmark every implementation, verification, preview, and device-handoff row `skipped`, set top-level\n`phase: done`, `status: done`, and `devicePreviewReady: false`, and publish one final progress\nwrite. Keep `docs\u002Fcreate-app-plan.html` unchanged because it describes the current app, while\n`native-app-plan.md` holds the approved but unapplied intent. Then print the exact follow-up\ncommands and stop.\n\nFor an implementation run, keep `docs\u002Fcreate-app-plan.html` unchanged until Step 8 verifies the\nimplemented state.\nThe approved proposal belongs in `native-app-plan.md` and the edit progress page, not in the living\ncurrent-app plan.\nMark `save-plan: done` and the first applicable implementation operation `active` in the progress\npage.\n\nThe saved plan describes approved intent, not successful application. When the\nData Model changed, merge its newly accepted `_dm_section.md` proposal here;\nnever replay stale scratch output for an unrelated edit. Preserve unrelated\nsections and do not reuse execution artifacts\u002Fapproval receipts bound to an older plan. The leaf\nupdates `.datamodel-manifest.json` only from verified schema\u002Fservice outcomes;\npending retirements stay transitional until Step 6.5. Record any failure and\nremaining operations in memory-bank rather than claiming this plan is applied.\nFor approved Dataverse implementation, freeze the shared workflow's\n`contract_sha256` and final saved `plan_sha256` in `approved_scope`, and retain\nthe absolute `planning_snapshot`, `architect_evidence`, and `schema_contract`\npaths. A plan-only save does not create this implementation approval context.\n\n### Step 5 — Apply app mutations\n\n**Telemetry checkpoint: `apply_app_mutations`**\n\nUpdate the progress page after every applicable operation below. Mark each of `data`, `native`, and\n`design` active only while its leaf runs, then `done`, `skipped`, or `failed` from the actual\nresult. Run `progress --json-file` after each transition so the checklist identifies the operation\nthat is currently running.\n\nApply sections in dependency order so screens always build against the current data\u002Fnative surface:\n\nRun only operations in the approved delta, not every section of the existing\nplan. Pass `MOBILE_APP_ORCHESTRATING=1` and the explicit implementation context\nabove on each handoff, including through routers and on retries. Reuse supplied\nanswers, and return to the approval gate if an unresolved choice changes scope.\n\n0. **Environment drift gate for data edits** — before Dataverse, SharePoint, connector, or sample-data work, compare `memory-bank.md`, `power.config.json`, and `.resolved-environment.json`. If they disagree, show the values and ask the user which environment is intended. Do not create tables or connections until confirmed.\n1. **Data Model** — invoke `\u002Fadd-dataverse --skip-planning` with the approved\n   delta and the scoped planning context below, not every row in the plan.\n   The leaf verifies the evidence\u002Fapproval hashes and performs fresh live\n   reconciliation before scoped mutations; no partial create-only fast-path\n   flags or fabricated create receipt. It refreshes the affected services,\n   updates verified inventory, and leaves generated services compiling.\n   Pass `offline_reconciliation_owner: edit-app`; Step 5.6 owns the offline\n   check, so the leaf returns its verified delta without prompting twice.\n   After it returns, run `npm run generate-schemas` and `npx --no-install tsc --noEmit`;\n   do not continue to screens until clean.\n2. **Sample Data** — seed only the explicit table allowlist approved in Step 3.\n   Propose newly created Dataverse tables used by changed screens as candidates,\n   not the entire project manifest. Distinguish `createdThisEdit` from historical\n   manifest `status: new`; existing\u002Freused parent tables need explicit inclusion.\n   Validate the approved names against verified output and the retirement set.\n   An empty scope means skip seeding. Missing\u002Funverified\u002Fretiring targets return to the owner\n   for correction, not a fallback to project-wide seeding. Pass the handoff below.\n   If insertion fails, record the partial result and continue only if the app\n   handles empty states; never report complete seed coverage.\n3. **Connector\u002FData Source** — read and execute `\u002Fadd-datasource` when ambiguous, or `\u002Fadd-sharepoint` \u002F `\u002Fadd-connector` for approved connector changes. For a retained source refresh, pass skill-only `--refresh --data-source-name \"\u003Cregistered-name>\"` with its verified identity in `approved_scope`; do not route refreshes through addition. Use the same refresh branch for service-only Dataverse repairs without schema changes. Regenerate services and record connection notes in `memory-bank.md`.\n4. **Pure-JavaScript Dependencies** — execute the Installation Contract in [`shared\u002Freferences\u002Fjavascript-dependency-planning.md`](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fjavascript-dependency-planning.md) for new or changed rows in the approved `## Screens → ### JavaScript Dependencies` table. Approval is consent for those exact packages and versions. Install and validate before screen work; if final inspection finds native code\u002Fconfig or incompatible runtime dependencies, remove only the newly added package and stop with the exact failed criterion.\n5. **Native Capabilities** — read and execute `\u002Fadd-native \u003Ccapability>` for every new capability. Do not install missing native packages or fake wrappers. If a capability is unsupported by the current template, stop before rebuilding screens that import it, record the block, and tell the user what upstream template support is missing.\n6. **Design** — read and execute the approved `\u002Fdesign-system` operation (refresh,\n   reskin, theme, or rollback). Include `CODE_APPS_NATIVE_ORCHESTRATING=1` in\n   the child environment to suppress intermediate browser tabs, alongside the\n   scoped `MOBILE_APP_ORCHESTRATING=1` context above. Apply its Tamagui integration reference to changed\n   tokens\u002Fthemes and provider wiring before verification; a brand artifact alone\n   does not prove runtime integration. Token-only changes usually do not require\n   screen TSX rewrites; component\u002Fdensity\u002Fnegative-rule changes may. Rebuild\n   affected screens in Step 6 rather than returning early.\n   For an approved custom dark palette, execute the reference's **Approved dark\n   palette** branch: wire `darkTokens.color` into `appDarkTheme`, then into the\n   provider's `brandedDarkTheme`. Verify the export\u002Fkeys and resolved dark\n   surface\u002Ftext values; writing `brand\u002Ftokens.dark.ts` alone is not completion.\n\nStep 5 applies additions\u002Frefreshes, not removals. If the Data Model change is\nremoval-only, do not run `\u002Fadd-dataverse`'s add workflow against the shortened\nplan: it would neither unregister the old source nor safely update its consumers.\nDefer approved retirements until Step 6.5, after source consumers are updated.\n\nAfter any Data Model, Connector\u002FData Source, JavaScript Dependency, or Native Capabilities mutation, rerun the generated-service\u002Fdependency\u002Fnative-wrapper probe before screen work. Screen prompts must reflect what exists on disk now, not what the earlier plan expected.\n\nDataverse handoff (only for approved schema\u002Fnew-binding work):\n\n```text\nInvoke skill: \u002Fadd-dataverse\n\nContext:\n  MOBILE_APP_ORCHESTRATING=1\n  orchestrator: edit-app\n  working_dir: \u003Cworking_dir>\n  phase: implementation\n  offline_reconciliation_owner: edit-app\n  planning_snapshot: \u003CSNAPSHOT_PATH>\n  architect_evidence: \u003CARCHITECT_EVIDENCE_PATH>\n  schema_contract: \u003Cworking_dir>\u002F.tmp\u002Fdataverse-schema-contract.json\n  approved_scope: \u003Caccepted delta and dependencies, contract_sha256, plan_sha256>\n\nArguments:\n  --working-dir '\u003Cworking_dir>'\n  --plan-section '\u003Cworking_dir>\u002Fnative-app-plan.md#data-model'\n  --skip-planning\n```\n\nSample-data handoff (only for a nonempty approved seed scope):\n\n```text\nInvoke skill: \u002Fadd-sample-data\n\nContext:\n  MOBILE_APP_ORCHESTRATING=1\n  orchestrator: edit-app\n  working_dir: \u003Cworking_dir>\n  phase: implementation\n  approved_scope: \u003Capproved seed tables, count\u002Fmedia policy, and lookup decisions>\n  retiring_tables: \u003Capproved retirement list, or empty>\n\nArguments:\n  --working-dir '\u003Cworking_dir>'\n  --tables \"\u003Capproved-seed-table-logical-names>\"\n  --exclude-tables \"\u003Cretiring-table-logical-names-or-empty>\"\n```\n\nThese are skill arguments, not Dataverse CLI flags. A required parent outside\nthe allowlist returns `NEEDS_CONTEXT`; the seeding leaf must not expand scope\nor seed a transitional retiring table to satisfy its coverage rules.\n\n#### Step 5.5 — Refresh generated service snapshot\n\nRun this after any data-source\u002Fschema\u002Fconnector mutation and before any screen-builder prompt:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nfor svc in src\u002Fgenerated\u002Fservices\u002F*.ts; do\n  [ -e \"$svc\" ] || continue\n  name=$(basename \"$svc\" .ts)\n  methods=$(grep -oE 'static async [a-zA-Z_]+' \"$svc\" | sed 's\u002Fstatic async \u002F\u002F' | tr '\\n' ',' | sed 's\u002F,$\u002F\u002F')\n  echo \"| \\`$name\\` | \\`src\u002Fgenerated\u002Fservices\u002F$name.ts\\` | $methods |\"\ndone\n```\n\nReplace or create the `## Generated Services (snapshot at \u003CISO timestamp>)` section in `native-app-plan.md` immediately after `## Screens`. If there are no services, write an empty table and a note. Screen-builders must treat this table as authoritative.\n\nMark still-present services in the approved removal set as retiring: builders\nmust not introduce or retain dependencies on them. Refresh this snapshot again\nafter Step 6.5 so it describes the actual remaining output.\n\nDo not ask the user to run these follow-up skills manually. This skill is the orchestrator.\n\n#### Step 5.6 — Offline profile reconciliation\n\nIf Step 5 created or extended Dataverse tables, an existing Mobile Offline Profile may now be missing those tables\u002Fcolumns (new tables never sync to devices; new columns arrive blank). Step 5's complete scoped `\u002Fadd-dataverse --skip-planning` handoff names `offline_reconciliation_owner: edit-app`, so this orchestrator owns the check instead of the leaf's Step 8.5. The flag alone is not enough. Skip when no Data Model mutation occurred in this edit.\n\nFor mixed addition\u002Fremoval edits, intersect any returned additions with the\napproved retained\u002Fadded Dataverse set before offering\u002Fapplying profile changes.\nNever add a retiring table to the offline profile merely because its transitional\nmanifest entry remains until Step 6.5.\n\nRun the local, no-network delta check:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Foffline-profile-delta.js\" --project-root '\u003Cworking_dir>'\n```\n\nCapture the exit status and stdout\u002Fstderr and follow the failure dispatch in\n[offline-profile-reconciliation.md](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Foffline-profile-reconciliation.md)\nbefore continuing: a non-zero exit, `status: error`, malformed\u002Fmissing JSON,\nor unknown status skips mutation helpers and ends with `DONE_WITH_CONCERNS`\nfor already-applied changes (otherwise `BLOCKED`), never a clean success.\nFor valid `no-manifest` \u002F `no-profile` \u002F `in-sync`, continue silently.\nFor `delta`, obtain approval and execute the reference's **Scoped helper\nhandoffs** with `orchestrator: edit-app`, the same absolute `working_dir`,\n`phase: implementation`, and the exact approved environment\u002Fprofile\u002Ftable\nscope. Pass `--working-dir '\u003Cworking_dir>'` to each helper along with its table\nand column arguments, then re-check through the same failure dispatch.\nRecord the outcome in the Step 8 memory-bank entry without clearing pending\n`offlineRetirement` outcomes.\n\nThese statuses concern additions only. Preserve any `offlineRetirement` outcomes\nfrom earlier attempts, and collect the removal leaf's updated outcomes in\nStep 6.5; an `in-sync` result never resolves a pending retirement.\n\n### Step 6 — Rebuild affected screens\n\n**Telemetry checkpoint: `rebuild_affected_screens`**\n\nSet `screens: active` before route\u002Flayout\u002Fshared-code work. Update its note after each builder wave,\nfor example `Wave 2 of 3 complete`, and run the progress command. Mark it `done` only after the\nnavigation\u002Fskeleton gate and every required builder wave pass.\n\nUse the plan diff plus the user's request to build the affected screen set:\n\n| Change type | Screens to rebuild |\n|---|---|\n| Existing screen behavior\u002Flayout\u002Fstate\u002Fsearch change | The named screen(s) |\n| New detail screen | The new detail screen plus the source list\u002Fsearch screen that navigates to it |\n| New create\u002Fedit form | The form screen plus parent list\u002Fdetail screens that launch it and refresh on focus |\n| New scanner\u002Fcamera\u002FPDF\u002Fpen workflow | The capability screen plus any result\u002Fdetail\u002Fform screens it routes to |\n| Data-model field added for visible UI | Every screen that displays or writes the field |\n| Data source removed\u002Freplaced | Every approved consumer, including shared hooks\u002Fhelpers and native upload\u002Fsync code; retain the old registration until these edits are complete |\n| Navigation pattern changed | Every tab\u002Froot screen and any route whose contract changed |\n| Design component\u002Fdensity\u002Freskin changed | All screens whose layout grammar is affected; for full reskin, run a broad screen wave or controlled style sweep |\n\nBefore spawning builders:\n\n- Pass the approved retiring service\u002Fsource list to every affected builder.\n  Still-present generated files are transitional dependencies, not permission\n  to keep or introduce usages that the edit is meant to remove.\n- Update route layout files using the `\u002Fcreate-mobile-app` Step 10b layout rules if navigation changed.\n- Create missing route folders for new screens.\n- Refresh the `## Generated Services` table using `\u002Fcreate-mobile-app` Step 10.7 rules if any data source\u002Fschema changed.\n- Generate or refresh app-specific shared code from `\u002Fcreate-mobile-app` Step 10.8a when two or more affected screens share an entity row\u002Fcard, choice map, cursor hook, or save helper.\n- For brand-new screens, write typed skeleton files using `\u002Fcreate-mobile-app` Step 10.8b patterns before calling builders.\n- For existing screens, do not overwrite with skeletons. Pass the current file content and the change request to the builder in edit mode. If imports\u002Fdata hooks changed, update them surgically before the builder fills or revises JSX.\n- For removed screens, delete route files and remove layout entries only when the user approved deletion in Step 3.\n\nNavigation\u002Flayout algorithm:\n\n- Read the approved `## Screens` Screen Map and Navigation Contracts.\n- Normalize every target file to its Expo route before editing. Reject duplicate normalized routes, especially `\u003Cparent>\u002F[id].tsx` together with `\u003Cparent>\u002F[id]\u002F\u003Cchild>.tsx`; move the detail contract to `\u003Cparent>\u002F[id]\u002Findex.tsx` before builders run.\n- For every new route, create the parent folder and inner `_layout.tsx` when the route is nested.\n- For modal\u002FformSheet\u002Fdetail routes, add the correct `\u003CStack.Screen name=\"...\" options={{ presentation: 'modal' | 'formSheet' }} \u002F>` in the owning folder layout.\n- For tab\u002Froot changes, patch only the route list in `app\u002F(app)\u002F_layout.tsx`; preserve auth\u002Fprovider logic and imports not related to route registration.\n- For removed routes, delete the route file and remove layout entries only after explicit user approval in Step 3.\n- After route\u002Flayout edits and before builders, run `npm run check-routes --if-present` or `node scripts\u002Fcheck-routes.js` if available.\n\nShared scaffold algorithm:\n\n- If `src\u002Fcomponents\u002Findex.tsx`, `src\u002Fhooks\u002Findex.ts`, `src\u002Futils\u002Findex.ts`, or `src\u002Ftokens\u002Findex.ts` is missing, copy the missing file from `shared\u002Fsamples\u002Fsrc\u002F`. Never overwrite an existing shared file.\n- If affected screens share an entity card\u002Frow, choice map, cursor hook, detail hook, or save helper, create or update a focused app-specific shared file before spawning builders.\n- For brand-new screens, write a typed skeleton at the `target_file` using the relevant `\u002Fcreate-mobile-app` Step 10.8b template. The skeleton must compile with `return null` before screen-builder runs.\n- For existing screens, never replace the whole file with a skeleton. Patch imports\u002Fhooks only when the approved edit changes the data\u002Fnative surface, then ask the builder to preserve existing behavior.\n\nRun the navigation\u002Fskeleton gate before screen-builder work:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnpx --no-install tsc --noEmit\n```\n\nIf it fails, batch-fix layouts, route names, skeleton imports, generated-service names, shared exports, or hook signatures, then rerun once. Do not launch screen-builders from a broken shell.\n\n#### Step 6.1 — Screen-builder preflight + waves\n\nBefore the first wave, run a silent `Task` preflight for `mobile-app:screen-builder` using a no-op screen name. If unavailable, print once and build inline using `agents\u002Fscreen-builder.md`; inline mode must satisfy the same quality rules.\n\nBatch affected screens in waves of up to 5. For each wave:\n\n1. Print the wave start: `Wave \u003CN>\u002F\u003CW> starting: \u003Cscreen names>`.\n2. Spawn all builders in one message so they can run in parallel.\n3. Parse each first line per `AGENTS.md` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCKED`). Unknown first lines are `BLOCKED`.\n4. Retry `NEEDS_CONTEXT` once with the missing context from plan\u002Ffiles\u002Fservices.\n5. Stop on `BLOCKED` unless the user chooses to skip with an approved placeholder.\n6. Run `npx --no-install tsc --noEmit` after the wave before launching the next wave.\n7. If the wave gate fails, group errors by root cause and respawn affected builders with consolidated TypeScript output. Cap at 2 retries per screen.\n\nDo not launch wave N+1 until wave N is clean.\n\nSpawn `mobile-app:screen-builder` agents in waves of up to 5 screens. Prompt each builder with:\n\n```text\nFollow screen-builder.md.\nMode: edit existing generated app.\nUser change request: \u003Cverbatim>\nworking_dir: \u003Cabsolute path>\nscreen_name: \u003Cscreen id>\nroute: \u003Croute>\ntarget_file: \u003Cabsolute path>\nplan_path: \u003Cabsolute path>\u002Fnative-app-plan.md\ncurrent_file: \u003Cpaste current file content if the file exists>\n\nPreserve unaffected behavior from the existing screen. Apply the approved plan diff. If this is an existing screen and no skeleton marker is present, update the screen from current_file instead of falling back to sample layout.\n```\n\n### Step 6.5 — Unregister retired data sources\n\nSkip when the approved removal set is empty. After Step 6 updates\u002Fremoves the\nconsumers, re-check that no retained source depends on a retiring registration.\nExecute [data-source-removal.md](..\u002F..\u002Fshared\u002Freferences\u002Fdata-source-removal.md)\nthrough `\u002Fadd-dataverse` for Dataverse bindings, `\u002Fadd-sharepoint` for SharePoint,\nor `\u002Fadd-connector` for other connectors\u002Fprocedures\u002Fflows, passing removal mode,\nthe exact registered identities, and the current approved orchestration context.\nSelect removal mode with the skill-only `--remove` argument; never pass it to CLI.\n\nThe leaf bypasses its add workflow and uses the supported CLI removal command,\nwhich owns `.power\u002Fschemas\u002F`, `src\u002Fgenerated\u002F`, and `power.config.json` cleanup.\nThen regenerate the runtime schema map, verify absent\u002Fretained registrations\nand generated output, and reconcile the app manifest and offline impact.\nRefresh the Generated Services snapshot again before final validation.\nA no-op, partial cleanup, or remaining consumer blocks completion; do not mark\nthe new plan as fully applied or manually patch generated\u002Fconfig files.\nCarry each leaf's `offlineRetirement` status into Step 8, including intentionally\nretained coverage and pending decisions\u002Fmigrations. Do not replace those statuses\nwith Step 5.6's addition-only result.\n\n### Step 7 — Verify\n\n**Telemetry checkpoint: `validate_edited_app`**\n\nSet `verify: active` before the first gate and run the progress command. On a failed gate, keep it\nactive while applying the bounded repair and record the failing command in its note. Mark it\n`failed` if verification cannot be completed; mark it `done` only after every required rerun passes.\n\nRun verification after mutations. Batch-fix root causes, then rerun the failed gate once. Verification is selected by what changed, but TypeScript is always required after an app mutation.\n\nRequired gates, selected by what changed:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnpm run generate-schemas      # if any data source\u002Fschema\u002Fconnector changed\nnpx --no-install tsc --noEmit              # always after app mutation\nnpm run check-routes --if-present\n```\n\nIf `npm run check-routes` is absent but `scripts\u002Fcheck-routes.js` exists, run:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode scripts\u002Fcheck-routes.js\n```\n\nWhen screen files changed, run the mobile plugin's report-mode validators explicitly:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode \"${PLUGIN_ROOT}\u002Fhooks\u002Fvalidate-screen-quality.js\" --report \u003Cchanged-screen-files-or-app-dir>\nnode \"${PLUGIN_ROOT}\u002Fhooks\u002Fvalidate-color-contrast.js\" --report \u003Cchanged-screen-files-or-app-dir>\n```\n\nTreat validator findings like create-flow gate failures: capture once, batch by root cause, repair, and rerun the same validator once. These scripts are invoked only inside the mobile workflow; do not register them as plugin-wide hooks.\n\n#### Step 7.1 — Targeted style-quality sweep\n\nWhen screen files changed, run a focused version of `\u002Fcreate-mobile-app` Step 11.4 against the changed screen files plus any route layouts changed by this edit.\n\nRules:\n\n1. Run `validate-screen-quality.js --report` and `validate-color-contrast.js --report` when available.\n2. Merge issues by file and rule.\n3. Auto-fix deterministic issues: weak readable tokens, yellow\u002Forange badges with white text, missing icon-only `aria-label`, missing `role`, tiny icon hit targets, raw hex tokens, missing safe-area padding, `allowFontScaling={false}`. Apply these web-standard accessibility props to Tamagui 2 components; raw React Native components retain their React Native accessibility props.\n4. Treat judgement calls as concerns, not infinite loops: complex safe-area restructuring, ambiguous brand color choices, large hierarchy redesigns, or empty-state rewrites that require large JSX movement.\n5. Re-run the same report validators for touched files. Cap retries at 2 per file per validator.\n6. Run `npx --no-install tsc --noEmit` after style fixes. Style concerns may remain, but TypeScript may not.\n\nIf auto-fixable issues remain after retries, record `DONE_WITH_CONCERNS` in `memory-bank.md` with file\u002Frule summaries.\n\nIf verification fails because the edit exposed stale generated services, rerun the relevant data-source regeneration once before changing screens by hand. If failures are unrelated pre-existing issues, report them separately and do not hide them as successful edit results.\n\n### Step 8 — Preview + memory-bank update\n\n**Telemetry checkpoint: `refresh_app_preview_and_history`**\n\nMark `preview: active` while regenerating `preview.html`, or `skipped` when no visible surface\nchanged. Then build `\u003Cedit-temp-dir>\u002Fapp-plan-sync.json` from the verified app state and mark\n`sync-plan: active`. The payload must contain complete snapshots for every changed section,\nincluding removals, plus the preview and verification notes owned by those sections. Run:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' sync \\\n  --json-file '\u003Cedit-temp-dir>\u002Fapp-plan-sync.json'\n```\n\nAfter the sync succeeds, mark `sync-plan: done`, settle every applicable checklist row, set\ntop-level `phase: done` and `status: done`, and run the progress command one last time, but only\nafter the device-test handoff below has updated the phone state.\nBefore that final progress write, reconcile each change entry with the verified app state.\nUpdate data-model tables and relationships from the final normalized contract and update screen\nnodes and edges from the final routes and navigation layouts.\nThe completed edit page and `docs\u002Fcreate-app-plan.html` must describe the same final structure.\nIf sync rendering fails, record the concern but do not misreport the app edit or verification as\nfailed.\n\nBefore Step 8, `npx --no-install tsc --noEmit` must be clean after all code edits from this `\u002Fedit-app` run. If any code was written after Step 7's `tsc`, rerun `npx --no-install tsc --noEmit`, batch-fix root causes, and continue only when TypeScript is error-free.\n\nIf any UI, design, navigation, native interaction, or visible data state changed - or if the user\nexplicitly asked for a preview - read and execute `\u002Fpreview-screens` after verification with\n`MOBILE_APP_ORCHESTRATING=1` and `MOBILE_APP_EMBED_PREVIEW=1`.\nThis regenerates `preview.html` without opening a separate browser page.\nAfter the file is written, put the same screens in the phone rail and publish the progress page:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' phone --stage screens \\\n  --preview-file '\u003Cworking_dir>\u002Fpreview.html'\n```\n\nKeep the progress page open.\nIt shows the screens in a sandboxed phone carousel, links to `preview.html` for a full-size view, and\nkeeps the living `docs\u002Fcreate-app-plan.html` in sync through the same phone state.\nIf the preview was skipped or generation failed, leave the phone on its current progress state and\nreport the concern.\n\nUnless this is `--plan-only`, finish with a real-device handoff. Read\n`\u002Fcreate-mobile-app` Step 12 from **Launch command** through **Put the QR in the plan** and execute\nthat sequence from the same `\u003Cworking_dir>`. Before launching, apply `\u002Fdebug-app` Phase 0.0's\nproject-local log, PID, and port-ownership checks to every\n`\u003Cworking_dir>\u002F.powernative\u002Fmetro-logs\u002Fmetro-*-pid-*-port-*.log` candidate.\n\n- When exactly one session is live, reuse it. Read its native Metro URL from the sanitized log,\n  verify that the URL port matches the live log's port, and do not run `npm run dev`.\n- When no session is live, start Metro with the template-owned `npm run dev` and capture the URL it\n  prints.\n- When several sessions are live, or the PID, port, log, and URL disagree, show the sessions and\n  ask which one to use. Do not start another server while the choice is unresolved.\n\nGenerate `.expo\u002Fmetro-qr.png` from the selected URL with the pinned\n`npx --no-install qrcode`. Then update both documents through the existing phone command:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' phone --stage qr \\\n  --qr-image '\u003Cworking_dir>\u002F.expo\u002Fmetro-qr.png' --qr-url \"\u003Cmetro-url>\"\n```\n\nDo not open `docs\u002Fcreate-app-plan.html`; its phone changes in the background. Run the final\n`progress` write with `devicePreviewReady: true` after this command succeeds so the already-open\nedit page replaces the screen carousel with the same QR code and shows the App Store and Google Play\nbuttons for Power Apps Mobile Preview. If Metro or QR generation fails,\nkeep `devicePreviewReady: false`; the completed edit page then shows `Device preview unavailable`\neven when the living plan contains a QR from an earlier run. Report the preview concern separately,\nand do not turn a verified app edit into a failure.\n\nIf the user gives a concrete runtime symptom and Metro is already running from the native dev-client flow, you may invoke `\u002Fdebug-app \"\u003Csymptom>\"` after the static verification and preview steps. This is an optional symptom-debug handoff, not a verification gate: do not run screen-by-screen runtime checks, do not crawl routes, do not use React Native Web, and do not call Metro HTTP endpoints directly.\n\nAppend an edit entry to `memory-bank.md`:\n\n```markdown\n### Edit: \u003Cyyyy-mm-dd> \u003Cshort title>\n- Request: \u003Cverbatim or concise summary>\n- Intent brief: \u003Ctarget screens\u002Froutes, data surface, native capability, design scope>\n- Assumptions: \u003Cinferred choices or none>\n- Skills\u002Fagents invoked: \u003Cdata-model-architect, screen-planner, add-dataverse, screen-builder, etc.>\n- Plan sections changed: \u003CData Model \u002F Native Capabilities \u002F Screens \u002F Design \u002F Connectors>\n- App changes: \u003Cscreens\u002Froutes\u002Fnative wrappers\u002Fdata sources>\n- Verification: \u003Ccommands\u002Fgates + pass\u002Ffail\u002Fskipped with reason>\n- Preview: \u003Cpreview.html path or not generated>\n- Debug handoff: \u003Cnot requested \u002F \u002Fdebug-app \"\u003Csymptom>\" invoked>\n- Offline retirement: \u003Cper-table not-applicable \u002F retained with reason \u002F pending \u002F reconciled with verification>\n- Blocks\u002Fconcerns: \u003Cnone or list>\n```\n\nFinal summary must say what changed in the app, what verification ran, where the preview is, whether\nthe living app plan was updated to reflect the latest verified changes, and whether a symptom-debug\nhandoff was requested. Claim the plan was updated only when the final sync succeeded; otherwise\nstate that the app edit verified but the living plan refresh failed and include that concern. Do\nnot end by saying the codebase was not changed unless this was explicitly `--plan-only`.\nIf any `offlineRetirement` outcome is `pending`, return `DONE_WITH_CONCERNS` and\nstate the unfinished decision separately: \"App changes completed. The offline\nprofile still includes Orders; deciding whether to retain or remove that coverage\nis pending.\" Substitute the actual table and only claim app completion when its\nverification passed. Never remove profile entries automatically to clear this note.\n\n## Notes\n\n- `native-app-plan.md` is still the durable source of truth. The change should be planned before it is applied, but planning is not the end state.\n- For complex multi-section edits, update and gate every required section first, then apply the mutation in dependency order. Do not leave a native capability entry that references missing Dataverse storage or a screen state that was never planned.\n- The architect agents are the same ones used by `native-app-planner` during initial creation, so planning improvements flow through here.\n- This skill intentionally covers post-generation iteration. It is acceptable for `\u002Fedit-app` to touch Dataverse, `src\u002Fnative\u002F`, route layouts, screen TSX, brand tokens, `preview.html`, and `memory-bank.md` when the approved edit requires it.\n","> **Plugin check**: Run `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-version.js\"` - if it outputs a message, show it to the user before proceeding.\n\n**Shared instructions: [shared-instructions.md](..\u002F..\u002Fshared\u002Fshared-instructions.md)** — read first.\n\n# Edit App (`\u002Fedit-app`)\n\nPost-generation editor for an existing mobile app. `native-app-plan.md` remains the source of truth, but the default outcome is a fixed generated app, not a plan-only diff. After the user approves the plan delta, continue into Dataverse\u002Fnative\u002Fdesign\u002Fscreen mutations, run verification, update `memory-bank.md`, and regenerate the static preview when UI changed.\n\nUse `--plan-only` only when the user explicitly asks to update planning docs without changing app code. Normal follow-up prompts in Copilot Chat Agent mode should apply the app change end to end.\n\n## Edit documentation protocol\n\nKeep two HTML files current during every edit:\n\n- `\u003Cedit-temp-dir>\u002Fedit-app-progress.html` shows the live operation checklist.\n- `docs\u002Fcreate-app-plan.html` remains the living description of the app.\n\nBoth are best-effort documentation. A rendering failure does not authorize a mutation, cancel an\napproval gate, or turn a failed verification into success.\n\n### Progress page\n\nAs soon as Step 0 resolves `working_dir`, before inferred-plan sync or the first progress write, ask\n`app-docs.js` for a namespaced directory inside the user's OS temp directory:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' temp\n```\n\nUse the returned `directory`, `progress`, `progressHtml`, and `sync` paths for the rest of the\nrun. Do not create progress files inside the project. Create `\u003Cedit-temp-dir>\u002Fedit-app-progress.json`\nwith one row per operation this edit will run.\nUse stable IDs such as `inspect`, `impact`, `plan`, `approve`, `save-plan`, `data`, `native`,\n`design`, `screens`, `verify`, `preview`, and `sync-plan`. Omit operations that do not apply.\nEach row has `id`, `label`, `status` (`pending`, `active`, `waiting`, `done`, `skipped`, or\n`failed`), and an optional `note`.\nAdd a top-level `changes` array for the Changes tab.\nKeep it empty during initial inspection.\nAfter Step 2, every entry requires `kind`, `title`, `rationale`, and optional `detail`.\nUse `kind: general` for text-only changes.\nUse structured diagram data for data-model and screen changes:\n\n```json\n{\n  \"changes\": [\n    {\n      \"kind\": \"data-model\",\n      \"title\": \"Add inspection evidence\",\n      \"detail\": \"Create a child table for photos and signatures.\",\n      \"rationale\": \"One inspection can have several evidence records with independent metadata.\",\n      \"dataModel\": {\n        \"tables\": [\n          {\n            \"name\": \"Inspection\",\n            \"columns\": [{ \"name\": \"inspectionid\", \"type\": \"guid\", \"primaryKey\": true }]\n          },\n          {\n            \"name\": \"Evidence\",\n            \"columns\": [\n              { \"name\": \"evidenceid\", \"type\": \"guid\", \"primaryKey\": true },\n              { \"name\": \"inspectionid\", \"type\": \"guid\", \"foreignKey\": true }\n            ]\n          }\n        ],\n        \"relationships\": [\n          {\n            \"from\": \"Inspection\",\n            \"to\": \"Evidence\",\n            \"cardinality\": \"one-to-many\",\n            \"label\": \"contains\"\n          }\n        ]\n      }\n    },\n    {\n      \"kind\": \"screen\",\n      \"title\": \"Add inspection detail\",\n      \"detail\": \"Add a route that shows findings and evidence.\",\n      \"rationale\": \"Inspectors need a focused review surface before updating a record.\",\n      \"screenGraph\": {\n        \"screens\": [\n          { \"id\": \"list\", \"name\": \"Inspections\", \"route\": \"\u002Finspections\" },\n          { \"id\": \"detail\", \"name\": \"Inspection detail\", \"route\": \"\u002Finspections\u002F[id]\" }\n        ],\n        \"edges\": [\n          { \"from\": \"list\", \"to\": \"detail\", \"label\": \"Select inspection\" }\n        ]\n      }\n    }\n  ]\n}\n```\n\nDerive data-model tables, columns, and relationships from the validated schema proposal.\nDerive screen nodes and edges from the updated Screen Map and Navigation Contracts.\nWhen multiple screens are shown, include every navigation edge needed to explain how the user moves\nbetween them.\nDo not hand-author Mermaid source in the payload.\n`app-docs.js` derives and renders the ER diagram or screen graph from the structured data.\nRetain the approved wording, rationale, and graph data through implementation and verification.\n\nRewrite that JSON at every numbered step boundary and run:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' progress \\\n  --json-file '\u003Cedit-temp-dir>\u002Fedit-app-progress.json'\n```\n\nEvery progress payload is a complete snapshot, not a patch.\nCarry every operation row forward and update all rows whose state changed before publishing.\nWhen the top-level phase advances, no row from an earlier phase may remain `active` or `waiting`.\nIn particular, an approval wait must show inspection and planning as complete and the approval row\nas `waiting`.\n\nThe top-level object also carries `phase`, `status`, `note`, `waiting`, and\n`devicePreviewReady`. Set the current row to `waiting` and `waiting: true` before every user\nquestion. Set completed rows to `done`; do not leave the first row active for the whole run. On\nfailure, mark the failed row and top-level status `failed`. The page keeps a phone preview on the\nright while work is active. Keep `devicePreviewReady: false` until this edit's Step 8 phone command\nsucceeds. Then set it to `true` in the final progress write, mark every applicable row settled, and\nset top-level status `done`. A QR left by an earlier run is never current-run preview evidence.\nEvery branch that ends the workflow must publish a terminal progress write. Preserve the operation's\nactual result, mark completed rows `done` or `failed`, mark rows that will not run `skipped`, clear\n`waiting`, and set the top-level status to `done` or `failed`.\n\nOpen `\u003Cedit-temp-dir>\u002Fedit-app-progress.html` once after the first write using the host's file\nopener. If no opener is available, print the absolute path. The page refreshes itself while work\nis active.\n\n### Living app plan\n\n`app-docs.js sync` accepts a structured snapshot, not a prose summary:\n\n```json\n{\n  \"appName\": \"Field inspections\",\n  \"dataPlatform\": \"dataverse\",\n  \"inferred\": false,\n  \"summary\": \"Added inspection detail and evidence capture.\",\n  \"sections\": {\n    \"requirements\": {},\n    \"architecture\": { \"dataPlatform\": \"dataverse\", \"nativeCapabilities\": [], \"connectors\": [] },\n    \"dataModel\": { \"tables\": [] },\n    \"screens\": { \"navigation\": \"\", \"list\": [] },\n    \"design\": {},\n    \"offline\": {},\n    \"trust\": {}\n  },\n  \"sectionStates\": { \"screens\": \"approved\" }\n}\n```\n\nFor an existing plan, include every section this edit changed and omit unchanged sections. Serialize\nthe complete current section after implementation; the sync command replaces that section so\nremoved screens, connectors, capabilities, and tables do not survive as stale rows. Build values\nfrom the verified app and its durable plan, not from the pre-approval proposal.\n\nWrite the payload to `\u003Cedit-temp-dir>\u002Fapp-plan-sync.json`, then run:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' sync \\\n  --json-file '\u003Cedit-temp-dir>\u002Fapp-plan-sync.json'\n```\n\nIf `docs\u002F.run-plan.json` is missing, the payload must cover every section that can be derived from\nthe app: routes and layouts for `screens`, generated models\u002Fservices and the manifest for\n`dataModel`, `power.config.json` plus generated registrations for connectors, `src\u002Fnative\u002F` and\ntemplate dependencies for native capabilities, and brand\u002Ftoken files for `design`. Mark this first\nsnapshot `inferred: true` and use the note `Plan inferred from existing app state because no prior\ncreate-run plan was present.` Unknown facts stay explicitly unknown; do not guess.\n\nUpdate `docs\u002Fcreate-app-plan.html` in the background. Do not open or focus it during `\u002Fedit-app`.\nRun the sync command after an inferred baseline is created, after approved plan sections are saved,\nand again after Step 8 verification so the page ends on the app's actual current state. Tell the\nuser when the living app plan has been updated to reflect the latest verified changes.\n\n## When to use\n\n- \"Improve the search screen to make it easier to use on mobile\"\n- \"Add loading, empty, and error states to the list screen\"\n- \"Add a detail screen for the selected record\"\n- \"Update the design to better match the company branding\"\n- \"Add a form to create a new record in Dataverse\"\n- \"Add barcode scanning and use the scanned value to search records\"\n- \"Generate a new static preview of the updated app\"\n- \"Add a `case` table to the data model\"\n- \"Replace the Drawer navigation with Tabs\"\n- \"Add `expo-camera` to the native capabilities\"\n- \"Add signature capture to approvals and store it in Dataverse\"\n- \"Generate an evidence PDF and retain it on the inspection record\"\n- \"Add a View PDF action for an HTTPS report URL\"\n- \"Reorder screens — move profile out of tabs, into a modal from the home header\"\n- \"Enable Application Insights for this app\"\n- \"Change the Application Insights resource used by this app\"\n- \"Disable Application Insights for this app\"\n\n## When NOT to use\n\n- Brand-new project → `\u002Fcreate-mobile-app`\n- Explicit implementation-only request → the matching leaf skill under\n  [app-edit-routing.md](..\u002F..\u002Fshared\u002Freferences\u002Fapp-edit-routing.md); do not infer\n  this from a short request or the absence of screen details.\n- No recognizable generated app root (`package.json` plus `app\u002F`) → stop and ask for the app\n  directory. A missing plan by itself is handled by the inferred-baseline path below.\n\n## Workflow\n\nThis skill owns direct feature requests forwarded by native, connector,\ndata-model, and design entry points. Reuse the forwarded original request,\narguments, and answers; do not ask the user to repeat them.\n\nThose entry points ask permission before invoking this full workflow. Reuse\n`entry_choice: full-integration` for the current request without repeating the\nmode question. A direct `\u002Fedit-app` invocation also needs no entry-choice menu.\nNeither authorizes mutations: keep the impact\u002Fplan gates below. Approved child\ncalls skip the entry question and return here; do not create a recursive menu.\n\nFor each child skill invocation, explicitly pass the\n[app-edit-routing.md](..\u002F..\u002Fshared\u002Freferences\u002Fapp-edit-routing.md) context:\n`MOBILE_APP_ORCHESTRATING=1`, `orchestrator: edit-app`, `working_dir`, `phase`,\nand `approved_scope`. Planning uses read-only proposals; Step 5 implementation\nuses the scope approved in Step 3 and saved in Step 4. The marker is not approval\nand must not be persisted or relied on via a previous shell export.\n\n0. Locate app + health\u002Fdrift probe → 0.5 Application Insights fast path when applicable → 1. Discover intent + inspect existing app → 1.5 Impact preview → 2. Re-plan affected sections → 3. Gate intent, plan + mutation preview → 4. Write plan diff → 5. Apply additions\u002Frefreshes → 6. Rebuild affected screens → 6.5 Unregister approved retired sources → 7. Verify + quality sweep → 8. Preview + memory-bank update + optional debug handoff\n\n---\n\n## Edit Quality Gate Policy — no quality compromise\n\nThis is a focused edit workflow, not a lighter quality bar. Reuse `\u002Fcreate-mobile-app` gates at edit scale.\n\n**Required gates by edit type:**\n\n| Edit touches | Required gates |\n|---|---|\n| Any source file | Existing-app health gate, final `npx --no-install tsc --noEmit` |\n| Dataverse\u002Fschema\u002Fconnector | Environment drift gate, data-source\u002Fschema gate, Generated Services snapshot refresh, final `tsc` |\n| Navigation\u002Froutes | Navigation\u002Flayout gate, route contract check, final `tsc` |\n| New screen | Shared scaffold gate, skeleton gate, screen-builder wave gate, style-quality sweep, route check, final `tsc` |\n| Existing screen TSX | Screen edit gate, style-quality sweep, route check when navigation changed, final `tsc` |\n| Native capability | Native allowlist gate, wrapper existence gate, final `tsc` |\n| Pure-JavaScript dependency | Approved exact-version dependency table, package-content gate, package validation, final `tsc` |\n| Design\u002Fcomponent\u002Fdensity | Design-system gate, affected-screen style sweep, final `tsc`, preview |\n| Application Insights configuration only | Valid `app.json`, provider `appConfig` wiring, final `tsc` only if `app\u002F_layout.tsx` changed |\n\n**When a gate fails:** capture full output once, classify by root cause, repair in a batch, rerun the same gate once. Do not make line-by-line fixes with `tsc` after every tiny edit. Continue only when the gate is clean or record a `BLOCKED:` \u002F `DONE_WITH_CONCERNS:` entry in `memory-bank.md`.\n\n**Hard stops:**\n\n- Do not run data-source mutations if the app root\u002Fenvironment cannot be identified.\n- Do not launch screen-builders from broken generated services, route layouts, shared code, or skeletons.\n- Do not import native wrappers in screens before `\u002Fadd-native` has generated them.\n- Do not hide unsupported native capabilities behind mocks or TODOs just to satisfy TypeScript.\n- Do not mark an edit successful if changed screens fail TypeScript, route contracts, or required validators.\n\n### Step 0 — Locate app + health\u002Fdrift probe\n\n**Telemetry checkpoint: `assess_app_health_and_drift`**\n\nBefore any project read or command, execute\n[app-working-directory.md](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fapp-working-directory.md).\nResolve the absolute `working_dir` once, bind every shell call to it with the\nfail-closed guard, and use absolute paths for file tools. Forward that same root\nto every data child; a previous `cd` or inherited launch cwd is not a handoff.\nImmediately run the edit documentation protocol's `temp` command and bind its returned\n`directory`, `progress`, `progressHtml`, and `sync` paths as `\u003Cedit-temp-dir>` values before any\ninferred-plan sync or progress write below.\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\ntest -f native-app-plan.md && echo \"OK: plan found\" || echo \"INFO: plan will be inferred\"\ntest -f package.json && echo \"OK: package found\" || echo \"ERROR: no package\"\ntest -d app && echo \"OK: app routes found\" || echo \"ERROR: no app routes\"\ntest -f memory-bank.md && echo \"OK: memory bank found\" || echo \"WARN: no memory bank\"\ngit status --short\n```\n\nIf `package.json` or `app\u002F` is missing, STOP because this is not a recognizable generated app.\nIf `native-app-plan.md` is missing, inspect the current app before asking edit questions. Build an\ninferred current-state baseline from routes\u002Flayouts, `power.config.json`, generated\nmodels\u002Fservices, `.datamodel-manifest.json`, `src\u002Fnative\u002F`, package dependencies, brand\u002Ftoken\nfiles, and `memory-bank.md` when present. Write `native-app-plan.md` with every evidenced section,\nlabel it `Inferred current-state baseline`, and mark unresolved facts as unknown. Do not run\n`\u002Fcreate-mobile-app`, invent missing business intent, or treat inference as mutation approval.\nCreate `\u003Cedit-temp-dir>\u002Fapp-plan-sync.json` from the same evidence and run the `sync` command so imported apps\nreceive `docs\u002Fcreate-app-plan.html` before planning begins.\n\nCreate the edit progress payload now with `inspect: active`, run the `progress` command, and open\n`\u003Cedit-temp-dir>\u002Fedit-app-progress.html`.\n\nRead if present:\n\n- `memory-bank.md` — project facts, target environment, visual companion flag, prior blocks\n- `.datamodel-manifest.json` — existing Dataverse tables\u002Fcolumns\n- `brand\u002Fdesign-system.md` and `brand\u002Ftokens.ts` — design constraints and token availability\n- `src\u002Fgenerated\u002Fservices\u002F*.ts` and `src\u002Fgenerated\u002Fmodels\u002F*.ts` — generated data surface\n\nRun these existing-app health checks before any mutation:\n\nThis is an inspection-only gate. Include required scaffold\u002Fprovider\u002Fservice\nrepairs in the proposed mutation scope; do not apply them before Step 3 approval.\n`--plan-only` never authorizes these repairs or any other app\u002Fcloud mutation.\n\n| Check | Action if unhealthy |\n|---|---|\n| `memory-bank.md` exists and has expected headings | If missing\u002Fcorrupt, ask whether to proceed with reduced resume safety; create\u002Fupdate only after approval |\n| `power.config.json`, `.resolved-environment.json`, and memory bank env agree | For data-source\u002Fschema edits, STOP until the user confirms the intended environment |\n| `src\u002Fcomponents\u002Findex.tsx`, `src\u002Fhooks\u002Findex.ts`, `src\u002Futils\u002Findex.ts`, `src\u002Ftokens\u002Findex.ts` exist | Restore missing shared scaffold from `shared\u002Fsamples\u002Fsrc\u002F` before screen-builder work; do not overwrite existing files |\n| `app\u002F_layout.tsx` still wraps providers and SafeAreaProvider correctly | Patch conservatively before screen work; route\u002Fsafe-area validators depend on this |\n| `src\u002Fgenerated\u002F` compiles when the edit depends on generated services | Regenerate schemas\u002Fservices first, or block before screen work |\n| `node_modules` and package scripts needed for verification exist | If missing, ask user to run install; do not pretend verification passed |\n\nIf the worktree has uncommitted changes that overlap likely edit targets, show the affected files and ask before continuing. Do not revert or stash automatically.\n\nIf the app already fails `npx --no-install tsc --noEmit`, capture the errors once. Continue only when the failures are in files this edit will touch or are generated-service drift this edit can repair; otherwise surface the pre-existing failure and ask whether to proceed. If the edit would add screens or generated services, clean the prerequisite gate before continuing.\n\n### Step 0.5 — Application Insights configuration fast path\n\nIf `--plan-only` is present, do not invoke the configuration skill or change\nApplication Insights. For a configuration-only request, report that it has no\nplan section and stop unchanged; for a mixed request, continue with only the\nrequested plan proposal.\n\nUse this fast path when the request is only to enable Application Insights, change its resource, or disable it. Application Insights is host\u002Fruntime configuration, not a connector or plan section, so do not run the planner, data-model, native, design, screen, or preview flows.\nFor a configuration-only request, use a `configure-insights` checklist row. Mark `inspect: done`\nand `configure-insights: active` before delegation.\n\nIf the request also adds or changes custom events in app screens, configure Application Insights here first, then continue through the normal edit workflow for those source changes.\n\nAll Application Insights logic lives in the dedicated `\u002Fsetup-app-insights` skill. Delegate to it rather than duplicating Azure discovery, connection-string handling, provider wiring, or privacy rules here:\n\n```\nInvoke skill: \u002Fsetup-app-insights\n\nEnvironment:\n  MOBILE_APP_ORCHESTRATING=1\n  orchestrator: edit-app\n  working_dir: \u003Cworking_dir>\n  phase: configuration\n  approved_scope: \u003Crequested configuration action; setup-app-insights owns approval>\n\nArguments:\n  --working-dir \u003Cworking_dir>\n  --action \u003Cenable|change-resource|disable>   # omit to let the skill infer + ask\n```\n\nDetermine `--action` from the request (`enable` \u002F `change-resource` \u002F `disable`); omit it if the request only says \"update Application Insights\" and let the skill ask. The skill owns the mutation preview, approval, `app.json` + `PowerAppsProvider` `appConfig` wiring, `memory-bank.md` updates, and the selection telemetry emit.\n\nHandle the return per the status protocol (AGENTS.md rule #12):\n\n- `DONE` → print the action completed. Then, if the return includes `instrumentation_offer: available` (a successful enable\u002Fchange-resource), ask the user one question, defaulting to **No**: \"Application Insights is on. Want me to add custom telemetry to your app's major operations (create \u002F update \u002F delete)?\"\n  - **Yes** → continue into the normal edit workflow (Step 1 onward) with this brief: *\"Add custom events at each successful create, update, and delete boundary for the app's main entities; emit named events through `getCustomEventsLogger` with approved scalar properties only (no operation results, payloads, form values, free text, record titles, personal identifiers, tokens, precise coordinates, nested objects, or complete URLs); use `trackScenario()` for any duration.\"* Screen-planner and screen-builder own the source edits under their existing privacy allowlist.\n  - **No** (or `instrumentation_offer: none`) → mark `configure-insights: done`, mark every remaining row `skipped`, clear `waiting`, set top-level `phase: done` and `status: done`, publish the progress page, then stop.\n- `DONE_WITH_CONCERNS` → mark `configure-insights: done`, mark every remaining row `skipped`, clear `waiting`, set top-level `phase: done` and `status: done`, include the concerns in the note, publish the progress page, surface the concerns, then stop.\n- `NEEDS_CONTEXT` → surface the question, re-invoke with the answer.\n- `BLOCKED` → mark `configure-insights: failed`, mark every remaining row `skipped`, clear `waiting`, set top-level `phase: done` and `status: failed`, publish the progress page, surface the error (usually `app.json` unusable), then stop.\n\n### Step 1 — Discover intent + inspect existing app\n\nUpdate `\u003Cedit-temp-dir>\u002Fedit-app-progress.json`: keep `inspect` active while reading the app, then mark it\n`done` once the existing routes, data surface, native wrappers, and design constraints are known.\nRun the protocol's `progress --json-file` command after each update.\n\nInfer from `$ARGUMENTS` when possible, but do not mutate files until you have a concrete edit brief. This is the mini `\u002Fcreate-mobile-app` requirements phase for one existing-app change.\n\nFirst inspect the app so questions can use real options instead of abstractions:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nfind app -name '*.tsx' -not -name '_layout.tsx' -not -name '+not-found.tsx' | sort\nls -1 src\u002Fgenerated\u002Fservices\u002F*.ts 2>\u002Fdev\u002Fnull | sed 's|src\u002Fgenerated\u002Fservices\u002F||;s|\\.ts$||'\nls -1 src\u002Fgenerated\u002Fmodels\u002F*.ts 2>\u002Fdev\u002Fnull | sed 's|src\u002Fgenerated\u002Fmodels\u002F||;s|\\.ts$||'\nfind src\u002Fnative -maxdepth 1 -type f -name '*.ts*' 2>\u002Fdev\u002Fnull | sort\n```\n\nAlso read the relevant `native-app-plan.md` sections (`## Data Model`, `## Native Capabilities`, `## Design`, `## Screens`, and `## Generated Services` if present) plus the existing TSX for any candidate screen. If `brand\u002Fdesign-system.md` exists, read it before asking design\u002Fscreen questions so the edit preserves product grammar, density, component rules, and negatives.\n\nAsk only for information that cannot be inferred from the app. If there is exactly one plausible screen\u002Ftable\u002Fservice, state the inferred choice in the mutation preview instead of asking. If there are multiple plausible choices, ask a small multiple-choice question with those real names.\n\nBuild an edit brief before Step 2:\n\n```markdown\n## Edit Brief\n- Intent: \u003Cwhat user wants to accomplish>\n- Target screens\u002Froutes: \u003Cexisting or new>\n- Data surface: \u003Cgenerated service\u002Ftable\u002Fconnector, or none>\n- Native capability: \u003Cwrapper\u002Fcontrol needed, or none>\n- Design scope: \u003Ctokens\u002Fcomponent grammar\u002Fscreen-specific, or none>\n- Plan sections to update: \u003CData Model \u002F Native Capabilities \u002F Screens \u002F Design \u002F Connectors>\n- App files likely touched: \u003Croutes\u002Flayouts\u002Fsrc\u002Fnative\u002Fsrc\u002Fgenerated\u002Fbrand\u002Fetc.>\n- Verification gates: \u003Cschema, tsc, routes, validators, preview>\n```\n\nIf the edit brief is incomplete after inspection, ask scenario-specific questions before continuing.\n\nOnly if the requested change is still unknown after inspection, ask via `AskUserQuestion`:\n\n> \"What should this app edit change?\n> (a) Data model — add\u002Fextend\u002Freuse Dataverse tables\n> (b) Native capability — camera, scanner, PDF, pen, files, secure storage\n> (c) Screens\u002Fnavigation — list, search, detail, form, tabs, states\n> (d) Design — palette, typography, components, density, brand rules\n> (e) Connector\u002Fdata source — SharePoint, Office, custom connector\n> (f) Multi-section feature — one user-visible change that needs several of the above\n> (g) Preview only\n> (h) Cancel\"\n\nAsk for a brief description only if the original request and supplied answers\nstill do not explain it. Ask one unresolved question at a time.\n\nScenario-specific questions to ask only when the answer is not already obvious:\n\n| Scenario | Required intent questions before planning |\n|---|---|\n| Search\u002Fmobile usability | Which existing search\u002Flist screen? Which fields should search cover? Should search run locally over loaded rows or query Dataverse\u002Fconnector server-side? Are filters\u002Fsort\u002Fscope needed? |\n| Loading, empty, error states | Which list screen(s)? If no list screen exists, should `\u002Fedit-app` create a new list screen or apply states to another data screen? Are there already loading\u002Fempty\u002Ferror components that should be improved rather than duplicated? |\n| Detail screen | From which source screen does the user select a record? Which table\u002Fservice is the record from? Which fields\u002Factions must appear? Should the route be push detail, modal, or formSheet? |\n| Branding\u002Fdesign | What is the brand source (brand doc, logo, URL, text description, existing app)? Is this palette-only, typography, component\u002Fdensity, or full reskin? Should all screens update or only named screens? |\n| Dataverse create form | Which Dataverse table? Existing table or new table? Which fields are required\u002Feditable? Where should the form launch from? What happens after save (back, detail, add another)? Are there lookup\u002Ffile\u002Fimage fields? |\n| Barcode\u002FQR scan search | Where should scanning live (new scanner screen, existing search screen action, form field)? What does the scanned value represent (record ID, serial number, asset tag, SKU, custom field)? Which table\u002Fservice\u002Ffield should it search? What happens on no match or multiple matches? |\n| New requirement + screen | What user workflow is being added? Who uses it? What data\u002Fnative\u002Fconnectors does it need? Where does it sit in navigation? What is success\u002Ffailure behavior? |\n| New data source | What job does the data source support? Is it structured business data (Dataverse), SharePoint list\u002Flibrary, a connector action, or another connector? Which screen(s), if any, should use it now? |\n| Remove\u002Freplace a table or integration | Remove it only from this app, or is server deletion separately intended? Which remaining screens, lookup\u002Fidentity helpers, native sync, or offline behavior still require it? Preserve server data by default. |\n| Native capability without a workflow | What should the capability do, where should users invoke it, and should the result stay local or be retained in an existing data source? |\n| Preview only | Preview all screens or only changed\u002Fkey screens? Should Visual Companion auto-open behavior be honored? |\n\nExisting-state checks before deciding to add vs edit:\n\n- For a named screen, confirm the route file exists. If it does not, ask whether to create it or choose an existing screen.\n- For list states, grep the target screen for `LoadingState`, `EmptyState`, `ErrorState`, `refreshing`, and `onRefresh`; improve missing or weak states, do not duplicate existing ones.\n- For forms, check generated service methods for `create`\u002F`update` before planning UI. If methods or table are absent, add\u002Frefresh the data model first.\n- For scanner work, check `src\u002Fnative\u002F` and the plan's Native Capabilities table for scanner\u002Fcamera wrappers before screen work.\n- For detail screens, check Navigation Contracts and existing dynamic routes before creating another `[id].tsx`.\n- For branding, check `brand\u002Fdesign-system.md`, `brand\u002Ftokens.ts`, and `tamagui.config.ts` before deciding whether TSX rebuilds are needed.\n\nUse this scenario coverage matrix for common follow-ups. The goal is one user prompt -> one orchestrated edit, not a list of commands the user must run manually.\n\n| User asks | Plan sections | Apply path | Screens \u002F verification |\n|---|---|---|---|\n| Improve search screen for mobile | Screens | `mobile-app:screen-planner` edit pass only | Rebuild the named search\u002Flist screen; run `tsc`, route check, preview |\n| Add loading, empty, and error states | Screens | Screen spec + existing TSX edit | Rebuild affected list screen; verify visible loading, empty, error, retry, refresh states |\n| Add a detail screen for selected record | Screens; Data Model only if fields\u002Fservices are missing | Update Screen Map + Navigation Contracts; run `\u002Fadd-dataverse` or `\u002Fadd-datasource` only if data surface is missing | Create route\u002Ffolder\u002Flayout as needed; build detail screen and source list\u002Fsearch navigation |\n| Update design to match company branding | Design; Screens only if component grammar\u002Fdensity changes | `\u002Fdesign-system --refresh \u003Cdimension>` or `--reskin` | Rebuild affected screens only when tokens alone are insufficient; always preview |\n| Add a form to create a new Dataverse record | Screens; Data Model if table\u002Fcolumns\u002Flookups\u002Fcreate service are missing | `\u002Fadd-dataverse --skip-planning` when schema\u002Fservice is missing | Build form route, create payload helper, parent navigation, and focus refresh; verify create\u002Fupdate payloads |\n| Add barcode scanning and use scanned value to search records | Native Capabilities, Screens; Data Model if scan target field is missing | `\u002Fadd-native barcode-scanner`; `\u002Fadd-dataverse` only if target field\u002Ftable is absent | Build scanner\u002Fsearch flow, pause\u002Flock scan callback, search via service filter, preview |\n| Add a full calendar, agenda, or scheduling view | Screens → JavaScript Dependencies | Add exact `react-native-calendars` version to the approved table, then `npm install --save-exact` before builders | Build the calendar screen with the approved pattern; no `\u002Fadd-native` or Android\u002FiOS rebuild |\n| Add a new requirement with a new screen | Usually Screens plus whichever of Data Model, Connector, Native, Design the requirement implies | Decompose into one coherent feature; apply data\u002Fconnector\u002Fnative\u002Fdesign first, then screens | Generate\u002Frefresh service snapshot, layouts, skeletons\u002Fshared code, then build affected screens |\n| Add a new data source but no screen | Connector\u002FData Source; sometimes Data Model | `\u002Fadd-datasource` when ambiguous; `\u002Fadd-sharepoint`, `\u002Fadd-connector`, or `\u002Fadd-dataverse` when clear | Refresh generated services and memory bank; no screen rebuild unless the user asked for UI |\n| Add Teams\u002Femail action or profile lookup | Connectors; Screens when consumed | `\u002Fadd-connector` after approval | Wire the action\u002Fread and its loading\u002Ferror\u002Fsuccess behavior; no Dataverse schema by default |\n| Add SQL\u002FExcel\u002FSharePoint data | Connectors, including external table\u002Flist schema; Screens when consumed | Matching connector leaf after approval | Do not add a Dataverse model just because the connector supplies tabular data |\n| Add a new table\u002Fentity but no screen | Data Model | `mobile-app:data-model-architect` -> `\u002Fadd-dataverse --skip-planning` | Refresh generated services; optionally seed sample data; no preview unless UI changed |\n| Stop using a table\u002Fconnector\u002Fflow or replace its data source | Data Model\u002FConnectors and affected Screens | Approved retirement via the matching leaf after consumer updates in Step 6 | CLI removes the app registration and regenerates services\u002Fconfig; Step 6.5 verifies remaining sources and refreshes the schema map |\n| Remove, rename, reorder, or change a screen archetype | Screens | `mobile-app:screen-planner` edit pass | Update route files\u002Flayouts\u002Fnavigation contracts; delete only approved files; run route check |\n| Generate a new static preview | None unless source is stale | `\u002Fpreview-screens` | No source edits; do not run data\u002Fnative\u002Fdesign work |\n\nOne user-visible feature may require multiple plan sections. That is allowed and expected. Multiple unrelated features in one prompt should be split: list the features, ask which to run first, and do not bundle their mutations.\n\n**Data Model is conditional.** A connector\u002Faction\u002Fnative capability does not\nautomatically require Dataverse. Reuse existing storage and schema. Plan Dataverse\nchanges only for new\u002Fchanged Dataverse tables, columns, or relationships actually\nrequired by the feature; missing generated services alone require regeneration,\nnot new schema. Keep connector operations and external table\u002Flist schemas in\n`## Connectors`. Preserve unaffected Data Model content verbatim.\n\nLoophole checks before continuing:\n\n- If the request adds UI that reads or writes data, confirm the generated service exists or add the data source before screen work. Never let screen-builders invent services.\n- If the request is ambiguous about Dataverse vs SharePoint vs another connector,\n  consult the `\u002Fadd-datasource` routing table read-only and resolve the choice\n  before approval. Execute the selected leaf only in Step 5.\n- If a screen requires a native wrapper, run `\u002Fadd-native` before screen-builders import `src\u002Fnative\u002F*`.\n- If a native capability is not shipped by the template, stop with a clear block; do not install native packages or fake support.\n- If a screen requires a pure-JavaScript library, add it with an exact version to `## Screens → ### JavaScript Dependencies`, include it in the mutation preview, and install it before screen builders run. Determine JS-only status from shipped contents, not from a package-name prefix.\n- If the request changes navigation, update route layouts and navigation contracts before spawning screen-builders.\n- If the request adds a new screen, generate any needed route folder, generated-service snapshot, shared code, and skeleton before building TSX.\n- Do not stop after writing `native-app-plan.md`. The plan update is an internal checkpoint; the app mutation and verification are the user-visible result.\n\nFor PDF\u002Fsignature requests, map the change to every affected section instead of editing only the first obvious one:\n\n| User request | Required plan updates |\n|---|---|\n| Add signature capture, sign-off, pen, ink, drawing | Native Capabilities: `pen-input`; Screens: capture, preview, cancellation, and applicable failure states; ask about retention, then update Data Model only if new\u002Fchanged Dataverse storage is required |\n| Store signed approval as Dataverse image | Data Model: Image column; Screens: normalize `data:image\u002Fpng;base64,...` before update; Native Capabilities: `pen-input` if capture is in-app |\n| Generate\u002Fexport\u002Fprint evidence PDF | Native Capabilities: `pdf-report` only when `expo-print` is present, plus `sharing` only when local share is needed and `expo-sharing` is present; Data Model: File column only if retained; Screens: generation pending\u002Ffailed\u002Fsuccess states |\n| Persist generated PDFs | Data Model: Dataverse File column or child Attachment table; Screens: create\u002Fupdate row first, then upload File bytes; Native Capabilities: `pdf-report` |\n| View\u002Fopen\u002Fpreview PDF | Native Capabilities: `native-pdf-viewer` for HTTPS URLs or local `file:\u002F\u002F` URIs when `@microsoft\u002Fpower-apps-native-pdf-viewer` 0.2.9+ is present; Screens: invalid URL and viewer failed states |\n\nIf a single PDF\u002Fsignature request requires multiple plan sections, say so and run the edit loop section-by-section. Do not write a native capability entry that references a Dataverse column or screen state that remains absent from the plan.\n\n### Step 1.5 — Impact preview (cheap abort gate)\n\n**Telemetry checkpoint: `analyze_edit_impact`**\n\nBefore showing the impact question, mark `inspect: done`, set `impact: waiting`, set top-level\n`phase: impact`, `waiting: true`, and run `progress --json-file`. If the user proceeds, change\n`impact` to `done`, set `plan: active`, clear `waiting`, and run it again. A cancellation sets the\ntop-level status to `done` with all unstarted operations `skipped`.\n\nBefore spawning architects or mutating files, show a rough impact preview and ask for proceed\u002Fedit\u002Fcancel. This mirrors `\u002Fcreate-mobile-app` Step 2c at edit scale.\n\nCompute:\n\n- **Cost tier:** Cheap (single existing screen), Medium (new route\u002Fform\u002Fdetail or one data source), Heavy (multi-screen\u002Fnav\u002Fdesign\u002Fdata\u002Fnative), Major (reskin or broad screen rebuild).\n- **Likely plan sections:** Data Model, Native Capabilities, Connectors\u002FData Sources, Design, Screens.\n- **Likely files:** exact screen\u002Flayout\u002Fnative\u002Fbrand\u002Fgenerated\u002Fmemory files when known.\n- **Likely skills\u002Fagents:** `mobile-app:data-model-architect`, `mobile-app:screen-planner`, `mobile-app:screen-builder`, `\u002Fadd-datasource`, `\u002Fadd-dataverse`, `\u002Fadd-sharepoint`, `\u002Fadd-connector`, `\u002Fadd-native`, `\u002Fdesign-system`, `\u002Fpreview-screens`, optional `\u002Fdebug-app` only when the user gives a concrete runtime symptom.\n- **Verification gates:** schema, generated services, route contracts, screen validators, preview.\n- **Main risks:** environment drift, unsupported native package, generated service missing, navigation contract change, broad design churn, stale installed plugin cache.\n\nPrint:\n\n```text\n─── Edit impact preview ─────────────────────────────\nIntent        \u003Cone sentence>\nTier          \u003Ccheap|medium|heavy|major> (~\u003Ctime range>)\nPlan          \u003Csections>\nSkills\u002Fagents \u003Clist>\nFiles         \u003Cscreen\u002Flayout\u002Fdata\u002Fnative\u002Fbrand\u002Fmemory summary>\nVerification  \u003Cgates>\nPreview       \u003Cyes\u002Fno>\nRisks         \u003Cnone or bullets>\n\nChoose:\n  (a) Proceed\n  (b) Edit intent \u002F answer more detail\n  (c) Cancel\n```\n\nIf the user chooses **edit**, return to Step 1 and refine the edit brief. If cancel, stop with no file mutations. If proceed, continue to Step 2.\n\n**If the user picks (d) Design:**\n\nRead the `\u002Fdesign-system` references to propose the Design delta without executing\nthe skill yet. Determine the dimension from the user's description:\n\n| User says | Route to |\n|---|---|\n| \"change colors\", \"palette\", \"accent\" | `\u002Fdesign-system --refresh palette` |\n| \"change fonts\", \"typography\", \"font\" | `\u002Fdesign-system --refresh typography` |\n| \"change components\", \"buttons\", \"cards\" | `\u002Fdesign-system --refresh components` |\n| \"change spacing\", \"density\", \"compact\" | `\u002Fdesign-system --refresh density` |\n| \"add rule\", \"remove rule\", \"negatives\" | `\u002Fdesign-system --refresh negatives` |\n| \"change animations\", \"motion\" | `\u002Fdesign-system --refresh motion` |\n| \"full redesign\", \"reskin\", \"new theme\" | `\u002Fdesign-system --reskin` |\n\n**One-major-change-per-prompt enforced.** If the user asks to change palette AND typography → refuse, ask which first. This matches `\u002Fdesign-system`'s own behavior.\n\nInclude runtime token\u002Fprovider wiring and any affected screens in the proposal.\nContinue through Steps 2-4 before executing `\u002Fdesign-system` in Step 5.\nDo not write brand artifacts before approval or during `--plan-only`, and do not\njump from design refresh straight to verification if screen changes are needed.\n\n### Step 2 — Re-plan affected sections\n\n**Telemetry checkpoint: `revise_affected_app_plan`**\n\nKeep `plan: active` while architects or inline planning update the affected sections. If a planner\nneeds user context, change `plan` to `waiting`, set `waiting: true`, and run the progress command\nbefore asking. Restore it to `active` after the answer.\n\nReuse the same planning primitives as `\u002Fcreate-mobile-app`, but only for the affected surfaces:\n\n| Surface | Reuse from create flow | Edit-app scope |\n|---|---|---|\n| Dataverse schema | `data-model-architect` + `\u002Fadd-dataverse` Step 8 | New\u002Fchanged tables, columns, lookups, calculated fields, generated services |\n| Connector choice | `\u002Fadd-datasource`, `\u002Fadd-sharepoint`, `\u002Fadd-connector` | New or changed external data\u002Faction surface |\n| Native capability | `\u002Fadd-native` Step 9 | New wrappers\u002Fcontrols needed by edited screens |\n| JavaScript dependency | `screen-planner` + `shared\u002Freferences\u002Fjavascript-dependency-planning.md` | Explicit package requests or established JS libraries needed by edited screens |\n| Design | `\u002Fdesign-system` Step 9b | Token refresh, reskin, density\u002Fcomponent rules |\n| Navigation | `\u002Fcreate-mobile-app` Step 10b | Changed tabs, stacks, route groups, modal\u002FformSheet presentation |\n| Service snapshot | `\u002Fcreate-mobile-app` Step 10.7 | Refresh after any data source\u002Fschema change before builders run |\n| Shared code + skeletons | `\u002Fcreate-mobile-app` Step 10.8 | New screens, changed data imports, new shared row\u002Fcard\u002Fhooks |\n| Screen implementation | `\u002Fcreate-mobile-app` Step 11 | Only affected screens, via `mobile-app:screen-builder` waves |\n| Quality sweep | `\u002Fcreate-mobile-app` Step 11.4 | Changed screen files and route layouts |\n\nRead each affected section verbatim from `native-app-plan.md` and pass it as input to the relevant read-only agent. Use the plugin namespace for every `Task` invocation.\n\nFor Dataverse schema\u002Fnew-binding work, first read and execute\n[dataverse-change-planning.md](..\u002F..\u002Fshared\u002Freferences\u002Fdataverse-change-planning.md).\nUse the requested delta and necessary dependencies, not all historical plan\nrows. The foreground obtains and validates compact evidence; the architect\nuses `Dataverse planning mode: required`, not legacy live discovery.\nNative\u002Fdesign\u002Fconnector-only edits, app-binding removals, and retained-service\nrefreshes skip this planning path and never reuse its old artifacts.\n\nBefore the first `Task`, run a silent preflight for the leaf agent you need (`mobile-app:data-model-architect`, `mobile-app:screen-planner`, or `mobile-app:screen-builder` preflight later). If the host cannot spawn agents, print once:\n\n> \"→ Planner agents unavailable in this host — running inline planning. (No action needed; this is automatic.)\"\n\nInline fallback rules:\n\n- Data Model: use the existing plan, manifest, models, and edit brief as context,\n  but ground decisions in the shared workflow's validated compact evidence.\n  Produce `_dm_section.md` and the normalized schema contract and run the same\n  decision validator as for an agent result; local files alone are not proof\n  of current server schema.\n- Screens: draft Screen Map \u002F Navigation Contracts \u002F per-screen spec changes inline using `agents\u002Fscreen-planner.md`, `shared\u002Freferences\u002Fscreen-templates.md`, and the existing screen TSX; then gate it exactly like an agent result.\n- Native Capabilities and Connectors: already handled inline by this skill.\n- Never skip approval just because a leaf agent is unavailable.\n\n| Section | Agent (read-only) | Output file |\n|---|---|---|\n| Data Model | `mobile-app:data-model-architect` | `_dm_section.md` + `.tmp\u002Fdataverse-schema-contract.json` |\n| Native Capabilities | (handled inline — no separate agent) | `_native_section.md` |\n| Screens | `mobile-app:screen-planner` | `_screens_section.md` |\n\n```\nSpawn agent: mobile-app:\u003Cagent-name>\n\nPrompt:\n  Update the existing \u003Csection-name> section based on the user's change request.\n\n  User request: \u003Cverbatim>\n  Current section content: \u003Cverbatim>\n  Working directory: \u003Cabsolute path>\n  Plugin root: ${PLUGIN_ROOT}\n  Phase: planning\n  Proposal only: \u003Ctrue for --plan-only or a planning-phase caller>\n\n  Mode: edit (preserve existing decisions where the change doesn't affect them).\n  Existing generated app must be updated after approval, so include enough detail for builders to mutate code without guessing.\n  Return the updated section as a markdown file.\n```\n\nFor the Data Model handoff, also include these fields verbatim:\n\n```text\nDataverse planning mode: required\nNormalized Dataverse foreground planning snapshot (validator input only): \u003CSNAPSHOT_PATH>\nCompact Dataverse architect evidence: \u003CARCHITECT_EVIDENCE_PATH>\nStructured schema contract output: \u003Cworking_dir>\u002F.tmp\u002Fdataverse-schema-contract.json\nScope: \u003Crequested delta and necessary dependencies; preserve unrelated rows>\nNative capabilities and connector ownership: \u003Cretained approved constraints>\n```\n\nHandle structured Dataverse context\u002Frevision signals with the shared planning\nrecovery before generic retry limits. For other signals, use `AGENTS.md`:\n`DONE` continues to output validation, `DONE_WITH_CONCERNS:` must be surfaced\nand recorded, `NEEDS_CONTEXT:` gets one clarified retry, `BLOCKED:` stops before\napp mutation, and unknown first lines are `BLOCKED: malformed agent return`.\nEvery Data Model result, including inline output, must pass the shared decision\nvalidator; `DONE` alone never authorizes Step 3.\n\nBefore Step 3, rebuild the progress payload's `changes` array from the completed affected-section\nproposals.\nEvery change must explain why it is necessary.\nFor a Data Model delta, include the affected tables, relevant columns, and relationships from the\nvalidated normalized contract so the Changes tab renders the proposed ER diagram.\nFor a Screens delta, include the affected existing and proposed screens plus their real navigation\nedges so the Changes tab renders the updated screen graph.\nRun `progress --json-file` after writing this payload and before changing `approve` to `waiting`.\n\nFor Native Capabilities (no separate agent), do it inline: read the current capability table, apply the change, regenerate the table. For PDF\u002Fpen rows, include storage\u002Foutput notes in the table or immediately below it:\n\n- `native-pdf-viewer` 0.2.9+ opens HTTPS URLs and local `file:\u002F\u002F` URIs; it does not support `content:\u002F\u002F`, `blob:`, or `http:\u002F\u002F`.\n- `pdf-report` generates a local PDF only when `expo-print` is present; local output may be opened by `native-pdf-viewer` 0.2.9+, shared with `expo-sharing` when present, or uploaded to Dataverse File storage.\n- `pen-input` returns a PNG data URI; cancellation is a non-error state; Dataverse target must be Image, File, or child Evidence\u002FSignature row.\n\nFor connector\u002Fdata-source edits, read\n[connector-planning.md](..\u002F..\u002Fshared\u002Freferences\u002Fconnector-planning.md) and the\n`\u002Fadd-datasource` routing table as reference only. Propose the `## Connectors`\ndelta with operations, external tables\u002Flist schemas, and consuming screens.\nDo not execute connector skills, create connections, or generate services in\nStep 2. Update Screens when the connector drives new screens\u002Fforms; defer the\nselected leaf to Step 5 after approval.\n\nFor removals\u002Freplacements, follow\n[data-source-removal.md](..\u002F..\u002Fshared\u002Freferences\u002Fdata-source-removal.md).\nBefore changing the plan, capture the current registration inventory and propose\nretain\u002Fadd\u002Frefresh\u002Fremoval sets. Do not interpret an omitted table as permission\nto delete it. Include non-screen consumers and offline dependencies, preserve\nserver tables\u002Frecords, and carry the approved removal set through Step 6.5.\n\n### Step 3 — Gate intent, plan + app mutation preview\n\n**Telemetry checkpoint: `approve_app_mutation_plan`**\n\nBefore asking for approval, mark `plan: done`, set `approve: waiting`, set top-level\n`phase: approval`, `waiting: true`, and run `progress --json-file`. A revision returns `plan` to\n`active`. Approval marks `approve: done`, sets `save-plan: active`, clears `waiting`, and runs the\ncommand again. Cancellation settles the page with remaining operations `skipped`.\n\nFor Dataverse planning, require exit `0` from\n`validate-dataverse-planning-decisions.js` for the current normalized contract\nand snapshot before showing this gate. Revisions repeat that check. There is\nno extra create-flow approval gate; preserve this edit's existing UX.\n\nIf this is a planning-phase handoff from another owner, return the validated\nproposal and concerns to that owner now, without saving the live plan or\nopening an implementation gate. Do not turn the caller's planning consent\ninto approval to apply the edit. A direct `--plan-only` request retains the\nexplicit plan-document approval below.\nBefore returning, mark `inspect`, `impact`, and `plan` as `done`; mark approval, save,\nimplementation, verification, preview, sync, and device rows `skipped`; clear `waiting`; set\ntop-level `phase: done`, `status: done`, and `devicePreviewReady: false`; and publish one final\nprogress write. The note must say that the validated proposal was returned to the owning workflow.\n\nShow the user a side-by-side diff (or before\u002Fafter) for every changed plan section. Also show an app mutation preview:\n\n- Edit brief: intent, target screens\u002Froutes, data\u002Fnative\u002FJavaScript\u002Fdesign dependencies, and assumptions\n- Data\u002Fschema operations to run (`\u002Fadd-dataverse --skip-planning`, connector add, native wrapper add)\n- Exact app data-source removals, consumer updates, and server data that will be preserved\n- Exact sample-data table allowlist and count\u002Fmedia policy, if requested; exclude\n  retiring tables and include required seed parents only with explicit approval.\n  An empty approved set authorizes no seed writes.\n- Screen files to create, rewrite, rename, or delete\n- Navigation\u002Flayout files to update\n- Verification commands to run\n- Whether `preview.html` will be regenerated\n\nAsk:\n\n> \"Approve this edit and apply it to the app?\n> (a) Approve and apply\n> (b) Revise — give feedback for another pass\n> (c) Cancel — discard changes\"\n\nIf revise → loop back to Step 2 with the user's notes appended. If approve → continue. If cancel → STOP, leave the plan and app untouched.\n\nIf `$ARGUMENTS` includes `--plan-only`, change option (a) to \"Approve and save plan only\" and stop after Step 4 with a clear note that the app was intentionally not changed.\n\n### Step 4 — Write plan diff\n\nKeep `save-plan: active` while writing the approved `native-app-plan.md` sections.\n\nReplace the approved section(s) in `native-app-plan.md` with the approved content (preserve all other sections verbatim). Print a unified diff so the user has a record:\n\n```\ndiff --git native-app-plan.md native-app-plan.md\n---\n+++ Section: Data Model\n- | ? Create (Tier 2) | contoso_workitem | ... |\n+ | ? Create (Tier 2) | contoso_workitem | ... |\n+ | ? Create (Tier 2) | contoso_case | Lookup → account, severity, status |\n```\n\nIf this is `--plan-only`, update `memory-bank.md` with `plan_only: true`, mark `save-plan: done`,\nmark every implementation, verification, preview, and device-handoff row `skipped`, set top-level\n`phase: done`, `status: done`, and `devicePreviewReady: false`, and publish one final progress\nwrite. Keep `docs\u002Fcreate-app-plan.html` unchanged because it describes the current app, while\n`native-app-plan.md` holds the approved but unapplied intent. Then print the exact follow-up\ncommands and stop.\n\nFor an implementation run, keep `docs\u002Fcreate-app-plan.html` unchanged until Step 8 verifies the\nimplemented state.\nThe approved proposal belongs in `native-app-plan.md` and the edit progress page, not in the living\ncurrent-app plan.\nMark `save-plan: done` and the first applicable implementation operation `active` in the progress\npage.\n\nThe saved plan describes approved intent, not successful application. When the\nData Model changed, merge its newly accepted `_dm_section.md` proposal here;\nnever replay stale scratch output for an unrelated edit. Preserve unrelated\nsections and do not reuse execution artifacts\u002Fapproval receipts bound to an older plan. The leaf\nupdates `.datamodel-manifest.json` only from verified schema\u002Fservice outcomes;\npending retirements stay transitional until Step 6.5. Record any failure and\nremaining operations in memory-bank rather than claiming this plan is applied.\nFor approved Dataverse implementation, freeze the shared workflow's\n`contract_sha256` and final saved `plan_sha256` in `approved_scope`, and retain\nthe absolute `planning_snapshot`, `architect_evidence`, and `schema_contract`\npaths. A plan-only save does not create this implementation approval context.\n\n### Step 5 — Apply app mutations\n\n**Telemetry checkpoint: `apply_app_mutations`**\n\nUpdate the progress page after every applicable operation below. Mark each of `data`, `native`, and\n`design` active only while its leaf runs, then `done`, `skipped`, or `failed` from the actual\nresult. Run `progress --json-file` after each transition so the checklist identifies the operation\nthat is currently running.\n\nApply sections in dependency order so screens always build against the current data\u002Fnative surface:\n\nRun only operations in the approved delta, not every section of the existing\nplan. Pass `MOBILE_APP_ORCHESTRATING=1` and the explicit implementation context\nabove on each handoff, including through routers and on retries. Reuse supplied\nanswers, and return to the approval gate if an unresolved choice changes scope.\n\n0. **Environment drift gate for data edits** — before Dataverse, SharePoint, connector, or sample-data work, compare `memory-bank.md`, `power.config.json`, and `.resolved-environment.json`. If they disagree, show the values and ask the user which environment is intended. Do not create tables or connections until confirmed.\n1. **Data Model** — invoke `\u002Fadd-dataverse --skip-planning` with the approved\n   delta and the scoped planning context below, not every row in the plan.\n   The leaf verifies the evidence\u002Fapproval hashes and performs fresh live\n   reconciliation before scoped mutations; no partial create-only fast-path\n   flags or fabricated create receipt. It refreshes the affected services,\n   updates verified inventory, and leaves generated services compiling.\n   Pass `offline_reconciliation_owner: edit-app`; Step 5.6 owns the offline\n   check, so the leaf returns its verified delta without prompting twice.\n   After it returns, run `npm run generate-schemas` and `npx --no-install tsc --noEmit`;\n   do not continue to screens until clean.\n2. **Sample Data** — seed only the explicit table allowlist approved in Step 3.\n   Propose newly created Dataverse tables used by changed screens as candidates,\n   not the entire project manifest. Distinguish `createdThisEdit` from historical\n   manifest `status: new`; existing\u002Freused parent tables need explicit inclusion.\n   Validate the approved names against verified output and the retirement set.\n   An empty scope means skip seeding. Missing\u002Funverified\u002Fretiring targets return to the owner\n   for correction, not a fallback to project-wide seeding. Pass the handoff below.\n   If insertion fails, record the partial result and continue only if the app\n   handles empty states; never report complete seed coverage.\n3. **Connector\u002FData Source** — read and execute `\u002Fadd-datasource` when ambiguous, or `\u002Fadd-sharepoint` \u002F `\u002Fadd-connector` for approved connector changes. For a retained source refresh, pass skill-only `--refresh --data-source-name \"\u003Cregistered-name>\"` with its verified identity in `approved_scope`; do not route refreshes through addition. Use the same refresh branch for service-only Dataverse repairs without schema changes. Regenerate services and record connection notes in `memory-bank.md`.\n4. **Pure-JavaScript Dependencies** — execute the Installation Contract in [`shared\u002Freferences\u002Fjavascript-dependency-planning.md`](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fjavascript-dependency-planning.md) for new or changed rows in the approved `## Screens → ### JavaScript Dependencies` table. Approval is consent for those exact packages and versions. Install and validate before screen work; if final inspection finds native code\u002Fconfig or incompatible runtime dependencies, remove only the newly added package and stop with the exact failed criterion.\n5. **Native Capabilities** — read and execute `\u002Fadd-native \u003Ccapability>` for every new capability. Do not install missing native packages or fake wrappers. If a capability is unsupported by the current template, stop before rebuilding screens that import it, record the block, and tell the user what upstream template support is missing.\n6. **Design** — read and execute the approved `\u002Fdesign-system` operation (refresh,\n   reskin, theme, or rollback). Include `CODE_APPS_NATIVE_ORCHESTRATING=1` in\n   the child environment to suppress intermediate browser tabs, alongside the\n   scoped `MOBILE_APP_ORCHESTRATING=1` context above. Apply its Tamagui integration reference to changed\n   tokens\u002Fthemes and provider wiring before verification; a brand artifact alone\n   does not prove runtime integration. Token-only changes usually do not require\n   screen TSX rewrites; component\u002Fdensity\u002Fnegative-rule changes may. Rebuild\n   affected screens in Step 6 rather than returning early.\n   For an approved custom dark palette, execute the reference's **Approved dark\n   palette** branch: wire `darkTokens.color` into `appDarkTheme`, then into the\n   provider's `brandedDarkTheme`. Verify the export\u002Fkeys and resolved dark\n   surface\u002Ftext values; writing `brand\u002Ftokens.dark.ts` alone is not completion.\n\nStep 5 applies additions\u002Frefreshes, not removals. If the Data Model change is\nremoval-only, do not run `\u002Fadd-dataverse`'s add workflow against the shortened\nplan: it would neither unregister the old source nor safely update its consumers.\nDefer approved retirements until Step 6.5, after source consumers are updated.\n\nAfter any Data Model, Connector\u002FData Source, JavaScript Dependency, or Native Capabilities mutation, rerun the generated-service\u002Fdependency\u002Fnative-wrapper probe before screen work. Screen prompts must reflect what exists on disk now, not what the earlier plan expected.\n\nDataverse handoff (only for approved schema\u002Fnew-binding work):\n\n```text\nInvoke skill: \u002Fadd-dataverse\n\nContext:\n  MOBILE_APP_ORCHESTRATING=1\n  orchestrator: edit-app\n  working_dir: \u003Cworking_dir>\n  phase: implementation\n  offline_reconciliation_owner: edit-app\n  planning_snapshot: \u003CSNAPSHOT_PATH>\n  architect_evidence: \u003CARCHITECT_EVIDENCE_PATH>\n  schema_contract: \u003Cworking_dir>\u002F.tmp\u002Fdataverse-schema-contract.json\n  approved_scope: \u003Caccepted delta and dependencies, contract_sha256, plan_sha256>\n\nArguments:\n  --working-dir '\u003Cworking_dir>'\n  --plan-section '\u003Cworking_dir>\u002Fnative-app-plan.md#data-model'\n  --skip-planning\n```\n\nSample-data handoff (only for a nonempty approved seed scope):\n\n```text\nInvoke skill: \u002Fadd-sample-data\n\nContext:\n  MOBILE_APP_ORCHESTRATING=1\n  orchestrator: edit-app\n  working_dir: \u003Cworking_dir>\n  phase: implementation\n  approved_scope: \u003Capproved seed tables, count\u002Fmedia policy, and lookup decisions>\n  retiring_tables: \u003Capproved retirement list, or empty>\n\nArguments:\n  --working-dir '\u003Cworking_dir>'\n  --tables \"\u003Capproved-seed-table-logical-names>\"\n  --exclude-tables \"\u003Cretiring-table-logical-names-or-empty>\"\n```\n\nThese are skill arguments, not Dataverse CLI flags. A required parent outside\nthe allowlist returns `NEEDS_CONTEXT`; the seeding leaf must not expand scope\nor seed a transitional retiring table to satisfy its coverage rules.\n\n#### Step 5.5 — Refresh generated service snapshot\n\nRun this after any data-source\u002Fschema\u002Fconnector mutation and before any screen-builder prompt:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nfor svc in src\u002Fgenerated\u002Fservices\u002F*.ts; do\n  [ -e \"$svc\" ] || continue\n  name=$(basename \"$svc\" .ts)\n  methods=$(grep -oE 'static async [a-zA-Z_]+' \"$svc\" | sed 's\u002Fstatic async \u002F\u002F' | tr '\\n' ',' | sed 's\u002F,$\u002F\u002F')\n  echo \"| \\`$name\\` | \\`src\u002Fgenerated\u002Fservices\u002F$name.ts\\` | $methods |\"\ndone\n```\n\nReplace or create the `## Generated Services (snapshot at \u003CISO timestamp>)` section in `native-app-plan.md` immediately after `## Screens`. If there are no services, write an empty table and a note. Screen-builders must treat this table as authoritative.\n\nMark still-present services in the approved removal set as retiring: builders\nmust not introduce or retain dependencies on them. Refresh this snapshot again\nafter Step 6.5 so it describes the actual remaining output.\n\nDo not ask the user to run these follow-up skills manually. This skill is the orchestrator.\n\n#### Step 5.6 — Offline profile reconciliation\n\nIf Step 5 created or extended Dataverse tables, an existing Mobile Offline Profile may now be missing those tables\u002Fcolumns (new tables never sync to devices; new columns arrive blank). Step 5's complete scoped `\u002Fadd-dataverse --skip-planning` handoff names `offline_reconciliation_owner: edit-app`, so this orchestrator owns the check instead of the leaf's Step 8.5. The flag alone is not enough. Skip when no Data Model mutation occurred in this edit.\n\nFor mixed addition\u002Fremoval edits, intersect any returned additions with the\napproved retained\u002Fadded Dataverse set before offering\u002Fapplying profile changes.\nNever add a retiring table to the offline profile merely because its transitional\nmanifest entry remains until Step 6.5.\n\nRun the local, no-network delta check:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Foffline-profile-delta.js\" --project-root '\u003Cworking_dir>'\n```\n\nCapture the exit status and stdout\u002Fstderr and follow the failure dispatch in\n[offline-profile-reconciliation.md](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Foffline-profile-reconciliation.md)\nbefore continuing: a non-zero exit, `status: error`, malformed\u002Fmissing JSON,\nor unknown status skips mutation helpers and ends with `DONE_WITH_CONCERNS`\nfor already-applied changes (otherwise `BLOCKED`), never a clean success.\nFor valid `no-manifest` \u002F `no-profile` \u002F `in-sync`, continue silently.\nFor `delta`, obtain approval and execute the reference's **Scoped helper\nhandoffs** with `orchestrator: edit-app`, the same absolute `working_dir`,\n`phase: implementation`, and the exact approved environment\u002Fprofile\u002Ftable\nscope. Pass `--working-dir '\u003Cworking_dir>'` to each helper along with its table\nand column arguments, then re-check through the same failure dispatch.\nRecord the outcome in the Step 8 memory-bank entry without clearing pending\n`offlineRetirement` outcomes.\n\nThese statuses concern additions only. Preserve any `offlineRetirement` outcomes\nfrom earlier attempts, and collect the removal leaf's updated outcomes in\nStep 6.5; an `in-sync` result never resolves a pending retirement.\n\n### Step 6 — Rebuild affected screens\n\n**Telemetry checkpoint: `rebuild_affected_screens`**\n\nSet `screens: active` before route\u002Flayout\u002Fshared-code work. Update its note after each builder wave,\nfor example `Wave 2 of 3 complete`, and run the progress command. Mark it `done` only after the\nnavigation\u002Fskeleton gate and every required builder wave pass.\n\nUse the plan diff plus the user's request to build the affected screen set:\n\n| Change type | Screens to rebuild |\n|---|---|\n| Existing screen behavior\u002Flayout\u002Fstate\u002Fsearch change | The named screen(s) |\n| New detail screen | The new detail screen plus the source list\u002Fsearch screen that navigates to it |\n| New create\u002Fedit form | The form screen plus parent list\u002Fdetail screens that launch it and refresh on focus |\n| New scanner\u002Fcamera\u002FPDF\u002Fpen workflow | The capability screen plus any result\u002Fdetail\u002Fform screens it routes to |\n| Data-model field added for visible UI | Every screen that displays or writes the field |\n| Data source removed\u002Freplaced | Every approved consumer, including shared hooks\u002Fhelpers and native upload\u002Fsync code; retain the old registration until these edits are complete |\n| Navigation pattern changed | Every tab\u002Froot screen and any route whose contract changed |\n| Design component\u002Fdensity\u002Freskin changed | All screens whose layout grammar is affected; for full reskin, run a broad screen wave or controlled style sweep |\n\nBefore spawning builders:\n\n- Pass the approved retiring service\u002Fsource list to every affected builder.\n  Still-present generated files are transitional dependencies, not permission\n  to keep or introduce usages that the edit is meant to remove.\n- Update route layout files using the `\u002Fcreate-mobile-app` Step 10b layout rules if navigation changed.\n- Create missing route folders for new screens.\n- Refresh the `## Generated Services` table using `\u002Fcreate-mobile-app` Step 10.7 rules if any data source\u002Fschema changed.\n- Generate or refresh app-specific shared code from `\u002Fcreate-mobile-app` Step 10.8a when two or more affected screens share an entity row\u002Fcard, choice map, cursor hook, or save helper.\n- For brand-new screens, write typed skeleton files using `\u002Fcreate-mobile-app` Step 10.8b patterns before calling builders.\n- For existing screens, do not overwrite with skeletons. Pass the current file content and the change request to the builder in edit mode. If imports\u002Fdata hooks changed, update them surgically before the builder fills or revises JSX.\n- For removed screens, delete route files and remove layout entries only when the user approved deletion in Step 3.\n\nNavigation\u002Flayout algorithm:\n\n- Read the approved `## Screens` Screen Map and Navigation Contracts.\n- Normalize every target file to its Expo route before editing. Reject duplicate normalized routes, especially `\u003Cparent>\u002F[id].tsx` together with `\u003Cparent>\u002F[id]\u002F\u003Cchild>.tsx`; move the detail contract to `\u003Cparent>\u002F[id]\u002Findex.tsx` before builders run.\n- For every new route, create the parent folder and inner `_layout.tsx` when the route is nested.\n- For modal\u002FformSheet\u002Fdetail routes, add the correct `\u003CStack.Screen name=\"...\" options={{ presentation: 'modal' | 'formSheet' }} \u002F>` in the owning folder layout.\n- For tab\u002Froot changes, patch only the route list in `app\u002F(app)\u002F_layout.tsx`; preserve auth\u002Fprovider logic and imports not related to route registration.\n- For removed routes, delete the route file and remove layout entries only after explicit user approval in Step 3.\n- After route\u002Flayout edits and before builders, run `npm run check-routes --if-present` or `node scripts\u002Fcheck-routes.js` if available.\n\nShared scaffold algorithm:\n\n- If `src\u002Fcomponents\u002Findex.tsx`, `src\u002Fhooks\u002Findex.ts`, `src\u002Futils\u002Findex.ts`, or `src\u002Ftokens\u002Findex.ts` is missing, copy the missing file from `shared\u002Fsamples\u002Fsrc\u002F`. Never overwrite an existing shared file.\n- If affected screens share an entity card\u002Frow, choice map, cursor hook, detail hook, or save helper, create or update a focused app-specific shared file before spawning builders.\n- For brand-new screens, write a typed skeleton at the `target_file` using the relevant `\u002Fcreate-mobile-app` Step 10.8b template. The skeleton must compile with `return null` before screen-builder runs.\n- For existing screens, never replace the whole file with a skeleton. Patch imports\u002Fhooks only when the approved edit changes the data\u002Fnative surface, then ask the builder to preserve existing behavior.\n\nRun the navigation\u002Fskeleton gate before screen-builder work:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnpx --no-install tsc --noEmit\n```\n\nIf it fails, batch-fix layouts, route names, skeleton imports, generated-service names, shared exports, or hook signatures, then rerun once. Do not launch screen-builders from a broken shell.\n\n#### Step 6.1 — Screen-builder preflight + waves\n\nBefore the first wave, run a silent `Task` preflight for `mobile-app:screen-builder` using a no-op screen name. If unavailable, print once and build inline using `agents\u002Fscreen-builder.md`; inline mode must satisfy the same quality rules.\n\nBatch affected screens in waves of up to 5. For each wave:\n\n1. Print the wave start: `Wave \u003CN>\u002F\u003CW> starting: \u003Cscreen names>`.\n2. Spawn all builders in one message so they can run in parallel.\n3. Parse each first line per `AGENTS.md` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCKED`). Unknown first lines are `BLOCKED`.\n4. Retry `NEEDS_CONTEXT` once with the missing context from plan\u002Ffiles\u002Fservices.\n5. Stop on `BLOCKED` unless the user chooses to skip with an approved placeholder.\n6. Run `npx --no-install tsc --noEmit` after the wave before launching the next wave.\n7. If the wave gate fails, group errors by root cause and respawn affected builders with consolidated TypeScript output. Cap at 2 retries per screen.\n\nDo not launch wave N+1 until wave N is clean.\n\nSpawn `mobile-app:screen-builder` agents in waves of up to 5 screens. Prompt each builder with:\n\n```text\nFollow screen-builder.md.\nMode: edit existing generated app.\nUser change request: \u003Cverbatim>\nworking_dir: \u003Cabsolute path>\nscreen_name: \u003Cscreen id>\nroute: \u003Croute>\ntarget_file: \u003Cabsolute path>\nplan_path: \u003Cabsolute path>\u002Fnative-app-plan.md\ncurrent_file: \u003Cpaste current file content if the file exists>\n\nPreserve unaffected behavior from the existing screen. Apply the approved plan diff. If this is an existing screen and no skeleton marker is present, update the screen from current_file instead of falling back to sample layout.\n```\n\n### Step 6.5 — Unregister retired data sources\n\nSkip when the approved removal set is empty. After Step 6 updates\u002Fremoves the\nconsumers, re-check that no retained source depends on a retiring registration.\nExecute [data-source-removal.md](..\u002F..\u002Fshared\u002Freferences\u002Fdata-source-removal.md)\nthrough `\u002Fadd-dataverse` for Dataverse bindings, `\u002Fadd-sharepoint` for SharePoint,\nor `\u002Fadd-connector` for other connectors\u002Fprocedures\u002Fflows, passing removal mode,\nthe exact registered identities, and the current approved orchestration context.\nSelect removal mode with the skill-only `--remove` argument; never pass it to CLI.\n\nThe leaf bypasses its add workflow and uses the supported CLI removal command,\nwhich owns `.power\u002Fschemas\u002F`, `src\u002Fgenerated\u002F`, and `power.config.json` cleanup.\nThen regenerate the runtime schema map, verify absent\u002Fretained registrations\nand generated output, and reconcile the app manifest and offline impact.\nRefresh the Generated Services snapshot again before final validation.\nA no-op, partial cleanup, or remaining consumer blocks completion; do not mark\nthe new plan as fully applied or manually patch generated\u002Fconfig files.\nCarry each leaf's `offlineRetirement` status into Step 8, including intentionally\nretained coverage and pending decisions\u002Fmigrations. Do not replace those statuses\nwith Step 5.6's addition-only result.\n\n### Step 7 — Verify\n\n**Telemetry checkpoint: `validate_edited_app`**\n\nSet `verify: active` before the first gate and run the progress command. On a failed gate, keep it\nactive while applying the bounded repair and record the failing command in its note. Mark it\n`failed` if verification cannot be completed; mark it `done` only after every required rerun passes.\n\nRun verification after mutations. Batch-fix root causes, then rerun the failed gate once. Verification is selected by what changed, but TypeScript is always required after an app mutation.\n\nRequired gates, selected by what changed:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnpm run generate-schemas      # if any data source\u002Fschema\u002Fconnector changed\nnpx --no-install tsc --noEmit              # always after app mutation\nnpm run check-routes --if-present\n```\n\nIf `npm run check-routes` is absent but `scripts\u002Fcheck-routes.js` exists, run:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode scripts\u002Fcheck-routes.js\n```\n\nWhen screen files changed, run the mobile plugin's report-mode validators explicitly:\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode \"${PLUGIN_ROOT}\u002Fhooks\u002Fvalidate-screen-quality.js\" --report \u003Cchanged-screen-files-or-app-dir>\nnode \"${PLUGIN_ROOT}\u002Fhooks\u002Fvalidate-color-contrast.js\" --report \u003Cchanged-screen-files-or-app-dir>\n```\n\nTreat validator findings like create-flow gate failures: capture once, batch by root cause, repair, and rerun the same validator once. These scripts are invoked only inside the mobile workflow; do not register them as plugin-wide hooks.\n\n#### Step 7.1 — Targeted style-quality sweep\n\nWhen screen files changed, run a focused version of `\u002Fcreate-mobile-app` Step 11.4 against the changed screen files plus any route layouts changed by this edit.\n\nRules:\n\n1. Run `validate-screen-quality.js --report` and `validate-color-contrast.js --report` when available.\n2. Merge issues by file and rule.\n3. Auto-fix deterministic issues: weak readable tokens, yellow\u002Forange badges with white text, missing icon-only `aria-label`, missing `role`, tiny icon hit targets, raw hex tokens, missing safe-area padding, `allowFontScaling={false}`. Apply these web-standard accessibility props to Tamagui 2 components; raw React Native components retain their React Native accessibility props.\n4. Treat judgement calls as concerns, not infinite loops: complex safe-area restructuring, ambiguous brand color choices, large hierarchy redesigns, or empty-state rewrites that require large JSX movement.\n5. Re-run the same report validators for touched files. Cap retries at 2 per file per validator.\n6. Run `npx --no-install tsc --noEmit` after style fixes. Style concerns may remain, but TypeScript may not.\n\nIf auto-fixable issues remain after retries, record `DONE_WITH_CONCERNS` in `memory-bank.md` with file\u002Frule summaries.\n\nIf verification fails because the edit exposed stale generated services, rerun the relevant data-source regeneration once before changing screens by hand. If failures are unrelated pre-existing issues, report them separately and do not hide them as successful edit results.\n\n### Step 8 — Preview + memory-bank update\n\n**Telemetry checkpoint: `refresh_app_preview_and_history`**\n\nMark `preview: active` while regenerating `preview.html`, or `skipped` when no visible surface\nchanged. Then build `\u003Cedit-temp-dir>\u002Fapp-plan-sync.json` from the verified app state and mark\n`sync-plan: active`. The payload must contain complete snapshots for every changed section,\nincluding removals, plus the preview and verification notes owned by those sections. Run:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' sync \\\n  --json-file '\u003Cedit-temp-dir>\u002Fapp-plan-sync.json'\n```\n\nAfter the sync succeeds, mark `sync-plan: done`, settle every applicable checklist row, set\ntop-level `phase: done` and `status: done`, and run the progress command one last time, but only\nafter the device-test handoff below has updated the phone state.\nBefore that final progress write, reconcile each change entry with the verified app state.\nUpdate data-model tables and relationships from the final normalized contract and update screen\nnodes and edges from the final routes and navigation layouts.\nThe completed edit page and `docs\u002Fcreate-app-plan.html` must describe the same final structure.\nIf sync rendering fails, record the concern but do not misreport the app edit or verification as\nfailed.\n\nBefore Step 8, `npx --no-install tsc --noEmit` must be clean after all code edits from this `\u002Fedit-app` run. If any code was written after Step 7's `tsc`, rerun `npx --no-install tsc --noEmit`, batch-fix root causes, and continue only when TypeScript is error-free.\n\nIf any UI, design, navigation, native interaction, or visible data state changed - or if the user\nexplicitly asked for a preview - read and execute `\u002Fpreview-screens` after verification with\n`MOBILE_APP_ORCHESTRATING=1` and `MOBILE_APP_EMBED_PREVIEW=1`.\nThis regenerates `preview.html` without opening a separate browser page.\nAfter the file is written, put the same screens in the phone rail and publish the progress page:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' phone --stage screens \\\n  --preview-file '\u003Cworking_dir>\u002Fpreview.html'\n```\n\nKeep the progress page open.\nIt shows the screens in a sandboxed phone carousel, links to `preview.html` for a full-size view, and\nkeeps the living `docs\u002Fcreate-app-plan.html` in sync through the same phone state.\nIf the preview was skipped or generation failed, leave the phone on its current progress state and\nreport the concern.\n\nUnless this is `--plan-only`, finish with a real-device handoff. Read\n`\u002Fcreate-mobile-app` Step 12 from **Launch command** through **Put the QR in the plan** and execute\nthat sequence from the same `\u003Cworking_dir>`. Before launching, apply `\u002Fdebug-app` Phase 0.0's\nproject-local log, PID, and port-ownership checks to every\n`\u003Cworking_dir>\u002F.powernative\u002Fmetro-logs\u002Fmetro-*-pid-*-port-*.log` candidate.\n\n- When exactly one session is live, reuse it. Read its native Metro URL from the sanitized log,\n  verify that the URL port matches the live log's port, and do not run `npm run dev`.\n- When no session is live, start Metro with the template-owned `npm run dev` and capture the URL it\n  prints.\n- When several sessions are live, or the PID, port, log, and URL disagree, show the sessions and\n  ask which one to use. Do not start another server while the choice is unresolved.\n\nGenerate `.expo\u002Fmetro-qr.png` from the selected URL with the pinned\n`npx --no-install qrcode`. Then update both documents through the existing phone command:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fapp-docs.js\" --working-dir '\u003Cworking_dir>' phone --stage qr \\\n  --qr-image '\u003Cworking_dir>\u002F.expo\u002Fmetro-qr.png' --qr-url \"\u003Cmetro-url>\"\n```\n\nDo not open `docs\u002Fcreate-app-plan.html`; its phone changes in the background. Run the final\n`progress` write with `devicePreviewReady: true` after this command succeeds so the already-open\nedit page replaces the screen carousel with the same QR code and shows the App Store and Google Play\nbuttons for Power Apps Mobile Preview. If Metro or QR generation fails,\nkeep `devicePreviewReady: false`; the completed edit page then shows `Device preview unavailable`\neven when the living plan contains a QR from an earlier run. Report the preview concern separately,\nand do not turn a verified app edit into a failure.\n\nIf the user gives a concrete runtime symptom and Metro is already running from the native dev-client flow, you may invoke `\u002Fdebug-app \"\u003Csymptom>\"` after the static verification and preview steps. This is an optional symptom-debug handoff, not a verification gate: do not run screen-by-screen runtime checks, do not crawl routes, do not use React Native Web, and do not call Metro HTTP endpoints directly.\n\nAppend an edit entry to `memory-bank.md`:\n\n```markdown\n### Edit: \u003Cyyyy-mm-dd> \u003Cshort title>\n- Request: \u003Cverbatim or concise summary>\n- Intent brief: \u003Ctarget screens\u002Froutes, data surface, native capability, design scope>\n- Assumptions: \u003Cinferred choices or none>\n- Skills\u002Fagents invoked: \u003Cdata-model-architect, screen-planner, add-dataverse, screen-builder, etc.>\n- Plan sections changed: \u003CData Model \u002F Native Capabilities \u002F Screens \u002F Design \u002F Connectors>\n- App changes: \u003Cscreens\u002Froutes\u002Fnative wrappers\u002Fdata sources>\n- Verification: \u003Ccommands\u002Fgates + pass\u002Ffail\u002Fskipped with reason>\n- Preview: \u003Cpreview.html path or not generated>\n- Debug handoff: \u003Cnot requested \u002F \u002Fdebug-app \"\u003Csymptom>\" invoked>\n- Offline retirement: \u003Cper-table not-applicable \u002F retained with reason \u002F pending \u002F reconciled with verification>\n- Blocks\u002Fconcerns: \u003Cnone or list>\n```\n\nFinal summary must say what changed in the app, what verification ran, where the preview is, whether\nthe living app plan was updated to reflect the latest verified changes, and whether a symptom-debug\nhandoff was requested. Claim the plan was updated only when the final sync succeeded; otherwise\nstate that the app edit verified but the living plan refresh failed and include that concern. Do\nnot end by saying the codebase was not changed unless this was explicitly `--plan-only`.\nIf any `offlineRetirement` outcome is `pending`, return `DONE_WITH_CONCERNS` and\nstate the unfinished decision separately: \"App changes completed. The offline\nprofile still includes Orders; deciding whether to retain or remove that coverage\nis pending.\" Substitute the actual table and only claim app completion when its\nverification passed. Never remove profile entries automatically to clear this note.\n\n## Notes\n\n- `native-app-plan.md` is still the durable source of truth. The change should be planned before it is applied, but planning is not the end state.\n- For complex multi-section edits, update and gate every required section first, then apply the mutation in dependency order. Do not leave a native capability entry that references missing Dataverse storage or a screen state that was never planned.\n- The architect agents are the same ones used by `native-app-planner` during initial creation, so planning improvements flow through here.\n- This skill intentionally covers post-generation iteration. It is acceptable for `\u002Fedit-app` to touch Dataverse, `src\u002Fnative\u002F`, route layouts, screen TSX, brand tokens, `preview.html`, and `memory-bank.md` when the approved edit requires it.\n",{"name":5,"model":24,"description":7,"allowed-tools":45,"user-invocable":46},"Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, Task, Skill",true,"main","0a55a88fa2855404029d1e5450faf92878baf763","plugins\u002Fmobile-apps\u002Fskills\u002Fedit-app",232,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills","https:\u002F\u002Fmicrosoft.github.io\u002Fpower-platform-skills\u002F","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 21:46:39",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":46},[59,62,65],{"tool":60,"command":61},"npx","npx skills add microsoft\u002Fpower-platform-skills --skill edit-app",{"tool":63,"command":64},"bunx","bunx skills add microsoft\u002Fpower-platform-skills --skill edit-app",{"tool":66,"command":67},"pnpm","pnpm dlx skills add microsoft\u002Fpower-platform-skills --skill edit-app","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmobile-apps\u002Fskills\u002Fedit-app\u002FSKILL.md",[70,76,80,84],{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Fargus_security.md","REFERENCE","参考文档",12371,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Fiot-security-reviewer\u002Freferences\u002Fargus_security.md",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fcommon_vulnerabilities.md",8461,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Fiot-security-reviewer\u002Freferences\u002Fcommon_vulnerabilities.md",{"path":81,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fsecure_examples.md",18096,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Fiot-security-reviewer\u002Freferences\u002Fsecure_examples.md",{"path":85,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fsecurity_checklist.md",6331,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Fdot_claude\u002Fskills\u002Fiot-security-reviewer\u002Freferences\u002Fsecurity_checklist.md",[89,97,118,141,159,173],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":96},"01M78JN2BFRRV1J54Q6WKZQ08D","compare-site-configurations","Compare Power Pages site configurations between two environments, such as dev, test and production, or between a local download and the live site, and explain which differences change site behavior. Use when a site works in one environment but not another (for example, works in dev but fails in test), to check configuration drift before promoting or deploying, or to see what changed between two sites. Produces a shareable HTML report and a JSON file that VS Code can import.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpower-pages\u002Fskills\u002Fcompare-site-configurations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":40},"01M699WVHX0XN59EPBTTPEKYPG","setup","Use when Process Intelligence needs building, explicit cloud\u002Faccount\u002Fenvironment configuration, sign-in, connection diagnostics, or recovery from an authentication error.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fsetup\u002FSKILL.md",[],[99,104,105,106,107,108,109,110,111,112,113,114,115,116,33,117],"configuration","diagnostics","error","environment","cloud","when","connection","authentication","use","Bash","recovery","process","sign","intelligence",{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":129,"publishedAt":40},"01M699WSR9EX55YY1WD9J22FEG","report-issue","Use when the user wants a Process Intelligence bug-report draft or support summary for a failed operation.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Freport-issue\u002FSKILL.md",[124],{"categoryNo":125,"categoryName":126,"taxonomyType":127,"taxonomyTypeDesc":128},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[130,131,132,133,112,109,134,135,115,136,117,137,138,139,140],"issue","report","report issue","bug-report","operation","draft","bug","summary","user","for","support",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":40},"01M699WR26YQ9Q21KE6MJF5B2G","investigate-process","Use when a broad Process Mining business question, observed pattern or competing explanation needs investigation across analytical perspectives.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Finvestigate-process\u002FSKILL.md",[],[148,115,149,150,112,151,152,109,153,154,155,33,156,157,158],"investigate","investigate process","question","process mining","business","across","perspectives","mining","pattern","investigation","analytical",{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"publishedAt":40},"01M699WP9SDG5ZR12P8VYNXKTN","derive-metric","Use when a requested measure is missing, a saved custom metric needs reuse, or an ephemeral formula or derived scalar is needed.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fderive-metric\u002FSKILL.md",[],[166,167,168,169,170,171,112,109,172,33],"metric","derive metric","missing","formula","custom","reuse","saved",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":40},"01M699WMG5R8P6SMTDAS1TKF9E","compare-cohorts","Use when comparing process cohorts, departments, periods or before-and-after results under matched definitions.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fcompare-cohorts\u002FSKILL.md",[],[180,181,112,109,182,115,33],"compare","compare cohorts","results"]