swe-knowledge-vault-refine
Use when refining swe-knowledge vault notes or diagrams.
- License 许可
- Unlicense
- 最近更新
- 2026-11-03
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- swe-knowledge-vault-refine
- description
- Use when refining swe-knowledge vault notes or diagrams.
03 SKILL.md 正文
swe-knowledge Vault Refinement (journey-writer ✒️)
Refinement workflow for F:\obsidian_note\swe-knowledge\ (ALL 15 KA folders + checklist/ + computing-foundation-note refined 2026-09-30: em-dash 0, links repaired, diagrams themed+rendered — cfn: 138 files, 2,223 em, 60/60 render). FUTURE em-dash batches remaining in vault: body-of-knowledge (3,482 em/108 files), career-path (2,431/224), engineering-foundation-note (787/26), document-template (301/11), math-for-software-engineering-note (143/14). NOTE: vault has an auto-backup job committing everything periodically ('vault backup: <date>' commits) — check git log before offering to commit; the user's changes may already be committed. Vault is git-backed; edit in place, user reviews then commits.
Em-dash removal convention (user-approved: context-aware)
Three-pass process per folder:
- Mechanical pass (regex): headings
# N — Title→# N: Title;**Label** —→**Label:**(colon INSIDE bold); list definitions- Term — def→- Term: def; wikilinks[[X]] — desc→[[X]]: desc(group chapters as[[X]] (Ch 5): desc); quote attributions> — Name, "Work" (year)→> *Name, "Work" (year)*; empty table cells| — |→| N/A |. - Classifier pass: paired dashes (exactly 2 per line) → parentheses; single mid-sentence dash → comma (appositive/gerund/preposition after), semicolon (independent clause or imperative verb after), colon (explanation/list after). Unmatched lines go to a scratch file for manual review.
- Manual pass: read every ambiguous line, write an explicit old→new replacement dict, apply with miss-reporting. Typical ~60-80 lines per folder.
Post-pass normalization: ; Capitalized → lowercase unless proper noun (keep a PROPER set of author/tech names); **Label**: → **Label:**; collapse double spaces in prose (skip tables, code, indented lines). En-dashes in ranges (Ch 12–13) are CORRECT — keep. Verify: zero —, zero **:, zero artifacts.
PITFALL: LaTeX lines escape differently (\tau in file vs \\tau in Python source) — check misses with grep before retrying. Code blocks may contain # comment lines that trip naive H1 counts — check in_code state.
CODE-BLOCK em-dashes: some folders (Clean Code/Clean Architecture notes) have hundreds of em-dashes inside fenced code as prose comments (// ❌ Bad — 40+ lines) or ASCII diagrams. Decide with the user's convention: these ARE prose, so replace too — spaced — → - (ASCII art alignment) or : in comments; never touch dashes that are code syntax. Count in_code vs prose separately before declaring done.
CITATIONS: source lines like *Source: Book — Author* or *Clean Code — Robert C. Martin* need manual rewrites to comma style (*Clean Code* by Robert C. Martin), not punctuation swaps; watch for broken italics when substituting (unmatched *).
WIKILINK PITFALL: mermaid uses [[...]] subroutine-shape syntax (A --> G[[Label]]) — protect mermaid blocks before any wikilink replacement. A [[Book Title]] link with no target file may be an intentional forward reference (check context, e.g. References section) — leave it and note it. Folder/index links ([[Folder/|X]], [[Folder/index|X]]) don't resolve — repoint to the folder's Overview note.
Wikilink repair
Broken links are common (old note names before consolidations). Build a filename→path index of the whole vault, extract all [[target]] (handle path/Name|Alias), map broken names to actual files, replace. Folder links ([[Microservice/01 Decomposition/|...]]) don't resolve — point to the first file inside. Verify zero broken after.
Panomete mermaid theme
Brand source (LOCKED v1.0): F:\obsidian_note\oralita_md\personal\brand\03_style-guide.md + 02_visual-identity.md. Palette: primary #1FB854, secondary #1EB88E, accent #1FB8AB, neutral #19362D, base-100 #1B1717, base-200 #161212, base-content #CAC9C9, neutral-content #CDD3D1, info #00B5FF, success #00A96E, warning #FFBE00, error #FF5861. RULE: black text on saturated fills (never white on green).
Mermaid in Obsidian can't read the daisyUI CSS vars — bake hex values into %%{init: {'theme':'base','themeVariables':{...}}}%% blocks. Three variants:
- Flowchart/graph: primaryColor #19362D, primaryTextColor #CDD3D1, primaryBorderColor/lineColor/nodeBorder #1FB854, background #1B1717, mainBkg #19362D, clusterBkg/edgeLabelBackground #161212, titleColor #1FB854, fontSize 14px.
- sequenceDiagram: adds actorBkg #19362D, actorBorder/actorLineColor #1FB854, actorTextColor #CDD3D1, signalColor/signalTextColor #CDD3D1, noteBkgColor #1EB88E + noteTextColor #000C07, activationBkgColor #1EB88E, activationBorderColor #1FB8AB, sequenceNumberColor #000000, labelBoxBkgColor #161212.
- classDiagram: adds classText #CDD3D1 on top of the flowchart set.
- timeline: adds cScale0..3 (brand ramp), timelineEventColor #1FB854 + timelineEventTextColor #000000, timelineLabelColor #CAC9C9.
- stateDiagram: flowchart set minus node-specific keys.
Remap any ad-hoc node style colors to brand tokens SEMANTICALLY (read the diagram first): reds→error #FF5861, orange/yellow→warning #FFBE00, greens→primary #1FB854 or success #00A96E, blues→info #00B5FF, purple→accent #1FB8AB, dark-blue ramps→neutral #19362D/secondary/accent/info gradient; stroke:#333→#000000; color:#fff on saturated fills→color:#000000, on dark neutral fills→#CDD3D1. draw.io palette: #dae8fc→info, #d5e8d4→primary, #fff2cc→warning, #e1d5e7→accent, #f8cecc→error AND append ,color:#000000 to style lines lacking an explicit color (they otherwise inherit light theme text and break contrast on saturated fills). Replace generic %%{init {'theme':'dark'}}%% with the brand init. Inject init as first line of blocks lacking one; never duplicate. Final check: scan diagram bodies (init lines excluded) for any hex not in the 15-color brand set.
Mermaid validation & broken-fence repair (2026-09-29 incident)
NEVER trust regex extraction (```mermaid\n(.*?)```) for validation — it misses unterminated blocks (no closing fence) and mis-pairs fences. Use a fence-aware line walker (open on mermaid, close on any next line; track unterminated). Some notes (Microservice sub-vault) have mermaid blocks whose closing was written much later (or never): headings/tables/blockquotes sit INSIDE the diagram and break the render. Fix = insert the missing right after the diagram's real last line (beware end lines closing subgraph blocks — fence must go AFTER them). FOLDERS 10-12 (2026-09-30) showed a DEEPER pattern: cascading alternation breakage — one missing (or SPURIOUS extra) fence shifts pairing for the whole file (09_Design_Contract had 5 missing closers across 27 fences; 10_Syntax had a spurious mermaid that split a code block; `13_07_Vulnerability_Management` had 5 stray fences sitting INSIDE tables). Steps: (1) list ALL fences with positions+info; (2) if count is odd, find the spurious or missing one by content (walk pairs by info tag, not alternation); (3) run an iterative repair: extract blocks with a fence-aware walker, and for every block whose body contains markdown-looking lines (heading/table/blockquote/bold/list/prose sentence), insert a closer at the true diagram end (walk back over blanks), repeat until no block contains markdown — TABLE DETECTION gotcha: the table matcher must be `^\s*\|.*\|` (row has a second pipe), NOT `\|[^\|]*\|>` which only matches arrow cells and missed real tables, leaving swallowed tables unrepaired; (4) re-check both odd-count AND 'mermaid opener followed by another mermaid opener' mispairs; (5) remove stray unpaired fences at EOF when content after them is a table/heading (they're cascade leftovers, not openers) — also when fences sit BETWEEN table rows (consecutive at rows 398/400/402-style), they are stray and must be removed even when the count looks even; (6) render, and if a block still fails with a small line number, the cause may be UNQUOTED PAREN LABELS in node text like A[X (e.g., Y)] → quote A["X (e.g., Y)"] (parens are shape-start tokens to the parser). CHECKLIST BATCH (2026-09-30, 83 files, 7,435 em): checklist items use - [ ] **Label** — desc so the list-def rule dominates (5,732 hits). Also: (1) tier-matrix boilerplate Skip ❌ sections entirely — they'd... repeats ~40x, replace globally; (2) tier header lines > 🧱 **Label** (parens) — ✅ status need a dedicated regex (label + optional parens + emoji status); (3) dangling **Label** — lines whose description is a following code block/table take a COLON, not semicolon; (4) > intro lines The **X** checklist — what... take semicolon; (5) Last updated: date — synced... take semicolon. Code-block pass: tree diagrams (├──/│) and // comment/# comment lines → -. Links: Obsidian resolves case-insensitively + via frontmatter aliases — build the resolver BEFORE declaring broken; [[bin]] (Cargo.toml) and [[lang]] (SvelteKit routes) inside inline code are NOT links — strip fences AND inline backticks before scanning. Security artifact links (Data-Breach-Response-Plan, Threat-Model, ...) with context 'template'/'if exists' are INTENTIONAL forward refs — leave them. Diagrams: 40 all flowchart; pastel tier styles (#e1f5ff/#e8f5e9/#f3e5f5/#ffebee/#fff3e0/#fff4e1/#e3f2fd) remapped semantically + black text; `[[[x]]]` triple-bracket node shapes are INVALID mermaid — convert to `[["x"]]`. Fence saga: nearly every checklist file's LAST mermaid block lacked its closer (table/heading swallowed to EOF), plus spurious early closers inside tree-diagram code blocks (`src/` closed on line 3, tree continued outside) — check files with tiny fence counts; ` ` inside list-item tables (secrets-management rotation table) split the block.
Validation toolchain (Bun + Edge, no Chromium download): scratch dir mermaid-check/ — bun add @mermaid-js/mermaid-cli puppeteer with PUPPETEER_SKIP_DOWNLOAD=true, puppeteer.json pointing executablePath at the installed Edge, run node_modules/.bin/mmdc -i in.mmd -o out.png -p puppeteer.json -q per block; exit code != 0 = parse error. Render all blocks in a background batch (run_batch.py pattern) and collect failures. ~2.5s/block. run_final.py reads manifest.json as 4-tuples [name, rel, idx, ""] + one <name>.mmd per block in the same dir; success format TOTAL: <n> fails: <n>.
Fence repair SAFETY RULES (2026-09-30 computing-foundation incident — damaged 8 files)
NEVER remove fence openers based on a content heuristic. The aggressive "block body contains markdown → spurious opener" pass treated bash # comment lines (and 6. Presentation-style numbered prose) as markdown headings and DELETED legitimate code-block openers — 8 files broke (missing closers + orphan openers cascading). Recovery that worked: git checkout HEAD -- <8 files> (auto-backup HEAD was clean), then REDO only the reverted files' text work (em/links/theming are deterministic scripts), and repair fences with INSERT-ONLY logic.
VERIFY EVERY fence change against git: git diff -U0 HEAD -- <folder> counting ^+``` vs ^-``` per file. Unbalanced = damage. Balanced is NOT safe: +1/−1 can hide a RELOCATED closer (a closer moved from before a prose line to after it = prose swallowed INSIDE a mermaid block → mmdc parse error, but every count/parity check passes). Files with ONLY insertions on odd-at-HEAD files are usually legit author-error fixes.
Full validation chain (all required): (1) semantic fence walk — flagged = tagged line where a closer is expected, or EOF with unclosed block; (2) mermaid openers count == regex-matched blocks count (a mismatch means a block's closer was eaten — typically mermaid-opener-paired-to-mermaid-opener); (3) no markdown (headings/tables/- [ ]) inside extracted .mmd bodies; (4) mmdc render all blocks — the only ground truth. Watch: 4-backtick outer fences (````markdown) are VALID for nested README examples — a 3bt-only validator falsely flags them; don't "fix" a correct 4bt structure. Reads must use default universal-newline open(); open(newline="") breaks ```mermaid\n regexes (CRLF on disk). Mermaid edge labels contain | so naive \|.*\|| table detectors flag graph lines as tables → false "markdown in block" → bogus repairs. Files on disk are mixed CRLF/LF; git may show a full-file rewrite after edits (EOL normalization) — compare the FENCE SEQUENCE vs HEAD instead of raw diff line counts. Domain symbols: decision-table don't-care entries are dashes, not punctuation — use en-dash – to keep the em census at 0 without changing meaning.
Workflow order per folder
survey (files/em-count/mermaid-count) → 3-pass em-dash (prose, then code-block pass) → normalization → wikilink repair (mermaid-protected) → mermaid theming → final verify (0 em-dash, 0 artifacts, 0 broken links, every block has init, 0 off-brand hex) → report table to user → offer commit. Report should include replacement-count tables and a what-I-didn't-touch section (en-dash ranges, code logic, intentional heading conventions like ## Intent-only pattern notes, prose voice).
04 同仓库更多 Skills
project-spec-docs
Fill/update project_spec docs (templates, MM handoffs).
penpot-mcp
Penpot MCP: connect, verify, and fix streaming via nginx.
nginx-streaming-proxy
Configure nginx for streaming endpoints (SSE, MCP, WS).
branding-ci
Use for brand/CI identity, style guides, and brand docs.
yuanbao
Yuanbao (元宝) groups: @mention users, query info/members.
slidev
Create and present web-based slidedecks for developers using Slidev with Markdown, Vue components, code highlighting, animations, and interactive features. Use when building technical presentations, conference talks, code walkthroughs, teaching materials, or developer decks.