# Query and rewrite Markdown structure with mdq

> Use mdq when an agent needs to target headings, lists, links, or other Markdown structure without falling back to brittle regex edits.

- Skill: `agentskillexchange/query-and-rewrite-markdown-structure-with-mdq` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentskillexchange/query-and-rewrite-markdown-structure-with-mdq`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentskillexchange/query-and-rewrite-markdown-structure-with-mdq/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: agentskillexchange (https://skillmd.com/u/agentskillexchange)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/agentskillexchange/query-and-rewrite-markdown-structure-with-mdq

---


# Query and rewrite Markdown structure with mdq

Use mdq when an agent needs to target headings, lists, links, or other Markdown structure without falling back to brittle regex edits.

## Prerequisites

mdq and Markdown files to inspect or rewrite.

## Installation

Use the upstream install or setup path that matches your environment:
- brew install mdq
- docker pull yshavit/mdq
- cargo install --git https://github.com/yshavit/mdq
- cargo build

Requirements and caveats from upstream:
- reviewers to complete. Enforcing these often requires ugly regexes that are a pain to write and worse to debug. Instead,
- echo 'My [example](https://github.com/yshavit/mdq) markdown' | docker run --rm -i yshavit/mdq '[]()'
- To use a specific release version, use yshavit/mdq:<version>. See [Docker Hub] for available version tags.

Basic usage or getting-started notes:
- For example, GitHub PRs are Markdown documents, and some organizations have specific templates with checklists for all
- you can (for example) ask mdq for all uncompleted tasks:
- [!tip]

- Source: https://github.com/yshavit/mdq
- Extracted from upstream docs: https://raw.githubusercontent.com/yshavit/mdq/HEAD/README.md

## Documentation

- https://github.com/yshavit/mdq

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/query-and-rewrite-markdown-structure-with-mdq/)

