# Query Refinement

> Refine a query with domain, filetype, exact-phrase, and term-exclusion constraints to cut noise. Use when results are broad, stale, or off-topic.

- Skill: `samraddhashrivastavatech/query-refinement` (Agent Skill)
- Install (CLI): `npx skillmds@latest add samraddhashrivastavatech/query-refinement`
- Raw SKILL.md: https://api.skillmd.com/api/skills/samraddhashrivastavatech/query-refinement/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Research & Search
- Author: SAMRADDHASHRIVASTAVATECH (https://skillmd.com/u/samraddhashrivastavatech)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/samraddhashrivastavatech/query-refinement

---


# Query refinement

Tighten a query so retrieval stays on target: constrain domain and filetype,
force exact phrases, and eject noise terms.

## When to use

- Results are too broad or polluted by unrelated terms.
- You know the target domain or format and want to express it.
- A phrase must match exactly (quotes) rather than loosely.

## Tools used

- `refine_query` — from a `query`, optionally set `domain`, `filetype`,
  `exact` (wrap in quotes), and `remove_terms`.

## Workflow

1. State the goal and the noise you saw.
2. `refine_query` with the constraints.
3. `validate_search_query` the result, then run it.
4. Compare hit quality against the unrefined version; keep what improved it.

## Input schema

```json
{ "query": "str", "domain": "str", "filetype": "str", "exact": "bool", "remove_terms": "list[str]" }
```

## Output schema

```json
{ "refined": "str", "log": "list[str]" }
```

## Security

Constraints shrink the haystack but do not certify needles; weigh hits by
source quality, not by how cleanly the query matched.

## Related skills

`query-builder`, `query-expansion`, `search-operators`, `web-search`
