Visual Basic Coding Practices
Application skill for VB.NET style (archived awesome-guidelines capsules). Legacy VB6 Wikibooks Hungarian rules apply only when maintaining pre-.NET code.
Core Principle
VB.NET quality is Framework-aligned naming plus Strict options and readable blocks, PascalCase public API, Try/Catch, no legacy On Error or Hungarian on new code.
When to Use / NOT
- VB.NET libraries, WinForms/WPF/ASP.NET VB projects,
.vb modules and classes.
- Setting up Option Strict, XML docs,
dotnet format, analyzer/build CI.
NOT when:
- C# / F#, use language-specific practice skills.
- Pure VB6/VBA maintenance, Wikibooks Hungarian may apply locally; do not mix into new.NET modules without migration plan.
Workflow
- Formatting, indent, statements, comments (
vb-style-formatting-layout.md).
- Naming, PascalCase/camelCase,
m_ fields (vb-style-naming-types.md).
- Idioms, options, Try/Catch, LINQ, events (
vb-style-idioms-control.md).
- Docs/verify, XML docs, file layout, build (
vb-style-docs-verify.md).
- Verify,
dotnet build, dotnet format, tests on changed projects.
Red Flags
- Missing Option Strict/Explicit on hand-written files
- Tab characters without space conversion
- Multiple statements per line (
: separator)
- Heavy
_ continuation where implicit works
My or my in identifier names
- Hungarian prefixes on new VB.NET (
strName, iCount)
On Error Goto instead of Try/Catch
Not x Is Nothing instead of x IsNot Nothing
- Type suffix characters (
$, %, #)
- Class containing only Shared methods (use Module)
Microsoft.VisualBasic.Compatibility usage
- Single-letter names without clear geometric/index role
- Asterisk comment boxes
- End-of-line comment preference over own-line (MS style)
- Multiple public types in one file
- Public API without XML documentation
- LINQ join expressed only via Where
- Empty Else/Case Else without documented intent
- Bug fix without build/test verification
Verification
dotnet build on affected projects
dotnet format --verify-no-changes when repo configures it
- Option Strict/Explicit header on new/changed
.vb
- Public API XML doc spot-check
- Capsule checklist on legacy-vs-.NET naming boundary
References
awesome-guidelines/references/vb-style-learning-note.md
awesome-guidelines/references/vb-style-formatting-layout.md
awesome-guidelines/references/vb-style-naming-types.md
awesome-guidelines/references/vb-style-idioms-control.md
awesome-guidelines/references/vb-style-docs-verify.md
1---2name: vb-coding-practices3description: Use when authoring or reviewing Visual Basic.NET, Option Strict/Explicit, 4-space layout, Framework PascalCase naming, Try/Catch idioms, XML docs on public API, and dotnet format/build/test in CI.4---56# Visual Basic Coding Practices78Application skill for VB.NET style (archived `awesome-guidelines` capsules). Legacy VB6 Wikibooks Hungarian rules apply only when maintaining pre-.NET code.910## Core Principle1112VB.NET quality is **Framework-aligned naming plus Strict options and readable blocks**, PascalCase public API, Try/Catch, no legacy On Error or Hungarian on new code.1314## When to Use / NOT1516- VB.NET libraries, WinForms/WPF/ASP.NET VB projects, `.vb` modules and classes.17- Setting up Option Strict, XML docs, `dotnet format`, analyzer/build CI.1819**NOT when:**2021- C# / F#, use language-specific practice skills.22- Pure VB6/VBA maintenance, Wikibooks Hungarian may apply locally; do not mix into new.NET modules without migration plan.2324## Workflow25261. **Formatting**, indent, statements, comments (`vb-style-formatting-layout.md`).272. **Naming**, PascalCase/camelCase, `m_` fields (`vb-style-naming-types.md`).283. **Idioms**, options, Try/Catch, LINQ, events (`vb-style-idioms-control.md`).294. **Docs/verify**, XML docs, file layout, build (`vb-style-docs-verify.md`).305. **Verify**, `dotnet build`, `dotnet format`, tests on changed projects.3132## Red Flags3334- Missing Option Strict/Explicit on hand-written files35- Tab characters without space conversion36- Multiple statements per line (`:` separator)37- Heavy `_` continuation where implicit works38- `My` or `my` in identifier names39- Hungarian prefixes on new VB.NET (`strName`, `iCount`)40- `On Error Goto` instead of Try/Catch41- `Not x Is Nothing` instead of `x IsNot Nothing`42- Type suffix characters (`$`, `%`, `#`)43- Class containing only Shared methods (use Module)44- `Microsoft.VisualBasic.Compatibility` usage45- Single-letter names without clear geometric/index role46- Asterisk comment boxes47- End-of-line comment preference over own-line (MS style)48- Multiple public types in one file49- Public API without XML documentation50- LINQ join expressed only via Where51- Empty Else/Case Else without documented intent52- Bug fix without build/test verification5354## Verification5556- `dotnet build` on affected projects57- `dotnet format --verify-no-changes` when repo configures it58- Option Strict/Explicit header on new/changed `.vb`59- Public API XML doc spot-check60- Capsule checklist on legacy-vs-.NET naming boundary616263## References6465- `awesome-guidelines/references/vb-style-learning-note.md`66- `awesome-guidelines/references/vb-style-formatting-layout.md`67- `awesome-guidelines/references/vb-style-naming-types.md`68- `awesome-guidelines/references/vb-style-idioms-control.md`69- `awesome-guidelines/references/vb-style-docs-verify.md`