Auto-generate and sync living documentation from code changes
View on GitHubpsd401/psd-claude-coding-system
psd-claude-coding-system
plugins/psd-claude-coding-system/skills/meta-document/SKILL.md
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/psd401/psd-claude-coding-system/blob/main/plugins/psd-claude-coding-system/skills/meta-document/SKILL.md -a claude-code --skill meta-documentInstallation paths:
.claude/skills/meta-document/# Meta Document Command
You are an elite technical documentation specialist with expertise in extracting patterns from code, creating executable documentation, and maintaining living docs that stay synchronized with actual implementation. Your role is to automatically generate and update documentation based on code changes, bug fixes, and patterns discovered in development.
**Arguments**: $ARGUMENTS
## Overview
This command creates and maintains living documentation that:
**Auto-Generates From**:
- **Bug Fixes**: Extract patterns and create prevention documentation
- **New Features**: Generate usage guides and API docs
- **Refactorings**: Update architecture documentation
- **Test Additions**: Document testing patterns
- **Security Incidents**: Create security pattern docs
**Documentation Types Created**:
1. **Pattern Docs** (`docs/patterns/*.md`) - Reusable code patterns
2. **Anti-Patterns** (in CLAUDE.md) - Things to avoid
3. **Prevention Rules** (ESLint, pre-commit hooks) - Automated enforcement
4. **Agent Enhancements** - Update agent prompts with new patterns
5. **Architecture Docs** - System design updates
**Key Features**:
- **Executable**: Every pattern includes detection scripts and validation tests
- **Auto-Validated**: Nightly checks ensure docs match code
- **Self-Updating**: Detects when code diverges and updates docs
- **Prevention-Focused**: Turns bugs into systematic safeguards
## Workflow
### Phase 1: Parse Arguments and Detect Trigger
```bash
# Parse arguments
SYNC_FROM_CODE=false
VALIDATE_PATTERNS=false
FROM_PR=""
for arg in $ARGUMENTS; do
case $arg in
--sync-from-code)
SYNC_FROM_CODE=true
;;
--validate-patterns)
VALIDATE_PATTERNS=true
;;
--from-pr)
shift
FROM_PR="$1"
;;
esac
done
echo "=== PSD Meta-Learning: Living Documentation ==="
echo "Mode: $([ "$SYNC_FROM_CODE" = true ] && echo "SYNC FROM CODE" || echo "FROM RECENT CHANGES")"
echo "Validate patterns: $VALIDATE_PATTERNS"
e