Purpose: Ensure all context files follow the same format and structure
Last Updated: 2026-01-06
Files MUST be <200 lines. No exceptions.
All files MUST follow MVI: 1-3 sentence core, 3-5 key points, minimal example, reference link.
Files MUST be in correct function folder: concepts/, examples/, guides/, lookup/, or errors/.
MUST update category README.md navigation when creating files.
Ask: Is this a concept, example, guide, lookup, or error?
→ Place in correct folder
Use standard template for file type (see templates.md)
- Core: 1-3 sentences
- Key points: 3-5 bullets
- Example: <10 lines
- Reference: Link to docs
Ensure file <200 lines. If not, split or reference external.
Link to related concepts/, examples/, guides/, errors/
MUST show full preview before writing ANY files:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Preview: File Creation Plan
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CREATE file:
{category}/{function}/{filename}.md ({line_count} lines)
Content preview:
┌─────────────────────────────────────────────────────────┐
│ # {Type}: {Name} │
│ │
│ **Purpose**: {1 sentence} │
│ **Last Updated**: {date} │
│ │
│ ## Core Concept │
│ {1-3 sentences} │
│ │
│ ## Key Points │
│ {3-5 bullets} │
│ ... │
└─────────────────────────────────────────────────────────┘
UPDATE navigation:
{category}/navigation.md
+ | [{filename}.md]({function}/{filename}.md) | {desc} | {priority} |
Validation:
✓ {line_count} lines (limit: {max_lines} for {type})
✓ MVI format applied
✓ Correct folder: {function}/
✓ Cross-references: {count} links added
Approve? [y/n/edit]: _
```
If file already exists at target path:
```
⚠️ File already exists: {category}/{function}/{filename}.md
Options:
1. Cancel (keep existing)
2. Show diff (compare existing vs new)
3. Overwrite (replace existing)
4. Rename new file to {filename}-v2.md
Choose [1/2/3/4]: _
```
Only after approval:
1. Write file to disk
2. Update navigation.md
3. Show confirmation:
```
✅ Created: {category}/{function}/{filename}.md ({line_count} lines)
✅ Updated: {category}/navigation.md
```
- [ ] <200 lines?
- [ ] MVI format?
- [ ] Correct folder?
- [ ] navigation.md updated?
- [ ] Cross-refs added?
Format: {topic}.md
Examples:
authentication.mdstate-management.mdmvi-principle.mdRule: Lowercase, hyphenated, describes the concept
Format: {what-it-demonstrates}.md
Examples:
jwt-auth-example.mdreact-hooks-example.mdapi-call-example.mdRule: End with -example.md, describes what it shows
Format: {action-being-done}.md
Examples:
setting-up-auth.mddeploying-api.mdmigrating-to-v2.mdRule: Gerund form (verbs ending in -ing), describes the task
Format: {what-is-referenced}.md
Examples:
cli-commands.mdfile-locations.mdapi-endpoints.mdRule: Plural noun, describes the reference type
Format: {framework-or-topic}-errors.md
Examples:
react-errors.mdnextjs-build-errors.mdauth-errors.mdRule: End with -errors.md, group by framework/topic (NOT one file per error)
Every context file MUST start with:
# {Type}: {Name}
**Purpose**: [1 sentence describing what this file contains]
**Last Updated**: {YYYY-MM-DD}
---
Example:
# Concept: JWT Authentication
**Purpose**: Stateless authentication using signed JSON Web Tokens
**Last Updated**: 2026-01-06
---
When adding files to README.md, assign priority:
| Priority | When to Use |
|---|---|
| critical | Must understand to work on project. Core concepts. |
| high | Commonly used. Important patterns. |
| medium | Occasionally needed. Reference material. |
| low | Rarely used. Edge cases. |
Example:
### Concepts
| File | Description | Priority |
|------|-------------|----------|
| [auth.md](concepts/auth.md) | Authentication system | critical |
| [caching.md](concepts/caching.md) | Cache strategy | high |
| [logging.md](concepts/logging.md) | Logging patterns | medium |
Link to related files when:
Format: **Related**: type/file.md
Example:
**Related**:
- concepts/authentication.md
- examples/jwt-auth-example.md
- errors/auth-errors.md
Rule: Use relative paths from current location
When creating a new file:
markdown
| [file.md](folder/file.md) | Description | priority |
- [ ] File is <200 lines?
- [ ] Follows MVI format (1-3 sentences, 3-5 points, example, reference)?
- [ ] In correct function folder (concepts/examples/guides/lookup/errors)?
- [ ] Has standard metadata (Purpose, Last Updated)?
- [ ] Added to navigation.md navigation?
- [ ] Priority assigned (critical/high/medium/low)?
- [ ] Cross-references added?
- [ ] Scannable in <30 seconds?
- [ ] No duplication of existing content?
If any checkbox is unchecked, fix before committing.
development/authentication.md ❌ (flat structure)
development/concepts/authentication.md ✅ (function-based)
# Concept: JWT
[500 lines of explanation, examples, edge cases...] ❌
# Concept: JWT
**Core Idea**: Stateless auth with signed tokens (1-3 sentences) ✅
Created: concepts/new-topic.md
README.md: Not updated ❌
Created: concepts/new-topic.md
README.md: Updated with navigation entry ✅
errors/jwt-expired-error.md
errors/jwt-invalid-error.md
errors/jwt-missing-error.md ❌ (too granular)
errors/auth-errors.md ✅ (grouped by topic)
If file exceeds line limit:
DO NOT exceed 200 lines under any circumstance.
Example:
If concepts/authentication.md hits 250 lines:
Option 1: Compress (apply MVI more strictly)
Option 2: Split:
- concepts/authentication.md (core)
- concepts/jwt-tokens.md (specific type)
- concepts/oauth.md (another type)
Option 3: Reference external:
- Keep 100-line summary in concepts/authentication.md
- Link to https://docs.company.com/auth (full details)
| File Type | Template | Max Lines |
|---|---|---|
| Concept | templates.md → Concept Template | 100 |
| Example | templates.md → Example Template | 80 |
| Guide | templates.md → Guide Template | 150 |
| Lookup | templates.md → Lookup Template | 100 |
| Error | templates.md → Error Template | 150 |
| README | templates.md → README Template | 100 |
Every context file must be: