---
name: deep-research-query
description: This skill should be used when a user wants to build a structured research query interactively before starting deep research. Example queries include "/deep-research query", "리서치 쿼리 만들어줘", "research query builder", "structured research query", "쿼리 빌더".
---

# Deep Research Query Builder

> Transform vague research ideas into structured, actionable research queries.

## Trigger Conditions

```
# Primary triggers
- "/deep-research query"
- "리서치 쿼리 만들어줘"
- "research query builder"
- "structured research query"
- "쿼리 빌더"
```

---

## WHEN TRIGGERED - EXECUTE IMMEDIATELY

### Phase 1: Discovery (REQUIRED)

**EXECUTE:** 아래 JSON으로 AskUserQuestion 도구를 즉시 호출한다. Detect user language and translate all labels.

```json
{
  "questions": [
    {
      "question": "What topic do you want to research?",
      "header": "Topic",
      "options": [
        {"label": "Type your topic", "description": "Enter a specific research topic or question"},
        {"label": "Browse examples", "description": "See example queries for inspiration"}
      ],
      "multiSelect": false
    },
    {
      "question": "What type of research is this?",
      "header": "Type",
      "options": [
        {"label": "Exploratory", "description": "Discover what exists, map the landscape"},
        {"label": "Comparative", "description": "Compare technologies, approaches, or products"},
        {"label": "Analytical", "description": "Deep analysis of causes, effects, and mechanisms"},
        {"label": "Predictive", "description": "Future trends, forecasts, and projections"}
      ],
      "multiSelect": false
    }
  ]
}
```

If user selects "Browse examples", load and present examples from:
`${CLAUDE_PLUGIN_ROOT}/skills/deep-research-main/examples/`

### Phase 2: Detailed Scoping

After getting the core topic, **EXECUTE:** 아래 JSON으로 AskUserQuestion 도구를 즉시 호출한다:

```json
{
  "questions": [
    {
      "question": "What geographic scope?",
      "header": "Geography",
      "options": [
        {"label": "Global", "description": "Worldwide perspective"},
        {"label": "US/North America", "description": "Focus on United States and North America"},
        {"label": "Asia-Pacific", "description": "Focus on APAC region"},
        {"label": "Europe", "description": "Focus on European markets"}
      ],
      "multiSelect": false
    },
    {
      "question": "What source quality do you need?",
      "header": "Quality",
      "options": [
        {"label": "A - Academic only", "description": "Peer-reviewed papers, meta-analyses only"},
        {"label": "B - High quality (Recommended)", "description": "Academic + official docs + established reports"},
        {"label": "C - Moderate", "description": "Include expert opinions and case studies"},
        {"label": "D - Broad coverage", "description": "Include preprints and expert blogs for maximum coverage"}
      ],
      "multiSelect": false
    }
  ]
}
```

### Phase 3: Query Generation

After gathering all inputs, generate:

1. **Structured JSON Query** following the schema at:
   `${CLAUDE_PLUGIN_ROOT}/skills/deep-research-query/references/query_schema.json`

2. **Human-Readable Research Brief** in markdown format

3. **Execution Checklist** for quality verification

### Output Format

#### JSON Query Structure
```json
{
  "task": {
    "title": "[Concise 5-15 word title]",
    "objective": "[Clear statement of research goal]",
    "type": "exploratory|comparative|analytical|predictive|evaluative"
  },
  "context": {
    "background": "[Why this research matters]",
    "audience": "technical|executive|academic|general|policy_maker",
    "use_case": "[How the research will be used]",
    "prior_knowledge": ["assumption 1", "assumption 2"]
  },
  "questions": {
    "primary": "[Main research question]",
    "secondary": ["Sub-question 1", "Sub-question 2", "Sub-question 3"],
    "hypotheses": ["Testable assumption 1"],
    "exclusions": ["Out of scope topic 1"]
  },
  "constraints": {
    "timeframe": {"start": "2024-01-01", "end": "present", "focus_period": "2025-2026"},
    "geography": {"scope": "global", "regions": [], "exclude_regions": []},
    "sources": {
      "required_types": ["peer_reviewed", "industry_reports"],
      "min_quality": "B",
      "language": ["en"]
    }
  },
  "output": {
    "format": "comprehensive_report",
    "length": {"min_words": 3000, "max_words": 10000},
    "structure": {
      "include_executive_summary": true,
      "include_bibliography": true,
      "generate_website": false
    },
    "citation_style": "APA",
    "tone": "professional"
  },
  "keywords": ["keyword1", "keyword2"],
  "special_instructions": []
}
```

#### Human-Readable Brief
```markdown
# Research Brief: [Title]

## Objective
[Clear statement]

## Research Questions
### Primary Question
> [Main question]

### Secondary Questions
1. [Sub-question 1]
2. [Sub-question 2]

## Scope & Constraints
| Dimension | Specification |
|-----------|--------------|
| Timeframe | [period] |
| Geography | [scope] |
| Min Quality | Grade [X] |

## Execution Checklist
- [ ] Primary question fully answered
- [ ] All secondary questions addressed
- [ ] Sources meet quality threshold
- [ ] Citations properly formatted
```

### Phase 4: Confirmation and Handoff

**EXECUTE:** 아래 JSON으로 AskUserQuestion 도구를 즉시 호출한다:

```json
{
  "questions": [
    {
      "question": "Query looks good? Ready to start research?",
      "header": "Action",
      "options": [
        {"label": "Start research now", "description": "Launch deep research with this query immediately"},
        {"label": "Save query only", "description": "Save the JSON query for later use"},
        {"label": "Adjust query", "description": "Modify some parameters before starting"}
      ],
      "multiSelect": false
    }
  ]
}
```

- **Start research now** -> Pass the JSON query to deep-research-main skill
- **Save query only** -> Write the JSON to a file for the user
- **Adjust query** -> Loop back to gather adjustments

---

## Quality Validation Rules

Before finalizing the query, verify:

### Task Validation
- [ ] Title is specific (not generic like "AI Research")
- [ ] Objective is measurable/verifiable
- [ ] Type matches the research approach

### Questions Validation
- [ ] Primary question is answerable (not too broad)
- [ ] Secondary questions support primary (not tangential)
- [ ] Exclusions prevent scope creep

### Constraints Validation
- [ ] Timeframe is realistic for the topic
- [ ] Geography matches topic relevance
- [ ] Source requirements are achievable

### Output Validation
- [ ] Length matches depth requested
- [ ] Format suits the audience

---

## Anti-Patterns to Avoid

### DO NOT Generate:
- Overly broad questions ("What is AI?")
- Unbounded timeframes ("all history")
- Conflicting constraints
- Generic keywords ("technology", "innovation")
- Unmeasurable objectives ("understand everything about...")

### DO Generate:
- Specific, answerable questions ("What is the current adoption rate of AI diagnostic tools in US hospitals?")
- Realistic scope boundaries (2-3 year timeframe for fast-moving fields)
- Concrete success criteria ("Identify top 10 tools by market share")
- Actionable search terms ("AI radiology FDA approved 2024 2025 adoption rate")
- Clear exclusions ("Exclude consumer health apps and administrative AI")

---

## Example Transformation

### Input (Vague)
> "I want to know about AI in healthcare"

### Discovery Process

After Phase 1-2 questions, the vague input transforms into:

| Dimension | Vague | Structured |
|-----------|-------|------------|
| Title | "AI in healthcare" | "AI Diagnostic Systems in Clinical Healthcare: Adoption and Impact 2023-2026" |
| Scope | Everything | US hospitals, diagnostic AI only, 2023-present |
| Exclusions | None | Consumer apps, billing AI, drug discovery |
| Sources | Any | FDA databases, PubMed, Gartner reports |
| Metrics | None | Adoption rate %, sensitivity/specificity, ROI timeline |

### Generated Keywords
From the vague "AI healthcare", generate specific search terms:
```
"AI diagnostics FDA approved 2025"
"clinical AI adoption rate hospital"
"radiology AI sensitivity specificity study"
"healthcare AI ROI implementation cost"
"medical AI regulatory compliance HIPAA"
```

---

## Language Adaptation

All AskUserQuestion labels and descriptions adapt to the user's detected language.

### Korean Input Handling
When user inputs Korean (e.g., "헬스케어 AI 리서치 쿼리 만들어줘"):

- All question labels in Korean
- Geographic options include Korea-relevant choices
- Source options include Korean research databases
- Output includes Korean citation conventions

### Multi-language Keywords
Generate search keywords in both the user's language and English for maximum coverage:
```
Korean input: "AI 의료 진단"
Generated: ["AI 의료 진단 2026", "AI medical diagnostics 2026", "의료 AI 도입 현황", "clinical AI adoption"]
```

---

## Integration with Deep Research

The generated query feeds directly into the deep-research-main skill:

1. Query builder outputs structured JSON
2. User confirms or adjusts
3. If "Start research now" selected, the JSON is passed to deep-research-main
4. Phase 1 (Question Scoping) is skipped since requirements are already defined
5. Research begins from Phase 2 (Retrieval Planning)

Save location for queries: `RESEARCH/queries/{topic}_{timestamp}.json`

---

## References

- Query schema: `${CLAUDE_PLUGIN_ROOT}/skills/deep-research-query/references/query_schema.json`
- Example queries: `${CLAUDE_PLUGIN_ROOT}/skills/deep-research-main/examples/`
