rm-guide-namespaces

Generate file-scoped C# namespaces matching directory hierarchy in redmuffin.Blazor.StaticWeb.

Updated Nov 11, 2023
One-click install
npx skills add https://github.com/michaelvolz/redmuffin.Blazor.StaticWeb --skill rm-guide-namespaces
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rm-guide-namespaces
Source: https://github.com/michaelvolz/redmuffin.Blazor.StaticWeb/tree/main/.opencode/skills/redmuffin-standards/rm-guide-namespaces
Command: npx skills add https://github.com/michaelvolz/redmuffin.Blazor.StaticWeb --skill rm-guide-namespaces

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Keeping namespaces aligned with file scopes and folder paths is easy to forget when creating or refactoring C# files, which leads to inconsistent organization and harder navigation.

Core Features & Use Cases

  • File-scoped namespace reminder: Always structure namespaces to match the new file scope so that each type benefits from the simplified syntax introduced in modern C#.
  • Folder-path alignment: Translate the directory hierarchy into the namespace path for predictable placement across layers of redmuffin.Blazor.StaticWeb.
  • Use Case: When adding a component under Features/Home, set the namespace to redmuffin.Blazor.StaticWeb.Features.Home to reflect both its responsibility and its folder location.

Quick Start

Ask for rm-guide-namespaces when adding or moving a C# file so namespaces stay file-scoped and mirror the folder path.

Frequently Asked Questions about rm-guide-namespaces

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I align C# namespaces with folder structure when creating new files?

To align C# namespaces with folder structure, set the namespace path to mirror the directory hierarchy using file-scoped namespace syntax, ensuring predictable placement across project layers and consistent organization for easier navigation.

What is a file-scoped namespace in C# and when should I use it?

A file-scoped namespace in C# uses simplified syntax to declare the namespace on a single line. Use it when adding or moving C# files to ensure consistent namespace paths that match the folder location and prevent block-scoped formats.

Why does my C# code organization break when I refactor or move files between folders?

C# code organization breaks during refactoring because keeping namespaces aligned with folder paths is easy to forget, leading to inconsistent file scopes and harder navigation when types are relocated across project directory layers.

Can I use block-scoped namespaces when adding new C# files to a project?

Block-scoped namespaces are not recommended for new C# files. You should adopt file-scoped namespaces that mirror the directory hierarchy to satisfy requirements for consistent namespace paths and prevent block-scoped namespaces in new code.

What's the best way to keep namespace paths consistent across multiple project layers in C#?

The best way to keep namespace paths consistent is to translate the directory hierarchy into the namespace path for every new or relocated C# file, using file-scoped namespace syntax to reflect both responsibility and folder location.