> For the complete documentation index, see [llms.txt](https://docs.luciq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luciq.ai/product-guides-and-integrations/product-guides/application-performance-monitoring/apm-optimizations.md).

# APM Optimizations

Use one prompt per APM metric to have your coding agent find the issues in your code behind slow launches, screens, and requests, and send them to Luciq.

APM shows you which launch phase, screen, or request is slow. APM Optimizations goes one step further and shows you what in your code causes it.

Instead of guessing at a fix, or opening occurrences one by one to find the pattern, you copy one prompt per metric into your coding agent. The agent reads your repository and sends the full list of issues in your code back to Luciq, each with its investigation. Your code stays on your machine.

* Find the code behind a slow App Launch, Screen Rendering, Flows, or Network metric.
* Get a prioritized list of issues instead of investigating occurrences one by one.
* Separate client-side problems from backend latency.

### Set-up APM Optimizations

Before you start, make sure your coding agent is connected to the [Luciq MCP server](https://docs.luciq.ai/product-guides-and-integrations/product-guides/ai-features/luciq-mcp-server.md) and is running in your app's repository.

{% stepper %}
{% step %}

#### Open the Debugging tab

Open any supported APM metric on the Luciq dashboard and select the **Debugging** tab. Each metric has its own **Find optimizations** page.
{% endstep %}

{% step %}

#### Connect Luciq MCP

This is a one-time setup so your coding agent can read your app's APM data. Use the **here** link on the page to connect it.
{% endstep %}

{% step %}

#### Copy the prompt

Click **Copy** to copy the prompt. Each metric has its own prompt, tailored to what that metric measures. For example, the Screen Rendering prompt checks frozen and slow frames, while the prompt for a latency metric looks at its percentiles.

The prompt already includes your app slug, mode, and the metric group, so you don't need to edit it.
{% endstep %}

{% step %}

#### Run it where your code lives

Paste the prompt into your coding agent, running in your app's repository. The agent first checks your APM data to confirm there is a real bottleneck worth optimizing, then traces it to the code responsible.

When it finishes, the agent sends the issues it found, with their investigations, to Luciq automatically. One prompt gets you the full list.
{% endstep %}

{% step %}

#### Optional: run it on a schedule

Ask your coding agent to make the prompt a routine, so it re-runs on its own and keeps your list of issues up to date.
{% endstep %}
{% endstepper %}

<figure><img src="https://2991836969-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCha1KrkvNKPdcC0aGvuB%2Fuploads%2Fgit-blob-5dbb54f002704a0a1e02ba1c58e901fb7ff27e9e%2Fapm-optimizations-debugging-prompt.png?alt=media" alt="The Debugging tab for a screen in Screen Rendering, showing the steps to connect Luciq MCP and copy the prompt."><figcaption></figcaption></figure>

## Optimizations Dashboard

Once your agent has sent its results, they appear in the **Optimizations** section of the **Debugging** tab. The filters at the top of the tab don't apply to this section.

Select an item in the list to see its details. Each item has a type and a priority:

* **Issue**: A problem in your code that affects the metric, such as work on the main thread that causes frozen frames.
* **Investigation**: A finding that explains the behavior you see in the data, but doesn't need a code change on its own.
* **Priority**: How urgently Luciq recommends addressing the item, for example **Medium priority**.

Each item includes:

* **What the data shows**: The metrics behind the finding, such as frozen and slow frame percentages, Apdex, and how they changed against the previous period. It also states how confident the finding is.
* **Root cause**: The code that causes the problem, with references to the files and lines involved.
* **Recommended actions**: The changes to make, including any trade-offs.

Select **Open in** at the bottom of an item to continue debugging it with your agent. You can ask questions, drill down, or create a fix.

<figure><img src="https://2991836969-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCha1KrkvNKPdcC0aGvuB%2Fuploads%2Fgit-blob-0ce07585c44d3e27fd5205f7c3cee5fca73042cf%2Fapm-optimizations-issues-list.png?alt=media" alt="The Optimizations section of the Debugging tab, showing a list of issues and investigations and the details of the selected issue."><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.luciq.ai/product-guides-and-integrations/product-guides/application-performance-monitoring/apm-optimizations.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
