# Skill: Implement HTTP Markdown Content Negotiation

> **Standard:** HTTP Content Negotiation
> **Category:** CONTENT_ACCESSIBILITY
> **Classification:** SPECIFICATION_AND_GUIDE
> **Author:** TinyCTO Architecture Guild (https://tinycto.tv)

## Overview
Support 'Accept: text/markdown' content negotiation so AI agents receive high-density token-efficient Markdown representations of web pages.

## Learning Objectives
1. Detect 'Accept: text/markdown' in request headers.
2. Transform page AST into structured Markdown with code blocks and metadata.
3. Set 'Vary: Accept' and 'Content-Type: text/markdown; charset=utf-8' on responses.

## Prerequisites
- Server-side rendering engine or Next.js route middleware

## Implementation & Execution Guide

### Step 1: Inspect Accept Header & Return Markdown
Serve clean markdown with frontmatter to agents.

```http
if (req.headers.get("accept")?.includes("text/markdown")) {
  return new Response(generateMarkdownForPage(data), {
    headers: {
      "Content-Type": "text/markdown; charset=utf-8",
      "Vary": "Accept"
    }
  });
}
```

## Architectural Takeaway
Serving clean Markdown reduces agent token consumption by 70-80% compared to raw HTML scraping.
