Scope: Applies to all C# module code under
Modules/**. Loaded automatically by VS Code Copilot. Directives: Enforces structural integrity, type safety, and mandatory build validation. These rules are non-negotiable.
- Suffix: Use
*FactoryExtension(e.g.,DomainConstraintsFactoryExtension). One concern per extension; do not merge unrelated cross-cutting concerns. - Template Files:
*TemplatePartial.cs: Contains constructor, model wiring, and metadata attachment.*TemplateBase.cs: Generated; do not hand-edit except for scaffoldedAfterBuildcallbacks.
- ID Handling: Prefer using Template Role names (using string constants) over the template's
TemplateIdconstant (staticconst string) for lookups. As last resort using hardcodedTemplateIdstrings.
- Scan Before You Name: Search for existing patterns before creating new classes.
grep_search→semantic_search→ then decide. Prefer extending abstractions over parallel ones. - Access Modifiers: Define all new types as
internalby default. Only usepublicif explicitly required for the external API. - Shared Projects: Do not introduce
.shproj/.projitemsfor new components without explicit approval. Prefer a referenced.csprojwithPrivateAssets="All".
- Eliminate Magic Values: Use
constorstatic readonlyfields. No inline magic numbers or strings. - Modern Strings: Use verbatim literals (
@"...") for quotes and raw string literals ("""...""") for multi-line blocks. - Warning: Never use global singletons for template-family scope (state must be clearable between Software Factory runs).
- Protocol: Owning templates attach managers in constructors. External extensions use
TryGetMetadata. Owning templates callmanager.ApplyRules()inAfterBuildat priority0. - Execution Priorities:
Band Integer Usage Core 0Owning template builds primary structure Enrichment 100Same-module cross-cutting additions Extension 500Factory extensions from other modules Final 1000FindMethod/FindClasson fully-built output
| Phase | Allowed Actions |
|---|---|
OnBeforeTemplateExecution |
Publish events (Registration Requests). No CSharpFile mutation. |
OnAfterTemplateRegistrations |
Find instances, schedule callbacks, register into managers. No event publishing. |
OnBuild / AfterBuild |
Mutate CSharpFile, read metadata, call ApplyRules. |
After every code change, verify the exit code is 0:
dotnet build "path/to/affected.csproj" --no-incremental --verbosity minimal --nologoSpecialized skills live in Modules/.agents/skills/. Load the relevant skill before generating code for that scenario — each skill contains Musts, Must Nots, pattern indexes, and a resource folder.
| Skill | Path | When to use |
|---|---|---|
| file-builder-expert | skills/file-builder-expert/SKILL.md |
Converting a C# class to a CSharpFile fluent template; writing OnBuild/AfterBuild callbacks; creating template registration classes; resolving types via GetTypeName/UseType. |
| intent-mapping-architect | skills/intent-mapping-architect/SKILL.md |
Generating update/creation mappings from designer metadata; implementing CSharpClassMappingManager, IMappingTypeResolver, or CSharpMappingBase; handling recursive object/collection mapping. |
| intent-metadata-consumer | skills/intent-metadata-consumer/SKILL.md |
Reading stereotype properties to drive code generation; authoring or extending *StereotypeExtensions.cs; writing LINQ queries against typed model collections (ClassModel, DTOModel, etc.). |
| intent-module-orchestrator | skills/intent-module-orchestrator/SKILL.md |
Dispatching ContainerRegistrationRequest / AppSettingRegistrationRequest via EventDispatcher; finding and modifying templates from other modules; authoring *FactoryExtension classes; priority-band ordering. |
Maintenance: Use
Modules/.agents/prompts/refresh-intent-skills.prompt.mdto audit skills against the latest SDK and update any stale patterns or resource files.
If architectural or logic paths are unclear and require runtime context:
- Instrument the Code: Add temporary log entries using
Intent.Utils.- Example:
Logging.Log.Debug("Context: " + variable);
- Example:
- Request Execution: Ask the user to run the module/Software Factory.
- Analyze Output: Request the specific log output from the user before proceeding with further code changes.