vb-core
FreeNo executable scriptsNot checkedCore VB.NET patterns, type safety, modern language features
by bobmatnyc★ 79 GitHub starsAbout this skill
Visual Basic .NET Core Patterns
Modern VB.NET (2019+) best practices with focus on type safety, LINQ, async/await, and .NET integration.
Quick Start
' Always enable strict type checking
Option Strict On
Option Explicit On
Option Infer On
' Modern class definition
Public Class Customer
Public Property Id As Integer
Public Property Name As String
Public Property Email As String
' Constructor
Public Sub New(id As Integer, name As String, email As String)
Me.Id = id
Me.Name = name
Me.Email = email
End Sub
End Class
' Modern async method
Public Async Function GetCustomerAsync(id As Integer) As Task(Of Customer)
Dim result = Await database.QueryAsync(Of Customer)(
"SELECT * FROM Customers WHERE Id = @id",
New With {.id = id}
)
Return result.FirstOrDefault()
End Function
' LINQ query
Dim activeCustomers = From c In customers
Where c.IsActive AndAlso c.Balance > 0
Order By c.Name
Select c
Type Safety (Critical)
Option Strict On
' ALWAYS at top of every file
Option Strict On
Option Explicit On
Option Infer On
' Why:
' - Option Strict: Prevents implicit narrowing conversions
' - Option Explicit: Requires variable declaration
' - Option Infer: Enables type inference (but still type-safe)
Explicit Types vs Inference
' ✅ Good: Explicit when clarity helps
Dim customerName As String = GetCustomerName(id)
Dim count As Integer = GetCount()
' ✅ Good: Inference when type is obvious
Dim customer = New Customer(1, "John", "[email protected]")
Dim items = New List(Of String) From {"a", "b", "c"}
' ❌ Bad: Dim without type and no inference
Dim data = GetData() ' What type is data?
' ✅ Better: Be explicit
Dim data As DataTable = GetData()
Nullable Types
' Modern nullable syntax (VB 15.5+)
Dim middleName As String? = Nothing
Dim age As Integer? = Nothing
' Null-conditional operator
Dim length As Integer? = middleName?.Length
' Null-coalescing operator
Dim displayName As String = middleName If Nothing
' Check for null
If age IsNot Nothing Then
Console.WriteLine($"Age: {age.Value}")
End If
' GetValueOrDefault
Dim years As Integer = age.GetValueOrDefault(0)
Modern Language Features
String Interpolation
' ✅ Modern (VB 14+)
Dim message = $"Customer {customer.Name} has balance {customer.Balance:C}"
' ❌ Old style (avoid)
Dim message = String.Format("Customer {0} has balance {1:C}", customer.Name, customer.Balance)
' ❌ Concatenation (avoid for complex strings)
Dim message = "Customer " & customer.Name & " has balance " & customer.Balance.ToString("C")
Lambda Expressions
' Single-line lambda
Dim isAdult = Function(age As Integer) age >= 18
' Multi-line lambda
Dim calculateTax = Function(amount As Decimal) As Decimal
Dim rate = If(amount > 10000, 0.2D, 0.15D)
Return amount * rate
End Function
' Lambda in LINQ
Dim adults = customers.Where(Function(c) c.Age >= 18).ToList()
' Action lambda (Sub)
items.ForEach(Sub(item) Console.WriteLine(item))
Collection Initializers
' List initialization
Dim numbers = New List(Of Integer) From {1, 2, 3, 4, 5}
' Dictionary initialization
Dim config = New Dictionary(Of String, String) From {
{"ConnectionString", "Server=..."},
{"Timeout", "30"},
{"MaxRetries", "3"}
}
' Array initialization
Dim names As String() = {"Alice", "Bob", "Charlie"}
Tuple Support
' Named tuples (VB 15.3+)
Function GetCustomerInfo(id As Integer) As (Name As String, Email As String)
Return ("John Doe", "[email protected]")
End Function
' Usage
Dim info = GetCustomerInfo(1)
Console.WriteLine($"{info.Name}: {info.Email}")
' Deconstruction
Dim (customerName, customerEmail) = GetCustomerInfo(1)
LINQ Patterns
Query Syntax vs Method Syntax
' Query syntax (more readable for complex queries)
Dim query = From c In customers
Where c.IsActive
Order By c.Name
Select New With {
.Name = c.Name,
.Email = c.Email
}
' Method syntax (more flexible)
Dim query = customers _
.Where(Function(c) c.IsActive) _
.OrderBy(Function(c) c.Name) _
.Select(Function(c) New With {
.Name = c.Name,
.Email = c.Email
})
Common LINQ Operations
' Filtering
Dim activeCustomers = customers.Where(Function(c) c.IsActive).ToList()
' Projection
Dim names = customers.Select(Function(c) c.Name).ToList()
' Ordering
Dim sorted = customers.OrderBy(Function(c) c.Name).ThenBy(Function(c) c.Id)
' Grouping
Dim grouped = From c In customers
Group c By c.City Into Group
Select City, Customers = Group
' Aggregation
Dim total = orders.Sum(Function(o) o.Amount)
Dim average = orders.Average(Function(o) o.Amount)
Dim count = customers.Count(Function(
Install vb-core in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the vb-core skill do?
Core VB.NET patterns, type safety, modern language features
How do I install the vb-core skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the vb-core skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic