From vb6-project
This skill should be used when editing VB6 source files (.bas, .cls, .frm, .frx), compiling VB6 projects (.vbp), creating new VB6 modules or forms, adding controls to forms, or troubleshooting VB6 compile errors. Also triggered by mentions of "Big5", "Shift-JIS", "GBK", "VB6 encoding", "compile VB6", ".frm format", "edit .bas", "new .frm", "add module", "add control", "CRLF", "encoding corruption", "resource string", ".rc file", ".gitattributes VB6", ".vb6-encoding". Provides encoding hooks for transparent Read/Edit/Write on ANSI-encoded VB6 files, .frm format auto-fix, compile helpers, and safety nets.
How this skill is triggered — by the user, by Claude, or both
Slash command
/vb6-project:vb6-projectThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
VB6 source files (.bas, .cls, .frm, .rc) are **ANSI encoded** (Big5, Shift-JIS, GBK, etc.) **with CRLF line endings**. Claude Code's Edit and Write tools output UTF-8, which would destroy these files.
VB6 source files (.bas, .cls, .frm, .rc) are ANSI encoded (Big5, Shift-JIS, GBK, etc.) with CRLF line endings. Claude Code's Edit and Write tools output UTF-8, which would destroy these files.
This plugin uses a hook-based transparent conversion system to make Read/Edit/Write all safe:
Read VB6 file Edit/Write VB6 file After Edit/Write
┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ PreToolUse │ │ Tool runs │ │ PostToolUse │
│ (Read hook) │ │ normally on │ │ (Edit/Write │
│ │ │ UTF-8 content│ │ hook) │
│ ANSI → UTF-8 │ ──> │ Claude Code │ ──> │ UTF-8 → ANSI │
│ on disk │ │ shows native │ │ + CRLF │
│ │ │ diff UI │ │ on disk │
└─────────────┘ └──────────────┘ └──────────────┘
.frm format issues.The encoding is read from .vb6-encoding in the project root (one line, e.g., big5). Supported values:
| Value | Language |
|---|---|
big5 | 繁體中文 (default) |
shift_jis | 日本語 |
gbk | 简体中文 |
euc-kr | 한국어 |
cp1252 | Western European |
The plugin's SessionStart hook (session_init.py) automatically creates these files if they don't exist:
| File | Purpose |
|---|---|
.vb6-encoding | Encoding config (default: big5) |
.gitattributes | CRLF line ending enforcement for VB6 files |
.git/hooks/pre-commit | Safety net — restores pending files before commit |
No manual setup is needed.
If a file is Read but never Edited (left in UTF-8), these safety nets restore it:
Important: Do not run VB6 IDE while Claude Code is editing VB6 files. The temporary UTF-8 state on disk would corrupt VB6 IDE's view of the files.
The hooks automatically handle encoding conversion:
| Tool | Problem |
|---|---|
sed -i | Strips CR from CRLF on Git Bash |
iconv | Stops on first unconvertible char, truncates file |
Use the Write tool directly. The PostToolUse(Write) hook automatically converts to native encoding + CRLF.
.frm files — format auto-fixed by hook.frm files have strict format requirements. The PostToolUse(Write) hook automatically fixes these common issues:
Begin VB.Form MyForm → Begin VB.Form MyForm (auto-added)Object={GUID}#ver; name.OCX → Object = "{GUID}#ver"; "name.OCX" (auto-fixed)You only need to get the content structure right (correct control nesting, property names, values).
The hook handles the format quirks. For full .frm format details, consult references/frm-format.md.
file Source/modified_file.bas
ISO-8859 text, with CRLF line terminators (ANSI encodings show as ISO-8859)Unicode text, UTF-8 text, with CRLF line terminatorsISO-8859 text (missing CRLF — line endings were stripped)Use the plugin's bundled compile.bat:
cmd.exe //c "cd /d <PROJECT_DIR> && ${CLAUDE_PLUGIN_ROOT}\scripts\compile.bat <PROJECT>.vbp"
compile.bat automatically restores any pending encoding files before compiling.[OK] Compile succeeded. at the end.[FAIL], read the compile.log and .log files next to the failing .frm.VB6 compile errors report line numbers relative to the code section of .frm files, not the absolute file line.
For .frm files, the code section starts after the Attribute VB_Exposed line. To find the actual file line:
Attribute VB_Exposed line number (e.g., line 163)For .bas and .cls files, the line number is counted from Attribute VB_Name (line 1 of the file), so it matches the file line directly.
VB6 uses .rc resource files (STRINGTABLE) for UI strings, compiled into .RES binary.
The .rc files are also ANSI encoded — Edit tool works safely on them (protected by hooks).
Auto-compile rule: If the .vbp contains a ResFile32= entry, check whether the referenced .RES file is missing or older than its corresponding .rc source. If so, compile the .rc before compiling the .vbp. VB6 links the .RES at compile time — a stale or missing .RES means the binary will have outdated or missing resource strings.
To compile .rc files:
cmd.exe //c "${CLAUDE_PLUGIN_ROOT}\scripts\compile_rc.bat \"<PROJECT_DIR>\Source\Resource\<main>.rc\""
For full details on string ID ranges, file structure, and troubleshooting,
consult references/resource-compilation.md.
After creating new .bas or .frm files, add entries to the .vbp project file.
The .vbp is ASCII-safe, so the Edit tool is acceptable for this file.
Module=ModuleName; Source\filename.basForm=Source\filename.frmAll paths relative to ${CLAUDE_PLUGIN_ROOT}:
scripts/compile.bat — VB6 command-line compiler wrapper (auto-restores pending files)scripts/compile_rc.bat — Resource compiler wrapper (.rc → .RES)scripts/git-pre-commit — Git pre-commit hook (auto-installed by SessionStart)hooks/scripts/session_init.py — SessionStart: creates .vb6-encoding, .gitattributes, installs git hookhooks/scripts/vb6_config.py — Shared config: reads .vb6-encoding, detects encodinghooks/scripts/vb6_pre_read.py — PreToolUse(Read): ANSI→UTF-8, file stays UTF-8 until Edit restoreshooks/scripts/vb6_post_edit.py — PostToolUse(Edit): UTF-8→ANSI+CRLF restorehooks/scripts/vb6_post_write.py — PostToolUse(Write): UTF-8→ANSI+CRLF + .frm format auto-fixhooks/scripts/vb6_restore.py — Safety net: SessionEnd + git pre-commit + compile.batreferences/frm-format.md — VB6 .frm file format specification and common mistakesreferences/resource-compilation.md — Resource file workflow, string ID ranges, troubleshootingGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub jasoncychueh/claude-vb6-plugin --plugin vb6-project