Individual skill

orchardcore-source-generators

Skill for using Orchard Core source generators and build-time analyzers. Covers the GenerateArguments attribute for compile-time named argument types, anonymous type interceptors for .NET 9+, PropertyBasedNamedEnumerable, the GenerateShape attribute and shape factory interceptors that avoid runtime proxies, the OCSG001 analyzer for sealed shape models, the OCSG002 analyzer for FeatureAttribute targets outside the current module, migration from anonymous to named types, and performance optimization. Use this skill when requests mention Orchard Core Source Generators, [GenerateArguments], What Gets Generated, OCSG001, OCSG002, sealed view model warning, Feature attribute ignored, or closely related Orchard Core troubleshooting work. Strong matches include OrchardCore.SourceGenerators, OrchardCore.DisplayManagement, INamedEnumerable, [GenerateShape], FeatureAttribute, RequireFeatures, Initialize, CreateAsync.

plugins/orchardcore/skills/orchardcore-source-generators/SKILL.md

Read pinned source

Source commit d86d04f234b1b2bd8145368a2544490f9d557596

What was checked

Matches the observed repository HEAD
Yes
Scanner rules are current
Yes
Repository scan complete
No
Skill scan complete
No
Observed behavior
Instructions only
Last checked
Nov 6, 2026

These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.

Install this skill

Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.

An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.

Repository context

Repository stars (not skill ratings)
13
Repository last updated
Oct 21, 2026
License
MIT

Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.

Files and excerpt

File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.

Browse files
Read excerpt

# Orchard Core Source Generators - Prompt Templates

## Use Source Generators for Performance Optimization

You are an Orchard Core expert. Generate code using source generators, the `[GenerateArguments]` attribute, anonymous type interceptors, and named argument types for shapes and display management.

### Guidelines

- Use `[GenerateArguments]` on `partial` classes to generate optimized `INamedEnumerable<object>` implementations at compile time.
- Generated classes extend `PropertyBasedNamedEnumerable` with zero-reflection property access via switch expressions.
- Classes marked with `[GenerateArguments]` must be `partial` and have at least one public instance property with a getter.
- For .NET 9+ projects, anonymous types passed to `Arguments.From()` are automatically optimized by interceptors.
- On older .NET versions, `Arguments.From()` falls back to cached reflection (acceptable for infrequent usage).
- Prefer named types with `[GenerateArguments]` for production code over anonymous types.