Skip to main content
skill CX Codex

preview-offline-scope — Claude Code skill: offline cache preview

preview-offline-scope estimates download payload and sync frequency costs for a Power Platform offline profile before rollout. Runs strictly in read-only mode.

MIT ★ 1,167 updated 2026-10-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add microsoft/power-platform-skills
/plugin install mobile-app@power-platform-skills
Open on GitHub

What preview-offline-scope does

This diagnostic skill inspects a Power Platform offline profile without mutating any data. It reads offline-profile.json and runs verify-offline-profile.js against the target Dataverse environment to flag configuration drift. It then queries Dataverse for table row counts while applying ownership criteria such as organization-wide, user-owned, or business-unit scopes.

Cache sizes are calculated using per-column byte heuristics. Strings average 100 bytes, unique identifiers take 40 bytes, and date fields use 28 bytes. The final summary aggregates total initial download size alongside an estimated daily transfer volume based on per-table refresh intervals.

The routine halts immediately if power.config.json lacks an environmentId. Tables configured with related-record filters cannot be computed independently and get flagged as parent-dependent in the report.

What it helps with

  • estimate initial download payload for mobile offline profiles
  • detect configuration drift between local profile and Dataverse
  • project daily sync transfer volume per device
  • inspect table row counts under scoped ownership filters

Example prompts for the agent

  • Estimate the initial download size and daily sync volume for offline-profile.json
  • Check our offline profile for drift and calculate table cache estimates
  • Run preview-offline-scope to see the per-table sync breakdown before pushing to users

How to install preview-offline-scope

1Plugin marketplace

/plugin marketplace add microsoft/power-platform-skills
/plugin install mobile-app@power-platform-skills

This installs the whole mobile-app plugin with all its skills

2Skills CLI (Vercel)

npx skills add microsoft/power-platform-skills --skill preview-offline-scope -a claude-code

3Manually: put the files in place

~/.claude/skills/preview-offline-scope/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/preview-offline-scope/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about preview-offline-scope

How to install preview-offline-scope in Claude Code?

Run both commands sequentially: /plugin marketplace add microsoft/power-platform-skills followed by /plugin install mobile-app@power-platform-skills.

What does preview-offline-scope do?

It calculates estimated mobile download sizes, checks profile drift against Dataverse, and reports expected daily data transfer per table.

Does preview-offline-scope modify existing profiles?

No, the tool operates strictly in read-only mode and performs diagnostic count queries without altering tenant records.

Source text

SKILL.md · MIT
---
name: preview-offline-scope
description: Use when the user wants to estimate the download size + sync frequency cost of an offline profile BEFORE pushing to users. Read-only. Wraps verify-offline-profile.js with per-table row-count estimates.
user-invocable: false
allowed-tools: Read, Bash, AskUserQuestion
model: sonnet
---

**Shared instructions: [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md)** — read first.

# Preview Offline Scope

Read-only diagnostic. Tells you "if you pushed this profile to users right now, here's what their devices would download and how often it would re-sync." No mutations.

Useful before:
- `/setup-offline-profile` for a final sanity check
- `/assign-offline-profile` (so users don't get surprised by data caps)
- `/edit-offline-profile` to gauge impact of a column-list change

Before any project read or command, apply
[app-working-directory.md](${PLUGIN_ROOT}/shared/references/app-working-directory.md).
Resolve one absolute `working_dir` for this direct invocation, or require the
owner's root for a child. Keep all shell calls, file reads, and retries on that
root and the same resolved environment/tenant. Read
`<working_dir>/offline-profile.json`; a supplied profile ID must match the
snapshot before verification. Missing or conflicting context is `NEEDS_CONTEXT`.

## Workflow

1. Verify project + locate profile → 2. Run verify (drift check) → 3. Per-table row counts → 4. Cache-size estimate → 5. Report

---

### Step 1 — Verify project + locate profile

Same as `/edit-offline-profile` Step 1. Read profileId from `offline-profile.json` or `$ARGUMENTS --profile-id`. Do not read profile metadata from `power.config.json`; it is owned by `pa app init`.

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
environment_id=$(node -p "require('./power.config.json').environmentId || ''") || {
  echo "BLOCKED: unreadable power.config.json" >&2; exit 1;
}
if [ -z "$environment_id" ]; then
  echo "NEEDS_CONTEXT: selected app has no environmentId" >&2; exit 1;
fi
node "${PLUGIN_ROOT}/scripts/resolve-environment.js" "$environment_id" --no-cache --require-tenant
```

Capture `<envUrl>` and `<tenantId>` and require them to match any owner identity.
Pass that tenant explicitly on verification, row counts, identity reads, and retries.

### Step 2 — Run verify

**Telemetry checkpoint: `verify_offline_profile_snapshot`**

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
node "${PLUGIN_ROOT}/scripts/verify-offline-profile.js" <envUrl> \
  --project-root '<working_dir>' --tenant-id "<tenantId>"
```

If `status: drift`, surface the drift list verbatim. The estimate that follows is still meaningful but flag that the live profile diverges from `offline-profile.json` — recommend re-running `/setup-offline-profile` or `/edit-offline-profile` to reconcile.

### Step 3 — Per-table row counts (with scope-applied filter)

**Telemetry checkpoint: `count_offline_profile_rows`**

For each table in the profile, run a `count` query that applies the same filter the runtime would use:

| `recorddistributioncriteria` | `recordsownedby*` flag | Effective filter |
|---|---|---|
| 1 (All records) | n/a | `?$count=true&$top=0` (whole table) |
| 2 + me | recordsownedbyme=true | `?$count=true&$top=0&$filter=_ownerid_value eq <current-user-id>` |
| 2 + team | recordsownedbymyteam=true | Approx: `_ownerid_value` in (current user's team-owned IDs); for estimate, use team count from `teamroles_association` |
| 2 + bu | recordsownedbymybusinessunit=true | `?$count=true&$top=0&$filter=_owningbusinessunit_value eq <current-bu-id>` |
| 0 (Related only) | n/a | Can't estimate independently — depends on parents. Report `~depends on parent counts`. |

For current-user/current-BU filters, resolve identity only inside this skill by calling Dataverse `WhoAmI` through `scripts/dataverse-request.js` against the resolved `<envUrl>` with `--tenant-id "<tenantId>"` from the same guarded root. If that call fails, report the affected scope as `unknown — current user/BU unavailable` instead of blocking the whole preview. Do not expect `scripts/resolve-environment.js` or `auth.config.json.environment` to provide `UserId` / `BusinessUnitId`.

For each table:

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> GET \
  "<entitysetname>?\$count=true&\$top=0&<scope-filter>" --tenant-id "<tenantId>"
```

Cap at 5000 (Dataverse non-aggregate count cap). When the result is exactly 5000, prefix with `≥` in the report.

### Step 4 — Cache-size estimate

**Telemetry checkpoint: `estimate_offline_cache_size`**

Rough byte-per-row heuristics (configurable; replace with measured values once we have a real sync benchmark):

| Column type | Bytes |
|---|---|
| Uniqueidentifier | 40 |
| String (avg 80 chars) | 100 |
| Integer / Decimal | 12 |
| DateTime | 28 |
| Boolean / State / Status | 4 |
| Picklist (option value only) | 8 |
| Memo (avg 500 chars) | 600 |
| Lookup (FK only) | 40 |
| Image (URL + thumbnail metadata only — see note below for full-image bytes) | 200 |
| File (URL + name metadata) | 200 |

For each table, compute: `estimatedBytesPerRow = sum(bytesForEach column in selectedcolumns)`. Then `tableTotalBytes = rows × estimatedBytesPerRow`.

Per-table sync overhead: each `syncintervalinminutes` interval triggers a delta query → assume ~20% of total rows touched on a typical day. `dailyTransferBytes = (totalBytes × 0.20 × intervalsPerDay)`.

### Step 5 — Report

```
═════════════════════════════════════════════════════════════
  Offline Scope Preview — <profileName>
═════════════════════════════════════════════════════════════

Drift status: ok | drift (see verify output)

Per-table breakdown:

| Table              | Scope          | Rows     | Cols | Est. bytes | Sync (min) |
|--------------------|----------------|----------|------|------------|------------|
| chnl_region        | All records    | 12       | 7    | 4 KB       | 60         |
| chnl_product       | All records    | 312      | 13   | 280 KB     | 60         |
| chnl_rmprofile     | Org+me         | 1        | 10   | 1 KB       | 10         |
| chnl_store         | Org+me         | 84       | 17   | 112 KB     | 10         |
| chnl_storevisit    | Org+me         | 412      | 13   | 220 KB     | 5          |
| chnl_order         | Org+me         | 156      | 14   | 95 KB      | 10         |
| chnl_orderline     | Related only   | ~depends | 11   | ~150 KB    | 10         |

Total initial download : ~860 KB (5000-rows cap not hit)
Daily transfer estimate: ~12 MB / device / day (assuming 20% delta rate)

Sync intervals per day:
  chnl_storevisit (5 min)  → 288 syncs/day  ⚠ high
  chnl_store      (10 min) → 144 syncs/day
  chnl_order      (10 min) → 144 syncs/day
  chnl_rmprofile  (10 min) → 144 syncs/day
  chnl_region     (60 min) → 24  syncs/day
  chnl_product    (60 min) → 24  syncs/day

Concerns:
  - chnl_storevisit at 5 min could exceed mobile data caps in low-signal areas
    (battery drain too). Consider 10 min unless 5 min is mission-critical.

Image / File bytes NOT counted by these heuristics. The metadata (URL +
thumbnail size) IS counted at 200 bytes/row, but the JPEG/file payload
itself transfers separately at runtime sync time. To estimate image
storage, multiply expected non-empty image rows × average JPEG size
(typically 10–500 KB per thumbnail).
```

## Status code (final line)

- `DONE` — estimate produced, no concerns
- `DONE_WITH_CONCERNS: <list>` — estimate produced but flagged items (high sync rates, near-cap row counts, drift detected, etc.)
- `NEEDS_CONTEXT: <missing>` — no profile to estimate against
- `BLOCKED: <reason>` — auth or query failures

## Notes

This skill is intentionally **estimate-grade, not precise**. The byte heuristics are rule-of-thumb; real cache size depends on Dataverse's storage layout + JSON serialization + per-device cache compression. The numbers are useful for **comparative** decisions (one scope vs another, one column list vs another), not for absolute capacity planning.

For precise figures, the only source of truth is the runtime sync log itself — only available once the app is deployed and an RM has signed in.

© Microsoft · MIT · microsoft/power-platform-skills

Similar skills

All skills for Mobile →

From the same set157

The whole set →
setup setup guides the agent through Process Intelligence configuration: dependency checks, cloud and environment selection, az login binding, then profile activation. CX Codex +1 ★ 1,167repo stars debug-flow debug-flow diagnoses failed Power Automate runs. It traces execution graphs, flags root causes, and prepares targeted flow fixes. CX Codex +1 ★ 1,167repo stars configure-canvas-mcp The configure-canvas-mcp skill connects Canvas Authoring MCP to an active Power Apps coauthoring session. Run it before editing a canvas app when the server is not connected yet. CX Codex +1 ★ 1,167repo stars add-sharepoint add-sharepoint connects SharePoint Online to Power Apps code apps: reads lists, manages documents, creates new lists via Graph API. CX Codex +1 ★ 1,167repo stars canvas-screen-builder canvas-screen-builder is a Claude Code subagent that adds or edits one screen in an existing Canvas App from a shared contract and scoped brief. It runs local QA without compiling. CX Codex ★ 1,167repo stars code-app-architect code-app-architect is a Claude Code subagent that guides Power Apps code project architecture with React and Vite, Dataverse integration, connector selection, and build troubleshooting. CX Codex ★ 1,167repo stars add-pdf-viewer add-pdf-viewer configures a native PDF viewer wrapper for HTTPS links and file:// URIs in Power Platform mobile projects. CX Codex +1 ★ 1,167repo stars add-pen-input The add-pen-input skill creates or checks a wrapper for handwriting and signature capture in a mobile app. /add-native routes pen, ink, drawing, and handwriting requests to it. CX Codex +1 ★ 1,167repo stars

Project sponsors

Companies that keep this analytics open