Skills Agentes

Argent Native Profiler

Perfilado nativo para detectar cuellos de botella de CPU, bloqueos de UI y problemas de memoria. En iOS usa xctrace y en Android usa Perfetto. Úsalo para diagnosticar problemas de rendimiento a nivel nativo.

Oficial
Estrellas
2.2k

en todo el repo

Actividad
57

0–100, la ruta de este skill

Actualizado
el mes pasado

último commit aquí

Commits
4

últimos 90 días

Contexto
2k tok

38 tok en reposo

Paquete
1 archivo

8 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add software-mansion/argent --skill argent-native-profiler --agent claude-code

Se instala solo en este repositorio.

Qué hace

  • Graba una sesión de perfilado en el dispositivo (xctrace en iOS, Perfetto en Android) y exporta los datos a XML
  • Analiza el trace y devuelve un informe estructurado de cuellos de botella, clasificados por severidad (RED/YELLOW)
  • Permite investigar en detalle: pilas de bloqueos, funciones que más llaman, desglose por hilo o fugas de memoria
  • Recarga sesiones de trace anteriores desde disco para volver a investigarlas
  • En iOS puede activar malloc stack logging para atribuir fugas de memoria a una pila de asignación real

Úsalo cuando

  • Hay que diagnosticar problemas de rendimiento a nivel nativo: cuellos de botella de CPU, bloqueos de UI o fugas de memoria

No lo uses cuando

    Qué lo activa

    Di cualquiera de estas frases y el agente debería cargar este skill.

    • Perfila la app para encontrar por qué se congela la UI
    • Busca fugas de memoria en la app en iOS
    • Analiza los cuellos de botella de CPU en Android

    SKILL.md

    En inglés

    1. Tools

    • native-profiler-start — start profiling on a booted device. iOS: xctrace recording for CPU, hangs, and leaks.
    • native-profiler-stop — stop the profiler and export trace data to timestamped XML files.
    • native-profiler-analyze — parse exported trace data and return a structured bottleneck payload.
    • profiler-stack-query — drill into parsed data: hang stacks, function callers, thread breakdown, leak details.
    • profiler-load — list and reload previous trace sessions from disk for re-investigation.

    2. Platform Support

    • iOS: Backend: Xcode Instruments via xctrace on a booted simulator or connected device. Requires Xcode command-line tools on PATH. Surfaces CPU hotspots, UI hangs, and memory leaks (instruments Leaks table).
    • Android: Backend: Perfetto via adb shell perfetto + an in-process WASM trace-processor engine. Surfaces CPU hotspots and UI hangs, with per-hang jank reason codes, a main-thread state breakdown with blocked_function attribution, and a GC overlap annotation. Also reports an RSS-growth signal for memory pressure; treat it as a hint to confirm manually, not a confirmed leak. The target app must be debuggable or include <profileable android:shell="true"/> in its manifest for perf_sample callstacks to be captured.

    3. Investigation Patterns

    After native-profiler-analyze surfaces findings, use profiler-stack-query to drill into root causes:

    • Hang detectedprofiler-stack-query mode=hang_stacks for full native call chains → mode=function_callers for the suspected function → read native source.
    • CPU hotspotprofiler-stack-query mode=thread_breakdown for per-thread distribution → mode=function_callers for the dominant function.
    • Memory leakprofiler-stack-query mode=leak_stacks filtered by object_type for responsible frames and libraries.
      • iOS: if leaks come back unattributed (responsible frame <Call stack limit reached>), re-run native-profiler-start with malloc_stack_logging: true. This cold-launches the app with Malloc Stack Logging so leaks carry a real allocation backtrace (responsible frame + library). It restarts the app and adds overhead, so use it only when you need leak attribution — not for CPU/hang passes.

    After presenting findings, ask the user whether to investigate further, implement fixes, or stop. After applying fixes, always re-profile the same scenario and compare with profiler-load. Report honestly whether the target metric improved, regressed, or stayed flat. If the fix showed no net benefit or introduced regressions elsewhere, say so and reconsider.

    Tip: For reproducible before/after comparisons, record the interaction sequence as a flow using the argent-create-flow skill before the first profiling run. Replay with flow-execute on subsequent runs to eliminate interaction variance.

    Note: The argent-react-native-profiler instructs to start native profiling automatically alongside React profiling. This skill's workflow and investigation patterns apply in both cases.


    4. Workflow

    Complete all steps in order — do not break mid-flow.

    Step 0: Ensure the target app is running

    The native-profiler-start tool auto-detects the running app on the device. You do not need to derive app_process manually — just make sure the app is launched.

    1. If the app is already running on the device, skip to Step 1 (do not pass app_process).
    2. If the app is not running, use launch-app with the correct bundle ID first.
    3. Only pass app_process explicitly if the tool reports multiple running user apps and you need to disambiguate.

    Note: If multiple build flavors are installed (dev, staging, prod), the tool will detect whichever one is currently running. If both are running, it will ask you to specify.

    Step 1: Start recording

    Call native-profiler-start with device_id (iOS UDID or Android serial). The tool auto-detects the running app and saves the trace to /tmp/argent-profiler-cwd/ with a timestamped filename. Let the user interact with the app or drive interaction via simulator tools (see argent-device-interact skill).

    Step 2: Stop and export

    Call native-profiler-stop with device_id. iOS sends SIGINT to xctrace, waits for trace packaging, and exports CPU, hangs, and leaks data to XML — check exportDiagnostics for any export warnings. Android sends SIGTERM to the on-device perfetto daemon, polls /proc/<pid> until it exits, then adb pulls the .pftrace to the host.

    Step 3: Analyze

    Call native-profiler-analyze with device_id. Returns a markdown report with bottlenecks categorized as CPU hotspots, UI hangs, or memory leaks, sorted by severity.

    Step 4: Present findings and ask about next steps

    Present a concise summary of the key findings. Then follow the "After analysis" guideline — ask whether to investigate further with query tools, implement fixes, or stop.

    Step 5: Drill-down investigation

    Use profiler-stack-query to investigate specific findings. See §3 Investigation Patterns for chaining guidance.

    Step 6: Reload previous sessions

    To revisit a previous trace:

    1. Call profiler-load mode=list to see available sessions.
    2. Call profiler-load mode=load_native session_id=<timestamp> device_id=<UDID> to re-parse the XML files.
    3. Use profiler-stack-query to investigate the reloaded data.

    5. Understanding Results

    Bottlenecks are categorized by severity:

    • RED: CPU functions taking >15% of total time, all UI hangs, and attributed memory leaks (those with a resolved responsible frame). These require immediate attention.
    • YELLOW: CPU functions taking 3-15% of total time, and unattributed memory leaks (<Call stack limit reached>, no library — see the memory-leaks caveat below). Worth investigating but may be acceptable.

    Each bottleneck type indicates a different class of problem:

    • CPU hotspots: Native functions consuming excessive CPU time. Look for tight loops, expensive computations, or redundant work.
    • UI hangs: Main thread blocked long enough to cause visible jank or unresponsiveness. Often caused by synchronous I/O, heavy layout passes, or lock contention.
    • Memory leaks: Objects allocated but never freed. Common causes include retain cycles, unclosed resources, or forgotten observers. Argent records via xctrace --attach, which has no malloc-stack history, so on the simulator most leaks come back unattributed (<Call stack limit reached>, no library) and are dominated by benign system allocations — these are reported as a low-confidence YELLOW summary, not confirmed RED leaks. For attributed stacks, capture with malloc stack logging enabled at launch.

    6. Important Caveats

    • Simulator vs device: Simulator profiling reflects host Mac performance, not real device hardware. Use device profiling for accurate CPU timings and memory behavior.
    • xctrace availability (iOS): Requires Xcode command-line tools installed. Verify with xcrun xctrace version.
    • Profiler overhead: xctrace instrumentation adds CPU load. If JSLexer, JSONEmitter, or Hermes runtime internals dominate the JS thread in CPU hotspot results, those reflect profiler overhead — not app work. Discount those entries when evaluating findings.
    • Run-to-run variance: Small fluctuations in CPU percentages between runs are normal. Treat only consistent directional changes (across 2+ runs or >15% delta) as actionable signal.
    • Live data variability: If the app fetches live API data, different responses between runs change rendering workload independently of code changes. Note when data-dependent screens show variance.

    Reproducido de software-mansion/argent bajo licencia Apache-2.0. Leer esta página en markdown.

    Archivos

    1 archivo en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

    Antes de instalar

    En iOS necesita las herramientas de línea de comandos de Xcode (xctrace) en el PATH; en Android la app debe ser debuggable o incluir profileable android:shell="true" en el manifiesto.

    Detalles

    Licencia
    Apache-2.0
    Recursos incluidos
    Solo SKILL.md
    Código fuente
    Ver SKILL.md

    Etiquetas

    Más de software-mansion/argent

    Este repo incluye 16 skills. Si instalas uno, normalmente ya tienes los demás.

    Crea, graba, edita, repite o repara flujos YAML reutilizables de Argent. Úsalo para grabar/repetir un recorrido de dispositivo, montar perfiles o comparaciones A/B, o antes de repetir tres o más interacciones.

    Costo de contexto al activarse
    1k tok
    Tamaño del paquete
    4 archivos
    Última actualización
    ayer
    Oficialtesting qa

    Interactúa con un simulador iOS, un emulador Android o una app Chromium (CDP) con las herramientas MCP de argent: toques, gestos, scroll, texto, botones físicos, lanzar apps, abrir URLs, capturas y esperas de elementos.

    Costo de contexto al activarse
    7.3k tok
    Tamaño del paquete
    2 archivos
    Última actualización
    ayer
    Oficialtesting qa

    Prueba de forma autónoma la interfaz de una app (iOS o Android) con bucles de interactuar-capturar-verificar usando las herramientas MCP de argent, para flujos de UI, login, navegación o pruebas end-to-end.

    Costo de contexto al activarse
    2.7k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 14 días
    Oficialtesting qa

    Depura un runtime JS vía CDP con las herramientas de debugger de argent. La vía principal es React Native por Metro (iOS/Android/Vega); un subconjunto también controla el renderer de una app Chromium (CDP).

    Costo de contexto al activarse
    3.4k tok
    Tamaño del paquete
    3 archivos
    Última actualización
    hace 14 días
    Oficialherramientas desarrollo

    Crea tests E2E de regresión QA reproducibles como flujos Argent a partir de casos de prueba, tickets o criterios de aceptación, con configuración determinista y dos pasadas consecutivas exitosas. Cubre iOS, Android, Chromium y Vega.

    Costo de contexto al activarse
    3.1k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    ayer
    Oficialtesting qa

    Flujos paso a paso para desarrollar o depurar apps React Native en simulador iOS o emulador Android. Úsalo para arrancar la app, depurar Metro, arreglar builds, diagnosticar errores en tiempo de ejecución o ejecutar tests.

    Costo de contexto al activarse
    5.2k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 14 días
    Oficialherramientas desarrollo

    Skills relacionados

    Configura y conecta un emulador Android con las herramientas MCP de argent. Úsalo al iniciar una sesión en Android, arrancar un emulador, obtener el serial de un dispositivo o antes de interactuar con la UI.

    Costo de contexto al activarse
    820 tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    Oficialherramientas desarrollo

    Configura y conecta un simulador iOS con las herramientas MCP de argent. Úsalo al iniciar una sesión, arrancar un simulador iOS, obtener un UDID o antes de cualquier interacción con el simulador.

    Costo de contexto al activarse
    194 tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 3 meses
    Oficialherramientas desarrollo

    Depura un runtime JS vía CDP con las herramientas de debugger de argent. La vía principal es React Native por Metro (iOS/Android/Vega); un subconjunto también controla el renderer de una app Chromium (CDP).

    Costo de contexto al activarse
    3.4k tok
    Tamaño del paquete
    3 archivos
    Última actualización
    hace 14 días
    Oficialherramientas desarrollo