---
name: ansight-app-inspection-dotnet
description: Use this skill when inspecting, debugging, verifying, or extracting evidence from a running .NET MAUI, .NET for Android, .NET for iOS, or .NET Mac Catalyst app through Ansight Studio. Prefer Ansight Studio MCP tools, then discover .NET remote app tools such as MAUI, VisualTree, database, file-system, preferences, secure-storage, reflection (`reflect.*`), artifacts, logs, telemetry, and screenshots before falling back to simulator or device access.
---

# Ansight .NET App Inspection Skill

Use this skill when the target app is a .NET MAUI, .NET for Android, .NET for iOS, or .NET Mac Catalyst app paired with Ansight Studio.

Do not use this skill for native-only iOS, native-only Android, React Native, Flutter, server, desktop, console, or web apps.

## Goal

Use Ansight Studio and the paired .NET app's live runtime data to inspect behavior, diagnose bugs, verify fixes, and extract evidence.

## Required Constraints

- Prefer mounted `ansight_*` MCP tools before direct simulator, emulator, device, or app-container access.
- Prefer `ansight-daemon mcp-stdio` when configuring agent access.
- Select the app and live session explicitly; do not guess when more than one live session matches.
- Pull Studio-owned state, logs, telemetry, annotations, screenshots, and artifacts before invoking remote app tools.
- Call `ansight_list_app_tools` before any `ansight_call_app_tool`.
- Only call tool ids that are present in the returned catalog.
- Prefer read-only evidence first. Use write, delete, `reflect.invoke_method`, `reflect.set_member_value`, XAML inflation, command invocation, or binding-context mutation only when the user explicitly asks for mutation or test driving.
- Report any fallback to direct device access and the reason Ansight could not satisfy the request.

## Default Workflow

1. Confirm Ansight Studio access.
   - Prefer mounted `ansight_*` tools.
   - If setup is required, configure `ansight-daemon mcp-stdio`.
2. Identify the target app.
   - Call `ansight_list_apps`.
   - Use `ansight_get_app` when app metadata or linked codebase metadata is needed.
3. Identify the target session.
   - Call `ansight_list_sessions` with `liveOnly=true` for live debugging.
   - Pass `appId` when known.
   - Ask the user to choose if multiple sessions match.
4. Gather host-owned evidence:
   - `ansight_get_app_state`
   - `ansight_get_logs`
   - `ansight_get_telemetry`
   - `ansight_get_annotations`
5. Discover .NET remote tools:
   - Call `ansight_list_app_tools` with the selected `sessionId`.
   - Inspect scopes, argument schemas, and guard policy.
6. Choose the narrowest tool family that answers the question.
7. Verify the behavior after any source-code fix or runtime mutation.

## .NET Evidence Priority

For UI issues:

- Prefer MAUI tools for .NET MAUI apps when present.
- Use `maui.get_current_page`, `maui.get_visual_tree`, `maui.find_elements`, and focused MAUI element tools only if the catalog exposes them.
- Use native `ui.get_visual_tree`, `ui.inspect_node`, and `ui.get_screenshot` when the issue is platform-native hierarchy, screenshots, or overlay diagnostics.
- Use screenshots and visual trees together when layout, visibility, hit targets, labels, or navigation state matter.

For state, data, or persistence issues:

- Use logs and telemetry first to bracket the failing time window.
- Use database tools only after listing databases and schema.
- Use file-system tools only after listing approved roots.
- Use preferences and secure-storage tools only with explicit store/key allow-lists exposed by the app.
- Use `reflect.*` tools only against registered roots from `reflect.list_roots`, and only after reading the tool schema and guard policy.

For performance issues:

- Use `ansight_get_telemetry` for memory, FPS, battery, timing, and custom channels.
- Correlate telemetry with logs, app lifecycle, screen views, and screenshots before changing code.

## Common .NET Remote Tool Families

These families may be present, depending on installed packages and runtime guards. Do not call them unless the catalog returns them.

- MAUI: current page, MAUI visual tree, elements, bindable properties, bindings, resources, navigation, layout, handlers, binding contexts, and controlled actions.
- VisualTree: native UI hierarchy, screenshot capture, node inspection, and diagnostic overlays.
- Database: SQLite discovery, schema inspection, and read-only queries.
- FileSystem: sandbox root listing, file reads, downloads, writes, copies, moves, and deletes.
- Preferences: preference store and key inspection/mutation.
- SecureStorage: allow-listed secure-storage keys.
- Reflection (`reflect.*`): registered live object roots, member reads, opt-in `reflect.set_member_value`, and opt-in `reflect.invoke_method`.
- Artifacts: app-owned diagnostic exports.

`reflect.*` is expected to come from `Ansight.Tools.Reflection` or an all-in-one package with remote tools enabled in a Debug or explicit local-development configuration. If the catalog does not expose it, report that the app may not have the development-time reflection suite enabled.

## Mutation Rules

- Do not mutate by default.
- For MAUI, prefer read-only page, visual-tree, binding, resource, layout, and handler inspection before mutation.
- Use `maui.set_bindable_property`, `maui.inflate_xaml`, `maui.add_element`, `maui.invoke_element_action`, `maui.invoke_binding_context_command`, `reflect.invoke_method`, `reflect.set_member_value`, file writes, preference writes, or secure-storage writes only when the user asks for mutation or controlled test driving.
- Explain the exact mutation, target node/root/key/path, and expected rollback before making it.
- Clean up overlays or temporary runtime elements when the workflow is complete.

## Output Expectations

Report:

- app id and session id used
- platform/target shape observed
- Ansight tools called
- key logs, telemetry, screenshots, visual tree nodes, database rows, files, preferences, secure-storage values, artifacts, or reflection roots that drove the conclusion
- any mutation performed
- any exported artifact path
- verification result after the fix or action
- any fallback to direct simulator/device access and why it was necessary
