Back to Claude Scientific Skills

Markdown Style Guide

scientific-skills/markdown-mermaid-writing/references/markdown_style_guide.md

2.38.034.3 KB
Original Source
<!-- Source: https://github.com/SuperiorByteWorks-LLC/agent-project | License: Apache-2.0 | Author: Clayton Young / Superior Byte Works, LLC (Boreal Bytes) -->

Markdown Style Guide

For AI agents: Read this file for all core formatting rules. When creating any markdown document, follow these conventions for consistent, professional output. When a template exists for your document type, start from it โ€” see Templates.

For humans: This guide ensures every markdown document in your project is clean, scannable, well-cited, and renders beautifully on GitHub. Reference it from your AGENTS.md or contributing guide.

Target platform: GitHub Markdown (Issues, PRs, Discussions, Wikis, .md files) Design goal: Clear, professional documents that communicate effectively through consistent structure, meaningful formatting, proper citations, and strategic use of diagrams.


Quick Start for Agents

  1. Identify the document type โ†’ Check if a template exists
  2. Structure first โ†’ Heading hierarchy, then content
  3. Apply formatting from this guide โ†’ Headings, text, lists, tables, images, links
  4. Add citations โ†’ Footnote references for all claims and sources
  5. Consider diagrams โ†’ Would a Mermaid diagram communicate this better than text?
  6. Add collapsible sections โ†’ For supplementary detail, speaker notes, or lengthy context
  7. Verify โ†’ Run through the quality checklist

Core Principles

#PrincipleRule
1Answer before they askAnticipate reader questions and address them inline. A great document resolves doubts as they form โ€” the reader finishes with no lingering "but what about...?"
2Scannable firstReaders skim before they read. Use headings, bold, and lists to make the structure visible at a glance.
3Cite everythingEvery claim, statistic, or external reference gets a footnote citation with a full URL. No orphan claims.
4Diagrams over walls of textIf a concept involves flow, relationships, or structure, use a Mermaid diagram alongside the text.
5Generous with informationDon't hide the details โ€” surface them. Use collapsible sections for depth without clutter, but never omit information because "they probably don't need it." If it's relevant, include it.
6Consistent structureSame heading hierarchy, same formatting patterns, same emoji placement across every document.
7One idea per sectionEach heading should cover one topic. If you're covering two ideas, split into two headings.
8Professional but approachableClean formatting, no clutter, no decorative noise โ€” but not stiff or academic. Write like a senior engineer explains to a colleague.

๐Ÿ—‚๏ธ Everything is Code

Everything is code. PRs, issues, kanban boards โ€” they're all markdown files in your repo, not data trapped in a platform's database.

Why this matters

  • Portable โ€” GitHub โ†’ GitLab โ†’ Gitea โ†’ anywhere. Your project management data isn't locked into any vendor. Switch platforms and your issues, PR records, and boards come with you โ€” they're just files.
  • AI-native โ€” Agents can read every issue, PR record, and kanban board with local file access. No API tokens, no rate limits, no platform-specific queries. grep beats gh api every time.
  • Auditable โ€” Project management changes go through the same PR review process as code changes. Every board update, every issue status change โ€” it's all in git history with attribution and timestamps.

How it works

WhatWhere it livesWhat GitHub does
Pull requestsdocs/project/pr/pr-NNNNNNNN-short-description.mdGitHub PR is a thin pointer โ€” humans go there to comment on diffs, approve, and watch CI. The record of what changed, why, and what was learned lives in the file.
Issuesdocs/project/issues/issue-NNNNNNNN-short-description.mdGitHub Issues is a notification and comment layer. Bug reports, feature requests, investigation logs, and resolutions live in the file.
Kanban boardsdocs/project/kanban/{scope}-{id}-short-description.mdNo external board tool needed. Modify the board in your branch, merge it with your PR. The board evolves with the codebase.
Decision recordsdocs/decisions/NNN-{slug}.mdNot tracked in GitHub at all โ€” purely repo-native.

The rule

๐Ÿ“Œ Don't capture information in GitHub's UI that should be captured in a file. Approve PRs in GitHub. Watch CI in GitHub. Comment in GitHub. But the actual content โ€” the description, the investigation, the decision โ€” lives in a committed file. If it's worth writing down, it's worth committing.

Templates for tracked documents

See File conventions for directory structure and naming.


Document Structure

Title and metadata

Every document starts with exactly one H1 title, followed by a brief context line and a separator:

markdown
# Document Title Here

_Brief context โ€” project name, date, or purpose in one line_

---
  • One H1 per document โ€” never more
  • Context line in italics โ€” what this document is, when, and for whom
  • Horizontal rule separates metadata from content

Heading hierarchy

LevelSyntaxUseMax per document
H1# TitleDocument title1 (exactly one)
H2## SectionMajor sections4โ€“10
H3### TopicTopics within a section2โ€“5 per H2
H4#### SubtopicSubtopics when needed2โ€“4 per H3
H5+Never useโ€”0

Rules:

  • Never skip levels โ€” don't jump from H2 to H4
  • Emoji in H2 headings โ€” one emoji per H2, at the start: ## ๐Ÿ“‹ Project Overview
  • No emoji in H3/H4 โ€” keep sub-headings clean
  • Sentence case โ€” ## ๐Ÿ“‹ Project overview not ## ๐Ÿ“‹ Project Overview (exception: proper nouns)
  • Descriptive headings โ€” ### Authentication flow not ### Details

Text Formatting

Bold, italic, code

FormatSyntaxWhen to useExample
Bold**text**Key terms, important concepts, emphasisPrimary database handles writes
Italic*text*Definitions, titles, subtle emphasisThe process is called sharding
Code`text`Technical terms, commands, file names, valuesRun npm install to install
Strike~~text~~Deprecated content, correctionsOld approach replaced by v2

Rules:

  • Bold sparingly โ€” if everything is bold, nothing is. Max 2โ€“3 bold terms per paragraph.
  • Don't combine bold and italic (***text***) โ€” pick one
  • Code for anything technical โ€” file names (README.md), commands (git push), config values (true), environment variables (NODE_ENV)
  • Never bold entire sentences โ€” bold the key word(s) within the sentence

Blockquotes

Use blockquotes for definitions, callouts, and important notes:

markdown
> **Definition:** A _load balancer_ distributes incoming network traffic
> across multiple servers to ensure no single server bears too much demand.

For warnings and callouts:

markdown
> โš ๏ธ **Warning:** This operation is destructive and cannot be undone.

> ๐Ÿ’ก **Tip:** Use `--dry-run` to preview changes before applying.

> ๐Ÿ“Œ **Note:** This requires admin permissions on the repository.
  • Prefix with emoji + bold label for typed callouts
  • Keep blockquotes to 1โ€“3 lines
  • Don't nest blockquotes (>>)

Lists

When to use each type

List typeSyntaxUse when
Bullet- itemItems have no inherent order
Numbered1. stepSteps must happen in sequence
Checkbox- [ ] itemTracking completion (agendas, checklists)

Formatting rules

  • Consistent indentation โ€” 2 spaces for sub-items (some renderers use 4; pick one, stick with it)
  • Parallel structure โ€” every item in a list should have the same grammatical form
  • No period at end unless items are full sentences
  • Keep items concise โ€” if a bullet needs a paragraph, it should be a sub-section instead
  • Max nesting depth: 2 levels โ€” if you need a third level, restructure
markdown
โœ… Good โ€” parallel structure, concise:

- Configure the database connection
- Run the migration scripts
- Verify the schema changes

โŒ Bad โ€” mixed structure, verbose:

- You need to configure the database
- Migration scripts
- After that, you should verify that the schema looks correct

markdown
See the [Mermaid Style Guide](mermaid_style_guide.md) for diagram conventions.
  • Meaningful link text โ€” [Mermaid Style Guide] not [click here] or [link]
  • Relative paths for internal links โ€” [Guide](./README.md) not absolute URLs
  • Full URLs for external links โ€” always https://

Footnote citations

Every claim, statistic, or reference to external work MUST have a footnote citation. This is non-negotiable for credibility.

markdown
Markdown was created by John Gruber in 2004 as a lightweight
markup language designed for readability[^1]. GitHub adopted
Mermaid diagram support in February 2022[^2].

[^1]: Gruber, J. (2004). "Markdown." _Daring Fireball_. https://daringfireball.net/projects/markdown/

[^2]: GitHub Blog. (2022). "Include diagrams in your Markdown files with Mermaid." https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/

Citation format:

[^N]: Author/Org. (Year). "Title." *Publication*. https://full-url

Rules:

  • Number sequentially โ€” [^1], [^2], [^3] in order of appearance
  • Full URL always included โ€” the reader must be able to reach the source
  • Group all footnotes at the document bottom โ€” under a ## References section or at the very end
  • Every external claim needs one โ€” statistics, quotes, methodologies, tools mentioned
  • Internal project links don't need footnotes โ€” use inline links instead

When the same URL appears multiple times, use reference-style links to keep the text clean:

markdown
The [official docs][mermaid-docs] cover all diagram types.
See [Mermaid documentation][mermaid-docs] for the full syntax.

[mermaid-docs]: https://mermaid.js.org/ 'Mermaid Documentation'

Images and Figures

Placement and syntax

markdown
![Descriptive alt text for screen readers](images/architecture_overview.png)
_Figure 1: System architecture showing the three-tier deployment model_

Rules:

  • Inline with content โ€” place images where they're relevant, not in a separate "Images" section
  • Descriptive alt text โ€” ![Three-tier architecture diagram] not ![image] or ![screenshot]
  • Italic caption below โ€” *Figure N: What this image shows*
  • Number figures sequentially โ€” Figure 1, Figure 2, etc. if multiple images
  • Relative paths โ€” images/file.png not absolute paths
  • Reasonable file sizes โ€” compress PNGs, use SVG where possible

Image naming convention

{document-slug}_{description}.{ext}

Examples:
  auth_flow_overview.png
  deployment_architecture.svg
  api_response_example.png

When NOT to use an image

If the content could be expressed as a Mermaid diagram, prefer that over a static image:

ScenarioUse
Architecture diagramMermaid flowchart or architecture-beta
Sequence/interactionMermaid sequenceDiagram
Data modelMermaid erDiagram
TimelineMermaid timeline or gantt
Screenshot of UIImage (Mermaid can't do this)
Photo / real-world imageImage
Complex data visualizationImage or Mermaid xychart-beta

See the Mermaid Style Guide for diagram type selection and styling.


Tables

When to use tables

  • Structured comparisons โ€” features, options, tradeoffs
  • Reference data โ€” configuration values, API parameters, status codes
  • Schedules and matrices โ€” timelines, responsibility assignments

When NOT to use tables

  • Narrative content โ€” use paragraphs instead
  • Simple lists โ€” use bullet points
  • More than 5 columns โ€” becomes unreadable on mobile; restructure

Formatting

markdown
| Feature | Free Tier | Pro Tier | Enterprise |
| ------- | --------- | -------- | ---------- |
| Users   | 5         | 50       | Unlimited  |
| Storage | 1 GB      | 100 GB   | Custom     |
| Support | Community | Email    | Dedicated  |

Rules:

  • Header row always โ€” no headerless tables
  • Left-align text columns โ€” |---| (default)
  • Right-align number columns โ€” |---:| when appropriate
  • Concise cell content โ€” 1โ€“5 words per cell. If you need more, it's not a table problem
  • Bold key column โ€” the first column or the column the reader scans first
  • Consistent formatting within columns โ€” don't mix sentences and fragments

Code Blocks

Inline code

Use backticks for technical terms within prose:

markdown
Run `git status` to check for uncommitted changes.
The `NODE_ENV` variable controls the runtime environment.

Fenced code blocks

Always specify the language for syntax highlighting:

markdown
```python
def calculate_average(values: list[float]) -> float:
    """Return the arithmetic mean of a list of values."""
    return sum(values) / len(values)
```

Rules:

  • Always include language identifier โ€” ```python, ```bash, ```json, etc.
  • Use ```text for plain output โ€” not ``` with no language
  • Keep blocks focused โ€” show the relevant snippet, not the entire file
  • Add a comment if context needed โ€” # Configure the database connection at the top of the block

Collapsible Sections

Use HTML <details> for supplementary content that shouldn't clutter the main flow โ€” speaker notes, implementation details, verbose logs, or optional deep-dives.

markdown
<details>
<summary><strong>๐Ÿ’ฌ Speaker Notes</strong></summary>

- Key talking point one
- Transition to next topic
- **Bold** emphasis works inside details
- [Links](https://example.com) work too

</details>

---

Rules:

  • Collapsed by default โ€” the <details> tag collapses automatically
  • Descriptive summary โ€” <strong>๐Ÿ’ฌ Speaker Notes</strong> or <strong>๐Ÿ“‹ Implementation Details</strong>
  • Blank line after <summary> tag โ€” required for markdown to render inside the block
  • ALWAYS follow with --- โ€” horizontal rule after every </details> for visual separation
  • Any markdown works inside โ€” bullets, bold, links, code blocks, tables

Common collapsible patterns

Summary labelUse for
๐Ÿ’ฌ Speaker NotesPresentation talking points, timing, transitions
๐Ÿ“‹ DetailsExtended explanation, verbose context
๐Ÿ”ง ImplementationTechnical details, code samples, config
๐Ÿ“Š Raw DataFull output, logs, data tables
๐Ÿ’ก BackgroundContext that helps but isn't essential

Horizontal Rules

Use --- (three hyphens) for visual separation:

markdown
---

When to use:

  • After every </details> block โ€” mandatory, creates clear separation
  • After title/metadata โ€” separates document header from content
  • Between major sections โ€” when an H2 heading alone doesn't create enough visual break
  • Before footnotes/references โ€” separates content from citation list

When NOT to use:

  • Between every paragraph (too busy)
  • Between H3 sub-sections within the same H2 (use whitespace instead)

Approved Emoji Set

One emoji per H2 heading, at the start. Use sparingly in body text for callouts and emphasis only.

Section headings

EmojiUse for
๐Ÿ“‹Overview, summary, agenda, checklist
๐ŸŽฏGoals, objectives, outcomes, targets
๐Ÿ“šContent, documentation, main body
๐Ÿ”—Resources, references, links
๐Ÿ“Agenda, navigation, current position
๐Ÿ Housekeeping, logistics, announcements
โœ๏ธTasks, assignments, action items

Status and outcomes

EmojiMeaning
โœ…Success, complete, correct, approved
โŒFailure, incorrect, avoid, rejected
โš ๏ธWarning, caution, important notice
๐Ÿ’กTip, insight, idea, best practice
๐Ÿ“ŒImportant, key point, remember
๐ŸšซProhibited, do not, blocked

Technical and process

EmojiMeaning
โš™๏ธConfiguration, settings, process
๐Ÿ”งTools, utilities, setup
๐Ÿ”Analysis, investigation, review
๐Ÿ“ŠData, metrics, analytics
๐Ÿ“ˆGrowth, trends, improvement
๐Ÿ”„Cycle, refresh, iteration
โšกPerformance, speed, quick action
๐Ÿ”Security, authentication, privacy
๐ŸŒWeb, API, network, global
๐Ÿ’พStorage, database, persistence
๐Ÿ“ฆPackage, artifact, deployment

People and collaboration

EmojiMeaning
๐Ÿ‘คUser, person, individual
๐Ÿ‘ฅTeam, group, collaboration
๐Ÿ’ฌDiscussion, comments, speaker notes
๐ŸŽ“Learning, education, knowledge
๐Ÿค”Question, consideration, reflection

Emoji rules

  1. One per H2 heading at the start โ€” ## ๐Ÿ“‹ Overview
  2. None in H3/H4 โ€” keep sub-headings clean
  3. Sparingly in body text โ€” for callouts (> โš ๏ธ **Warning:**) and key markers only
  4. Never in: titles (H1), code blocks, link text, table data cells
  5. No decorative emoji โ€” ๐ŸŽ‰ ๐Ÿ’ฏ ๐Ÿ”ฅ ๐ŸŽŠ ๐Ÿ’ฅ โœจ add noise, not meaning
  6. Consistency โ€” same emoji = same meaning across all documents in the project

Mermaid Diagram Integration

Whenever content describes flow, structure, relationships, or processes, consider whether a Mermaid diagram would communicate it better than prose alone. Diagrams and text together are more effective than either alone.

When to add a diagram

Any time your text describes flow, structure, relationships, timing, or comparisons, there's a Mermaid diagram that communicates it better. Scan the table below to identify the right type, then follow this workflow:

  1. Read the Mermaid Style Guide first โ€” emoji, color palette, accessibility, complexity management
  2. Then open the specific type file โ€” exemplar, tips, template, complex example
Your content describes...Add a...Type file
Steps in a process, workflow, decision logicFlowchartflowchart.md
Who talks to whom and when (API calls, messages)Sequence diagramsequence.md
Class hierarchy, type relationships, interfacesClass diagramclass.md
Status transitions, entity lifecycle, state machineState diagramstate.md
Database schema, data model, entity relationshipsER diagramer.md
Project timeline, roadmap, task dependenciesGantt chartgantt.md
Parts of a whole, proportions, distributionPie chartpie.md
Git branching strategy, merge/release flowGit Graphgit_graph.md
Concept hierarchy, brainstorm, topic mapMindmapmindmap.md
Chronological events, milestones, historyTimelinetimeline.md
User experience, satisfaction scores, journeyUser Journeyuser_journey.md
Two-axis comparison, prioritization matrixQuadrant chartquadrant.md
Requirements traceability, compliance mappingRequirement diagramrequirement.md
System architecture at varying zoom levelsC4 diagramc4.md
Flow magnitude, resource distribution, budgetsSankey diagramsankey.md
Numeric trends, bar charts, line chartsXY Chartxy_chart.md
Component layout, spatial arrangement, layersBlock diagramblock.md
Work item tracking, status board, task columnsKanban boardkanban.md
Binary protocol layout, data packet formatPacket diagrampacket.md
Cloud infrastructure, service topology, networkingArchitecture diagramarchitecture.md
Multi-dimensional comparison, skills, radar analysisRadar chartradar.md
Hierarchical proportions, budget breakdownTreemaptreemap.md

๐Ÿ’ก Pick the right type, not the easy type. Don't default to flowcharts for everything โ€” a timeline is better than a flowchart for chronological events, a sequence diagram is better for service interactions, an ER diagram is better for data models. Scan the table above and match your content to the most specific type. If you catch yourself writing a paragraph that describes a visual concept, stop and diagram it.

How to integrate

Place the diagram inline with the related text, not in a separate section:

markdown
### Authentication Flow

The login process validates credentials, checks MFA status,
and issues session tokens. Failed attempts are logged for
security monitoring.

โ€Ž```mermaid
sequenceDiagram
accTitle: Login Authentication Flow
accDescr: User login sequence through API and auth service

    participant U as ๐Ÿ‘ค User
    participant A as ๐ŸŒ API
    participant S as ๐Ÿ” Auth Service

    U->>A: POST /login
    A->>S: Validate credentials
    S-->>A: โœ… Token issued
    A-->>U: 200 OK + session

โ€Ž```

The token expires after 24 hours. See [Authentication flow](#authentication-flow)
for refresh token details.

Always follow the Mermaid Style Guide for diagram styling โ€” emoji, color classes, accessibility (accTitle/accDescr), and type-specific conventions.


Whitespace and Spacing

  • Blank line between paragraphs โ€” always
  • Blank line before and after headings โ€” always
  • Blank line before and after code blocks โ€” always
  • Blank line before and after blockquotes โ€” always
  • No blank line between list items โ€” keep lists tight
  • No trailing whitespace โ€” clean line endings
  • One blank line at end of file โ€” standard convention
  • No more than one consecutive blank line โ€” two blank lines = too much space

Quality Checklist

Structure

  • Exactly one H1 title
  • Heading hierarchy is correct (H1 โ†’ H2 โ†’ H3 โ†’ H4, no skips)
  • Each H2 has exactly one emoji at the start
  • H3 and H4 have no emoji
  • Horizontal rules after title metadata and after every </details> block

Content

  • Every external claim has a footnote citation
  • All footnotes have full URLs
  • All links tested and working
  • Meaningful link text (no "click here")
  • Bold used for key terms, not entire sentences
  • Code formatting for all technical terms

Visual elements

  • Images have descriptive alt text
  • Images have italic figure captions
  • Images placed inline with related content (not in separate section)
  • Tables have header rows and consistent formatting
  • Mermaid diagrams considered where applicable (with accTitle/accDescr)

Collapsible sections

  • <details> blocks have descriptive <summary> labels
  • Blank line after <summary> tag (for markdown rendering)
  • Horizontal rule --- after every </details> block
  • Content inside collapses renders correctly

Polish

  • No spelling or grammar errors
  • Consistent whitespace (no trailing spaces, no double blanks)
  • Parallel grammatical structure in lists
  • Renders correctly in GitHub light and dark mode

Templates

Templates provide pre-built structures for common document types. Copy the template, fill in your content, and follow this style guide for formatting. Every template enforces the principles above โ€” citations, diagrams, collapsible depth, and self-answering structure.

Document typeTemplateBest for
Presentation / briefingpresentation.mdSlide-deck-style documents with speaker notes, structured sections, and visual flow
Research paper / analysisresearch_paper.mdData-driven analysis, literature reviews, methodology + findings with heavy citations
Project documentationproject_documentation.mdSoftware/product docs โ€” architecture, getting started, API reference, contribution guide
Decision record (ADR/RFC)decision_record.mdRecording why a decision was made โ€” context, options evaluated, outcome, consequences
How-to / tutorial guidehow_to_guide.mdStep-by-step instructions with prerequisites, verification steps, and troubleshooting
Status report / executive briefstatus_report.mdProgress updates, risk summaries, decisions needed โ€” for leadership and stakeholders
Pull request recordpull_request.mdPR documentation with change inventory, testing evidence, rollback plan, and review notes
Issue recordissue.mdBug reports (reproduction steps, root cause) and feature requests (acceptance criteria, user stories)
Kanban boardkanban.mdSprint/release/project work tracking with visual board, WIP limits, metrics, and blocked items

File conventions for tracked documents

Some templates produce documents that accumulate over time. Use these directory conventions:

Document typeDirectoryNaming patternExample
Pull requestsdocs/project/pr/pr-NNNNNNNN-short-description.mddocs/project/pr/pr-00000123-fix-auth-timeout.md
Issuesdocs/project/issues/issue-NNNNNNNN-short-description.mddocs/project/issues/issue-00000456-add-export-filter.md
Kanban boardsdocs/project/kanban/{scope}-{identifier}-short-description.mddocs/project/kanban/sprint-2026-w07-agentic-template-modernization.md
Decision recordsdocs/decisions/NNN-{slug}.mddocs/decisions/001-use-postgresql.md
Status reportsdocs/status/status-{date}.mddocs/status/status-2026-02-14.md

Choosing a template

  • Presenting to people? โ†’ Presentation
  • Publishing analysis or research? โ†’ Research paper
  • Documenting a codebase or product? โ†’ Project documentation
  • Recording why you chose X over Y? โ†’ Decision record
  • Teaching someone how to do something? โ†’ How-to guide
  • Updating leadership on progress? โ†’ Status report
  • Documenting a PR for posterity? โ†’ Pull request record
  • Tracking a bug or requesting a feature? โ†’ Issue record
  • Managing work items for a sprint or project? โ†’ Kanban board
  • None of these fit? โ†’ Start from this style guide's rules directly โ€” no template required

Common Mistakes

โŒ Multiple emoji per heading

markdown
## ๐Ÿ“š๐Ÿ“Š๐Ÿ“ˆ Content Topics โ† Too many

โœ… Fix: One emoji per H2

markdown
## ๐Ÿ“š Content topics

โŒ Missing citations

markdown
Studies show 73% of developers prefer Markdown. โ† Where's the source?

โœ… Fix: Add footnote

markdown
Studies show 73% of developers prefer Markdown[^1].

[^1]: Stack Overflow. (2024). "Developer Survey Results." https://survey.stackoverflow.co/2024

โŒ Wall of text without structure

markdown
The system handles authentication by first checking the JWT token
validity, then verifying the user exists in the database, then
checking their permissions against the requested resource...

โœ… Fix: Use a list, heading, or diagram

markdown
### Authentication flow

1. Validate JWT token signature and expiration
2. Verify user exists in the database
3. Check user permissions against the requested resource

โŒ Images in a separate section

markdown
## Content

[paragraphs of text]

## Screenshots

[all images grouped here] โ† Disconnected from context

โœ… Fix: Place images inline where relevant

โŒ No horizontal rule after collapsible sections

markdown
</details>
### Next Topic  โ† Runs together visually

โœ… Fix: Always add --- after </details>

markdown
</details>

---

### Next topic โ† Clear separation

Resources