Extracts duplicated properties, methods, and logic from sibling Blazor components into a shared intermediate base class. Covers identification of duplicated surfaces, base class creation, member migration, and @inherits directive updates. Use when three or more components share copy-pasted Parameter declarations, consolidating shared helper methods, or refactoring component inheritance hierarchies.
94
92%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
confidence: low source: earned
When multiple components in the same inheritance tier share identical properties, methods, or logic that should live in a common base class. Signs: 3+ components with copy-pasted [Parameter] declarations and helper methods.
List every property, method, and field that appears identically (or near-identically) across the sibling components. Only consolidate members that are truly shared by ALL siblings.
Place it in the same directory/namespace as its parent. Inherit from the existing shared parent:
public class BaseListControl<TItem> : DataBoundComponent<TItem>[Parameter] properties: move as-isprotected if subclasses or .razor templates call them, private otherwise: OldParent to : NewBase in .razor.cs@inherits OldParent to @inherits NewBase in .razorA successful build confirms no accidental member hiding or missing references. Watch for CS0263 (partial class base mismatch) — both .razor and .razor.cs must agree on the base class.
@inherits in the .razor file and : BaseClass in the .razor.cs must specify the same type for partial classes.protected methods in the base are accessible from .razor template code (@code blocks and inline expressions).ListItem copies to apply formatting, preserve all properties (Text, Value, Selected, Enabled) to avoid data loss.GetItems() at render time, not at bind time, so they affect both static and data-bound items.[Parameter] declarations remain in subclasses@inherits directives updated in all .razor files1bd9b17
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.