---
name: jira-bug-backlog-trend
description: "Every Friday: open bugs right now, bugs created and resolved this week, and the eight-week trend, so a bad week is not mistaken for a bad quarter. Use when the user asks for this, or when it runs on a schedule."
---

# Jira bug backlog trend

Every Friday: open bugs right now, bugs created and resolved this week, and the eight-week trend, so a bad week is not mistaken for a bad quarter.

"Is quality getting better?" usually gets answered from memory. The open bug count alone says little; whether the team closes bugs faster than they arrive says a lot, and so does where they pile up.

The agent counts bugs with JQL every Friday, rebuilds the open count for the last eight weeks from created and resolved dates (so the trend is there from the first run), and names the components where bugs are collecting.

## Two ways to get the data

Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.

## Route A: API or MCP server

### What you need

- Browse permission on every project whose bugs you count; bugs in projects the user cannot see are left out without a warning.
- Jira Cloud API access through a connector or MCP server, or a token in `JIRA_API_TOKEN` (with `JIRA_EMAIL` and `JIRA_BASE_URL`) for the search and count endpoints.

If something is missing, say what and stop; do not invent numbers.

### Steps

1. **Count open bugs** (Jira): `POST /rest/api/3/search/approximate-count` with `{"jql": "project = ACME AND issuetype = Bug AND statusCategory != Done"}`, or page through `GET /rest/api/3/search/jql` with `fields=components,priority,created` to get the breakdown at the same time.
2. **Count this week's flow** (Jira): Created: `issuetype = Bug AND created >= startOfWeek()`. Resolved: `issuetype = Bug AND resolved >= startOfWeek()`. The net change is created minus resolved.
3. **Rebuild the trend** (Jira): For each of the last 8 weeks, count `issuetype = Bug AND created <= endOfWeek(-n) AND (resolved is EMPTY OR resolved > endOfWeek(-n))`. That gives the open count at the end of each week without any stored history.
4. **Find where bugs collect**: Group open bugs by component and priority. Flag any component whose open bugs grew by 3 or more this week, and count Highest and High bugs older than 30 days.
5. **Report**: The open count, its change since last Friday, created against resolved, and the components that grew.

## Route B: the browser

### What you need

- Signed in to Jira with Browse permission on every project whose bugs you count.

If something is missing, say what and stop; do not invent numbers.

### Steps

Start at https://home.atlassian.com/. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.

1. **Count open bugs**: From Atlassian Home open Jira, choose **Filters** > **View all work items**, switch to **JQL** and run `project = ACME AND issuetype = Bug AND statusCategory != Done`. The total above the list ("1-50 of 87") is the open count. Show the Component, Priority and Created columns.
2. **Count this week's flow**: Run `project = ACME AND issuetype = Bug AND created >= startOfWeek()` and then `project = ACME AND issuetype = Bug AND resolved >= startOfWeek()`, noting each total. Net change is created minus resolved.
3. **Rebuild the trend**: For n from 1 to 8, run `project = ACME AND issuetype = Bug AND created <= endOfWeek(-n) AND (resolved is EMPTY OR resolved > endOfWeek(-n))` and note the total each time. For a standing view instead, open **Dashboards**, create one and add the **Created vs. Resolved Chart** gadget on a saved filter for the project's bugs, period Weekly, 8 periods.
4. **Find where bugs collect**: Back on the open-bugs query, sort by Component and read the counts per component and priority. Run `AND priority in (Highest, High) AND created <= -30d` for the old high-priority count, and compare each component with last week's card to find any that grew by 3 or more.
5. **Report**: The open count, its change since last Friday, created against resolved, the 8-week trend and the components that grew.

Note: Eleven searches a week is slow in a browser; once the Created vs. Resolved gadget is on a dashboard, two of the queries and the whole trend come from one page. The counts match the API exactly, since both run the same JQL.

## The report

- **Open bugs** now, and the change since last Friday.
- **Created vs resolved** this week.
- **Trend**: open bugs at the end of each of the last 8 weeks.
- **Hot spots**: components where open bugs grew, and old high-priority bugs.
- One line on which component needs attention first, if any.

## Post it to Briefkin

When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.

```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
  -H "authorization: Bearer $BRIEFKIN_TOKEN" \
  -H "content-type: application/json" \
  -d @- <<'JSON'
{
  "v": 1,
  "event_id": "jira-bug-backlog-trend/<date of this run, e.g. 2026-10-16>",
  "item_key": "jira-bug-backlog-trend",
  "project": "Acme",
  "source": "Jira bug backlog trend skill",
  "kind": "metric",
  "title": "Open bugs down by 6 this week",
  "metric": {
    "label": "Open bugs",
    "value": 87,
    "better": "lower",
    "period_start": "<start of the period, ISO 8601>",
    "period_end": "<end of the period, ISO 8601>"
  },
  "glance": [
    {
      "type": "Grid",
      "props": {
        "columns": 3
      },
      "children": [
        {
          "type": "Stat",
          "props": {
            "label": "Created",
            "value": 14
          }
        },
        {
          "type": "Stat",
          "props": {
            "label": "Resolved",
            "value": 20
          }
        },
        {
          "type": "Stat",
          "props": {
            "label": "Net",
            "value": -6,
            "tone": "ok"
          }
        }
      ]
    },
    {
      "type": "Badges",
      "props": {
        "items": [
          {
            "label": "Checkout +4",
            "tone": "bad"
          },
          {
            "label": "Search -5",
            "tone": "ok"
          },
          {
            "label": "Mobile web -3",
            "tone": "ok"
          }
        ]
      }
    }
  ],
  "widget": [
    {
      "type": "Bars",
      "props": {
        "items": [
          {
            "label": "Checkout",
            "value": 24
          },
          {
            "label": "Search",
            "value": 18
          },
          {
            "label": "Mobile web",
            "value": 15
          },
          {
            "label": "Admin",
            "value": 12
          },
          {
            "label": "API",
            "value": 10
          },
          {
            "label": "Other",
            "value": 8
          }
        ],
        "unit": "bugs"
      }
    },
    {
      "type": "Callout",
      "props": {
        "text": "Checkout gained 4 bugs this week and holds 5 of the 7 High bugs older than 30 days.",
        "tone": "warn"
      }
    }
  ],
  "size": "md"
}
JSON
```

Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.

Set `period_start` and `period_end` to the window the number covers: the tile names it from them ("Last 7 days", "Today", "This month"). For a count right now (open items, a balance), send `"period_label": ""` so no period shows; for another name, send it as `period_label` (at most 24 characters).

## Run it on a schedule

Suggested: Fridays at 16:00 (`0 16 * * 5`). From cron, with the agent signed in on that machine:

```bash
0 16 * * 5 claude -p "Run the jira-bug-backlog-trend skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```

Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/jira-bug-backlog-trend#schedule

Source: https://briefkin.dev/skills/jira-bug-backlog-trend
