skills/workflow/server-documentation/SKILL.md
# Server Documentation System Set up a documentation system that tracks changes and maintains server/project documentation with Claude Code hooks. ## When to Use - Setting up a new server or development environment - Need to track configuration changes over time - Want automatic documentation of work sessions - Maintaining changelog for infrastructure ## Directory Structure ``` ~/docs/ # User home directory (cross-platform) ├── changelog.md # Global over
npx skillsauth add liauw-media/codeassist skills/workflow/server-documentationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Set up a documentation system that tracks changes and maintains server/project documentation with Claude Code hooks.
~/docs/ # User home directory (cross-platform)
├── changelog.md # Global overview with system info and changelog
└── YYYY-MM-DD/
├── changes.md # Daily quick change log (table format)
└── *.md # Detailed topic files as needed
| Platform | Docs Location | Command Location |
|----------|---------------|------------------|
| Linux/macOS | ~/docs/ | ~/bin/docchange |
| Windows (Git Bash) | ~/docs/ | ~/bin/docchange (bash script) |
| Windows (CMD/PS) | %USERPROFILE%\docs\ | %USERPROFILE%\bin\docchange.cmd |
Linux/macOS:
mkdir -p ~/docs ~/bin
Windows (PowerShell):
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\docs", "$env:USERPROFILE\bin"
Create ~/docs/changelog.md with this template:
# System Documentation
## Overview
| Property | Value |
|----------|-------|
| Hostname | `hostname-here` |
| IP | `x.x.x.x` |
| OS | `os-version` |
| Provider | `provider-name` |
## Services
| Service | Port | URL | Notes |
|---------|------|-----|-------|
| example | 8080 | http://localhost:8080 | Description |
## Users
| User | Purpose | Docker | Sudo |
|------|---------|--------|------|
| admin | Administration | Yes | Yes |
## Key Paths
| Path | Purpose |
|------|---------|
| ~/docs | Documentation |
| ~/projects | Project files |
## Quick Commands
```bash
docchange "Description of change" # Log a change
| Date | Summary | |------|---------|
<!-- New entries added above -->
### Step 3: Create docchange Command
#### Linux/macOS (`~/bin/docchange`)
```bash
#!/bin/bash
# docchange - Log a change to daily documentation
# Usage: docchange "Description of change"
set -e
# Validate input
if [ -z "$1" ]; then
echo "Usage: docchange \"Description of change\"" >&2
exit 1
fi
# Configuration
DOCS_DIR="$HOME/docs"
TODAY=$(date +%Y-%m-%d)
TIME=$(date +%H:%M)
DAY_DIR="$DOCS_DIR/$TODAY"
CHANGES_FILE="$DAY_DIR/changes.md"
# Sanitize input - escape pipe characters to prevent table breakage
DESCRIPTION="${1//|/¦}"
# Create daily directory if missing
mkdir -p "$DAY_DIR"
# Create changes.md with header if missing
if [ ! -f "$CHANGES_FILE" ]; then
cat > "$CHANGES_FILE" << EOF
# Changes for $TODAY
| Time | Change |
|------|--------|
EOF
fi
# Append the change
echo "| $TIME | $DESCRIPTION |" >> "$CHANGES_FILE"
echo -e "\e[32mLogged: $DESCRIPTION\e[0m"
Make executable and add to PATH:
chmod +x ~/bin/docchange
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
~/bin/docchange)Claude Code runs in Git Bash, so this script provides 2.7x faster performance than PowerShell.
#!/bin/bash
# docchange - Log a change to daily documentation
# Usage: docchange "Description of change"
#
# Optimized for Git Bash on Windows (used by Claude Code)
# For native Windows CMD, use docchange.cmd instead.
set -e
# Validate input
if [ -z "$1" ]; then
echo "Usage: docchange \"Description of change\"" >&2
exit 1
fi
# Configuration
DOCS_DIR="$USERPROFILE/docs"
TODAY=$(date +%Y-%m-%d)
TIME=$(date +%H:%M)
DAY_DIR="$DOCS_DIR/$TODAY"
CHANGES_FILE="$DAY_DIR/changes.md"
# Sanitize input - escape pipe characters to prevent table breakage
DESCRIPTION="${1//|/¦}"
# Create daily directory if missing
mkdir -p "$DAY_DIR"
# Create changes.md with header if missing
if [ ! -f "$CHANGES_FILE" ]; then
cat > "$CHANGES_FILE" << EOF
# Changes for $TODAY
| Time | Change |
|------|--------|
EOF
fi
# Append the change
echo "| $TIME | $DESCRIPTION |" >> "$CHANGES_FILE"
echo -e "\e[32mLogged: $DESCRIPTION\e[0m"
Make executable:
chmod +x ~/bin/docchange
%USERPROFILE%\bin\docchange.ps1)Used by the CMD wrapper for native Windows environments.
<#
.SYNOPSIS
Log a change to the daily documentation changelog.
.DESCRIPTION
Appends a timestamped entry to ~/docs/YYYY-MM-DD/changes.md
.PARAMETER Description
The change description to log
.EXAMPLE
docchange "Updated nginx configuration"
#>
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Description
)
$ErrorActionPreference = "Stop"
# Configuration
$DocsDir = "$env:USERPROFILE\docs"
$Today = Get-Date -Format "yyyy-MM-dd"
$Time = Get-Date -Format "HH:mm"
$DayDir = "$DocsDir\$Today"
$ChangesFile = "$DayDir\changes.md"
# Sanitize input - escape pipe characters to prevent table breakage
$Description = $Description -replace '\|', '¦'
# Create daily directory if missing
if (!(Test-Path $DayDir)) {
New-Item -ItemType Directory -Force -Path $DayDir | Out-Null
}
# Create changes.md with header if missing
if (!(Test-Path $ChangesFile)) {
$header = @"
# Changes for $Today
| Time | Change |
|------|--------|
"@
# Use .NET for UTF8 without BOM (works on PS 5.1+)
[System.IO.File]::WriteAllText($ChangesFile, $header + "`n", [System.Text.UTF8Encoding]::new($false))
}
# Append with file locking to prevent corruption from concurrent writes
$entry = "| $Time | $Description |`n"
$maxRetries = 3
$retryCount = 0
while ($retryCount -lt $maxRetries) {
try {
$stream = [System.IO.File]::Open(
$ChangesFile,
[System.IO.FileMode]::Append,
[System.IO.FileAccess]::Write,
[System.IO.FileShare]::Read
)
$writer = [System.IO.StreamWriter]::new($stream, [System.Text.UTF8Encoding]::new($false))
$writer.Write($entry)
$writer.Close()
$stream.Close()
break
}
catch [System.IO.IOException] {
$retryCount++
if ($retryCount -ge $maxRetries) {
throw "Could not write to $ChangesFile after $maxRetries attempts: $_"
}
Start-Sleep -Milliseconds 100
}
}
Write-Host "Logged: $Description" -ForegroundColor Green
%USERPROFILE%\bin\docchange.cmd)@echo off
REM docchange - Log a change to daily documentation
REM Usage: docchange "Description of change"
powershell -ExecutionPolicy RemoteSigned -NoProfile -File "%USERPROFILE%\bin\docchange.ps1" %*
Run once in PowerShell:
$binPath = "$env:USERPROFILE\bin"
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*$binPath*") {
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$binPath", "User")
Write-Host "Added $binPath to PATH. Restart terminal to use."
}
Create .claude/hooks/post-tool-use.sh (Linux/macOS) or .claude/hooks/post-tool-use.ps1 (Windows) to auto-document significant changes.
Linux/macOS:
#!/bin/bash
# Auto-log file edits to documentation
TOOL="$1"
if [ "$TOOL" = "Edit" ] || [ "$TOOL" = "Write" ]; then
# Hook can trigger docchange for significant edits
# Customize based on your needs
:
fi
Windows:
param($Tool)
# Auto-log file edits to documentation
if ($Tool -eq "Edit" -or $Tool -eq "Write") {
# Hook can trigger docchange for significant edits
# Customize based on your needs
}
| Feature | Benefit |
|---------|---------|
| Input sanitization | Pipe chars \| replaced with ¦ to prevent table breakage |
| UTF8 without BOM | Prevents encoding issues with other tools |
| File locking (PS) | Prevents corruption from concurrent writes |
| RemoteSigned policy | More secure than Bypass while allowing local scripts |
| -NoProfile flag | Faster startup, avoids profile interference |
| Environment | Script | Time |
|-------------|--------|------|
| Git Bash (Claude Code) | ~/bin/docchange (bash) | ~0.19s |
| Windows CMD/PowerShell | docchange.cmd | ~0.50s |
Claude Code uses Git Bash, so the bash script is automatically used for best performance.
docchange "Installed nginx and configured reverse proxy"
docchange "Updated firewall rules for port 443"
docchange "Created backup script in ~/bin/backup.sh"
For complex changes, create a detailed file:
# Linux/macOS/Git Bash
cat > ~/docs/$(date +%Y-%m-%d)/nginx-setup.md << 'EOF'
# Nginx Setup
## Installation
...
## Configuration
...
EOF
# Then log the summary
docchange "Set up nginx - see nginx-setup.md for details"
# Linux/macOS/Git Bash
cat ~/docs/$(date +%Y-%m-%d)/changes.md
# Windows PowerShell
Get-Content "$env:USERPROFILE\docs\$(Get-Date -Format 'yyyy-MM-dd')\changes.md"
docchange "Test entry"~/ paths in documentation, they expand correctly on all platformsWhen working with Claude Code, ask it to:
docchange "description" after significant changesExample prompt:
After completing this task, run docchange with a summary of what was changed.
development
Use when decomposing complex work. Dispatch fresh subagent per task, review between tasks. Flow: Load plan → Dispatch task → Review output → Apply feedback → Mark complete → Next task. No skipping reviews, no parallel dispatch.
development
Delegate tasks to remote Claude Code agent containers for parallel execution, long-running analysis, or resource-intensive operations.
development
Use when working on multiple features simultaneously. Creates isolated workspaces without branch switching, enabling parallel development.
tools
Use when making commits, creating branches, or managing Git operations. Ensures consistent Git practices and proper commit messages.