---
title: "Query and rewrite Markdown structure with mdq"
description: "Use mdq when an agent needs to target headings, lists, links, or other Markdown structure without falling back to brittle regex edits."
verification: "listed"
source: "https://github.com/yshavit/mdq"
author: "yshavit"
publisher_type: "individual"
category:
  - "Data Extraction & Transformation"
framework:
  - "Multi-Framework"
tool_ecosystem:
  github_repo: "yshavit/mdq"
  github_stars: 1708
---

# 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

Choose whichever fits your setup:

1. Copy this skill folder into your local skills directory.
2. Clone the repo and symlink or copy the skill into your agent workspace.
3. Add the repo as a git submodule if you manage shared skills centrally.
4. Install it through your internal provisioning or packaging workflow.
5. Download the folder directly from GitHub and place it in your skills collection.

Install command or upstream instructions:

```
Install mdq from the project release or package instructions, then run its query and rewrite commands against Markdown files during docs cleanup, migration, or audit work.
```

## Documentation

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

## Source

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