Builds on concepts from Introduction to Markdown.
Markdown files serve a dual purpose when working with AI coding assistants: they're human-readable documentation AND machine-parseable instructions. This tutorial explores the design considerations most users overlook.
When you write a README.md, you think about human readers. When you write a .github/copilot-instructions.md, you're writing for an AI that will interpret your instructions. But here's what many users miss: the AI reads your markdown differently than humans do.
Humans scan for:
- Visual hierarchy (headers, bold text)
- Readable prose
- Formatted code blocks
AI assistants parse for:
- Semantic meaning
- Instruction priority
- Contextual relationships
- Conditional logic
Understanding this difference changes how you structure your files.
## Variable and function names
Use descriptive camelCase names like `calculateTotal` not `calc` or `x`.
## JavaScript files
Use `const` instead of `let` when the value won't change.The AI understands that naming advice applies to variables, not file organization. Headers create semantic boundaries.
Before committing your code:
- Run it locally to make sure it works
- Check the browser console for errors
- Make sure you saved all your filesThe AI interprets this as a checklist of required steps, not prose to summarize.
You **must** run linting before commits.
You _should_ add tests for new functions.
You may skip documentation for internal utilities.The emphasis patterns (must/should/may) map to RFC 2119-style requirement levels. I parse these as hard rules, recommendations, and permissions respectively.
Always use this format:
```javascript
function greetUser(name) {
return `Hello, ${name}!`;
}
```The AI treats code blocks as exact templates to follow, not suggestions to adapt.
Plain markdown handles 90% of use cases. XML tags become useful for:
# Project setup
Follow these steps to configure your environment.
<instructions>
When the user asks about setup, remind them to run `npm install` first.
</instructions>The <instructions> block won't render in GitHub or documentation viewers, but I read and follow it. This lets you embed AI-specific guidance without cluttering human-readable docs.
<critical>
Never commit .env files to version control.
</critical>
<optional>
Consider adding a .env.example file for reference.
</optional>While bold text works for emphasis, XML tags create unambiguous priority levels I can reference consistently.
<note title="Project structure">
JavaScript files go in the src/ folder. Images go in assets/.
</note>
<note title="Naming conventions">
Use camelCase for variables and functions. Use kebab-case for file names.
</note>The title attribute lets the AI index and retrieve specific notes by topic.
<when language="typescript">
Always define explicit return types for public functions.
</when>
<when language="javascript">
Use JSDoc comments for type hints.
</when>I interpret these as context-dependent rules, applying the relevant one based on what we're working on.
## Rules
<rules>
- Use descriptive variable names, not single letters
- Add comments to explain complex logic
- Keep functions short and focused on one task
</rules>Wrapping rules in a dedicated tag reinforces that these are hard constraints.
<context>
This is a beginner JavaScript project.
Code goes in the src/ folder, images in assets/.
</context>
<instructions>
When creating new files, follow the existing naming pattern.
Always update the README when adding new features.
</instructions>Separating background information from actionable instructions helps me distinguish "what exists" from "what to do."
When writing commit messages, follow this format:
<example>
<input>I added a function that calculates the total price</input>
<output>Add calculateTotal function for shopping cart</output>
</example>Showing input/output pairs trains me on your preferred transformations.
<rules>
<critical>
<database>
<read-only>
Never modify production data.
</read-only>
</database>
</critical>
</rules>Deeply nested tags add complexity without improving my understanding. Flat structures work better:
<critical>
Database rule: Never modify production data.
</critical><paragraph>
<sentence>This is how I write documentation.</sentence>
<sentence>Every sentence gets a tag.</sentence>
</paragraph>This adds noise without semantic value. Use XML tags sparingly for structural purposes, not as a replacement for prose.
I don't validate XML schemas or execute XPath queries. A tag like <very-important-please-read> works because I interpret its meaning, not because it's in a predefined list.
Plain markdown with clear headers is sufficient:
# Project instructions
## What to always do
- Run your code locally before pushing
- Check the browser console for errors
## What to never do
- Commit passwords or API keys
- Push broken code to the main branchAdd XML tags where they provide clarity:
# Project instructions
<critical>
Never expose API keys in client-side code.
</critical>
## Code style
Follow the existing patterns in the codebase.
<when working-on="functions">
Keep each function focused on one task.
</when>
<when working-on="readme">
Include a description, setup instructions, and usage examples.
</when>Use the hybrid approach freely:
<context>
These instructions are read by GitHub Copilot when working in this project.
</context>
# Project instructions
## General rules
<rules>
- Prefer editing existing files over creating new ones
- Ask before creating Python files
- Use sentence case for markdown headers
</rules>
## Project-specific
<instructions>
This is an educational repository. Explain changes thoroughly.
</instructions>- Markdown structure carries meaning - Headers scope rules, lists enumerate steps, emphasis signals priority
- XML tags are invisible to humans - Use them for AI-specific instructions that shouldn't clutter documentation
- Tags work by semantic interpretation - I read meaning, not formal schemas
- Simplicity wins - Plain markdown handles most cases; add XML only when it provides clear value
- The dual-audience problem is real - Design files knowing both humans and AI will read them differently
The best AI instruction files balance human readability with machine parseability. Start simple, add structure only where it solves a problem.