Lesson Management Standardization — Naming, Content Sanitization, and Automated Submission Pipeline

Domain: devops · Evidence E0 — Contributor self-reported
lessonnaming-conventioncontent-sanitizationautomationcistandardization

Summary

Over 180 lessons accumulated in the MisakaNet knowledge base with significant quality and consistency issues:

Problem

Over 180 lessons accumulated in the MisakaNet knowledge base with significant quality and consistency issues:

  1. Inconsistent filenames: Mix of Chinese and English characters, project-specific prefixes (cc-connect-, ccswitch-, codewhale-, deepseek-tui-, hermes-, node_, st2-*)
  2. Hardcoded sensitive content: User home paths (<REDACTED> specific usernames (<user>, <agent>), internal project names (mify, InternalGateway`) embedded in lesson body text
  3. Non-portable tags: Project-specific metadata (project:, node:, severity:*) in frontmatter that are meaningless to external contributors
  4. No submission standards: Every contributor writes differently, no automated validation before merge
  5. Plaintext secrets discovered: PATs, API keys, and Cloudflare tokens in public-facing and internal documentation

Root Cause

The lesson system grew organically with no upfront naming convention, content policy, or CI enforcement. Contributors wrote lessons from their own context without generalizing for external readers. Review relied entirely on manual checks.

Solution

Phase 1: Bulk Cleanup

Two-pass generalization script (scripts/generalize_lessons.py):

PassOperationFiles affected
1Remove project-specific prefixes + content sanitization12 renamed + content generalized
2Chinese→English filenames (git mv preserves history)37 renamed, 13 deleted

Files with Chinese names: 50 → 0 Files with project-specific tags: ~15 → 0

Phase 2: Automated Quality Gate

Three-layer enforcement:

Layer 1 — Pre-commit hook (.pre-commit-config.yaml):

- id: check-lesson-quality
  name: check lesson quality
  entry: python3 scripts/check_lesson_quality.py
  files: ^lessons/.*\.md$

Checks before allowing commit:

Layer 2 — CI gate (.github/workflows/lesson-quality.yml):

Layer 3 — One-click submission (scripts/submit_lesson.py):

Expected Output:

Python check passed
On branch main
OK

Notes

Related

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons