Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

Fix cross-plugin side effects from mobile-app validation hooks (#323)

Ameya Apte7eb51c8a8eae
diff --git a/plugins/mobile-apps/AGENTS.md b/plugins/mobile-apps/AGENTS.md
index c460e7dbc..a3aeecdb7 100644
--- a/plugins/mobile-apps/AGENTS.md
+++ b/plugins/mobile-apps/AGENTS.md
@@ -26,8 +26,8 @@ README.md ← Plugin overview
agents/ ← native-app-planner, data-model-architect, screen-planner, screen-builder
shared/ ← shared-instructions, references, samples, memory-bank template
skills/ ← /create-mobile-app, /add-dataverse, /add-connector, /add-native, ...
-scripts/ ← dataverse-request.js helper used by /add-dataverse + open-wrap-url.js helper used by /open-wrap-url
-hooks/ ← PostToolUse validators
+scripts/ ← shared helpers, including validate-mobile-files.js for skill-owned changed-file validation
+hooks/ ← Validator implementations invoked explicitly by mobile workflows
```
## Template source
@@ -56,7 +56,9 @@ Do not add preparation rewrites for `scheme`, `package`, `bundleIdentifier`, `sr
7. **Persisted plan** — Write `native-app-plan.md` (Mermaid ER + per-screen specs + native capabilities matrix) as the source of truth that sub-skills `Read`.
8. **CLI compatibility** — Use `npx power-apps ...` for code-app lifecycle and data-source commands. Use `scripts/resolve-environment.js` plus `az` tokens for Dataverse environment URL/tenant discovery and Azure/Entra operations. See [`shared/shared-instructions.md`](./shared/shared-instructions.md).
9. **Agent invocation namespace** — All `Task` invocations of agents in this plugin MUST use the fully-qualified `mobile-app:<agent-name>` form (e.g. `mobile-app:native-app-planner`, `mobile-app:screen-builder`). Bare names like `native-app-planner` return `Agent type 'native-app-planner' not found` because Claude Code namespaces all plugin agents by plugin name.
-10. **Sub-agent return-status protocol** — Every agent in this plugin (`native-app-planner`, `data-model-architect`, `screen-planner`, `screen-builder`) MUST return a status code as the **literal first line** of its final message. Orchestrators (skills that invoke agents via `Task`) MUST parse the first line and branch:
+10. **Plugin isolation** — Do not add `hooks/hooks.json`: Claude loads plugin hooks during unrelated workflows, so a mobile write hook can block Canvas Apps tool calls. Mutating skills follow the changed-file gate in `shared/shared-instructions.md`, and final-artifact agents invoke `scripts/validate-mobile-files.js` directly.
+11. **Invocation metadata** — Public entry skills use `user-invocable: true` and remain model-invocable. Bundled implementation helpers use both `user-invocable: false` and `disable-model-invocation: true`; their owner reads `SKILL.md` directly. Hidden standalone workflows such as `assign-offline-profile` and `preview-offline-scope` use `user-invocable: false` without disabling model invocation because no owner reads them directly. Agents use `user-invocable: false` without `disable-model-invocation` so qualified `Task` delegation remains available.
+12. **Sub-agent return-status protocol** — Every agent in this plugin (`native-app-planner`, `data-model-architect`, `screen-planner`, `screen-builder`) MUST return a status code as the **literal first line** of its final message. Orchestrators (skills that invoke agents via `Task`) MUST parse the first line and branch:
| Code | Meaning | Orchestrator action |
|---|---|---|
diff --git a/plugins/mobile-apps/agents/data-model-architect.md b/plugins/mobile-apps/agents/data-model-architect.md
index 533951ad0..2fad8b3c3 100644
--- a/plugins/mobile-apps/agents/data-model-architect.md
+++ b/plugins/mobile-apps/agents/data-model-architect.md
@@ -1,6 +1,7 @@
---
name: data-model-architect
description: Use when an orchestrator needs a Dataverse data model proposed (existing-table reuse, new tables in dependency-tier order, Mermaid ER diagram) for embedding in native-app-plan.md. Read-only — proposes, never mutates. Called by native-app-planner and /edit-app; not invoked directly by users.
+user-invocable: false
color: cyan
model: sonnet
tools:
diff --git a/plugins/mobile-apps/agents/native-app-planner.md b/plugins/mobile-apps/agents/native-app-planner.md
index c2cda4d88..2ac39dfac 100644
--- a/plugins/mobile-apps/agents/native-app-planner.md
+++ b/plugins/mobile-apps/agents/native-app-planner.md
@@ -1,6 +1,7 @@
---
name: native-app-planner
description: Use when the orchestrator needs a full plan + four approval gates (data model → native capabilities → connectors → screens) for a Power Apps mobile app. Read-only — proposes everything, mutates nothing. Called by /create-mobile-app; not invoked directly by users.
+user-invocable: false
color: cyan
tools:
- Read
@@ -562,7 +563,17 @@ Reject loop = re-spawn data-model-architect in `mode: cross-entity-audit` with t
**Auto-skip rule:** if Step 5c.1 returned "no cross-entity reads required" (zero `related_entity_fields` blocks across all screens), skip Gate 1 addendum entirely. Print:
> "→ Gate 1 addendum auto-skipped — no cross-entity reads in the screen plan."
-## Step 6 — Return Status
+## Step 6 — Validate written artifacts
+
+Run the mobile changed-file dispatcher against every file this planner wrote or edited, including `native-app-plan.md` and temporary section files that remain in the project:
+
+```bash
+node "${PLUGIN_ROOT}/scripts/validate-mobile-files.js" --project-root "<working_dir>" --file "<changed-file>" [--file "<changed-file>" ...]
+```
+
+Repair reported violations and rerun until it exits `0`. Pass exact changed files, never the whole project root.
+
+## Step 7 — Return Status
You MUST return your final message to `/create-mobile-app` with one of these four status codes as the **literal first line** (no markdown, no preamble, no `Status:` prefix, no backticks). The orchestrator parses the first line to decide what to do next. After the status line, leave a blank line, then write the structured summary below.
diff --git a/plugins/mobile-apps/agents/offline-profile-architect.md b/plugins/mobile-apps/agents/offline-profile-architect.md
index f57b8af81..64c4d428c 100644
--- a/plugins/mobile-apps/agents/offline-profile-architect.md
+++ b/plugins/mobile-apps/agents/offline-profile-architect.md
@@ -1,6 +1,7 @@
---
name: offline-profile-architect
description: Use when the orchestrator needs an offline profile design proposed (per-table row scope, recommended relationships, selected columns, sync frequency) for embedding in native-app-plan.md ## Offline Profile section. Read-only — proposes, never mutates. Called by /setup-offline-profile; not invoked directly by users.
+user-invocable: false
color: teal
model: sonnet
tools:
diff --git a/plugins/mobile-apps/agents/screen-builder.md b/plugins/mobile-apps/agents/screen-builder.md
index 38e141916..ab6b8e630 100644
--- a/plugins/mobile-apps/agents/screen-builder.md
+++ b/plugins/mobile-apps/agents/screen-builder.md
@@ -1,12 +1,14 @@
---
name: screen-builder
description: Use when an orchestrator needs ONE screen of a Power Apps mobile app implemented from a per-screen spec in native-app-plan.md. Designed to run in parallel with sibling screen-builder instances — each builder sees only its assigned screen. Called by /create-mobile-app and /edit-app; not invoked directly by users.
+user-invocable: false
color: green
model: sonnet
tools:
- Read
- Write
- Edit
+ - Bash
- Grep
- Glob
---
@@ -36,7 +38,6 @@ You will be invoked by `/create-mobile-app` Step 11 or `/edit-app` screen-rebuil
Do NOT define `function LoadingState()`, `function formatDate()`, `function Field()`, `function Section()`, or status color maps inside your screen. Do NOT write the `useState(loading) + useFocusEffect(load) + onRefresh` pattern manually — use `useListData` instead.
- **App-specific custom components.** If the orchestrator generated app-specific components in `src/components/` (e.g. `InspectionCard.tsx`, `EquipmentRow.tsx`), import them via `import { InspectionCard } from '@/components/InspectionCard'`. Check what's in `src/components/` before writing your screen — if a component exists for your entity, use it.
- **Screen skeleton exists — fill it in, don't overwrite.** The orchestrator pre-writes a typed skeleton at your `target_file` with all imports, hook calls, and `return null`. Your job: replace `return null` with the real JSX layout. Do NOT discard the skeleton's imports — they are pre-resolved from the Generated Services table, the per-screen `**Data**` field, and Standard Imports for the screen's archetype. The skeleton file IS the import source of truth; the plan no longer documents per-screen imports separately. If a skeleton does NOT exist at your `target_file` (older orchestrator version), proceed from scratch using the `**Data**` field + Generated Services table to resolve service imports yourself.
-- **Fast-wave mode.** During Step 11, the orchestrator may defer deterministic style-hook blocking until the Step 11.4 sweep. Still write good mobile UI on the first pass, but do not spend extra self-repair passes chasing raw hex/token/a11y/style-hook heuristics unless they also break TypeScript, routing, data access, or obvious usability. Step 11.4 runs the batch validators across all screens and owns those deterministic cleanup edits.
- **Older-orchestrator fallback.** If the skeleton is absent AND no `### Standard Imports` / `#### Resolved Imports` blocks exist in the plan, resolve imports yourself from the `**Data**` field + Generated Services table.
- **NEVER write `_layout.tsx` files.** The orchestrator owns all `_layout.tsx` files at Step 10b — both the outer `app/(app)/_layout.tsx` (Tabs/Drawer) and per-folder inner ones (`app/(app)/<folder>/_layout.tsx`). If your `target_file` IS a `_layout.tsx`, your assigned task is wrong — STOP and report `BLOCKED [<screen_name>]: target_file is a _layout.tsx (<path>) — orchestrator owns layouts, not builders`. Two parallel builders writing the same folder's `_layout.tsx` would race; only the orchestrator can serialize that. **You also do not need to declare the route in any `_layout.tsx`** — the orchestrator already wrote the `<Stack.Screen name="<your-name>">` line for you. Just write your screen's content.
- **Your `target_file` may be nested.** With the folder-grouped navigation pattern, paths like `app/(app)/inspections/[id].tsx` and `app/(app)/inspections/new.tsx` are normal. The folder is guaranteed to exist (orchestrator created it at Step 10b.2). Just write to whatever absolute path you were given. Do NOT modify the path or strip the folder.
@@ -1128,7 +1129,17 @@ Follow these whenever the spec touches navigation, list rows, or modals. Recipes
- `<Input>` with manual date string parsing
- Any third-party calendar picker library
-## Step 4 — Return Status
+## Step 4 — Validate the written screen
+
+Before returning a status, run the mobile changed-file dispatcher against exactly `target_file`:
+
+```bash
+node "${PLUGIN_ROOT}/scripts/validate-mobile-files.js" --project-root "<working_dir>" --file "<target_file>"
+```
+
+If it exits `2`, repair every reported violation and rerun it. Do not return `DONE` until it exits `0`. This explicit mobile-owned gate replaces the former plugin-wide write hooks, which also ran during unrelated Canvas Apps workflows.
+
+## Step 5 — Return Status
You MUST return your final message to the orchestrator with one of these four status codes as the **literal first line** (no markdown, no preamble, no `Status:` prefix, no backticks). The orchestrator parses the first line to decide what to do next. After the status line, leave a blank line, then write the one-line summary below.
diff --git a/plugins/mobile-apps/agents/screen-planner.md b/plugins/mobile-apps/agents/screen-planner.md
index db5878e59..50eb59353 100644
--- a/plugins/mobile-apps/agents/screen-planner.md
+++ b/plugins/mobile-apps/agents/screen-planner.md
@@ -1,6 +1,7 @@
---
name: screen-planner
description: Use when an orchestrator needs a screen graph + per-screen specs (navigation pattern, components, data, native capabilities) and a plan-time HTML preview or screen-plan delta for a Power Apps mobile app. Read-only — does NOT write TSX. Called by native-app-planner and /edit-app; not invoked directly by users.
+user-invocable: false
color: cyan
model: sonnet
tools:
diff --git a/plugins/mobile-apps/hooks/hooks.json b/plugins/mobile-apps/hooks/hooks.json
deleted file mode 100644
index fa4d3e491..000000000
--- a/plugins/mobile-apps/hooks/hooks.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
- "_comment": "PreToolUse write safety is enabled. It blocks Write/Edit/MultiEdit paths outside the active project working directory to prevent accidental cross-repo writes. Plugin location can be anywhere; run the host from the target template/app folder (or pass that folder as the current working directory).",
- "hooks": {
- "PreToolUse": [
- {
- "matcher": "Write|Edit|MultiEdit",
- "hooks": [
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-write-safety.js'));\"",
- "timeout": 10
- }
- ]
- }
- ],
- "PostToolUse": [
- {
- "matcher": "Skill|skill",
- "hooks": [
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','run-skill-posttool-validation.js'));\"",
- "timeout": 30
- }
- ]
- },
- {
- "matcher": "Write|Edit|MultiEdit",
- "hooks": [
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-icon-imports.js'));\"",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-screen-quality.js'));\"",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-color-contrast.js'));\"",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-connector-first.js'));\"",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-package-deps.js'));\"",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-dataverse-payload.js'));\"",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-dataverse-heavy-lists.js'));\"",
- "timeout": 10
- },
- {
- "type": "command",
- "command": "node -e \"const path=require('node:path'); const root=process.env.PLUGIN_ROOT||process.env.CLAUDE_PLUGIN_ROOT; if(!root){console.error('PLUGIN_ROOT is not set'); process.exit(0);} require(path.resolve(root,'hooks','validate-navigation-idempotency.js'));\"",
- "timeout": 10
- }
- ]
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/plugins/mobile-apps/hooks/run-skill-posttool-validation.js b/plugins/mobile-apps/hooks/run-skill-posttool-validation.js
deleted file mode 100644
index 0958ddc2d..000000000
--- a/plugins/mobile-apps/hooks/run-skill-posttool-validation.js
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * PostToolUse hook for mobile-app skills.
- *
- * After a Skill tool call returns, look up whether the skill has a registered
- * validator. If so, run the validator with the same stdin payload and propagate
- * stdout/stderr/exit code back to the caller.
- *
- * Mirrors the power-pages hook pattern. Adding a new validator = update
- * TRACKED_SKILLS in scripts/lib/mobile-app-hook-utils.js and ship a
- * validator script under the skill's directory.
- */
-
-const path = require('path');
-const { spawnSync } = require('child_process');
-const {
- getTrackedSkillFromToolInput,
- getValidatorScript,
-} = require('../scripts/lib/mobile-app-hook-utils');
-
-const DEBUG = process.env.DEBUG === '1' || process.env.DEBUG === 'true';
-
-function debug(msg) {
- if (DEBUG) process.stderr.write(msg);
-}
-
-debug('[mobile-app hook] run-skill-posttool-validation.js started\n');
-
-let inputData = '';
-
-process.stdin.on('data', (chunk) => {
- inputData += chunk;
-});
-
-process.stdin.on('end', () => {
- debug(`[mobile-app hook] stdin closed, received ${inputData.length} bytes\n`);
- try {
- const input = JSON.parse(inputData);
- const skillName = getTrackedSkillFromToolInput(input.tool_input);
- if (!skillName) {
- debug('[mobile-app hook] No tracked skill detected — skipping validation\n');
- process.exit(0);
- }
-
- const validatorScript = getValidatorScript(skillName);
- if (!validatorScript) {
- debug(`[mobile-app hook] Skill "${skillName}" has no validator — skipping\n`);
- process.exit(0);
- }
-
- debug(`[mobile-app hook] Running validator for skill "${skillName}": ${validatorScript}\n`);
-
- const validatorPath = path.join(__dirname, '..', validatorScript);
- const result = spawnSync(process.execPath, [validatorPath], {
- input: inputData,
- encoding: 'utf8',
- cwd: input.cwd || process.cwd(),
- });
-
- if (result.stdout) process.stdout.write(result.stdout);
- if (result.stderr) process.stderr.write(result.stderr);
-
- debug(`[mobile-app hook] Validator exited with code ${result.status ?? 0}\n`);
- process.exit(result.status ?? 0);
- } catch (err) {
- process.stderr.write(`[mobile-app hook] Unexpected error: ${err.message}\n`);
- process.exit(0);
- }
-});
diff --git a/plugins/mobile-apps/hooks/validate-color-contrast.js b/plugins/mobile-apps/hooks/validate-color-contrast.js
index 830ec3400..2946a06ee 100644
--- a/plugins/mobile-apps/hooks/validate-color-contrast.js
+++ b/plugins/mobile-apps/hooks/validate-color-contrast.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: catch contrast-failing color usage in TS/TSX files.
+ * Explicit validator: catch contrast-failing color usage in TS/TSX files.
*
* Fires after Write / Edit / MultiEdit. Scans the resulting content for
* patterns that historically fail WCAG AA in this plugin's generated apps:
@@ -78,19 +78,6 @@ function isWriteTool(toolName) {
return toolName === 'Write' || toolName === 'Edit' || toolName === 'MultiEdit';
}
-function hasDeferredStyleHooksMarker(filePath) {
- if (typeof filePath !== 'string' || !filePath) return false;
-
- let dir = path.dirname(path.resolve(filePath));
- for (let depth = 0; depth < 12; depth += 1) {
- if (fs.existsSync(path.join(dir, '.tmp', 'defer-style-hooks'))) return true;
- const parent = path.dirname(dir);
- if (parent === dir) break;
- dir = parent;
- }
- return false;
-}
-
function extractContent(toolName, toolInput) {
if (toolName === 'Write' && typeof toolInput.content === 'string') {
return toolInput.content;
@@ -314,11 +301,6 @@ function main() {
const filePath = toolInput.file_path || toolInput.filePath;
if (!isWatchedFile(filePath)) process.exit(0);
- // Skip gates set by env var or a project-local marker. The marker is used
- // only during Step 11 fast screen-builder waves; Step 11.4 report mode still
- // scans the same files and owns the deferred cleanup.
- if (process.env.CODE_APPS_NATIVE_SKIP_CONTRAST_HOOK === '1' || hasDeferredStyleHooksMarker(filePath)) process.exit(0);
-
const content = extractContent(toolName, toolInput);
if (!content) process.exit(0);
diff --git a/plugins/mobile-apps/hooks/validate-connector-first.js b/plugins/mobile-apps/hooks/validate-connector-first.js
index f0a4e2c5b..09d161f37 100644
--- a/plugins/mobile-apps/hooks/validate-connector-first.js
+++ b/plugins/mobile-apps/hooks/validate-connector-first.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: enforce connector-first rule.
+ * Explicit validator: enforce the connector-first rule.
*
* Blocks writes to .ts / .tsx / .js / .jsx files that bypass the generated
* connector services by calling Microsoft Graph, Azure REST, or arbitrary
diff --git a/plugins/mobile-apps/hooks/validate-dataverse-heavy-lists.js b/plugins/mobile-apps/hooks/validate-dataverse-heavy-lists.js
index be6f16db1..e4b4fb7a4 100644
--- a/plugins/mobile-apps/hooks/validate-dataverse-heavy-lists.js
+++ b/plugins/mobile-apps/hooks/validate-dataverse-heavy-lists.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: enforce cursor-list contracts for heavy Dataverse screens.
+ * Explicit validator: enforce cursor-list contracts for heavy Dataverse screens.
*
* The source of truth is native-app-plan.md. If a written app screen maps to a
* per-screen spec whose Pagination field is `cursor`, it must not use the
diff --git a/plugins/mobile-apps/hooks/validate-dataverse-payload.js b/plugins/mobile-apps/hooks/validate-dataverse-payload.js
index 1fcf9b2ab..0f4c994a9 100644
--- a/plugins/mobile-apps/hooks/validate-dataverse-payload.js
+++ b/plugins/mobile-apps/hooks/validate-dataverse-payload.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: catch the two HTTP-400 crash patterns on Dataverse calls.
+ * Explicit validator: catch HTTP-400 crash patterns on Dataverse calls.
*
* Fires after Write / Edit / MultiEdit on TS/TSX files. Reads the resulting
* file content and blocks the write if either:
diff --git a/plugins/mobile-apps/hooks/validate-icon-imports.js b/plugins/mobile-apps/hooks/validate-icon-imports.js
index bc8a0de7d..ed268ba9e 100644
--- a/plugins/mobile-apps/hooks/validate-icon-imports.js
+++ b/plugins/mobile-apps/hooks/validate-icon-imports.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: forbid non-Ionicons icon imports in TS/TSX files.
+ * Explicit validator: forbid non-Ionicons icon imports in TS/TSX files.
*
* Fires after Write / Edit / MultiEdit. Reads the tool_input from stdin,
* scans the resulting file content (or applied edit content) for forbidden
diff --git a/plugins/mobile-apps/hooks/validate-navigation-idempotency.js b/plugins/mobile-apps/hooks/validate-navigation-idempotency.js
index 277990565..a9e5a6e65 100644
--- a/plugins/mobile-apps/hooks/validate-navigation-idempotency.js
+++ b/plugins/mobile-apps/hooks/validate-navigation-idempotency.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: enforce navigation intent + submit idempotency guardrails.
+ * Explicit validator: enforce navigation intent and submit idempotency guardrails.
*
* Blocking errors:
* - `router.push(...)` to known singleton routes (must use `router.navigate(...)`)
diff --git a/plugins/mobile-apps/hooks/validate-package-deps.js b/plugins/mobile-apps/hooks/validate-package-deps.js
index 5c7af8364..38ebfd954 100644
--- a/plugins/mobile-apps/hooks/validate-package-deps.js
+++ b/plugins/mobile-apps/hooks/validate-package-deps.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: forbid bad dependencies in package.json writes.
+ * Explicit validator: forbid bad dependencies in package.json writes.
*
* Triggers on Write/Edit/MultiEdit of any package.json. Blocks when the
* resulting deps include known-bad packages, private vendor packages are
@@ -134,6 +134,14 @@ function reconstructBeforeContent(toolName, toolInput, afterContent) {
}
function getNativeAllowlistDeps(toolName, toolInput, afterContent, packageJsonPath) {
+ if (toolInput.validation_mode === 'explicit-mobile-workflow') {
+ try {
+ return readPackageDepsFromContent(fs.readFileSync(BUNDLED_TEMPLATE_PACKAGE_PATH, 'utf8'));
+ } catch {
+ return null;
+ }
+ }
+
const beforeContent = reconstructBeforeContent(toolName, toolInput, afterContent);
const beforeDeps = beforeContent ? readPackageDepsFromContent(beforeContent) : null;
return beforeDeps || readPackageLockDeps(packageJsonPath);
@@ -152,7 +160,7 @@ function isWriteTool(t) {
}
function readResult(toolName, toolInput) {
- // Prefer the file on disk (PostToolUse runs after the write).
+ // Prefer the file on disk because explicit validation runs after the write.
const fp = toolInput.file_path || toolInput.filePath;
if (typeof fp === 'string' && fs.existsSync(fp)) {
try {
diff --git a/plugins/mobile-apps/hooks/validate-protected-paths.js b/plugins/mobile-apps/hooks/validate-protected-paths.js
index 7d643c06d..d842f6ab8 100644
--- a/plugins/mobile-apps/hooks/validate-protected-paths.js
+++ b/plugins/mobile-apps/hooks/validate-protected-paths.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: protect agent-generated read-only paths.
+ * Explicit validator: protect agent-generated read-only paths.
*
* Blocks writes to:
* - any path under `src/generated/` (regenerated by `npx power-apps add-data-source`)
diff --git a/plugins/mobile-apps/hooks/validate-screen-quality.js b/plugins/mobile-apps/hooks/validate-screen-quality.js
index 0ff7a4a2a..3b4ed61ce 100644
--- a/plugins/mobile-apps/hooks/validate-screen-quality.js
+++ b/plugins/mobile-apps/hooks/validate-screen-quality.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PostToolUse hook: enforce 5 screen-quality rules deterministically.
+ * Explicit validator: enforce screen-quality rules deterministically.
*
* Replaces these per-screen self-check rules from agents/screen-builder.md:
* - #20 Palette warmth (no raw grays in screens)
@@ -19,8 +19,8 @@
*
* Scope:
* - Watches: app/(any-path)/*.tsx, src/components/(any-path)/*.tsx
- * - Skips: brand/tokens.ts, tamagui.config.ts, tests, node_modules,
- * src/generated (auto-generated), shared/samples (plugin source)
+ * - Skips: route layouts, brand/tokens.ts, tamagui.config.ts, tests,
+ * node_modules, src/generated (auto-generated), shared/samples
*
* Exit codes:
* 0 = pass (clean, not watched, or unparseable input)
@@ -36,19 +36,6 @@ function isWriteTool(toolName) {
return toolName === 'Write' || toolName === 'Edit' || toolName === 'MultiEdit';
}
-function hasDeferredStyleHooksMarker(filePath) {
- if (typeof filePath !== 'string' || !filePath) return false;
-
- let dir = path.dirname(path.resolve(filePath));
- for (let depth = 0; depth < 12; depth += 1) {
- if (fs.existsSync(path.join(dir, '.tmp', 'defer-style-hooks'))) return true;
- const parent = path.dirname(dir);
- if (parent === dir) break;
- dir = parent;
- }
- return false;
-}
-
function isWatchedFile(filePath) {
if (typeof filePath !== 'string') return false;
if (!/\.tsx$/i.test(filePath)) return false;
@@ -57,6 +44,7 @@ function isWatchedFile(filePath) {
// Exclusions — these legitimately contain hex / inline shadows / etc.
const exclude = [
+ /\/_layout\.tsx$/,
/\/brand\//,
/\/tamagui\.config\.ts/,
/\/node_modules\//,
@@ -646,8 +634,6 @@ process.stdin.on('end', () => {
const filePath = toolInput.file_path || toolInput.filePath;
if (!isWatchedFile(filePath)) process.exit(0);
- if (process.env.CODE_APPS_NATIVE_SKIP_SCREEN_QUALITY_HOOK === '1' || hasDeferredStyleHooksMarker(filePath)) process.exit(0);
-
const content = extractContent(toolName, toolInput);
if (!content) process.exit(0);
diff --git a/plugins/mobile-apps/hooks/validate-write-safety.js b/plugins/mobile-apps/hooks/validate-write-safety.js
index a07c0634f..555199e9a 100644
--- a/plugins/mobile-apps/hooks/validate-write-safety.js
+++ b/plugins/mobile-apps/hooks/validate-write-safety.js
@@ -1,7 +1,7 @@
#!/usr/bin/env node
/**
- * PreToolUse guardrail for Write / Edit / MultiEdit.
+ * Explicit mobile-workflow guardrail for Write / Edit / MultiEdit payloads.
*
* Two checks, both hard-fail (exit 2 = block tool call, message goes to model):
*
@@ -15,6 +15,10 @@
* the words "tenant"/"client"/"secret"). Targets the planner accidentally
* pasting connection strings into memory-bank.md or native-app-plan.md.
*
+ * This validator is invoked by scripts/validate-mobile-files.js for files owned
+ * by a mobile workflow. It is deliberately not registered in hooks/hooks.json:
+ * Claude loads plugin hooks during unrelated workflows, including Canvas Apps.
+ *
* Both checks are conservative — they err on the side of blocking. False
* positives are recoverable (the model sees the rejection reason and can
* reword); silent secret leakage is not.
@@ -23,6 +27,7 @@
* sparingly — usually means the guardrail itself needs adjusting.
*/
+const fs = require('fs');
const path = require('path');
const DEBUG = process.env.DEBUG === '1' || process.env.DEBUG === 'true';
@@ -68,6 +73,47 @@ function scanForSecrets(content) {
return null;
}
+// Claude Code loads plugin hooks for every tool call, including calls made by
+// other installed plugins. A Power Apps mobile project is identified by the two
+// runtime dependencies that distinguish this template from Canvas and web apps.
+function packageMarksMobileProject(packagePath) {
+ try {
+ const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
+ const deps = {
+ ...(pkg.dependencies || {}),
+ ...(pkg.devDependencies || {}),
+ ...(pkg.peerDependencies || {}),
+ ...(pkg.optionalDependencies || {}),
+ };
+ return Boolean(deps.expo && deps['@microsoft/power-apps-native-host']);
+ } catch {
+ return false;
+ }
+}
+
+function findMobileProjectRoot(candidatePath) {
+ if (!candidatePath || typeof candidatePath !== 'string') return null;
+
+ let current = path.resolve(candidatePath);
+ try {
+ if (!fs.statSync(current).isDirectory()) current = path.dirname(current);
+ } catch {
+ current = path.dirname(current);
+ }
+
+ while (true) {
+ if (packageMarksMobileProject(path.join(current, 'package.json'))) return current;
+ const parent = path.dirname(current);
+ if (parent === current) return null;
+ current = parent;
+ }
+}
+
+function isMobileInvocation(paths, cwd) {
+ if (findMobileProjectRoot(cwd)) return true;
+ return paths.some((targetPath) => findMobileProjectRoot(path.resolve(cwd, targetPath)));
+}
+
// ---------------------------------------------------------------------------
// Path safety. The cwd is the project root for any skill invocation. Any
// Write/Edit must stay under it.
@@ -106,15 +152,16 @@ function extractWriteTargets(toolName, toolInput) {
const paths = [];
const contents = [];
+ const filePath = toolInput.file_path || toolInput.filePath;
if (toolName === 'Write') {
- if (toolInput.file_path) paths.push(toolInput.file_path);
+ if (filePath) paths.push(filePath);
if (typeof toolInput.content === 'string') contents.push(toolInput.content);
} else if (toolName === 'Edit') {
- if (toolInput.file_path) paths.push(toolInput.file_path);
+ if (filePath) paths.push(filePath);
if (typeof toolInput.new_string === 'string') contents.push(toolInput.new_string);
} else if (toolName === 'MultiEdit') {
- if (toolInput.file_path) paths.push(toolInput.file_path);
+ if (filePath) paths.push(filePath);
if (Array.isArray(toolInput.edits)) {
for (const e of toolInput.edits) {
if (typeof e?.new_string === 'string') contents.push(e.new_string);
@@ -154,6 +201,11 @@ process.stdin.on('end', () => {
const { paths, contents } = extractWriteTargets(toolName, toolInput);
+ if (!isMobileInvocation(paths, cwd)) {
+ debug(`Skipping non-mobile write in ${cwd}`);
+ process.exit(0);
+ }
+
for (const p of paths) {
if (!isPathSafe(p, cwd)) {
reject(
diff --git a/plugins/mobile-apps/scripts/lib/mobile-app-hook-utils.js b/plugins/mobile-apps/scripts/lib/mobile-app-hook-utils.js
deleted file mode 100644
index b557c877d..000000000
--- a/plugins/mobile-apps/scripts/lib/mobile-app-hook-utils.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Registry of skills that have a PostToolUse validator.
- *
- * Add an entry when you ship a new validator script under the skill's
- * directory. The hook (hooks/run-skill-posttool-validation.js) reads this
- * file to decide whether to run anything after a Skill tool call.
- *
- * Validators are plain Node scripts that:
- * - read JSON-encoded tool_input on stdin
- * - run their checks (file existence, schema validation, type-check, etc.)
- * - print human-readable output to stdout / stderr
- * - exit 0 on success, non-zero to fail the calling skill
- *
- * v0 ships with no validators yet. Add them as the skills mature.
- */
-
-const TRACKED_SKILLS = {
- 'create-mobile-app': {},
- 'setup-auth': {},
- 'add-dataverse': {},
- 'setup-datamodel': {},
- 'add-connector': {},
- 'add-native': {},
- 'list-connections': {},
- 'edit-app': {},
- 'deploy': {},
- 'report-issue': {},
-};
-
-function detectTrackedSkill(value) {
- if (typeof value !== 'string') return null;
-
- const trimmed = value.trim();
- if (TRACKED_SKILLS[trimmed]) return trimmed;
-
- // Strip leading slash and optional plugin prefix: /add-dataverse, /mobile-app:add-dataverse
- const normalized = trimmed.replace(/^\/?(?:mobile-app:)?/, '').toLowerCase();
- if (TRACKED_SKILLS[normalized]) return normalized;
-
- // Fall back to searching for mobile-app:<skill> anywhere in the string
- const commandMatch = trimmed.match(/mobile-app:([a-z0-9-]+)/i);
- if (!commandMatch) return null;
-
- const skillName = commandMatch[1].toLowerCase();
- return TRACKED_SKILLS[skillName] ? skillName : null;
-}
-
-function getTrackedSkillFromToolInput(toolInput) {
- if (!toolInput || typeof toolInput !== 'object') return null;
-
- for (const field of ['skill', 'skill_name', 'skillName', 'name', 'commandName', 'command']) {
- const skillName = detectTrackedSkill(toolInput[field]);
- if (skillName) return skillName;
- }
-
- try {
- return detectTrackedSkill(JSON.stringify(toolInput));
- } catch {
- return null;
- }
-}
-
-function getValidatorScript(skillName) {
- return TRACKED_SKILLS[skillName]?.validatorScript ?? null;
-}
-
-module.exports = {
- TRACKED_SKILLS,
- detectTrackedSkill,
- getTrackedSkillFromToolInput,
- getValidatorScript,
-};
diff --git a/plugins/mobile-apps/scripts/lib/mobile-validator-manifest.js b/plugins/mobile-apps/scripts/lib/mobile-validator-manifest.js
new file mode 100644
index 000000000..caa0a4949
--- /dev/null
+++ b/plugins/mobile-apps/scripts/lib/mobile-validator-manifest.js
@@ -0,0 +1,42 @@
+const path = require('node:path');
+
+const SOURCE_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx']);
+const TYPESCRIPT_EXTENSIONS = new Set(['.ts', '.tsx']);
+const TEXT_EXTENSIONS = new Set([
+ '.css',
+ '.html',
+ '.js',
+ '.json',
+ '.jsx',
+ '.md',
+ '.ts',
+ '.tsx',
+ '.yaml',
+ '.yml',
+]);
+
+function hasExtension(filePath, extensions) {
+ return extensions.has(path.extname(filePath).toLowerCase());
+}
+
+const VALIDATORS = [
+ { script: 'validate-write-safety.js', appliesTo: () => true },
+ { script: 'validate-protected-paths.js', appliesTo: () => true },
+ { script: 'validate-package-deps.js', appliesTo: (filePath) => path.basename(filePath) === 'package.json' },
+ { script: 'validate-icon-imports.js', appliesTo: (filePath) => hasExtension(filePath, SOURCE_EXTENSIONS) },
+ { script: 'validate-connector-first.js', appliesTo: (filePath) => hasExtension(filePath, SOURCE_EXTENSIONS) },
+ { script: 'validate-dataverse-payload.js', appliesTo: (filePath) => hasExtension(filePath, TYPESCRIPT_EXTENSIONS) },
+ { script: 'validate-dataverse-heavy-lists.js', appliesTo: (filePath) => hasExtension(filePath, TYPESCRIPT_EXTENSIONS) },
+ { script: 'validate-navigation-idempotency.js', appliesTo: (filePath) => path.extname(filePath).toLowerCase() === '.tsx' },
+ { script: 'validate-screen-quality.js', appliesTo: (filePath) => path.extname(filePath).toLowerCase() === '.tsx' },
+ { script: 'validate-color-contrast.js', appliesTo: (filePath) => path.extname(filePath).toLowerCase() === '.tsx' },
+];
+
+function isTextFile(filePath) {
+ return hasExtension(filePath, TEXT_EXTENSIONS);
+}
+
+module.exports = {
+ VALIDATORS,
+ isTextFile,
+};
\ No newline at end of file
diff --git a/plugins/mobile-apps/scripts/validate-mobile-files.js b/plugins/mobile-apps/scripts/validate-mobile-files.js
new file mode 100644
index 000000000..d41ea1fd4
--- /dev/null
+++ b/plugins/mobile-apps/scripts/validate-mobile-files.js
@@ -0,0 +1,162 @@
+#!/usr/bin/env node
+
+/**
+ * Runs the mobile plugin's former write hooks explicitly for files changed by a
+ * mobile skill or agent. Plugin-level hooks run in unrelated plugin sessions,
+ * so mobile workflows call this dispatcher before reporting completion.
+ */
+
+const fs = require('node:fs');
+const path = require('node:path');
+const { spawnSync } = require('node:child_process');
+const { VALIDATORS, isTextFile } = require('./lib/mobile-validator-manifest');
+
+const PLUGIN_ROOT = path.resolve(__dirname, '..');
+
+function usage() {
+ return [
+ 'Usage: node validate-mobile-files.js --project-root <path> --file <path> [--file <path> ...]',
+ '',
+ 'Paths must be regular files. Relative paths resolve from --project-root.',
+ ].join('\n');
+}
+
+function parseArgs(argv) {
+ const parsed = { projectRoot: null, targets: [] };
+
+ for (let index = 0; index < argv.length; index += 1) {
+ const arg = argv[index];
+ if (arg === '--project-root') {
+ parsed.projectRoot = argv[index + 1];
+ index += 1;
+ } else if (arg === '--file') {
+ parsed.targets.push(argv[index + 1]);
+ index += 1;
+ } else if (arg === '--help' || arg === '-h') {
+ parsed.help = true;
+ } else {
+ parsed.targets.push(arg);
+ }
+ }
+
+ return parsed;
+}
+
+function isWithinRoot(filePath, projectRoot) {
+ const relative = path.relative(projectRoot, filePath);
+ return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
+}
+
+function runValidator(validatorName, filePath, content, projectRoot) {
+ const validatorPath = path.join(PLUGIN_ROOT, 'hooks', validatorName);
+ const payload = JSON.stringify({
+ cwd: projectRoot,
+ tool_name: 'Write',
+ tool_input: {
+ content,
+ file_path: filePath,
+ filePath,
+ validation_mode: 'explicit-mobile-workflow',
+ },
+ });
+
+ return spawnSync(process.execPath, [validatorPath], {
+ cwd: projectRoot,
+ encoding: 'utf8',
+ env: {
+ ...process.env,
+ CLAUDE_PLUGIN_ROOT: PLUGIN_ROOT,
+ PLUGIN_ROOT,
+ },
+ input: payload,
+ });
+}
+
+function main(argv) {
+ const { help, projectRoot: projectRootArg, targets } = parseArgs(argv);
+ if (help) {
+ process.stdout.write(`${usage()}\n`);
+ return 0;
+ }
+ if (!projectRootArg || targets.length === 0 || targets.some((target) => !target)) {
+ process.stderr.write(`${usage()}\n`);
+ return 1;
+ }
+
+ const requestedProjectRoot = path.resolve(projectRootArg);
+ if (!fs.existsSync(requestedProjectRoot) || !fs.statSync(requestedProjectRoot).isDirectory()) {
+ process.stderr.write(`Project root not found: ${requestedProjectRoot}\n`);
+ return 1;
+ }
+ const projectRoot = fs.realpathSync(requestedProjectRoot);
+
+ const files = new Set();
+ let blocked = false;
+
+ for (const target of targets) {
+ const requestedTargetPath = path.resolve(projectRoot, target);
+ if (!isWithinRoot(requestedTargetPath, projectRoot)) {
+ process.stderr.write(`BLOCKED: validation target is outside the mobile project root: ${requestedTargetPath}\n`);
+ blocked = true;
+ continue;
+ }
+ if (!fs.existsSync(requestedTargetPath)) {
+ process.stderr.write(`Validation target not found: ${requestedTargetPath}\n`);
+ blocked = true;
+ continue;
+ }
+ const stat = fs.lstatSync(requestedTargetPath);
+ if (stat.isSymbolicLink()) {
+ process.stderr.write(`BLOCKED: validation target must not be a symbolic link: ${requestedTargetPath}\n`);
+ blocked = true;
+ continue;
+ }
+ if (!stat.isFile()) {
+ process.stderr.write(`Validation target must be a regular file: ${requestedTargetPath}\n`);
+ blocked = true;
+ continue;
+ }
+ const targetPath = fs.realpathSync(requestedTargetPath);
+ if (!isWithinRoot(targetPath, projectRoot)) {
+ process.stderr.write(`BLOCKED: resolved validation target is outside the mobile project root: ${targetPath}\n`);
+ blocked = true;
+ continue;
+ }
+ files.add(targetPath);
+ }
+
+ let binaryFiles = 0;
+ for (const filePath of files) {
+ const textFile = isTextFile(filePath);
+ const content = textFile ? fs.readFileSync(filePath, 'utf8') : '';
+ if (!textFile) binaryFiles += 1;
+
+ for (const validator of VALIDATORS) {
+ if (!validator.appliesTo(filePath)) continue;
+ const result = runValidator(validator.script, filePath, content, projectRoot);
+ if (result.stdout) process.stdout.write(result.stdout);
+ if (result.stderr) process.stderr.write(result.stderr);
+ if (result.error) {
+ process.stderr.write(`Validator ${validator.script} failed to start: ${result.error.message}\n`);
+ blocked = true;
+ } else if (result.status !== 0) {
+ blocked = true;
+ }
+ }
+ }
+
+ if (blocked) return 2;
+ const binarySummary = binaryFiles > 0 ? `; ${binaryFiles} binary file path(s) checked` : '';
+ process.stdout.write(`Mobile validation passed for ${files.size} file(s)${binarySummary}.\n`);
+ return 0;
+}
+
+if (require.main === module) {
+ process.exitCode = main(process.argv.slice(2));
+}
+
+module.exports = {
+ isWithinRoot,
+ main,
+ parseArgs,
+};
\ No newline at end of file
diff --git a/plugins/mobile-apps/shared/references/dataverse-offline-api.md b/plugins/mobile-apps/shared/references/dataverse-offline-api.md
index 135b20ba7..d9423620b 100644
--- a/plugins/mobile-apps/shared/references/dataverse-offline-api.md
+++ b/plugins/mobile-apps/shared/references/dataverse-offline-api.md
@@ -308,7 +308,7 @@ node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> POST \
|---|---|---|
| `204` | Published | Continue |
| `400 / 0x80071141` "circular relationship" | Profile's association graph contains a cycle (e.g., `account => task => account`) | Parse the path from the error message, remove ONE association (prompt user at this point), re-attempt publish |
-| `400 / 0x80071140` "no relationships are specified" for a Related-only table | A profile item has `recorddistributioncriteria=0` (Related rows only) but no `mobileofflineprofileitemassociation` rows targeting it. Without those, the runtime would sync zero rows. **Empirical 2026-05-24**: server enforces this at publish time — and the validation seems to look at associations published in an earlier `publishedon` snapshot, not the current uncommitted ones. So for profiles being **retrofitted** (existing publish + late association additions), publish can fail even after associations are added. | Parse the table name from the error message. Two recoveries: (a) re-run `/add-table-to-offline-profile --table <tbl>` to add the missing associations — must include ALL relevant inbound relationships, not just one. (b) `/edit-offline-profile --table <tbl> --scope 2 --me` to change scope away from Related-only. Prompt user to pick. |
+| `400 / 0x80071140` "no relationships are specified" for a Related-only table | A profile item has `recorddistributioncriteria=0` (Related rows only) but no `mobileofflineprofileitemassociation` rows targeting it. Without those, the runtime would sync zero rows. **Empirical 2026-05-24**: server enforces this at publish time — and the validation seems to look at associations published in an earlier `publishedon` snapshot, not the current uncommitted ones. So for profiles being **retrofitted** (existing publish + late association additions), publish can fail even after associations are added. | Parse the table name from the error message. Two recoveries: (a) read and execute `${CLAUDE_SKILL_DIR}/../add-table-to-offline-profile/SKILL.md` with `--table <tbl>` to add ALL relevant inbound associations, not just one; (b) read and execute `${CLAUDE_SKILL_DIR}/../edit-offline-profile/SKILL.md` with `--table <tbl> --scope 2 --me` to change scope away from Related-only. Prompt user to pick. |
| `429` (rate limit) | Concurrent publish in progress on shared env | Back off via `dataverse-request.js` automatic retry; if still failing, fall through to the targeted-then-fallback pattern below |
| Client timeout, but server-side committed | Shared envs can take longer than `dataverse-request.js`'s 4-retry budget allows | Verify by re-GET — if `componentstate=0` AND `publishedon` is non-null + recent, treat as success |
diff --git a/plugins/mobile-apps/shared/references/offline-profile-reconciliation.md b/plugins/mobile-apps/shared/references/offline-profile-reconciliation.md
index 792c711a0..ebb22994d 100644
--- a/plugins/mobile-apps/shared/references/offline-profile-reconciliation.md
+++ b/plugins/mobile-apps/shared/references/offline-profile-reconciliation.md
@@ -89,10 +89,12 @@ default = update now):
On **Yes**, apply in this order (both are non-interactive when the target is explicit):
-1. For each `missingTables[]` entry → `/add-table-to-offline-profile --table <logicalName>`
- (or `--all-new` to add them all at once).
-2. For each `tablesWithNewColumns[]` entry →
- `/edit-offline-profile --table <logicalName> --columns add:<comma-separated newColumns>`.
+1. For each `missingTables[]` entry, read and execute
+ `${CLAUDE_SKILL_DIR}/../add-table-to-offline-profile/SKILL.md` with
+ `--table <logicalName>` (or `--all-new` to add them all at once).
+2. For each `tablesWithNewColumns[]` entry, read and execute
+ `${CLAUDE_SKILL_DIR}/../edit-offline-profile/SKILL.md` with
+ `--table <logicalName> --columns add:<comma-separated newColumns>`.
Re-run the delta check afterward; expect `in-sync`. Surface any remaining `delta` as a
concern rather than looping.
diff --git a/plugins/mobile-apps/shared/shared-instructions.md b/plugins/mobile-apps/shared/shared-instructions.md
index becb8a4ae..487468be4 100644
--- a/plugins/mobile-apps/shared/shared-instructions.md
+++ b/plugins/mobile-apps/shared/shared-instructions.md
@@ -83,6 +83,23 @@ All non-Dataverse connectors require a connection ID or connection reference bef
## Safety Guardrails
+### Mandatory changed-file validation
+
+Plugin-level hooks also run during unrelated plugin workflows, so every mutating mobile skill owns its validation:
+
+1. Track every file written by the skill or its subagents. Exclude untouched output from trusted generators such as `npx power-apps init` and `npx power-apps add-data-source`.
+2. Before returning success, pass each changed file explicitly:
+
+ ```bash
+ node "${PLUGIN_ROOT}/scripts/validate-mobile-files.js" \
+ --project-root "<working_dir>" \
+ --file "<changed-file-1>" \
+ --file "<changed-file-2>"
+ ```
+
+3. On exit `2`, repair every finding and rerun. Exit `0` is required before `DONE`.
+
+Never pass a directory or the whole project. Files with common text extensions (see `scripts/lib/mobile-validator-manifest.js`) receive content-based checks; other files receive path-safety-only checks. This gate remains required after a successful typecheck.
### MUST (required before acting)
- **Confirm before any deployment.** Before running platform-native run commands, ask: _"Build and run on `<platform>`? Metro will start in foreground."_ — exception: the first build at the end of `/create-mobile-app` is pre-approved as part of the scaffold flow.
@@ -221,7 +238,7 @@ When a skill is invoked from another skill (e.g., `/create-mobile-app` calls `/a
- **Memory bank is still read** — but skip the summary if the caller just updated it.
- **Honor `--skip-planning`** — if the caller indicates the plan is already approved, do not re-spawn the planner agent.
- **Inherit `working_dir`** — never default to `process.cwd()` when invoked from another skill.
-- **Scratch files go in `<working_dir>/.tmp/`** — never write temporary files (request bodies, intermediate JSON, scratch data) to `/tmp/` or any path outside the project directory. The `validate-write-safety` hook blocks out-of-project writes. Create the folder first: `mkdir -p <working_dir>/.tmp`.
+- **Scratch files go in `<working_dir>/.tmp/`** — never write temporary files (request bodies, intermediate JSON, scratch data) to `/tmp/` or any path outside the project directory. Keeping scratch data project-local prevents cross-project writes and makes cleanup deterministic. Create the folder first: `mkdir -p <working_dir>/.tmp`.
---
diff --git a/plugins/mobile-apps/skills/add-connector/SKILL.md b/plugins/mobile-apps/skills/add-connector/SKILL.md
index a7a4dbef7..cfe606f1b 100644
--- a/plugins/mobile-apps/skills/add-connector/SKILL.md
+++ b/plugins/mobile-apps/skills/add-connector/SKILL.md
@@ -1,6 +1,6 @@
---
name: add-connector
-description: Use when the user wants to add a Power Platform connector to a mobile app and there is no dedicated /add-* skill for that connector (Dataverse and SharePoint have their own skills).
+description: Use when adding a Power Platform connector to an Expo/React Native Power Apps mobile app and no dedicated mobile connector skill exists.
user-invocable: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion, Skill
model: sonnet
diff --git a/plugins/mobile-apps/skills/add-datasource/SKILL.md b/plugins/mobile-apps/skills/add-datasource/SKILL.md
index 29ef7f01e..2d70917ff 100644
--- a/plugins/mobile-apps/skills/add-datasource/SKILL.md
+++ b/plugins/mobile-apps/skills/add-datasource/SKILL.md
@@ -1,6 +1,6 @@
---
name: add-datasource
-description: Use when the user wants to add a data source to a mobile app but hasn't said which kind (Dataverse table, SharePoint list, or other connector).
+description: Use when adding an unspecified data source to an Expo/React Native Power Apps mobile app; routes to Dataverse, SharePoint, or another connector.
user-invocable: true
allowed-tools: Read, Grep, Glob, AskUserQuestion, Skill
model: sonnet
diff --git a/plugins/mobile-apps/skills/add-dataverse/SKILL.md b/plugins/mobile-apps/skills/add-dataverse/SKILL.md
index 80ec73e73..419f68a65 100644
--- a/plugins/mobile-apps/skills/add-dataverse/SKILL.md
+++ b/plugins/mobile-apps/skills/add-dataverse/SKILL.md
@@ -329,7 +329,7 @@ For each `Create` decision, in **tier order** (Tier 0 → Tier 1 → Tier 2 →
**Solution targeting (HARD):** every Step 5 / 5b POST MUST pass `--solution <uniquename>` so Dataverse routes the new artifact into our solution rather than the unmanaged default. Read the solution name from `memory-bank.md` Power Platform context (captured in Step 3b). Without this flag, multi-project environments end up with cross-solution leakage and the foreign-collision class of bug returns. The script translates `--solution` to the `MSCRM.SolutionUniqueName` HTTP header.
-**Scratch files:** When writing request body JSON to disk (e.g. table definitions, column metadata, relationship payloads), always write to `<working_dir>/.tmp/`, never to `/tmp/`. The hook `validate-write-safety.js` blocks writes outside the project directory. Create the folder if it doesn't exist: `mkdir -p <working_dir>/.tmp`.
+**Scratch files:** When writing request body JSON to disk (e.g. table definitions, column metadata, relationship payloads), always write to `<working_dir>/.tmp/`, never to `/tmp/`. Keeping request bodies project-local prevents cross-project writes and makes cleanup deterministic. Create the folder if it doesn't exist: `mkdir -p <working_dir>/.tmp`.
```bash
node "${CLAUDE_SKILL_DIR}/../../scripts/dataverse-request.js" <envUrl> POST EntityDefinitions \
@@ -796,8 +796,8 @@ Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKI
| `status` | Action |
|---|---|
| `no-manifest` / `no-profile` / `in-sync` | Continue to Step 9 silently. For `no-profile` (no offline profile exists) do not nag — the app may not use offline. |
-| `error` | `offline-profile.json` is unreadable — the script prints `status: error` and **exits non-zero**. Do NOT treat this as an `/add-dataverse` failure (the tables are already created): surface the `error` string, **skip reconciliation** (never drive the update skills against a corrupt file), and finish with `DONE_WITH_CONCERNS` telling the user to fix `offline-profile.json`, then run `/add-table-to-offline-profile` manually. |
-| `delta` | Prompt the user (one `AskUserQuestion`, default = update now) to add the missing tables / new columns to the offline profile, then invoke `/add-table-to-offline-profile` (for `missingTables[]`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` (for `tablesWithNewColumns[]`). Re-run the delta check; it should read `in-sync`. Follow the exact prompt + ordering in the reconciliation reference. |
+| `error` | `offline-profile.json` is unreadable — the script prints `status: error` and **exits non-zero**. Do NOT treat this as an `/add-dataverse` failure (the tables are already created): surface the `error` string, **skip reconciliation** (never drive the update workflows against a corrupt file), and finish with `DONE_WITH_CONCERNS` telling the user to fix `offline-profile.json`. |
+| `delta` | Prompt the user (one `AskUserQuestion`, default = update now) to add the missing tables / new columns. For `missingTables[]`, read and execute `${CLAUDE_SKILL_DIR}/../add-table-to-offline-profile/SKILL.md`; for `tablesWithNewColumns[]`, read and execute `${CLAUDE_SKILL_DIR}/../edit-offline-profile/SKILL.md` with `--table <t> --columns add:<newColumns>`. Re-run the delta check; it should read `in-sync`. Follow the exact prompt + ordering in the reconciliation reference. |
### Step 9 — Summary
diff --git a/plugins/mobile-apps/skills/add-native/add-camera/SKILL.md b/plugins/mobile-apps/skills/add-native/add-camera/SKILL.md
index 48252e4f3..510bfe05e 100644
--- a/plugins/mobile-apps/skills/add-native/add-camera/SKILL.md
+++ b/plugins/mobile-apps/skills/add-native/add-camera/SKILL.md
@@ -2,6 +2,7 @@
name: add-camera
description: Internal implementation skill invoked by /add-native for camera, image picker, barcode scanner, QR scanner, and camera/gallery Dataverse artifact workflows.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.md b/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.md
index 696c1b2bc..719e80b14 100644
--- a/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.md
+++ b/plugins/mobile-apps/skills/add-native/add-geolocation/SKILL.md
@@ -2,6 +2,7 @@
name: add-geolocation
description: Internal implementation skill invoked by /add-native for native background GPS tracking with durable storage and Dataverse sync using @microsoft/power-apps-native-bglocation.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.md b/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.md
index 2aaab68ab..98ea612b3 100644
--- a/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.md
+++ b/plugins/mobile-apps/skills/add-native/add-pdf-report/SKILL.md
@@ -2,6 +2,7 @@
name: add-pdf-report
description: Internal implementation skill invoked by /add-native for app-generated PDF report workflows using expo-print and, when present, expo-sharing.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md b/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md
index bba1b6e28..8eca75797 100644
--- a/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md
+++ b/plugins/mobile-apps/skills/add-native/add-pdf-viewer/SKILL.md
@@ -2,6 +2,7 @@
name: add-pdf-viewer
description: Internal implementation skill invoked by /add-native for native PDF control workflows. Handles HTTPS and file URI PDF viewing with @microsoft/power-apps-native-pdf-viewer 0.2.9+.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.md b/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.md
index 60c78f055..f33f7a867 100644
--- a/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.md
+++ b/plugins/mobile-apps/skills/add-native/add-pen-input/SKILL.md
@@ -2,6 +2,7 @@
name: add-pen-input
description: Internal implementation skill invoked by /add-native for pen, signature, ink, drawing, and handwriting capture workflows using @microsoft/power-apps-native-pen-input.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.md b/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.md
index 6513eac13..207946591 100644
--- a/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.md
+++ b/plugins/mobile-apps/skills/add-table-to-offline-profile/SKILL.md
@@ -1,7 +1,8 @@
---
name: add-table-to-offline-profile
-description: Use when the user wants to add ONE table (typically a newly-added Dataverse table) to an existing offline profile without re-running the full /setup-offline-profile wizard. Parallel to /add-dataverse — same single-table flow.
+description: Internal mobile-app workflow read and executed only by mobile orchestrators to add one Dataverse table to an existing Mobile Offline Profile.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/create-mobile-app/SKILL.md b/plugins/mobile-apps/skills/create-mobile-app/SKILL.md
index 723e02442..b1966d79b 100644
--- a/plugins/mobile-apps/skills/create-mobile-app/SKILL.md
+++ b/plugins/mobile-apps/skills/create-mobile-app/SKILL.md
@@ -1708,21 +1708,6 @@ Before the first wave, do a one-shot probe to confirm `Task` can spawn `mobile-a
**Hard rule — no nested agent spawning.** Screen-builder agents MUST NOT spawn further agents (no nested `Task` calls). The top-level orchestrator owns the entire screen-builder fan-out: one `Task` batch per wave of up to 5 screens. If a builder needs help that previously would have been a nested spawn, it returns `NEEDS_CONTEXT:` and the orchestrator handles the follow-up at the wave boundary.
-**Fast-wave style deferral:** before spawning the first wave, create `<working_dir>/.tmp/defer-style-hooks` with a short note. The PostToolUse style hooks (`validate-screen-quality`, `validate-color-contrast`) skip blocking writes while this marker exists. This marker does **not** disable TypeScript, connector-first, protected-path, package, or write-safety validators. It only moves deterministic style debt out of the parallel builder hot path and into Step 11.4's batch report/fix sweep.
-
-```bash
-mkdir -p <working_dir>/.tmp
-printf 'Step 11 fast-wave mode: defer style hook blocking until Step 11.4 report sweep.\n' > <working_dir>/.tmp/defer-style-hooks
-```
-
-Delete the marker immediately after the last screen wave's final TypeScript gate passes and before Step 11.4 starts:
-
-```bash
-rm -f <working_dir>/.tmp/defer-style-hooks
-```
-
-Never leave this marker in place for Step 11.4 or Step 12. Report mode ignores the marker and should always scan the generated screens.
-
**Print before spawning** (substitute computed values; `<W>` = total waves = `ceil(N/5)`):
> "→ [Step 11/13] Building <N> screens in <W> wave(s) of up to 5 concurrent.
> Wave 1/<W> starting: <comma-separated screen names in this wave>."
@@ -1803,12 +1788,6 @@ This sticky policy controls **how to handle a failed gate**, not whether the gat
Run one controlled stylistic debt sweep after all screen-builder waves and TypeScript gates are clean, before preview or dev-server launch. This keeps screen-builder retries focused on critical compile/data/route issues, then fixes visual and accessibility quality across the full screen set in batches.
-Before running any report, assert the Step 11 fast-wave marker is gone:
-
-```bash
-rm -f <working_dir>/.tmp/defer-style-hooks
-```
-
**Print before starting:**
> "→ [Step 11.4/13] Running stylistic validators in batch + auto-fixing contrast / accessibility / token issues across all screens (~2-3 min)"
@@ -1833,7 +1812,7 @@ For each available stylistic validator:
4. Build one file-level edit batch per affected file. Apply affected files in parallel because screen files are independent. Do not run one edit per issue when multiple issues are in the same file; that reintroduces slow per-write loops and line-number drift.
5. Re-run the same validator in `--report` mode for the touched files. Cap retries at 2 per file per validator.
-**Hook behavior during the sweep:** Do not disable hooks globally and do not recreate `<working_dir>/.tmp/defer-style-hooks`. If a normal PostToolUse hook blocks an intermediate edit, treat that as signal that the edit batch was incomplete: fold the hook's message into that file's next retry. Only use a temporary skip env var if the validator itself documents one and you immediately re-run `--report` before advancing.
+These validators are invoked explicitly by this mobile workflow. They are not registered as plugin-wide hooks because that would run them during unrelated Canvas Apps and other plugin operations.
After all validators report no auto-fixable issues, run:
diff --git a/plugins/mobile-apps/skills/deploy/SKILL.md b/plugins/mobile-apps/skills/deploy/SKILL.md
index 9ba72cf2c..5b8b2425b 100644
--- a/plugins/mobile-apps/skills/deploy/SKILL.md
+++ b/plugins/mobile-apps/skills/deploy/SKILL.md
@@ -1,6 +1,6 @@
---
name: deploy
-description: Use when the user wants to deploy / publish / push a Power Apps mobile app to a Power Platform tenant so others can run it.
+description: Use to deploy, publish, or push an Expo/React Native Power Apps mobile app to a Power Platform tenant.
user-invocable: true
allowed-tools: Read, Glob, Bash, AskUserQuestion, Skill
model: sonnet
@@ -96,7 +96,7 @@ Branch on the JSON `status` (full contract in [offline-profile-reconciliation.md
Options:
-- **Update the offline profile now (recommended)** — invoke `/add-table-to-offline-profile` for each `missingTables[]` entry (or once with `--all-new`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` for each `tablesWithNewColumns[]` entry, following the ordering in the reconciliation reference. Then re-run the delta check; when it reports `in-sync`, continue to Step 3.
+- **Update the offline profile now (recommended)** — read and execute `${CLAUDE_SKILL_DIR}/../add-table-to-offline-profile/SKILL.md` for each `missingTables[]` entry (or once with `--all-new`), then read and execute `${CLAUDE_SKILL_DIR}/../edit-offline-profile/SKILL.md` with `--table <t> --columns add:<newColumns>` for each `tablesWithNewColumns[]` entry. Follow the ordering in the reconciliation reference, then re-run the delta check; when it reports `in-sync`, continue to Step 3.
- **Deploy anyway** — requires an explicit override. Wait for the exact phrase `deploy without offline` (case-insensitive); a bare `y`/`yes` is not enough, mirroring the environment-mismatch gate in Step 3. Then continue to Step 3 and note the skipped reconciliation in the Step 4 build-history row.
Do not push until the gate is resolved (reconciled to `in-sync`, or explicitly overridden).
diff --git a/plugins/mobile-apps/skills/design-system/SKILL.md b/plugins/mobile-apps/skills/design-system/SKILL.md
index d5202e497..b4fc6f2b9 100644
--- a/plugins/mobile-apps/skills/design-system/SKILL.md
+++ b/plugins/mobile-apps/skills/design-system/SKILL.md
@@ -1,6 +1,6 @@
---
name: design-system
-description: Creates and manages the brand design system for a Power Apps mobile app. Generates brand/design-system.md (source of truth), brand/tokens.ts (importable Tamagui tokens), and brand/design-system.html (visual gallery). Triggered at Step 6.5 of /create-mobile-app, or standalone via /design-system.
+description: Creates the Tamagui brand system for an Expo/React Native Power Apps mobile app, including design-system.md, tokens.ts, and an HTML gallery.
user-invocable: true
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, Task, WebFetch
model: opus
diff --git a/plugins/mobile-apps/skills/design-system/references/vibe/direction-polished-inspection.md b/plugins/mobile-apps/skills/design-system/references/vibe/direction-polished-inspection.md
index 4d66b8f55..0fa07bcc0 100644
--- a/plugins/mobile-apps/skills/design-system/references/vibe/direction-polished-inspection.md
+++ b/plugins/mobile-apps/skills/design-system/references/vibe/direction-polished-inspection.md
@@ -136,7 +136,7 @@ Where `statusBg` returns hue at ~10-15% alpha (`#fbe5e6` for red, `#e6f0fa` for
## Hard rules (encoded so screen-builders don't drift)
-These are documented here for clarity, but the plugin's existing PostToolUse validators (`hooks/validate-color-contrast.js`, `hooks/validate-screen-quality.js`) enforce them automatically across every direction. The new preset inherits them for free.
+The owning mobile workflow checks these rules explicitly with the contrast and screen-quality validators.
| # | Rule | Enforced by |
|---|---|---|
diff --git a/plugins/mobile-apps/skills/edit-app/SKILL.md b/plugins/mobile-apps/skills/edit-app/SKILL.md
index 35d1ba03b..cd8638837 100644
--- a/plugins/mobile-apps/skills/edit-app/SKILL.md
+++ b/plugins/mobile-apps/skills/edit-app/SKILL.md
@@ -413,7 +413,7 @@ Run the local, no-network delta check:
node "${CLAUDE_SKILL_DIR}/../../scripts/offline-profile-delta.js"
```
-Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md): `no-manifest` / `no-profile` / `in-sync` → continue silently (do not nag when no profile exists); `delta` → prompt to update, then invoke `/add-table-to-offline-profile` (for `missingTables[]`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` (for `tablesWithNewColumns[]`), and re-check to `in-sync`. Record the reconciliation outcome in the Step 8 memory-bank edit entry.
+Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md): `no-manifest` / `no-profile` / `in-sync` → continue silently (do not nag when no profile exists); `delta` → prompt to update, then read and execute `${CLAUDE_SKILL_DIR}/../add-table-to-offline-profile/SKILL.md` for `missingTables[]` and `${CLAUDE_SKILL_DIR}/../edit-offline-profile/SKILL.md` for `tablesWithNewColumns[]`, passing the arguments documented by each workflow, and re-check to `in-sync`. Record the reconciliation outcome in the Step 8 memory-bank edit entry.
### Step 6 — Rebuild affected screens
@@ -513,20 +513,14 @@ If `npm run check-routes` is absent but `scripts/check-routes.js` exists, run:
node scripts/check-routes.js
```
-When screen files changed, also run the available validators from `hooks/` if this repository is the plugin checkout, or the equivalent project scripts if the generated app exposes them:
+When screen files changed, run the mobile plugin's report-mode validators explicitly:
```bash
-node hooks/validate-screen-quality.js --report <changed-screen-files-or-app-dir>
-node hooks/validate-color-contrast.js --report <changed-screen-files-or-app-dir>
-node hooks/validate-icon-imports.js <changed-screen-files-or-app-dir>
-node hooks/validate-navigation-idempotency.js <changed-screen-files-or-app-dir>
-node hooks/validate-protected-paths.js <changed-files>
-node hooks/validate-connector-first.js <changed-files>
-node hooks/validate-dataverse-payload.js <changed-files>
-node hooks/validate-package-deps.js <project-root>
+node "${CLAUDE_SKILL_DIR}/../../hooks/validate-screen-quality.js" --report <changed-screen-files-or-app-dir>
+node "${CLAUDE_SKILL_DIR}/../../hooks/validate-color-contrast.js" --report <changed-screen-files-or-app-dir>
```
-Only run validators that exist and are relevant to the changed files. Treat validator failures like create-flow gate failures: capture once, batch by root cause, repair, and rerun the same validator/gate once.
+Treat 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.
#### Step 7.1 — Targeted style-quality sweep
diff --git a/plugins/mobile-apps/skills/edit-offline-profile/SKILL.md b/plugins/mobile-apps/skills/edit-offline-profile/SKILL.md
index 3bd53afc0..7cd19aba1 100644
--- a/plugins/mobile-apps/skills/edit-offline-profile/SKILL.md
+++ b/plugins/mobile-apps/skills/edit-offline-profile/SKILL.md
@@ -1,7 +1,8 @@
---
name: edit-offline-profile
-description: Use when the user wants to change ONE aspect of an existing offline profile (row scope for a table, column list, sync frequency) without re-running the full /setup-offline-profile wizard. Mirrors the /edit-app gated edit pattern.
+description: Internal mobile-app workflow read and executed only by mobile orchestrators to change one table's scope, columns, or sync settings in a Mobile Offline Profile.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/enable-tables-offline/SKILL.md b/plugins/mobile-apps/skills/enable-tables-offline/SKILL.md
index ede6fb134..c1e5910a6 100644
--- a/plugins/mobile-apps/skills/enable-tables-offline/SKILL.md
+++ b/plugins/mobile-apps/skills/enable-tables-offline/SKILL.md
@@ -1,7 +1,8 @@
---
name: enable-tables-offline
-description: Use when the user needs to enable the per-table prerequisites (Can be taken offline, Track changes) before a Dataverse table can be added to a Mobile Offline Profile. Pre-flight pass for /setup-offline-profile.
+description: Internal mobile-app workflow read and executed only by /setup-offline-profile to enable Dataverse table prerequisites for a Mobile Offline Profile.
user-invocable: false
+disable-model-invocation: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion, EnterPlanMode, ExitPlanMode
model: sonnet
---
diff --git a/plugins/mobile-apps/skills/list-connections/SKILL.md b/plugins/mobile-apps/skills/list-connections/SKILL.md
index 6f1de80b8..883629ed3 100644
--- a/plugins/mobile-apps/skills/list-connections/SKILL.md
+++ b/plugins/mobile-apps/skills/list-connections/SKILL.md
@@ -1,6 +1,6 @@
---
name: list-connections
-description: Use when the user asks to find, create, or look up a Power Platform connection ID or connection reference for the current environment.
+description: Use to find or create a Power Platform connection ID or reference for an Expo/React Native Power Apps mobile app.
user-invocable: true
allowed-tools: Bash
model: haiku
diff --git a/plugins/mobile-apps/skills/setup-datamodel/SKILL.md b/plugins/mobile-apps/skills/setup-datamodel/SKILL.md
index c34ca401f..0c34bebae 100644
--- a/plugins/mobile-apps/skills/setup-datamodel/SKILL.md
+++ b/plugins/mobile-apps/skills/setup-datamodel/SKILL.md
@@ -168,7 +168,7 @@ Run the local, no-network delta check:
node "${CLAUDE_SKILL_DIR}/../../scripts/offline-profile-delta.js"
```
-Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md): `no-manifest` / `no-profile` / `in-sync` → continue to Phase 7 silently (do not nag when no profile exists); `delta` → prompt to update, then invoke `/add-table-to-offline-profile` (for `missingTables[]`) and `/edit-offline-profile --table <t> --columns add:<newColumns>` (for `tablesWithNewColumns[]`), and re-check to `in-sync`.
+Branch on the JSON `status` per [offline-profile-reconciliation.md](${CLAUDE_SKILL_DIR}/../../shared/references/offline-profile-reconciliation.md): `no-manifest` / `no-profile` / `in-sync` → continue to Phase 7 silently (do not nag when no profile exists); `delta` → prompt to update, then read and execute `${CLAUDE_SKILL_DIR}/../add-table-to-offline-profile/SKILL.md` for `missingTables[]` and `${CLAUDE_SKILL_DIR}/../edit-offline-profile/SKILL.md` for `tablesWithNewColumns[]`, passing the arguments documented by each workflow, and re-check to `in-sync`.
### Phase 7 — Summary
diff --git a/plugins/mobile-apps/skills/setup-offline-profile/SKILL.md b/plugins/mobile-apps/skills/setup-offline-profile/SKILL.md
index 99eedefc1..c44308e8c 100644
--- a/plugins/mobile-apps/skills/setup-offline-profile/SKILL.md
+++ b/plugins/mobile-apps/skills/setup-offline-profile/SKILL.md
@@ -27,7 +27,7 @@ End-to-end wizard for creating a Dataverse Mobile Offline Profile that the app (
## Workflow
-1. Verify project & auth → 2. Resolve mode (create vs extend) → 3. Spawn architect agent → **Gate 1** (table prerequisites) → 4. Run `/enable-tables-offline` if needed → 5. POST profile shell → **Gate 2** (per-table row scope) → 6. POST profile items → **Gate 3** (relationships + columns + sync) → 7. POST associations → 8. Validate + publish → 9. Persist artifacts → 10. Summary
+1. Verify project & auth → 2. Resolve mode (create vs extend) → 3. Spawn architect agent → **Gate 1** (table prerequisites) → 4. Run the internal `enable-tables-offline` workflow if needed → 5. POST profile shell → **Gate 2** (per-table row scope) → 6. POST profile items → **Gate 3** (relationships + columns + sync) → 7. POST associations → 8. Validate + publish → 9. Persist artifacts → 10. Summary
---
@@ -316,12 +316,12 @@ configReview: accepted
> **Design rationale.** The original Step 3.5 used free-text replies ("type `accept` or describe edits in English") to keep things conversational. In practice users typed responses the regex parsers didn't recognise — `change scope of contact to teamonly`, `set sync to 10`, etc. — and the skill either silently dropped the edit or asked a clarifying question that drove additional confusion. The `AskUserQuestion` flow above eliminates parsing risk for the enumerable fields (scope, sync interval, top-level decision) while preserving the free-text path for the genuinely free-form fields (name, description, column lists). Net result: zero ambiguous interactions for the common adjustments, fewer typing-induced errors, parity with `/create-mobile-app`'s plan-gate UX.
-### Step 4 — Run `/enable-tables-offline` if needed
+### Step 4 — Run the internal `enable-tables-offline` workflow if needed
-If Gate 1 identified any table needing change, invoke `/enable-tables-offline` as a sub-skill with the list:
+If Gate 1 identified any table needing change, read and execute `${CLAUDE_SKILL_DIR}/../enable-tables-offline/SKILL.md` with the table list as its `$ARGUMENTS`:
```text
-/enable-tables-offline cr123_note,cr123_visit
+$ARGUMENTS: cr123_note,cr123_visit
```
Wait for it to return. Expected final line: `DONE` or `DONE_WITH_CONCERNS:`.