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.
JavaScript claude-code-pluginclaude-code-skillscode-appsgithub-copilot-pluginpower-appspower-pagespower-platform
Add mobile sign-out planning guidance (#397)
Shubham Agarwal37d72e4b3043
diff --git a/plugins/mobile-apps/agents/screen-builder.md b/plugins/mobile-apps/agents/screen-builder.mdindex 6afff6200..476d60d52 100644--- a/plugins/mobile-apps/agents/screen-builder.md+++ b/plugins/mobile-apps/agents/screen-builder.md@@ -46,6 +46,8 @@ You will be invoked by `/create-mobile-app` Step 11 or `/edit-app` screen-rebuil- **HARD RULE — Route Intent Matrix + tap idempotency.** Navigation APIs are NOT interchangeable. Apply this matrix exactly: (1) **singleton destinations** (`/(app)/workout/form`, `/(app)/recovery/form`, `/login`, and any route the plan marks singleton) use `router.navigate(...)`, never `router.push(...)`; (2) **entity detail drill-down** routes use `router.push(...)`; (3) **auth/guard redirects** use `router.replace(...)`. Any primary navigation CTA (`Start`, `Continue`, `Open`, `Next`) must be double-tap safe: lock with `isNavigating`, early-return when true, set lock before calling router, and unlock in `finally` (or after transition callback). On iOS this prevents duplicate transitions and accidental double stack entries.+- **HARD RULE — Profile owns sign-out, but is not sign-out-only.** Every generated app has a Profile screen at `/(app)/profile`. If your assigned screen is Profile, render the planned app-specific profile sections first, then a visible text button labeled `Sign out` exactly where the spec places it. Use `signOut` from `useAuth()`; do not call `npx power-apps logout`, clear storage manually, or invent a custom auth service. Confirm before signing out, then call `signOut()` and `router.replace('/login')`. Non-Profile screens must not add sign-out actions.+- **HARD RULE — `useLocalSearchParams<{}>` type for THIS screen MUST be the EXACT union from the Navigation Contracts row, not a synthesized "what this screen needs" type.** The planner enforces param-union: every param ANY sender pushes to your route is listed in the contracts table for your route. Your `useLocalSearchParams<{}>` declaration MUST include every one of those params (path params required, query params optional with `?`). Even if your screen's content only uses some of them, the OTHERS are still received from senders and must be declared so they're typed correctly — undeclared params are silently dropped at runtime, breaking the senders.**Example — `/inspections/[id]/defect` from a real plan:**@@ -409,6 +411,8 @@ Read `<plan_path>`. Locate the per-screen spec for your `screen_name` under `##**Functional fields:**- **Domain layout decisions** — read this block FIRST (added by screen-planner). It answers: what data fields matter most, what is the visual emphasis, and what makes this screen different from a generic CRUD screen. These answers are binding — they override any generic "use the sample" instinct. If this block is absent, derive the answers yourself from the entity name + archetype before writing any JSX.- **Role** (when present) — gates which controls render for which persona. Combine with the UX contract: e.g. `Role: Supervisor` on an override screen → render the PIN gate; `Role: Inspector (edit) / Supervisor (read)` → hide edit chevrons / submit CTA when the signed-in user is a Supervisor. The role itself does not generate auth code (that lives in shared `useAuth()`); it tells you which conditional UI branches the spec expects. If absent, treat the screen as open to all signed-in users.+- **Profile content** (Profile screen only) — app-specific sections to render above sign-out. Use any generated services named in the Data field for persisted user/role/preference context; otherwise render local/static app context from the spec. Do not collapse Profile into a single sign-out button.+- **Sign-out affordance** (Profile screen only) — binding placement and label for sign-out. Use the skeleton's `handleSignOut` when present, or implement the same confirmed `useAuth().signOut` + `router.replace('/login')` flow locally. Do not move sign-out to Home, drawer, header, overflow menus, or any business-data screen.- Row style override (List screens) — if omitted, inherit from `### Shared Conventions`; if no shared default exists, pick the style that best communicates the entity's key fields. Do NOT default to generic cards.- Hero type override (Detail screens) — if omitted, inherit from `### Shared Conventions`; if no shared default exists, pick the hero that fits the entity.- Layout delta — combine the screen-specific layout delta with the archetype pattern, Shared Conventions, and Design Direction. A compact spec is intentional; absence of universal chrome/layout rules is not a missing requirement.diff --git a/plugins/mobile-apps/agents/screen-planner.md b/plugins/mobile-apps/agents/screen-planner.mdindex aa2724c66..e1982db91 100644--- a/plugins/mobile-apps/agents/screen-planner.md+++ b/plugins/mobile-apps/agents/screen-planner.md@@ -230,6 +230,17 @@ Examples:Keep total screen count tight — under 8 for v0 unless the requirements explicitly demand more. The user can iterate later.+### Sign-out placement rule++Every generated signed-in app MUST include a Profile screen and place sign-out there:++- Always add exactly one Profile screen at `/(app)/profile` with file `app/(app)/profile.tsx`.+- The Profile screen must be useful for the app being built, not a sign-out-only screen. Include 2-4 requirement-driven sections such as role/team/site context, assigned territory, default filters, saved preferences, contact/support info, app/environment details, or domain-specific account settings. Pick sections from the app's users and workflow; do not add generic filler.+- Add a visible `Sign out` button on the Profile screen. The button uses `useAuth().signOut`, asks for confirmation, and returns to `/login` after sign-out.+- Include the Profile screen in the Screen Map, Navigation Contracts, and Per-Screen Specs on every generated app, even when the user's requirements do not mention profile, account, settings, or sign-out.+- Never make sign-out the Home screen's primary CTA, and never create a Home screen whose main purpose is signing out.+- Do not put sign-out on Home, business-data screens, drawers, headers, or overflow menus. Profile is the only sign-out owner.+## Step 3.5 — Shared Conventions (graph phase output)**Print before starting:**@@ -365,6 +376,8 @@ For each screen the user adds, provide this compact shape:- **Presentation** — `default` (push onto stack) | `modal` (slide-up sheet, full-screen) | `formSheet` (iOS form-sheet — partial overlay). Use `modal` for create/edit forms reached from a list, `formSheet` for confirmations or short pickers, `default` for everything else. Inner `_layout.tsx` files use this to set `<Stack.Screen options={{ presentation }}>`.- **Layout delta** — only the screen-specific structure not implied by archetype + Shared Conventions. Name custom/app-specific components and the one primary visual arrangement; do NOT restate safe area, skeleton, default row wrappers, default buttons, or universal chrome.- **UX contract** — required for Home, workflow, queue, picker, review, audit, and form screens; omit only for simple read-only CRUD screens. Include only fields that apply: header title source + subtitle/context source; primary action label + placement (`bottom CTA` unless read-only); whether a create action is `visible-label`, `extended FAB`, or `icon-only FAB with accessibility label`; disabled reason text; filter chips and counts; selected-state cue; severity/status/urgency fields; countdown/SLA field; tab/section badge count source; timeline event fields (`timestamp`, `actor`, `action`, `status`).+- **Profile content** — REQUIRED on the Profile screen only. List 2-4 app-specific profile sections based on the app requirements and target users, for example `Role + team`, `Assigned site/territory`, `Default queue filters`, `App support/contact`, `Environment/app version`. Include any generated service needed for those sections; otherwise use local/static app context plus `useAuth()`.+- **Sign-out affordance** — REQUIRED on the Profile screen and omitted from every other screen. Write `visible Button "Sign out" using useAuth().signOut with confirm`; sign-out returns to `/login` after completion.- **Data** — which generated services it calls, with method names (e.g., bounded lookup: `AccountsService.getAll({ top: 50, orderBy: ['name asc'], select: ['name'] })`; cursor list: `InspectionsService.getAll({ maxPageSize: 50, orderBy: ['scheduledDate asc', 'inspectionid asc'], select: [...] })` plus `skipToken` continuation support)- **Related entity fields** (REQUIRED if any UI field on the screen displays data from an entity OTHER than the primary `Data` service's table; OMIT entirely otherwise) — one entry per cross-entity field. The `data-model-architect`'s Step 6a Cross-entity Read Audit reads this block to decide which calculated columns to propose. Mechanical schema:@@ -618,6 +631,17 @@ None.- **Navigation:** row tap → `/(app)/inspections/[id]`; bottom CTA → `/(app)/inspections/new`- **State delta:** empty "No inspections scheduled", CTA "New inspection"+#### Profile (`/(app)/profile`)+- **Domain layout decisions:** Key fields: signed-in account state + domain role/team context + app-specific defaults. Visual emphasis: the user's operational context, not the sign-out button. Different from generic: profile sections mirror the app's workflow, with sign-out separated at the bottom.+- **Archetype:** Tab-root+- **Purpose:** Let the signed-in user review account context, app-specific preferences/context, support details, and sign out.+- **Layout delta:** account summary block → 2-4 app-specific profile sections → app/support info rows → separated destructive action zone.+- **Profile content:** choose sections from the app requirements, such as assigned team/site, default queue filters, supervisor/escalation contact, territory/route, app support, or environment/app version.+- **Sign-out affordance:** visible Button "Sign out" using `useAuth().signOut` with confirm.+- **Data:** `useAuth()` plus generated services only when the Profile content needs persisted app-specific user context; otherwise local/static app context.+- **Navigation:** reached from Profile tab/drawer entry; sign-out replaces to `/login` after `signOut`.+- **Key user actions:** review profile/context, adjust supported app-specific defaults when planned, sign out.+### Open Questions for the User- Should "Capture receipt" support multiple photos per inspection or just one? Assumed one for v0.- Should profile screen allow editing the user's contact record? Assumed read-only for v0.diff --git a/plugins/mobile-apps/skills/create-mobile-app/SKILL.md b/plugins/mobile-apps/skills/create-mobile-app/SKILL.mdindex 06820f4f0..6e40fda1b 100644--- a/plugins/mobile-apps/skills/create-mobile-app/SKILL.md+++ b/plugins/mobile-apps/skills/create-mobile-app/SKILL.md@@ -1651,9 +1651,10 @@ export default function <ScreenName>() {}```-**Skeleton template for an Auth/Profile screen** (any screen whose data calls are `useAuth()` only):+**Skeleton template for the Profile screen** (`/(app)/profile`, always generated; app-specific content comes from the Profile spec):```tsximport React from 'react';+import { Alert } from 'react-native';import { useRouter } from 'expo-router';import { YStack, XStack, Text, Button } from 'tamagui';import { SafeAreaView } from 'react-native-safe-area-context';@@ -1665,7 +1666,22 @@ export default function <ScreenName>() {// There is NO `user` / `account` field. Display name comes from the ID-token claim, not from useAuth().const { isSignedIn, signOut } = useAuth();- // TODO: screen-builder fills JSX here+ const handleSignOut = React.useCallback(() => {+ Alert.alert('Sign out?', 'You can sign in again with your work or school account.', [+ { text: 'Cancel', style: 'cancel' },+ {+ text: 'Sign out',+ style: 'destructive',+ onPress: () => {+ void Promise.resolve()+ .then(() => signOut())+ .finally(() => router.replace('/login'));+ },+ },+ ]);+ }, [router, signOut]);++ // TODO: screen-builder fills JSX here. Any visible Sign out button calls handleSignOut.return null;}```@@ -1673,8 +1689,11 @@ export default function <ScreenName>() {**Rules for skeleton generation:**- Replace `<Service>`, `<Entity>`, `<ScreenName>`, `<searchKeys>`, `<orderField>`, `<field_declarations>` with actual values from the plan's per-screen spec + Generated Services table.- If a service is NOT in the Generated Services table, still write the import but add `// TODO(connector-not-yet-added)` above it.+- Profile skeletons may also include generated service/model imports when the Profile spec's `Profile content` or `Data` fields require persisted app-specific user context. Keep the sign-out helper regardless of whether Profile also loads data.- The skeleton is a **valid TypeScript file** (compiles with `return null`) — builders replace the `return null` with real JSX.- Do NOT write skeletons for screens that already exist in the template (e.g. `home.tsx` if it's already present).+- The Profile skeleton must keep the `handleSignOut` helper and wire the planned `Sign out` button to it. Do not inline a second auth/logout path, and do not make Profile a sign-out-only screen.+- Do not merge sign-out imports or helpers into non-Profile screen skeletons. The Profile screen is the only sign-out owner.- **Never destructure `user`, `account`, `profile`, or `claims` from `useAuth()`** — those fields do not exist on `AuthState`. The only fields are `isLoading`, `isAuthReady`, `isSignedIn`, `error`, `acquireToken`, `signIn`, `signOut`. If the screen needs the signed-in user's name/email, add a `// TODO: decode ID token claim` comment — do not invent a field.---