Agent skill

Orchardcore Nswag Regenerate

by OrchardCMS in OrchardCMS/OrchardCore

Regenerate the OrchardCore.OpenApi module's NSwag-generated C/TypeScript API clients, and verify the regeneration produces a stable (non-reshuffled) diff.

BSD-3-ClauseAuto-check passedBackend & APIs

Install Orchardcore Nswag Regenerate

skills CLI
$ npx skills add OrchardCMS/OrchardCore --skill orchardcore-nswag-regenerate -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install OrchardCMS/OrchardCore orchardcore-nswag-regenerate --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/OrchardCMS/OrchardCore.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/orchardcore-nswag-regenerate .claude/skills/orchardcore-nswag-regenerate && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
orchardcore-nswag-regenerate
GitHub stars
8.2k
Token cost
~2k tokens
SKILL.md length
874 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Regenerate the OrchardCore.OpenApi module's NSwag-generated C/TypeScript API clients, and verify the regeneration produces a stable (non-reshuffled) diff.

  • Works in 3 steps: Fetch swagger.json from a running… → Copy the .nswag config, and in the copy… → nswag run .
  • Asked to regenerate the NSwag client(s)
  • SKILL.md covers Preferred:…, Where things live, Manual procedure (fallback) and Reproducible / offline…, plus 2 more sections
  • Calls dotnet and yarn

What it does

Orchardcore Nswag Regenerate is an agent skill from OrchardCMS/OrchardCore. Regenerate the OrchardCore.OpenApi module's NSwag-generated C/TypeScript API clients, and verify the regeneration produces a stable (non-reshuffled) diff. Use when asked to "regenerate the NSwag client(s)", update Services/OpenApiClient.cs or .scripts/bloom/services/OpenApiClient.ts, or investigate noisy diffs from NSwag regeneration.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering OpenAPI specifications. It works with OpenAPI, C# and TypeScript. The repository describes itself as: Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework. The licence is BSD-3-Clause.

When your agent uses it

  • Asked to regenerate the NSwag client(s)
  • Update Services/OpenApiClient.cs
  • .scripts/bloom/services/OpenApiClient.ts
  • Investigate noisy diffs from NSwag regeneration

Example prompts

  • “regenerate the NSwag client(s)”
  • “/orchardcore-nswag-regenerate”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Fetch swagger.json from a running instance into a scratch file.
  2. Copy the .nswag config, and in the copy only change documentGenerator.fromDocument.url to the scratch file's path, and both generators'…
  3. nswag run .

What it can do on your machine

Read from SKILL.md and the folder at commit bfbe92f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dotnet
    • yarn

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use yarn, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Orchardcore Nswag Regenerate loads about 2k tokens when it runs. Until then it costs about 92 tokens; SKILL.md has 874 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from OrchardCMS/OrchardCore at commit bfbe92f, republished under its BSD-3-Clause licence (© OrchardCMS). 874 words, ~2,005 tokens.

Download SKILL.mdSave it as .claude/skills/orchardcore-nswag-regenerate/SKILL.md (or your agent's skills folder).
name
orchardcore-nswag-regenerate
description
Regenerate the OrchardCore.OpenApi module's NSwag-generated C#/TypeScript API clients, and verify the regeneration produces a stable (non-reshuffled) diff. Use when asked to "regenerate the NSwag client(s)", update Services/OpenApiClient.cs or .scripts/bloom/services/OpenApiClient.ts, or investigate noisy diffs from NSwag regeneration.

OrchardCore NSwag Regenerate

Regenerates the OpenApi module's NSwag-generated C#/TypeScript API clients and verifies the regeneration produces a stable, non-reshuffled diff.

Preferred: tools/OpenApiClientGenerator (automated, no browser/dev-server needed)

A console project that does the whole pipeline headlessly:

bash
dotnet run --project tools/OpenApiClientGenerator -c Release
yarn build   # refreshes the Vue app's bundled JS against the new TS client

It boots the CMS in-process on an ephemeral port, uses OrchardCore.AutoSetup with src/OrchardCore.Cms.Web/Recipes/openapi-generation-setup.recipe.json (issetuprecipe: true) to provision the Default tenant with the same feature set as openapi-generation.recipe.json below, fetches swagger.json, writes a scratch .nswag config pointing at that capture, and shells out to the nswag CLI (same prerequisite as the manual path: dotnet tool install -g NSwag.ConsoleCore). Source: tools/OpenApiClientGenerator/Program.cs.

Why Default tenant specifically: OrchardCore.Tenants (and .Distributed, .FeatureProfiles) have DefaultTenantOnly = true in their [Feature] manifest attribute — they can only be enabled on the Default/Host shell, never a secondary tenant. A Blog-recipe functional-test tenant cannot enable OrchardCore.Tenants, which is why this tool targets the Default shell via AutoSetup rather than reusing the functional-test harness's tenant pattern.

This tool only regenerates the clients against whatever API surface the current source produces — it does not add a CI drift-check gate (that was scoped out; see nswag-automation-plan.md in git stash history for the fuller original proposal, "Part 1" of which this tool implements).

The manual procedure below still applies if you need to regenerate against a real running dev server (e.g. to inspect swagger.json interactively) or investigate the tool's own behavior.

Where things live

  • Config: src/OrchardCore.Modules/OrchardCore.OpenApi/OrchardCore.OpenApi.nswag — this file already exists, do not assume it's missing. It defines both generators:
    • openApiToCSharpClient → outputs Services/OpenApiClient.cs (relative to the module folder)
    • openApiToTypeScriptClient → outputs ../../../.scripts/bloom/services/OpenApiClient.ts
  • Source document: documentGenerator.fromDocument.url points at a running instance's Swashbuckle endpoint, https://localhost:5001/swagger/v1/swagger.json. NSwag also accepts a local file path in this same field instead of a URL — useful for reproducible/offline generation (see below).
  • Recipe: src/OrchardCore.Modules/OrchardCore.OpenApi/Recipes/openapi-generation.recipe.json (name OpenApiGeneration) enables every feature that exposes an API endpoint: OrchardCore.Contents, OrchardCore.Queries, OrchardCore.Tenants, OrchardCore.Search.Lucene, OrchardCore.Search.Elasticsearch, OrchardCore.OpenApi. It also contains a Settings step setting OpenApiSettings.AllowAnonymousSchemaAccess: true — anonymous schema access is disabled by default (the middleware returns 401 for unauthenticated swagger.json fetches), and both NSwag paths below fetch the schema anonymously. The setup recipe used by the generator tool (openapi-generation-setup.recipe.json) has the same step. Note the Settings step replaces the whole stored OpenApiSettings object, wiping any OAuth configuration on the tenant it runs on — fine for throwaway generation tenants, worth knowing on a configured one.
    • It has "issetuprecipe": false, so it does not appear in the new-tenant/site-setup recipe dropdown. Run it against an already-set-up tenant instead, via Admin ▸ Configuration ▸ Recipes, click "Run" next to "OpenApi Generation", confirm the modal. (/Admin/Recipes, AdminController.Execute in OrchardCore.Recipes.)

Manual procedure (fallback)

NSwag CLI

Installed as a dotnet tool: ~/.dotnet/tools/nswag (or dotnet tool install -g NSwag.ConsoleCore if missing). Run with:

bash
nswag run src/OrchardCore.Modules/OrchardCore.OpenApi/OrchardCore.OpenApi.nswag

This requires a live server at the configured url. For a real regeneration that updates the committed files, run the actual local dev server, set it up with the OpenApiGeneration recipe, and run the command above unmodified.

Reproducible / offline generation (for testing determinism, without touching committed files)

  1. Fetch swagger.json from a running instance into a scratch file.
  2. Copy the .nswag config, and in the copy only change documentGenerator.fromDocument.url to the scratch file's path, and both generators' output to scratch paths. Do this with a small Python/jq one-liner rather than hand-editing — the config is plain JSON.
  3. nswag run <scratch-config>.

This lets you diff two independent generations without ever touching the real generated files or needing HTTPS/dev-cert setup.

Show full SKILL.md (322 more words)Show less

Determinism: why regeneration used to reshuffle unrelated methods

Two independent root causes were found and fixed (skrypt/openapi branch):

  1. Swashbuckle's operation order wasn't pinned. Without an explicit sort, swagger.json operations come out in whatever order ASP.NET Core's action discovery enumerates them — which depends on assembly/feature load order in OrchardCore's modular architecture, not source order. Fixed in OrchardCore.OpenApi/Startup.cs's AddSwaggerGen call:

    csharp
    c.OrderActionsBy(apiDesc => $"{apiDesc.RelativePath}_{apiDesc.HttpMethod}");

    Route path + verb is fixed at compile time and unique per operation, so this is stable regardless of load order.

  2. A duplicate operationId across two operations. QueryApiController used to have one action handling both GET and POST on api/queries/{name} under a single [EndpointName("ApiExecuteQuery")]. OpenAPI requires operationId to be unique per operation — reusing one across two operations forced NSwag to invent a disambiguating suffix internally, and that suffix logic wasn't deterministic across runs (e.g. ApiExecuteQueryPOSTAsync vs ApiExecuteQueryPOSTPOSTAsync). Fixed by splitting into two actions with distinct names (ApiExecuteQueryGet / ApiExecuteQueryPost), delegating to a shared private method — the pattern already used by e.g. ElasticsearchApiController (ApiGetElasticsearchContent/ApiPostElasticsearchContent).

Lesson for any future controller/endpoint added to the OpenApi-exposed surface: never reuse the same [EndpointName]/operationId across two different HTTP verbs on the same route. Give each verb its own action and its own name, even if they share implementation via a private helper.

Verifying stability empirically

Boot two independently-provisioned tenants (each gets its own ShellContext and fresh feature/extension discovery — this is what actually varies, not wall-clock time), run the OpenApiGeneration recipe on each, fetch swagger.json from each, generate against both, and diff. A stable setup produces byte-identical output except for the tenant's own base-URL prefix embedded in the client's default baseUrl (an expected, real difference between distinct tenants — not a bug).

The existing functional test suite (test/OrchardCore.Tests.Functional/Tests/Cms/OpenApiTests.cs) already exercises the relevant plumbing (feature enablement, swagger.json access) if you need a template for scripting this via Playwright/CmsTestBase. Any throwaway verification test written for this should be deleted afterward — it's not meant to be a permanent part of the suite.

© OrchardCMS, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/orchardcore-nswag-regenerate of OrchardCMS/OrchardCore.

Open the folder on GitHubat commit bfbe92f

Compare with similar skills

Orchardcore Nswag Regenerate next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Orchardcore Nswag Regenerate compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Orchardcore Nswag Regenerate this skillOrchardCMS/OrchardCore8.2k—~2kAutomated safety check: PassBSD-3-Clause
API Breaking Change Detectorgithub/awesome-copilot40k—~1.7kAutomated safety check: PassMIT
OpenAPI to MCP Servermcp-use/mcp-use11k—~5.2kAutomated safety check: PassApache-2.0
Api2clialexknowshtml/api2cli454—~2.9kAutomated safety check: PassMIT
Projectsamchon/nestia2.2k—~3kAutomated safety check: PassMIT
API ContractChenyCHENYU/Robot_Admin1k—~1.9kAutomated safety check: PassMIT

Similar skills

  • API Breaking Change Detector

    github/awesome-copilot

    Official

    Cross-references C Web API controllers/DTOs against their TypeScript/JavaScript consumers (React, Angular, Vue, Svelte, Node.js, or hand-written/auto-generated HTTP clients like Fetch, Axios, NSwag)…

    40k GitHub stars~1.7k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • OpenAPI to MCP Server

    mcp-use/mcp-use

    Turns an OpenAPI or Swagger spec into an MCP server with the mcp-use TypeScript SDK, mapping each operation to a tool, wiring auth, testing and deploying.

    11k GitHub stars~5.2k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Api2cli

    alexknowshtml/api2cli

    Generate a working CLI from any API, then wrap it in a Claude Code skill.

    454 GitHub stars~2.9k tokensUpdated 7 mo ago
    Backend & APIsAuto-check passed
  • Project

    samchon/nestia

    Defines the nestia product contract, workspace layout, package boundaries, the Go plugin composition model, and canonical commands.

    2.2k GitHub stars~3k tokensUpdated 4 days ago
    Backend & APIsAuto-check passed
  • API Contract

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs.

    1k GitHub stars~1.9k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Tsp Csharp

    querylenshq/ef-querylens

    Comprehensive C and .NET development skill for TSP projects.

    225 GitHub stars~1.3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed

More from OrchardCMS/OrchardCore

All 17 skills in this repo
  • Orchardcore Video Producer

    OrchardCMS/OrchardCore

    Produces narrated Orchard Core videos (feature walkthroughs, module overviews, pull request demos) with one unified look and specification - 1080p, Orchard Core logo, colors and fonts, the same…

    8.2k GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Orchardcore Admin Edit Views

    OrchardCMS/OrchardCore

    Creates and updates OrchardCore admin edit views using the ocat- CSS class conventions.

    8.2k GitHub stars~3.7k tokensUpdated yesterday
    Auto-check passed
  • Orchardcore Asset Manager

    OrchardCMS/OrchardCore

    Builds, watches, and manages frontend assets in OrchardCore.

    8.2k GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Orchardcore Data Migration

    OrchardCMS/OrchardCore

    Creates and updates OrchardCore data migrations (DataMigration classes with CreateAsync/UpdateFromX).

    8.2k GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Orchardcore Display Management

    OrchardCMS/OrchardCore

    Controls how OrchardCore renders content — placement.json rules, display drivers, shapes, zones, alternates, and editor groupings (tabs/cards/columns).

    8.2k GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Orchardcore Docs Writer

    OrchardCMS/OrchardCore

    Authors OrchardCore documentation — MkDocs Material pages, module README docs, nav entries, admonitions, tabbed content, and redirects.

    8.2k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Orchardcore Nswag Regenerate

What does Orchardcore Nswag Regenerate do?

Regenerate the OrchardCore.OpenApi module's NSwag-generated C/TypeScript API clients, and verify the regeneration produces a stable (non-reshuffled) diff. Orchardcore Nswag Regenerate is an agent skill from OrchardCMS/OrchardCore.OpenApi module's NSwag-generated C/TypeScript API clients, and verify the regeneration produces a stable (non-reshuffled) diff.

When should I use Orchardcore Nswag Regenerate?

Orchardcore Nswag Regenerate fits situations like: asked to regenerate the NSwag client(s); update Services/OpenApiClient.cs; .scripts/bloom/services/OpenApiClient.ts; investigate noisy diffs from NSwag regeneration.

How do I install Orchardcore Nswag Regenerate in Claude Code?

Run `npx skills add OrchardCMS/OrchardCore --skill orchardcore-nswag-regenerate -a claude-code`. Or copy the skill folder (.agents/skills/orchardcore-nswag-regenerate in OrchardCMS/OrchardCore) into .claude/skills/orchardcore-nswag-regenerate in your project. Claude Code loads it when a task matches its description.

How do I install Orchardcore Nswag Regenerate in Codex?

Run `npx skills add OrchardCMS/OrchardCore --skill orchardcore-nswag-regenerate -a codex`. Or copy the skill folder (.agents/skills/orchardcore-nswag-regenerate in OrchardCMS/OrchardCore) into .agents/skills/orchardcore-nswag-regenerate in your project. Codex loads it when a task matches its description.

Can I use Orchardcore Nswag Regenerate in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add OrchardCMS/OrchardCore --skill orchardcore-nswag-regenerate -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/orchardcore-nswag-regenerate, .gemini/skills/orchardcore-nswag-regenerate, .github/skills/orchardcore-nswag-regenerate and .opencode/skills/orchardcore-nswag-regenerate in your project.

What does Orchardcore Nswag Regenerate need to run?

Going by SKILL.md and its folder, Orchardcore Nswag Regenerate needs the command-line tools its instructions call (dotnet and yarn).

Does Orchardcore Nswag Regenerate access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Orchardcore Nswag Regenerate safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Orchardcore Nswag Regenerate use?

Orchardcore Nswag Regenerate is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Orchardcore Nswag Regenerate use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Orchardcore Nswag Regenerate?

Skills that share tags, products or a category with Orchardcore Nswag Regenerate: API Breaking Change Detector (github/awesome-copilot, 40k stars), OpenAPI to MCP Server (mcp-use/mcp-use, 11k stars), Api2cli (alexknowshtml/api2cli, 454 stars) and Project (samchon/nestia, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Orchardcore Nswag Regenerate?

OrchardCMS (a GitHub organization) maintains it in OrchardCMS/OrchardCore, which has 8,193 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 10, 2026.

Source: OrchardCMS/OrchardCore on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.