Skip to content
Back to skills

Coreex Scaffold

ASecurity

Guide CoreEx solution scaffolding and retrofit decisions after bootstrap. USE FOR: choosing coreex templates and options (API, Relay, Subscribe, database, messaging, refdata, DDD, ROP), checking the current solution shape, adding missing hosts or an Aspire AppHost, or preparing a first local runnable state. DO NOT USE FOR: unrelated runtime debugging, creating the initial AI bootstrap (use coreex-bootstrap), or re-scaffolding an existing solution. INVOKES: workspace inspection, a one-question...

  • 29 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 24, 2026
ai-agentsshellsqlrailsazuretestingdebugginggitapidatabase

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add Avanade/CoreEx --skill coreex-scaffold --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coreex Scaffold?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coreex Scaffold
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/avanade-coreex-scaffold/badge)](https://www.skillsdirectory.com/skills/avanade-coreex-scaffold)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: coreex-scaffold
description: "Guide CoreEx solution scaffolding and retrofit decisions after bootstrap. USE FOR: choosing coreex templates and options (API, Relay, Subscribe, database, messaging, refdata, DDD, ROP), checking the current solution shape, adding missing hosts or an Aspire AppHost, or preparing a first local runnable state. DO NOT USE FOR: unrelated runtime debugging, creating the initial AI bootstrap (use coreex-bootstrap), or re-scaffolding an existing solution. INVOKES: workspace inspection, a one-question interview, pinned template installation, dry-run validation, template generation or retrofit, solution wiring, and focused build/test validation."
argument-hint: "Optional: base solution name, whether this is new or retrofit, required hosts, database choice, messaging needs, and whether to add an Aspire AppHost for local orchestration."
tags: ["coreex", "scaffolding", "retrofit", "template", "hosts", "aspire", "apphost", "orchestration"]
---

<!--
  AI workflow asset — dual-audience notice:
  - In the Avanade/CoreEx repository: this file is the authored source. Edit it here.
  - In a consumer repository: this file was generated by `dotnet new coreex-ai` (or refreshed via
    `dotnet new coreex-ai --force` / the `/coreex-docs-sync` skill). Do not hand-edit it directly —
    propose the change upstream in Avanade/CoreEx instead, then refresh once it is released.
-->

# CoreEx Scaffold

Guides a repository through the right CoreEx setup path by interviewing the user in simple English and translating the answers into safe CoreEx template commands.

## When to Use

- Starting a new CoreEx domain or service from a repository that already contains only the bootstrap AI assets.
- Deciding whether the first cut should create just the API host or also include the outbox relay and/or subscriber hosts.
- Adding missing `Api`, `Relay`, `Subscribe` or `Functions` hosts, including standalone Functions integration apps without shared libraries.
- Adding a repository/Test.Common baseline without business layers, or an independent CodeGen console without a database/reference-data scaffold.
- Preparing local Functions dependencies and test-owned broker topology without adding application capabilities.
- Adding an Aspire AppHost so a solution's hosts can be run and debugged together locally, with a dashboard.
- Converting plain-English project needs into either the matching `dotnet new coreex*` commands or the safest retrofit path.

## When Not to Use

- You are debugging local runtime, container, Aspire, or package restore issues unrelated to project shaping.
- You still need to create the initial bootstrap repository; run `dotnet new coreex-ai` then `/coreex-bootstrap` before this skill is used.
- You want architectural guidance for an existing implementation beyond project setup; use `CoreEx Expert` instead.

## Workflow Overview

1. **Inspect the workspace shape first.**
2. **Interview the user in simple English.** Ask one short question at a time and turn the answers into template inputs.
3. **Validate the naming shape before any template command.**
4. **Choose the safest implementation path.** Prefer dry-runs and stop on layout mismatches.
5. **Apply the right shape.** Generate only what is missing or explicitly requested.
6. **Validate the scaffold.** Wire projects into the solution, then choose between shape validation and fully runnable local validation.
7. **Summarize the result.** Show the derived inputs, commands, validations, and any deferred steps.

For step-by-step guidance, see [references/workflow.md](references/workflow.md).

For local Functions infrastructure, read [references/local-infrastructure.md](references/local-infrastructure.md): Compose/Azurite, test-owned Service Bus topology, guarded queue setup and host connection settings. Apply it when local setup is requested, not automatically during empty scaffolding.

## Interactive Interview Rules

- Resolve recorded decisions and inspect the existing solution before asking.
- Ask only unresolved behavioral or design questions, one question per interaction, using the available interaction mechanism (for example, `ask_user`). Never rely on an unavailable confirmation-card tool.
- Ask short, plain-English questions. Do not ask the user to supply template flag names.
- The canonical interview order is: base solution name, new vs retrofit, HTTP API, reliable event publishing, event consumption, data storage, messaging provider when needed, reference data, domain layer, and ROP.
- Prefer either/or or small-choice questions before any extra freeform follow-up.
- For conventional solution templates, if the user gives a partial or non-canonical name, stop and help them reach `[Company].[Product].[Domain]` before any template command. Functions has the deployment-name exception below; do not impose a new domain/root scaffold on standalone apps.
- If the workspace already proves a choice, restate it in the implementation plan instead of asking again.
- Apply documented implementation defaults in the plan instead of turning them into user questions: preserve standard test projects, use the local setup recipe's safety guards and defer runtime harnesses until a capability needs them. Ask only when requirements conflict or change scope.
- Present one compact implementation plan once requirements are resolved. Wait for explicit approval unless the user's request already authorizes implementation; approval remains valid unless scope changes.
- An unavailable user or approval tool is not approval. If explicit approval is required, use the available interaction mechanism; if none is available, present the plan once and stop pending approval. Do not retry the same question or invent consent.
- Before any real `dotnet new` command, restate the derived inputs in one compact summary. Ask again only if an unresolved ambiguity materially changes the scaffold.

## Default Selection Policy

When the workspace does not already prove a value, recommend the safest default that still keeps the workflow moving:

| Question | Default |
|---|---|
| Base solution name | The workspace root folder name if it is already in `[Company].[Product].[Domain]` form; otherwise the best canonical guess from workspace hints. If only two parts exist, use `Product` as a temporary middle segment. The user can override during the interview. |
| New domain or retrofit | `New domain` in a bootstrap-only repo |
| HTTP API | `Yes` |
| Reliable event publishing | `No` |
| Event consumption | `No` |
| Data storage | `No local database` |
| Messaging provider | `Yes` for Azure Service Bus when messaging is needed |
| Reference data | `No` |
| Domain layer | `No` |
| Result/ROP style | `No` |
| Aspire AppHost | `No` |

Set outbox to `true` only when the user chose owned persistence and reliable publishing. Otherwise keep it `false`.

## Quick Reference

| User answer | Template impact |
|---|---|
| "I need HTTP endpoints." | Add `coreex-api`. |
| "I need a Functions app." | Add `coreex-functions`; determine shared-core versus standalone from requirements/references. No trigger is generated. |
| "I need to publish events reliably." | Add `coreex-relay`; use a messaging provider and keep outbox enabled where relevant. |
| "I need to consume events." | Add `coreex-subscribe`; use a messaging provider. |
| "This service stores its own data in SQL Server." | `--data-provider SqlServer` |
| "This service stores its own data in Postgres." | `--data-provider Postgres` |
| "This service stores its own data in Azure Cosmos DB." | `--data-provider Cosmos` |
| "This is a facade. No local database." | `--data-provider None` |
| "I need reference data." | `--refdata-enabled true` |
| "I want a Domain layer." | Add `coreex-domain` addon after `coreex` |
| "I want Result/ROP style pipelines." | `--rop-enabled true` |
| "I want to run everything locally with one command / a dashboard." | Add `coreex-aspire` after all chosen hosts exist, with `--has-api`/`--has-relay`/`--has-subscribe` matching what was chosen |

## Prerequisite

Before this skill runs, the repository must already be in one of these states:
- A bootstrap-only shell created by `coreex-bootstrap`; or
- An existing CoreEx solution that is missing hosts, root/shared-test conventions or independent CodeGen tooling.
- An existing Functions solution that needs local dependency files or deliberately selected infrastructure setup tooling.

**Standalone baseline:** use `coreex-solution` for a new Functions/integration repository: root solution/build/package conventions and lightweight Test.Common by default (`--test-common false` opts out), without Application/Infrastructure/Contracts or a database. Raw `coreex-functions --shared-core false` remains supported without a baseline and uses inline versions only when CPM is not enabled. For existing repositories, follow the [safe baseline retrofit](references/workflow.md#standalone-baseline-and-existing-project-retrofit); do not overwrite root policy.

**AI assets:** If the repository does not yet have `.github/instructions/` or `.github/agents/`, the consumer should run `dotnet new coreex-ai` at the repo root first (optionally with `--app-folder <subfolder>` for monorepos), installed from an explicitly pinned `CoreEx.Template::<version>` (see [Version-pin discipline](/.github/coreex-ai-workflows.md#version-pin-discipline)). This skill will remind the user if AI assets appear to be absent.

## Naming Rules

**Functions deployment names:** `coreex-functions` takes the full deployment name ending in `.Functions`, e.g. `Sales.Functions` or `Sales.Imports.Functions`. It is not restricted to four parts. Default shared-core references use the name minus the final suffix; pass `--solution-name Company.Product.Sales` when deployment and shared library prefixes differ. Test names replace the final `.Functions` with `.Test.Functions`, independently of `--solution-name`. The canonical rules below apply to the other solution/addon templates.

`coreex-solution` takes the actual solution name without imposing a three-part domain. `coreex-codegen` takes the full project name ending `.CodeGen` and emits `tools/<full-project-name>/`; reuse existing tools instead of generating duplicates.

- The base solution name must be in `[Company].[Product].[Domain]` form, e.g. `Avanade.Bookstore.Books`.
- The `coreex` (solution) template takes the **3-part base name**: `-n Company.Product.Books`. If the current directory is already named `Company.Product.Books`, `-n` can be omitted — the template uses the folder name automatically.
- Every **addon template** — `coreex-domain` included — takes a **4-part name** with its suffix appended:
  - `coreex-domain -n Company.Product.Books.Domain`
  - `coreex-api -n Company.Product.Books.Api`
  - `coreex-relay -n Company.Product.Books.Relay`
  - `coreex-subscribe -n Company.Product.Books.Subscribe`
  - `coreex-aspire -n Company.Product.Books.Aspire`
- Addon templates **always require `-n`** — the folder name is the 3-part base and cannot supply the addon's suffix automatically.
- `coreex-aspire` also always requires `--has-api`/`--has-relay`/`--has-subscribe` set explicitly to match whichever hosts this solution actually has — unlike the other host templates, there is no shared parameter it can derive this from.
- Do not pass the 3-part base name to an addon template; doing so causes it to emit into `src/Company.Product.Books/` instead of its own suffixed folder, colliding with (or overwriting) sibling addons.
- If the user gives only a two-part name, ask for the missing segment before running any template.
- If the repository already exists with a non-canonical root name (e.g., `Avanade.Books`), prefer a manual retrofit unless the user explicitly wants to rename the solution first.

## Command Patterns

### Functions Host and Test Pair

From the solution/output root, inspect an existing host first; create only explicitly requested missing deployments. Dry-run before applying:

```text
# Shared application libraries; --solution-name is needed only if prefixes differ.
dotnet new coreex-functions -n Company.Product.Sales.Imports.Functions --solution-name Company.Product.Sales --dry-run
dotnet new coreex-functions -n Company.Product.Sales.Imports.Functions --solution-name Company.Product.Sales

# New standalone repository: baseline and shared test support, not business layers.
dotnet new coreex-solution -n Sales --dry-run
dotnet new coreex-solution -n Sales
dotnet new coreex-functions -n Sales.Imports.Functions --shared-core false --test-common-project "..\Sales.Test.Common\Sales.Test.Common.csproj" --dry-run
dotnet new coreex-functions -n Sales.Imports.Functions --shared-core false --test-common-project "..\Sales.Test.Common\Sales.Test.Common.csproj"
```

Functions emits `src/<full-host-name>/` and `tests/<host-name-with-Test.Functions>/`. Register both under `hosts`/`tests` and build by solution or project path. Discover the actual Test.Common project and supply its path relative to the generated test project using `--test-common-project`; omission generates no common reference, and a supplied missing path fails the build. Existing test projects use the SDK reference command instead. Package management follows effective CPM independently of `shared-core`; merge missing central entries deliberately, never add them or change existing pins silently. Record actual deployments/features in root/host guidance. Multiple hosts may share libraries but must not reference one another. Use [`coreex-functions`](../coreex-functions/SKILL.md) for real capabilities and tests.

**Test defaults:** a new layered Functions solution uses `coreex` for its shared libraries, retaining the generated `Test.Unit` and `Test.Common`; `coreex-functions` adds `Test.Functions`, not a replacement for `Test.Unit`. Keep isolated application validators/mappers/logic in `Test.Unit`, and invocation/composition coverage in `Test.Functions`. Standalone uses its generated `Test.Functions` and optional shared test support; do not invent a separate `Test.Unit` project merely to match the layered shape. Host-local file types can be tested in `Test.Functions`; do not add a Functions host reference to `Test.Unit` just to move those tests.

Do not pass data-provider/outbox/refdata flags to this template or automatically scan all shared services. Capability setup owns those dependencies. `coreex-aspire` does not generate Functions references; wire a requested Functions runtime into an existing AppHost using the project's verified Functions integration rather than its Api/Relay/Subscribe flags.

### Bootstrap-Only Repository

```text
# Step 1: Run the solution template. If the folder is named Avanade.Product.Books, -n can be omitted.
dotnet new coreex -n Avanade.Product.Books --data-provider SqlServer --messaging-provider ServiceBus --refdata-enabled true --outbox-enabled true --rop-enabled false

# Step 1a (optional): Add the Domain layer when domain complexity warrants DDD.
dotnet new coreex-domain -n Avanade.Product.Books.Domain
dotnet sln Avanade.Product.Books.slnx add src/Avanade.Product.Books.Domain --include-references false

# Step 2: Add each host template using the 4-part name (base + host suffix).
dotnet new coreex-api        -n Avanade.Product.Books.Api        --data-provider SqlServer --refdata-enabled true --outbox-enabled true
dotnet new coreex-relay      -n Avanade.Product.Books.Relay      --data-provider SqlServer --messaging-provider ServiceBus
dotnet new coreex-subscribe -n Avanade.Product.Books.Subscribe --data-provider SqlServer --messaging-provider ServiceBus --refdata-enabled true

# Step 2a (optional): Add an Aspire AppHost for local orchestration, once the hosts above exist.
dotnet new coreex-aspire -n Avanade.Product.Books.Aspire --has-api true --has-relay true --has-subscribe true --data-provider SqlServer --messaging-provider ServiceBus

# Step 3: Add host and test projects to the solution file.
dotnet sln Avanade.Product.Books.slnx add src/Avanade.Product.Books.Api --solution-folder hosts --include-references false
dotnet sln Avanade.Product.Books.slnx add tests/Avanade.Product.Books.Test.Api --solution-folder tests --include-references false
dotnet sln Avanade.Product.Books.slnx add src/Avanade.Product.Books.Relay --solution-folder hosts --include-references false
dotnet sln Avanade.Product.Books.slnx add tests/Avanade.Product.Books.Test.Relay --solution-folder tests --include-references false
dotnet sln Avanade.Product.Books.slnx add src/Avanade.Product.Books.Subscribe --solution-folder hosts --include-references false
dotnet sln Avanade.Product.Books.slnx add tests/Avanade.Product.Books.Test.Subscribe --solution-folder tests --include-references false
dotnet sln Avanade.Product.Books.slnx add aspire/Avanade.Product.Books.Aspire --include-references false
dotnet sln Avanade.Product.Books.slnx add aspire/Avanade.Product.Books.Aspire.MockHost --include-references false
dotnet sln Avanade.Product.Books.slnx add aspire/Avanade.Product.Books.Test.Aspire --include-references false

# Step 4: Validate the generated solution.
dotnet build Avanade.Product.Books.slnx
dotnet test tests/Avanade.Product.Books.Test.Unit
# Run broader test projects only when their local infrastructure dependencies are available.
```

Host projects always live physically under `src/` and are grouped under the virtual `/hosts/` solution folder. Host test projects live under `tests/` and the `/tests/` solution folder. Always pass `--solution-folder` when adding hosts; a solution folder does not change a project's filesystem path. The examples use `--include-references false`; omit it on SDKs that do not expose that option (see [solution registration](references/workflow.md#solution-registration-and-deferred-work)).

### Existing Repository Retrofit (Skip Bootstrap)

```text
# Existing implementations: preserve root policy and generate only missing addons.
# A missing standalone baseline uses the reviewed retrofit workflow, never coreex --force.
dotnet new coreex-domain     -n Company.Product.Books.Domain    # optional: only when DDD is needed
dotnet new coreex-api        -n Company.Product.Books.Api ...
dotnet new coreex-relay      -n Company.Product.Books.Relay ...
dotnet new coreex-subscribe -n Company.Product.Books.Subscribe ...
dotnet new coreex-aspire    -n Company.Product.Books.Aspire --has-api ... --has-relay ... --has-subscribe ...   # optional: only if the repo needs local orchestration
# Then add new projects to the solution file as in Step 3 above.
```

**Adding an AppHost that already exists:** if `coreex-aspire` output already exists and a new host is being added, do not re-run `coreex-aspire --force` — it will overwrite any customisation already made to `AppHost.cs`. Instead, add the missing `<ProjectReference>` and `builder.AddProject<...>(...)` line to the existing files by hand.

**Adding an API host after CodeGen already ran:** when `refdata-enabled` is `true`, the `*.CodeGen` tool only emits the reference-data controller into an `*.Api` project directory that exists at generation time — it silently skips it (a log warning, not an error) for any `coreex-api` added afterward. If `coreex-api` is added to a solution where CodeGen has already been run at least once, re-run `dotnet run --project tools/[solution].CodeGen` afterward so the new host gets its reference-data controller.

## Existing Repository Guardrails

- **Bootstrap is a prereq:** This skill assumes `dotnet new coreex-ai` has already been run and (for a blank repo) `/coreex-bootstrap` has generated root guidance files.
- **For retrofit work:** Never rerun the full root scaffold over populated implementations. A missing standalone baseline may be staged separately with `coreex-solution`, then merged through the [reviewed retrofit](references/workflow.md#standalone-baseline-and-existing-project-retrofit), including existing-project registration, Test.Common references and version-preserving CPM migration.
- **Template identity conflicts:** If `dotnet new list` or template execution reports duplicate CoreEx template identities, warn the user which template source is being selected before continuing.
- **Version-pin discipline:** If `CoreEx.Template` needs installing or updating here, never run a bare `dotnet new install CoreEx.Template` — resolve and pin an explicit `::<version>` matching the project's referenced `CoreEx` NuGet version (see [coreex-ai-workflows.md § Version-pin discipline](/.github/coreex-ai-workflows.md#version-pin-discipline)).
- **Pre-flight validation:** Always run a dry-run with the intended base solution name before any real domain/host template invocation.
- **Watch for nested roots:** If dry-run output shows paths like `src\\Company.Product.Books.Api\\src\\Company.Product.Books.Api\\...`, the output root is wrong; stop and change strategy.
- **Naming mismatch:** If dry-run output shows incorrect project names because the repo uses a non-canonical root name, stop and recommend either renaming the solution first or manually creating the missing hosts.
- **Force only for bootstrap replacement:** In a confirmed bootstrap-only repo, `--force` is acceptable only after dry-run validation shows the expected canonical layout. `--force` overwrites every file the current template version emits but does **not** delete files an older/superseded template version left behind — treat any such leftover as a manual-review orphan, not a safe-to-ignore artifact.
- **No force for mismatches:** Do not use `--force` to push through a naming or layout mismatch. The mismatch itself indicates an unsafe operation.

## Host-Addition Checklist

- Resolve the recorded configuration and authorized scope; preserve existing hosts and dry-run only the missing templates.
- Generate from the solution root with full suffixed names; verify the host and test project paths.
- Resolve Test.Common independently of host/business-library names; wire consuming test projects explicitly and honor a common opt-out. Never add a test-support reference to runtime projects.
- Update root `AGENTS.md` and register the explicit projects using `dotnet sln add ... --include-references false` when the SDK supports it and dependencies are already registered. Keep hosts under the virtual `hosts` folder and tests under `tests`.
- If solution registration is unsafe while Visual Studio has it open, defer only that step and validate new projects by path. Provide pending commands once, then stop with registration explicitly deferred; recheck only when asked or given new information.
- Build the solution (or each unregistered project) before testing. Run API/Relay/Subscribe integration projects **sequentially**, awaiting each completion; they share resettable database/cache/broker state. Avoid concurrent test builds of shared project references; see the test instructions for safe `--no-build` parallelism.
- Report results and exact blocked/deferred steps without claiming them complete. See [validation details](references/workflow.md#phase-6-validate-the-scaffold) for infrastructure setup and defect handling.

## Shape Selection Guide

| Need | Recommendation |
|---|---|
| Empty repo, own data, expose HTTP only | `coreex` + `coreex-api` |
| Empty repo, own data, expose HTTP, publish reliable events | `coreex` + `coreex-api` + `coreex-relay` |
| Empty repo, expose HTTP, publish events, consume events | `coreex` + `coreex-api` + `coreex-relay` + `coreex-subscribe` |
| Existing repo missing only runtime hosts | Infer current shape, then add only the missing hosts |
| Functions integration with shared business logic | `coreex-functions -n <deployment>.Functions`, with `--solution-name <shared-prefix>` if different |
| Standalone Blob/Service Bus/HTTP/Timer integration | `coreex-solution` + `coreex-functions --shared-core false`, with the actual Test.Common reference; add capabilities via `coreex-functions` skill |
| File generation without reference data/database | Optional `coreex-codegen -n <name>.CodeGen`, then `coreex-file`; reuse an existing tool when present |
| Facade over another system with no local database | `coreex --data-provider None --messaging-provider None` and add `coreex-api --data-provider None` only if an API is needed |

## Key References

- `../../docs/coreex/application-scaffolding-guide.md`.
- `../../docs/coreex/layers.md`.
- `../../docs/coreex/patterns.md`.
- `https://github.com/Avanade/CoreEx/blob/main/src/CoreEx.Template/README.md`.

## Related Templates

| Template | Short name | Purpose |
|---|---|---|
| CoreEx AI workflow assets | `coreex-ai` | Installs the `.github/` instructions, skills, prompts, agents, and docs cache, plus `.claude/` commands — run at repo root before or after scaffolding |
| CoreEx solution baseline | `coreex-solution` | Root solution/build/package conventions and Test.Common by default, without business layers |
| CoreEx code-generation console | `coreex-codegen` | Independent design-time tool; explicit File generation requires no database/ref-data |
| CoreEx Application services | `coreex` | Scaffolds the implementation layers (Contracts, Application, Infrastructure, etc.) |
| CoreEx Domain layer | `coreex-domain` | Adds a Domain project for DDD — run after `coreex`, wire via `dotnet sln add` |
| CoreEx API host | `coreex-api` | Adds an ASP.NET Core API host |
| CoreEx Outbox Relay host | `coreex-relay` | Adds an outbox relay host |
| CoreEx Subscriber host | `coreex-subscribe` | Adds an event subscriber host |
| CoreEx Functions host | `coreex-functions` | Adds an empty isolated-worker host and test project; optional `--shared-core false` |
| CoreEx Aspire AppHost | `coreex-aspire` | Adds an Aspire AppHost orchestrating this solution's own hosts — run after those hosts exist |

Files in this skill

  • README.md2.1 KB
  • SKILL.md18.4 KB
  • assets/README.md2.9 KB
  • assets/docker-compose.local.yml1.4 KB
  • assets/servicebus-config.template.json2 KB
  • references/workflow.md20.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.