What it does
"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.
How it works
1Count open bugs
POST /rest/api/3/search/approximate-countwith{"jql": "project = ACME AND issuetype = Bug AND statusCategory != Done"}, or page throughGET /rest/api/3/search/jqlwithfields=components,priority,createdto get the breakdown at the same time.2Count this week's flow
Created:
issuetype = Bug AND created >= startOfWeek(). Resolved:issuetype = Bug AND resolved >= startOfWeek(). The net change is created minus resolved.3Rebuild the trend
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
4Find 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
5Report
The open count, its change since last Friday, created against resolved, and the components that grew.
Post it to the board
With
BRIEFKIN_TOKENset, the agent sends the result as one card that updates in place every run. Without it, you get the report in the chat.
What you get
- 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.
Install and run it
Pick your agent, where the data comes from and how to schedule it; the commands below follow.
Install the skill
One command. It puts the SKILL.md in ~/.claude/skills and in ~/.agents/skills, which Codex, Cursor, Gemini CLI, Copilot CLI and OpenCode read too.
shell
curl -fsSL https://briefkin.dev/skills/jira-bug-backlog-trend/install | shRun it
Ask Claude Code:
prompt
Run the jira-bug-backlog-trend skillOr paste the prompt instead of installing:
prompt
Using Jira Cloud JQL (GET /rest/api/3/search/jql, or POST /rest/api/3/search/approximate-count for counts) for project ACME: count open bugs (issuetype = Bug AND statusCategory != Done), bugs created this week (created >= startOfWeek()) and bugs resolved this week (resolved >= startOfWeek()). Rebuild the open count at the end of each of the last 8 weeks with created <= endOfWeek(-n) AND (resolved is EMPTY OR resolved > endOfWeek(-n)). Break open bugs down by component and priority, name components whose open bugs grew by 3 or more, and count High or Highest bugs older than 30 days. Lead with the open count and the change since last week.Put it on a schedule
Fridays at 16:00, from cron on any machine where Claude Code is signed in:
crontab
0 16 * * 5 claude -p "Run the jira-bug-backlog-trend skill"Add it with
crontab -e. A laptop asleep at that time runs it when it wakes if you use launchd or Task Scheduler instead; GitHub Actions works for the API route.Send it to your board
Connect Briefkin once with
curl -fsSL https://briefkin.dev/install | shand every run lands on your board as a stat tile. How setup works
View the SKILL.mdRaw file
SKILL.md---
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
What your agent needs
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(withJIRA_EMAILandJIRA_BASE_URL) for the search and count endpoints.
Connecting Jira
- Atlassian Rovo MCP Server, Atlassian's official remote server for Jira and Confluence at
https://mcp.atlassian.com/v2/mcp. In Claude, add the Atlassian connector from the directory; in Claude Code, runclaude mcp add --transport http atlassian https://mcp.atlassian.com/v2/mcpand authenticate with/mcp. It signs in with OAuth 2.1 or an API token and respects your Jira permissions (getting started). - Atlassian CLI. After
acli jira auth login,acli jira workitem search --jql "sprint in openSprints()" --jsonreturns the same issues from a terminal. - REST API with an API token. Create a token at id.atlassian.com under Security > API tokens. The skill reads
JIRA_EMAIL,JIRA_API_TOKENandJIRA_BASE_URL(https://acme.atlassian.net) and uses basic auth. A scoped token limited toread:jira-workandread:jira-useris narrower; scoped tokens callhttps://api.atlassian.com/ex/jira/{cloudId}instead of your site URL.
A classic token can do anything your account can, so prefer a scoped token with read scopes only, or an account that just has Browse permission on the projects in the report.
Questions
Does a reopened bug throw the trend off?
A little. Reopening clears the resolution date, so the rebuilt history counts that bug as open the whole time. For most teams that is a bug or two; once the skill has run for a few weeks, the card's own history holds the real Friday counts.
We track bugs with a label, not an issue type.
Swap issuetype = Bug for labels = bug (or your label) in every query. Keep the same filter in all three, or created and resolved will not add up to the change in the open count.
Do I need Briefkin to use the Jira bug backlog trend skill?
No. The skill runs with your own agent and gives you the report in the chat. With a Briefkin token set, each run also posts it to your board as a stat tile, so you can glance at it instead of asking again.
Which agents can run it?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Windsurf and Amp all read SKILL.md files. The install command puts it in ~/.claude/skills and ~/.agents/skills, where they look. ChatGPT, the Claude app and Grok take the prompt instead. Pick your agent under "Install and run it" and the commands change to match.
Can it work without an API or MCP server, from my browser?
Yes. Switch the data source to "Your browser" and the steps change to the Jira pages themselves: the agent opens home.atlassian.com in a browser you are signed in to and reads the numbers off the page. Claude Code, Codex, Cursor, Claude app and ChatGPT can drive a browser out of the box; Gemini CLI, Copilot CLI and OpenCode need a Playwright or Chrome DevTools MCP server first. It is slower than the API and needs you signed in, so it suits a report you run by hand or from a scheduler on your own computer.