From wpf-dev-pack
Organizes literal strings in C# as const strings in static classes for error messages, logs, exceptions, and UI texts. Use for maintainability, reusability, and consistency in .NET codebases.
npx claudepluginhub christian289/dotnet-with-claudecode --plugin wpf-dev-packThis skill uses the workspace's default tool permissions.
A guide on handling literal strings in C# code.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
A guide on handling literal strings in C# code.
The templates folder contains a Console Application example (use latest .NET per version mapping).
templates/
└── LiteralStringSample/ ← Console Application
├── Constants/
│ ├── Messages.cs ← General message constants
│ └── LogMessages.cs ← Log message constants
├── Program.cs ← Top-Level Statement entry point
├── GlobalUsings.cs
└── LiteralStringSample.csproj
Literal strings should preferably be pre-defined as const string
// Good example
const string ErrorMessage = "An error has occurred.";
if (condition)
throw new Exception(ErrorMessage);
// Bad example
if (condition)
throw new Exception("An error has occurred.");
Manage by separating into static classes by message type:
// Constants/Messages.cs
namespace LiteralStringSample.Constants;
public static class Messages
{
// Error messages
public const string ErrorOccurred = "An error has occurred.";
public const string InvalidInput = "Invalid input.";
// Success messages
public const string OperationSuccess = "Operation completed successfully.";
}
// Constants/LogMessages.cs
namespace LiteralStringSample.Constants;
public static class LogMessages
{
// Information logs
public const string ApplicationStarted = "Application started.";
// Format strings
public const string UserLoggedIn = "User logged in: {0}";
}
using LiteralStringSample.Constants;
try
{
if (string.IsNullOrEmpty(input))
{
throw new ArgumentException(Messages.InvalidInput);
}
Console.WriteLine(Messages.OperationSuccess);
}
catch (Exception)
{
Console.WriteLine(Messages.ErrorOccurred);
}
// Using format strings
Console.WriteLine(string.Format(LogMessages.UserLoggedIn, userName));