AgentSkillsCN

detecting-duplicate-bugs

在创建新JIRA问题之前,通过对比新问题摘要与已有问题,提前识别重复的Bug。在QA记录Bug、提及潜在重复问题,或在创建新JIRA工单前使用。

SKILL.md
--- frontmatter
name: detecting-duplicate-bugs
description: Detects duplicate JIRA bugs before creation by comparing new bug summaries against existing issues. Use when QA is logging bugs, mentions potential duplicates, or before creating new JIRA tickets.

Duplicate Bug Detection Agent

Prevents JIRA clutter by identifying duplicate or similar bugs before ticket creation.

When to use this skill

  • QA is writing a new bug report
  • User mentions "similar issue" or "might be duplicate"
  • Before creating a new JIRA bug ticket
  • Reviewing backlog for potential duplicates

Workflow

  • Collect the new bug summary and description from QA
  • Search existing JIRA bugs using relevant keywords
  • Fetch full details of candidate duplicate bugs
  • Compare similarity using text comparison logic
  • Return recommendation with confidence score

Instructions

Step 1: Extract Bug Information

Gather from user input:

  • Summary: Brief title of the bug
  • Description: Detailed explanation of the issue
  • Component (optional): Affected module/feature
  • Labels (optional): Existing tags

Step 2: Search Existing Bugs

Construct JQL query to find potential duplicates:

jql
project = * AND (
  summary ~ "keyword1 keyword2" OR
  description ~ "keyword1 keyword2" OR
  text ~ "error message"
) AND status != Closed ORDER BY updated DESC

Search strategies:

  • Extract 3-5 key terms from the new bug summary
  • Include error messages or codes
  • Search within same component if known
  • Limit to last 6 months (adjustable)

Step 3: Compare Similarity

For each candidate bug, compare:

FieldWeightMethod
Summary40%Cosine similarity or keyword overlap
Description40%Semantic similarity, error pattern match
Component10%Exact match bonus
Steps to Reproduce10%Sequence similarity

Similarity scoring:

  • > 85%: High probability duplicate
  • 70-85%: Possible duplicate (flag for review)
  • < 70%: Likely unique

Step 4: Return Recommendation

Response format:

code
Duplicate Check Results:
━━━━━━━━━━━━━━━━━━━━━━━
🔍 Analyzed: [X] existing bugs

✅ HIGH MATCH (>85%):
   • BUG-245: "[Summary]" (92% similar)
     → URL: https://jira.company.com/browse/BUG-245

⚠️  POSSIBLE MATCH (70-85%):
   • BUG-189: "[Summary]" (78% similar)
     → URL: https://jira.company.com/browse/BUG-189

✨ Recommendation: [Create New / Review BUG-245 / Add Comment to BUG-189]

JIRA Integration

API Endpoints needed:

bash
# Search issues
GET /rest/api/2/search?jql={query}&fields=summary,description,status,key

# Get issue details
GET /rest/api/2/issue/{issueKey}

Authentication:

Scripts

Use the helper script for similarity calculation:

bash
python .agent/skills/detecting-duplicate-bugs/scripts/similarity_checker.py \
  --new-bug "bug_summary.txt" \
  --candidates "candidate_bugs.json" \
  --threshold 0.7

Example Usage

code
User: "Login button not working on mobile safari"

→ Search JQL: project = * AND (summary ~ "login button" OR summary ~ "mobile safari")
→ Compare with top 20 results
→ Output: "Similar bug found: BUG-178 (85% match) - Login failure on iOS browsers"

Resources

Configuration

Set in environment or .env file:

code
JIRA_BASE_URL=https://yourcompany.atlassian.net
JIRA_API_TOKEN=your_api_token_here
JIRA_PROJECT_KEYS=PROJ,QA,BUG
SIMILARITY_THRESHOLD=0.75