three-tier-docs

Use after code changes. Syncs CLAUDE.md, CONTEXT.md, and docs/ai-context/ automatically.

16 stars

Best use case

three-tier-docs is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use after code changes. Syncs CLAUDE.md, CONTEXT.md, and docs/ai-context/ automatically.

Teams using three-tier-docs should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/three-tier-docs/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/documentation/three-tier-docs/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/three-tier-docs/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How three-tier-docs Compares

Feature / Agentthree-tier-docsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use after code changes. Syncs CLAUDE.md, CONTEXT.md, and docs/ai-context/ automatically.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# SKILL: Three-Tier Documentation

> **Purpose**: Auto-sync documentation across 3 tiers (CLAUDE.md → CONTEXT.md → docs/)
> **Target**: Documenter agent after implementation

---

## Quick Start

### When to Use This Skill
- After implementing features
- After refactoring code
- After creating new components
- Run via `/document` command

### Quick Reference
```bash
# Tier 1: Sync 3 Entry Point documents
# - CLAUDE.md (≤200 lines)
# - docs/ai-context/project-structure.md
# - docs/ai-context/docs-overview.md

# Tier 2: Component CONTEXT.md (≤200 lines)
# - Purpose, key files, patterns

# Tier 3: Feature CONTEXT.md (≤200 lines)
# - Implementation details
```

---

## What This Skill Covers

### In Scope
- 3-tier documentation hierarchy (CLAUDE.md, CONTEXT.md, docs/)
- Size limits and content organization
- Auto-sync patterns after code changes

### Out of Scope
- Detailed templates → @.claude/skills/three-tier-docs/REFERENCE.md
- Verification skills → docs-verify
- Git documentation workflow → @.claude/skills/git-master/SKILL.md

---

## Core Concepts

### 3-Tier Hierarchy

**Tier 1: Entry Points** (3 files only)
- `CLAUDE.md` - Architecture, features, Quick Start (≤200 lines)
- `docs/ai-context/project-structure.md` - Tech stack, file tree (≤200 lines)
- `docs/ai-context/docs-overview.md` - Documentation navigation, Tier mapping (≤200 lines)
- **Required**: CLAUDE.md top section must reference the other 2 files
- **Constraint**: docs/ai-context/ folder must contain exactly 2 files

**Tier 2: CONTEXT.md** (Component Directory)
- **Purpose**: Component context
- **Content**: Purpose, key files, patterns
- **Size**: ≤200 lines per file
- **Scope**: Component-level context

**Tier 3: CONTEXT.md** (Feature Directory)
- **Purpose**: Feature implementation details
- **Content**: Implementation details, deep-dive
- **Size**: ≤200 lines per file
- **Scope**: Feature-level context

### Content Organization

| Tier | Location | Files | Update Frequency |
|------|----------|-------|------------------|
| 1 | Root + docs/ai-context/ | CLAUDE.md, project-structure.md, docs-overview.md | Project changes |
| 2 | Component dirs | CONTEXT.md | Component changes |
| 3 | Feature dirs | CONTEXT.md | Feature changes |

---

## Execution Steps

### Step 1: Sync Tier 1 Documents

**Tier 1 Structure** (3 files total):
- `CLAUDE.md` - Project architecture, features, Quick Start (≤200 lines)
- `docs/ai-context/project-structure.md` - Tech stack, file tree
- `docs/ai-context/docs-overview.md` - Documentation navigation, Tier mapping

**Required**: CLAUDE.md must reference project-structure.md and docs-overview.md at the top

**Verification**:
```bash
# Check Tier 1 files exist
for file in "CLAUDE.md" "docs/ai-context/project-structure.md" "docs/ai-context/docs-overview.md"; do
  if [ ! -f "$file" ]; then
    echo "FAIL: Missing Tier 1 file: $file"
    exit 1
  fi
done

# Check CLAUDE.md references the other 2 files
if ! grep -q "project-structure.md" CLAUDE.md || ! grep -q "docs-overview.md" CLAUDE.md; then
  echo "FAIL: CLAUDE.md must reference project-structure.md and docs-overview.md"
  exit 1
fi

echo "✓ Tier 1 documents verified"
```

---

### Step 2: Generate Component CONTEXT.md Files

**Target directories**: Any directory with code files (e.g., src/, components/, lib/)

**Script**: See REFERENCE.md for full bash implementation

```bash
# Generate CONTEXT.md for key directories
for dir in src/ components/ lib/ .claude/commands/ .claude/skills/ .claude/agents/; do
  [ -d "$dir" ] || continue
  [ -f "$dir/CONTEXT.md" ] && [ -s "$dir/CONTEXT.md" ] && continue
  # Generate template (see REFERENCE.md for full script)
  echo "✓ Generated $dir/CONTEXT.md"
done
```

**Size Limit**: ≤200 lines per file

---

### Step 3: Verify Documentation Compliance

Invoke the `docs-verify` skill for comprehensive validation.

**Validation includes**:
- Tier 1 line limits (≤200 lines): CLAUDE.md, project-structure.md, docs-overview.md
- ai-context file count (exactly 2 files)
- Cross-reference validation
- Circular reference detection

**Script**: See @.claude/skills/docs-verify/SKILL.md for full verification commands

### Step 4: Inline Verification

Verify documentation compliance immediately after update:

```bash
# 1. Tier 1 Line Limits (≤200)
for file in CLAUDE.md docs/ai-context/*.md; do
  [ -f "$file" ] || continue
  lines=$(wc -l < "$file" | tr -d ' ')
  [ "$lines" -gt 200 ] && echo "FAIL: $file has $lines lines (limit: 200)"
done

# 2. ai-context file count (exactly 2)
count=$(find docs/ai-context -maxdepth 1 -name "*.md" -type f | wc -l | tr -d ' ')
[ "$count" -ne 2 ] && echo "FAIL: docs/ai-context/ has $count files (expected: 2)"

# 3. Cross-reference check
grep -oE '@[^][:space:]]+' CLAUDE.md | while read ref; do
  [ ! -e "${ref#@}" ] && echo "Broken: $ref"
done
```

---

## Verification Failure Recovery

**Line count violations**: CLAUDE.md >200 lines → Extract to docs/ai-context/ | CONTEXT.md >200 lines → Move examples or simplify

**Broken cross-references**: Check file exists with `test -f {path}` | Use absolute paths (e.g., `@.claude/skills/...`)

**Missing frontmatter**: Add required fields (name, description) | Validate with `yamllint {file}`

**Recovery Steps**: Invoke docs-verify skill → Find violating file → Apply fix from REFERENCE.md → Re-verify

---

## Further Reading

**Internal**: @.claude/skills/three-tier-docs/REFERENCE.md - Complete templates, examples, verification patterns | @.claude/skills/documentation-best-practices/SKILL.md - Size limits, quality standards

**External**: [Documentation System Design](https://documentation.divio.com/) | [Writing for AI](https://docs.anthropic.com/claude/docs/guide-to-writing-good-docs)

---

**Version**: claude-pilot 4.4.15

Related Skills

write-docs

16
from diegosouzapw/awesome-omni-skill

Write documentation with real, validated examples. Executes commands through the user to capture actual output. Use for any new documentation or major doc updates.

wiki-docs

16
from diegosouzapw/awesome-omni-skill

Document custom Magento 2 site functionality in the project wiki. Systematically captures custom features, modules, configurations, and business logic for client handover and developer onboarding.

update-docs

16
from diegosouzapw/awesome-omni-skill

Update documentation pages to match source code changes on the current branch

update-docs-and-commit

16
from diegosouzapw/awesome-omni-skill

Updates documentation files (changelog, architecture, project_status) based on git changes, then stages and commits all changes. Use after completing features or fixes.

sync-docs

16
from diegosouzapw/awesome-omni-skill

Strategic documentation sync - review docs before implementation (pull context) OR export learnings after implementation (push to living docs). NOT bidirectional - two separate one-way operations at different phases.

smart-pr-docs

16
from diegosouzapw/awesome-omni-skill

Intelligent PR documentation generator that analyzes code changes, tracks ripple effects across the codebase, updates claude.md files, and creates visual dependency maps. USE WITH codebase-architecture-mapper for elite "System-Aware" context.

review-docs

16
from diegosouzapw/awesome-omni-skill

Review documentation (README.md and CLAUDE.md) for quality, completeness, and consistency. Use when asked to review docs, check documentation, validate README files, or audit CLAUDE.md coverage.

reindex-docs

16
from diegosouzapw/awesome-omni-skill

Re-index all PDF and HTML documents, update index.html, and commit/push changes to the repository

pitchdocs-suite

16
from diegosouzapw/awesome-omni-skill

One-command generation and audit of the full public repository documentation set — README, CHANGELOG, ROADMAP, CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, issue templates, PR template, and discussion templates. Use when setting up a new repo or auditing an existing one.

organize-agent-docs

16
from diegosouzapw/awesome-omni-skill

Organize project agentic documentation into universal (AGENTS.md) and agent-specific files (CLAUDE.md, GEMINI.md, etc.). Use when asked to "organize agent docs", "separate agent instructions", "restructure AGENTS.md", or when a project has agent documentation that mixes universal and tool-specific content.

openclaw-docs-sync

16
from diegosouzapw/awesome-omni-skill

Sync OpenClaw + ClawHub + Skills docs into a local mirror for the QMD memory backend.

moai-docs-unified

16
from diegosouzapw/awesome-omni-skill

Enhanced docs unified with AI-powered features. Enhanced with Context7 MCP for up-to-date documentation.