Complete lessons learned standards, validation, and multi-file management...
Purpose: Single source of truth for ALL lessons learned standards, validation, and management.
When to Use:
This skill contains:
Lessons learned files follow strict naming to ensure consistency and discoverability:
Pattern: [role]-lessons-learned.md
Location: /docs/lessons-learned/[role]-lessons-learned.md
Multi-part files:
[role]-lessons-learned.md (original)[role]-lessons-learned-2.md[role]-lessons-learned-3.mdThe following roles are recognized for lessons learned documentation:
backend-developer-lessons-learned.md - Backend development, API design, server-side logicreact-developer-lessons-learned.md - React development, UI components, client-side functionalitytest-developer-lessons-learned.md - Test creation and test suite designtest-executor-lessons-learned.md - Test execution, environment setup, troubleshootingdatabase-designer-lessons-learned.md - Database design, migrations, data managementdevops-lessons-learned.md - Deployment, infrastructure, operational concernsui-designer-lessons-learned.md - UI/UX design, wireframes, design systemsbusiness-requirements-lessons-learned.md - Requirements gathering and analysisfunctional-spec-lessons-learned.md - Technical specifications and designcode-reviewer-lessons-learned.md - Code review patterns and quality checksgit-manager-lessons-learned.md - Version control and git operationslibrarian-lessons-learned.md - Documentation organization and maintenanceorchestrator-lessons-learned.md - Workflow coordination and orchestrationtechnology-researcher-lessons-learned.md - Technology evaluation and researchlint-validator-lessons-learned.md - Code quality validationprettier-formatter-lessons-learned.md - Code formatting standardsFormat: Problem → Solution → Example (PREVENTION pattern)
Each lessons learned entry MUST follow this structure:
## Problem: [Brief Description]
**Problem**: Detailed description of what went wrong.
**Root Cause**: Why it happened.
**Solution**: Specific, actionable steps to prevent recurrence.
**Example**:
```bash
# ❌ Wrong approach that caused the problem
command --wrong-flag
# ✅ Correct approach that prevents the problem
command --correct-flag
### Entry Requirements
1. **Date Format**: Use ISO format (YYYY-MM-DD) for consistency
2. **Context**: Provide enough background for future readers to understand
3. **Actionable**: Each lesson MUST include specific, actionable takeaways
4. **Concrete**: Include code examples, commands, file paths, error messages
5. **Prevention-focused**: Use language like "avoid", "don't", "never", "instead of"
6. **Cross-referenced**: Link to related documentation
### NOT a Lessons Learned
**Don't create lessons for**:
- "How to" instructions → That's a Skill (automation)
- General documentation → That's a guide in /docs/
- Step-by-step procedures → That's a Skill or process doc
**DO create lessons for**:
- What went wrong and why
- Mistakes to avoid
- Better approaches discovered
- Architecture violations that caused problems
- Debugging patterns that worked
### Common Tags
Use these standardized tags to categorize lessons:
- `#critical` - Critical issues that caused significant problems
- `#process` - Process improvements and workflow changes
- `#tooling` - Tool selection and configuration lessons
- `#debugging` - Debugging techniques and troubleshooting
- `#performance` - Performance-related insights
- `#security` - Security considerations and best practices
- `#integration` - Third-party service integration lessons
- `#testing` - Testing strategy and implementation insights
- `#deployment` - Deployment and infrastructure lessons
- `#communication` - Team communication and coordination
---
## 📏 File Size Limits and Multi-File Management
### Size Limits (MANDATORY)
**Maximum file size**: 2,000 lines per file
**Warning threshold**: 1,800 lines (90% of maximum)
**Check before writing**: Always use `wc -l filename` before adding lessons
**Why 2,000 lines?**
- Conservative limit for Claude's 25,000 token read limit
- Ensures files remain readable and maintainable
- Prevents file read errors that block workflows
### Multi-File Structure
When lessons learned files exceed 1,800 lines (warning) or 2,000 lines (maximum), they MUST be split:
**File naming**:
- Part 1: `[role]-lessons-learned.md` (original file)
- Part 2: `[role]-lessons-learned-2.md`
- Part 3: `[role]-lessons-learned-3.md`
- Part N: `[role]-lessons-learned-N.md`
**Each part MUST**:
- Have a multi-file header (see format below)
- Reference all other parts
- Specify which part to write to
- Stay under 2,000 lines
### Part 1 Header Format (REQUIRED)
**Every multi-file lessons learned MUST have this header in Part 1**:
```markdown
## 📚 MULTI-FILE LESSONS LEARNED
**Files**: 3 total
**Part 1**: [role]-lessons-learned.md (THIS FILE)
**Part 2**: [role]-lessons-learned-2.md (MUST READ)
**Part 3**: [role]-lessons-learned-3.md (MUST READ)
**Read ALL**: Parts 1, 2, AND 3 are MANDATORY
**Write to**: Part 3 ONLY
**Maximum file size**: 2,000 lines per file
**IF READ FAILS**: STOP and use lessons-learned-validator skill to fix immediately
## 📚 MULTI-FILE LESSONS LEARNED
**Files**: 3 total
**Part 2**: [role]-lessons-learned-2.md (THIS FILE)
**Part 1**: [role]-lessons-learned.md (MUST READ FIRST)
**Part 3**: [role]-lessons-learned-3.md (MUST ALSO READ)
**Read ALL**: Parts 1, 2, AND 3 are MANDATORY
**Write to**: Part 3 ONLY
**Maximum file size**: 2,000 lines per file
**IF READ FAILS**: STOP and use lessons-learned-validator skill to fix immediately
BEFORE doing ANY work, agents MUST:
ALWAYS write to the LAST file in the series:
wc -l [last-file].mdStep-by-step split process:
Check current state:
wc -l docs/lessons-learned/[role]-lessons-learned-N.md
If file > 2,000 lines, create next part:
# If Part 2 is full, create Part 3
touch docs/lessons-learned/[role]-lessons-learned-3.md
Add header to new part (see Part 2+ format above)
Move recent lessons to new part:
Update Part 1 header:
**Files**: 2 total → **Files**: 3 total**Write to**: Part 2 ONLY → **Write to**: Part 3 ONLYVerify all parts readable:
wc -l docs/lessons-learned/[role]-lessons-learned*.md
# All files should be under 2,000 lines
Test reading all parts before proceeding
STARTUP VALIDATION GATE - MANDATORY FOR ALL AGENTS:
# Set flag
LESSONS_LEARNED_READABLE=false
# Attempt to read ALL lessons learned files for your role
for FILE in docs/lessons-learned/[your-role]-lessons-learned*.md; do
if ! cat "$FILE" > /dev/null 2>&1; then
echo "❌ CRITICAL: Cannot read $FILE"
echo "STOP: Use lessons-learned-validator skill to fix"
exit 1
fi
done
# Only when ALL files read successfully
LESSONS_LEARNED_READABLE=true
# ONLY proceed with work if flag is true
if [ "$LESSONS_LEARNED_READABLE" = "true" ]; then
# Proceed with task
else
echo "❌ BLOCKED: Cannot proceed until lessons files are readable"
exit 1
fi
If validator reports file exceeds 2,000 lines:
Identify the oversized file:
find docs/lessons-learned -name "*lessons-learned*.md" -exec wc -l {} \; | sort -rn
Check if it's the last file in series:
Create next part:
# If Part 2 is oversized (file count is 2)
# Create Part 3
touch docs/lessons-learned/[role]-lessons-learned-3.md
Add header to new part with correct file count
Move content:
LINES - 1800 (leave buffer)Update Part 1 header with new file count
Run validator again to confirm fix
# Validate specific lessons learned file
bash .claude/skills/lessons-learned-validator/execute.sh \
docs/lessons-learned/react-developer-lessons-learned.md
# Validate multi-part file
bash .claude/skills/lessons-learned-validator/execute.sh \
docs/lessons-learned/test-developer-lessons-learned-2.md
# Show help and usage information
bash .claude/skills/lessons-learned-validator/execute.sh --help
Use the lessons-learned-validator skill to check [role]-lessons-learned.md
Before committing lessons:
bash .claude/skills/lessons-learned-validator/execute.sh \
docs/lessons-learned/my-role-lessons-learned.md
Validate all lessons learned files:
for file in docs/lessons-learned/*-lessons-learned*.md; do
echo "Validating: $file"
bash .claude/skills/lessons-learned-validator/execute.sh "$file"
echo ""
done
Check file size before writing:
LAST_FILE=$(ls -1 docs/lessons-learned/[role]-lessons-learned*.md | tail -1)
LINE_COUNT=$(wc -l < "$LAST_FILE")
if [ "$LINE_COUNT" -gt 1800 ]; then
echo "⚠️ File approaching limit - plan split soon"
elif [ "$LINE_COUNT" -gt 2000 ]; then
echo "❌ File exceeds limit - MUST split before writing"
fi
Before committing lessons, validate format and size:
# OLD: Validate your lessons file
bash .claude/skills/lessons-learned-validator.md \
docs/lessons-learned/[your-role]-lessons-learned.md
# Validate specific file
bash .claude/skills/lessons-learned-validator.md \
docs/lessons-learned/react-developer-lessons-learned.md
# Validate all lessons learned files
for file in docs/lessons-learned/*-lessons-learned*.md; do
echo "Validating: $file"
bash .claude/skills/lessons-learned-validator.md "$file"
echo ""
done
# Check if you need to split
LAST_FILE=$(ls -1 docs/lessons-learned/[role]-lessons-learned*.md | tail -1)
LINE_COUNT=$(wc -l < "$LAST_FILE")
if [ "$LINE_COUNT" -gt 1800 ]; then
echo "⚠️ File approaching limit - plan split soon"
elif [ "$LINE_COUNT" -gt 2000 ]; then
echo "❌ File exceeds limit - MUST split before writing"
fi
Wrong:
## How to Configure Docker
Run `docker-compose up -d`
Right:
## Problem: Docker Containers Fail to Start
**Problem**: Running `docker-compose up` fails with port conflicts.
**Solution**: Use development compose file overlay:
- Run: `docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d`
- Or use restart-dev-containers skill
**Example**:
```bash
# ❌ Wrong - Uses wrong ports
docker-compose up
# ✅ Right - Uses dev ports correctly
bash .claude/skills/container-restart.md
### Issue: Generic Problems
**Wrong**:
```markdown
**Problem**: Tests fail.
Right:
**Problem**: E2E tests fail with "Element not found" error even though element exists.
Root cause: Docker container has compilation error but still shows "running" status.
Error message: `TimeoutError: Waiting for selector "#login-button" timed out`
Wrong:
**Solution**: Be careful with state management.
Right:
**Solution**: Always use Zustand for global state, React Query for server state.
Steps:
1. Create store: `apps/web/src/stores/authStore.ts`
2. Use hook: `const { user } = useAuthStore()`
3. Never store server data in Zustand - use React Query
Wrong:
**Example**: We fixed this in the user component.
Right:
**Example**: File: `apps/web/src/features/auth/components/LoginForm.tsx:45`
```typescript
// ❌ Wrong - Direct state mutation
setUser(existingUser)
// ✅ Right - Create new object
setUser({ ...existingUser, isAuthenticated: true })
### Issue: File Exceeds Size Limit
**Problem**: Validator reports "File exceeds 2,000 lines"
**Fix**: Use split procedure in this skill
**Quick fix**:
```bash
# 1. Check current size
wc -l docs/lessons-learned/[role]-lessons-learned-N.md
# 2. Create next part
touch docs/lessons-learned/[role]-lessons-learned-$((N+1)).md
# 3. Add header to new part (see header format in this skill)
# 4. Move recent 200-400 lines to new part
# 5. Update Part 1 header with new file count
# 6. Verify all parts under 2,000 lines
wc -l docs/lessons-learned/[role]-lessons-learned*.md
The validator produces structured output for programmatic use:
{
"validation": {
"file": "docs/lessons-learned/react-developer-lessons-learned.md",
"score": 87,
"maxScore": 100,
"percentage": 87,
"status": "pass",
"structure": {
"score": 18,
"maxScore": 20,
"issues": ["Large file, consider splitting"]
},
"format": {
"score": 26,
"maxScore": 30,
"lessons": 15,
"problemSections": 15,
"solutionSections": 15,
"exampleSections": 14
},
"content": {
"score": 25,
"maxScore": 30,
"codeBlocks": 18,
"crossReferences": 7
},
"maintenance": {
"score": 18,
"maxScore": 20,
"lastUpdated": "2025-11-04",
"outdatedLessons": 0,
"duplicates": 0,
"fileSize": "1,456 lines (73% of max)"
},
"recommendations": [
"Add more cross-references to architecture docs",
"One lesson missing Example section"
]
}
}
MANDATORY startup check:
wc -l [last-file].mdRun validator on all your lessons files:
bash .claude/skills/lessons-learned-validator.md \
docs/lessons-learned/[your-role]-lessons-learned*.md
Validator runs automatically on ALL lessons files. Oversized files block finalization.
docs/lessons-learned/docs/archive/obsolete-lessons/When archiving lessons:
docs/archive/obsolete-lessons//docs/functional-areas/ when applicableInitial Context: Show pass/fail and score only On Request: Show detailed breakdown by category On Failure: Show specific issues with examples of fixes On Pass: Show summary with minor recommendations
Remember: This skill is the SINGLE SOURCE OF TRUTH for all lessons learned operations. Everything you need to know about lessons learned format, validation, size management, and fix procedures is in this file. Do not look elsewhere for this information.