RAG Knowledge Style Guide

Purpose

This document defines the canonical structure and style for all knowledge, pattern, and code-example files in the RAG library. New content should follow this guide by default.

Frontmatter Standard

All content files must start with YAML frontmatter:

---
layout: default
title: Human-readable Title
description: One-sentence summary in plain English
permalink: /rag/<folder>/<file>.html
level: Beginner | Intermediate | Advanced
tags:
  - primary-domain
  - secondary-domain
last_reviewed: 2025-01-01
---

Summary Quality Rules

CRITICAL: Summaries must be clean and meaningful:

Examples:

Standard Section Order (Knowledge / Pattern Files)

All non-index knowledge and pattern files should use this section order:

  1. # Title (matches frontmatter title)
  2. > **Based on Real Implementation Experience** (optional but recommended)
  3. ## Overview
  4. ## Prerequisites
  5. ## When to Use
  6. ## Core Concepts
  7. ## Patterns and Examples (or domain-appropriate main section)
  8. ## Edge Cases and Limitations
  9. ## Related Patterns
  10. ## Q&A

Overview

Prerequisites

Use bullets grouped as:

When to Use

Clearly distinguish when to choose this pattern/approach vs. alternatives. Use:

Core Concepts

Define key ideas and vocabulary. Prefer:

Patterns and Examples

Organize by:

Edge Cases and Limitations

Explicitly list:

Use a consistent bullet style:

Ensure bidirectional links where it makes sense.

Q&A

Use the standard format:

## Q&A

### Q: Question?

**A**: Clear, direct answer in 2–5 sentences, using bold for key terms and patterns.

Target 8–10 questions for primary pattern files, 5–8 for smaller topics.

Code Example Files Structure

Code-example files should follow this order:

  1. Frontmatter (as above, with tags including code-examples and language)
  2. # Title
  3. ## Overview
  4. ## When to Use
  5. ## Example 1: Name
  6. ## Example 2: Name (etc.)
  7. ## Testing Considerations
  8. ## Related Patterns

Within each example:

Voice and Tone

Terminology

Formatting Rules

RAG Metadata Requirements

For files to be properly indexed in rag-library.json, ensure:

Required Metadata Fields

Each file entry in rag-library.json should include:

Optional RAG Fields

Summary Extraction Rules

When generating summaries for rag-index.md or rag-library.json:

  1. Extract from frontmatter description field - this is the canonical summary
  2. If frontmatter description is missing or placeholder, extract first 1-2 sentences from Overview section
  3. Clean any front-matter YAML that may have leaked into summaries
  4. Ensure summary is 1-2 sentences, present tense, describes value and when to use
  5. Never use placeholder text - always provide meaningful description