From 6e2f49984f9f6a0b153f0e69ae0648b0a59ffeb7 Mon Sep 17 00:00:00 2001 From: "aicia[bot]" Date: Mon, 8 Jun 2026 15:16:56 +0200 Subject: [PATCH 01/88] =?UTF-8?q?=E2=9C=A8=20add=20dotnet-docfx-digest=20s?= =?UTF-8?q?kill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce new docfx documentation skill for validating and maintaining .NET public API documentation. Includes SKILL.md definition, bundled scripts for DocFX maintenance and compilation validation, evals for testing, and references for overwrite file guidance. --- skills/dotnet-docfx-digest/SKILL.md | 603 ++++++++ skills/dotnet-docfx-digest/evals/evals.json | 78 + .../references/docfx-overwrite-files.md | 45 + skills/dotnet-docfx-digest/scripts/README.md | 110 ++ skills/dotnet-docfx-digest/scripts/agents.cs | 432 ++++++ skills/dotnet-docfx-digest/scripts/docfx.cs | 1338 +++++++++++++++++ 6 files changed, 2606 insertions(+) create mode 100644 skills/dotnet-docfx-digest/SKILL.md create mode 100644 skills/dotnet-docfx-digest/evals/evals.json create mode 100644 skills/dotnet-docfx-digest/references/docfx-overwrite-files.md create mode 100644 skills/dotnet-docfx-digest/scripts/README.md create mode 100644 skills/dotnet-docfx-digest/scripts/agents.cs create mode 100644 skills/dotnet-docfx-digest/scripts/docfx.cs diff --git a/skills/dotnet-docfx-digest/SKILL.md b/skills/dotnet-docfx-digest/SKILL.md new file mode 100644 index 0000000..02f5a8e --- /dev/null +++ b/skills/dotnet-docfx-digest/SKILL.md @@ -0,0 +1,603 @@ +--- +name: dotnet-docfx-digest +description: > + Create and maintain developer-friendly DocFX documentation digests for .NET public APIs, including repo-wide no-input audits, namespace overview pages, extension-member documentation, overwrite files, examples, availability notes, AGENTS.md maintenance, and verification. Use when the user asks to document a .NET API, create or update DocFX documentation, write namespace overview pages, add extension-method tables, update XML documentation comments, add API examples, maintain DocFX overwrite files, or verify documentation builds. Treat requests like "use dotnet-docfx-digest", "update the DocFX docs", "complete missing documentation", "create namespace pages", "add examples for this type", "update the extension members table", or "verify the documentation builds" as automatic triggers. Also use whenever public .NET API surface changes and documentation needs to stay aligned with source code. +--- + +# .NET DocFX Digest Steward + +## Description + +Create and maintain developer-friendly DocFX documentation digests for .NET public APIs, including namespace overview pages, extension-member documentation, overwrite files, examples, availability notes, and verification. Preserve manual edits, document public API only, require buildable copy/paste-ready examples for concrete APIs, and keep documentation aligned with actual source code and tests. + +## Activation Requirements + +This skill is autonomous by default. If the user invokes the skill without naming a namespace, type, member, or changed API, do not ask what to document first. Treat the request as a repo-wide DocFX documentation audit and repair task: + +1. Run the repository-instruction script. +2. Inspect repository guidance, `docfx.json`, source projects, generated metadata, tests, samples, existing overwrite files, namespace pages, and availability includes. +3. Run the validator to discover missing or stale complementary documentation. +4. Fill the missing DocFX pieces that can be derived from source evidence. +5. Ask a concise clarifying question only when inspection exposes a correctness-affecting choice that cannot be resolved from repository evidence. + +When this skill is invoked against a repository, the agent must run the deterministic repository-instruction script before completing the task: + +```bash +dotnet run --file skills/dotnet-docfx-digest/scripts/agents.cs -- --repo-root . +``` + +Before reporting completion, the agent must run the deterministic validator: + +```bash +dotnet run --file skills/dotnet-docfx-digest/scripts/docfx.cs -- --repo-root . +``` + +If either script cannot run, the agent must report the exact command, exit code, and failure output. Do not claim repository instructions or documentation were verified unless the scripts ran successfully. + +## Core Principles + +Documentation is part of the public contract. When changing public .NET APIs, the agent must update the corresponding documentation in the same change set. This includes XML documentation comments, DocFX overwrite files, namespace overview pages, examples, extension-method listings, and availability information. + +The documentation must reflect the actual code, not intended code. Do not invent APIs, overloads, target frameworks, behaviors, exceptions, or examples. Verify every documented claim against source code, tests, project files, generated metadata, or existing documentation. + +Manual documentation is authoritative context. Preserve existing manual edits unless they are factually incorrect. Prefer additive changes. When information is stale, update the stale portion while retaining nearby human-written explanations, tone, and structure. + +## Scope + +Apply this skill to: + +- Public .NET types, +- Public constructors, +- Public properties, +- Public methods, +- Public fields, +- Public events, +- Public delegates, +- Public enums and enum members, +- Public extension methods, +- Public namespaces containing public API, +- DocFX overwrite Markdown files, +- DocFX namespace overview Markdown files, +- XML documentation comments, +- API examples, +- availability includes or availability statements. + +Do not document: + +- Private types, +- Internal types, +- Private members, +- Internal members, +- Implementation-only helpers, +- Test-only fixtures unless they are part of a documented public test-support API, +- Namespaces that contain no public API. + +If a namespace contains only private or internal types, do not create a namespace overview page for it. + +## Repository Discovery + +Before editing documentation, locate the DocFX workspace. + +For Codebelt repositories, the DocFX workspace is always: + +```text +.docfx +``` + +The DocFX configuration file is always: + +```text +.docfx/docfx.json +``` + +For other repositories, locate `docfx.json` before making DocFX-specific changes. + +Inspect `docfx.json` to understand: + +- Content roots, +- API metadata inputs, +- Overwrite file locations, +- Include file locations, +- Resource paths, +- Output conventions. + +Do not assume paths beyond the repository's actual DocFX configuration, except for Codebelt repositories where `.docfx/docfx.json` is the convention. + +When creating or repairing overwrite files, read `references/docfx-overwrite-files.md` for the DocFX overwrite and `docfx.json` rules that matter most to agents. + +## AGENTS.md Maintenance + +Persistent repository guidance is enforced by script, not by AI memory. When this skill is invoked, run: + +```bash +dotnet run --file skills/dotnet-docfx-digest/scripts/agents.cs -- --repo-root . +``` + +The script must create or update a marker-bounded DocFX documentation maintenance section in the repository root `AGENTS.md`. Do not manually duplicate this section. If the script fails, report the failure and do not claim `AGENTS.md` was updated. + +## Public API Rule + +Only public API is documented. Before adding or updating documentation, determine whether the item is public from source code or generated metadata. + +A type is documentable only when it is externally visible. A member is documentable only when it is public and belongs to a documentable public type. + +Do not add documentation pages for namespaces that contain no public types. Do not add extension-method documentation for non-public extension methods. + +## Required Documentation Updates + +When a public API is added or materially changed, update all relevant documentation surfaces: + +1. XML documentation comments in source code. +2. DocFX overwrite files when manual API documentation exists or is needed. +3. Namespace overview page. +4. Extension members table when extension methods are involved. +5. Availability information. +6. At least one usage example unless the documented item is an abstraction. +7. Verification artifacts or commands proving the documentation remains buildable and accurate. + +A "material change" includes: + +- New public API, +- Removed public API, +- Changed public signature, +- Changed behavior, +- Changed exception behavior, +- Changed generic constraints, +- Changed nullability contract, +- Changed target framework availability, +- Changed platform availability, +- Changed extension-method availability, +- Changed obsolete/deprecation status, +- Changed default values, +- Changed thread-safety or lifecycle expectations. + +## Examples Are Mandatory + +Every automatically documented concrete public type or concrete public member must include at least one example showing how to use it. + +An example may be omitted only when the item is an abstraction, such as: + +- Interface, +- Abstract class, +- Abstract member, +- Attribute intended only for framework discovery, +- Marker type with no direct usage, +- Pure contract type where concrete usage belongs on implementations. + +When omitting an example for an abstraction, the documentation must make that reason clear. + +Preferred source for examples: + +1. Existing unit tests, +2. Existing functional tests, +3. Existing integration tests, +4. Existing samples, +5. Minimal new sample derived from actual public API behavior. + +Examples derived from tests must be converted into real-life usage. Do not paste raw assertion-heavy test code as documentation unless the documentation is specifically explaining testing. Convert Arrange/Act/Assert test structure into developer-oriented sample code. + +The example must be: + +- Realistic, +- Minimal, +- Deterministic, +- Copy/paste-ready, +- Buildable in a normal consuming project, +- Free of hidden repository-specific helpers unless those helpers are also public and documented, +- Free of pseudo-code, +- Free of ellipses inside code blocks, +- Free of unexplained magic values, +- Valid for the documented target framework availability. + +Bad example pattern: + +```csharp +// Arrange +var sut = new Foo(); + +// Act +var actual = sut.Bar(); + +// Assert +Assert.Equal("baz", actual); +``` + +Preferred documentation pattern: + +```csharp +using My.Library; + +var formatter = new Foo(); +string value = formatter.Bar(); +Console.WriteLine(value); +``` + +If assertions are useful, use them only when the sample is explicitly framed as a test sample and can compile in that test context. + +## Example Verification + +Every code sample added or changed must be verified. A C# code sample must compile. + +The deterministic validator compiles C# documentation samples as .NET 10 file-based apps. Run: + +```bash +dotnet run --file skills/dotnet-docfx-digest/scripts/docfx.cs -- --repo-root . +``` + +A sample may opt out only when the code fence includes: + +```csharp +// dotnet-docfx-digest:skip-compile - +``` + +The reason is mandatory. Do not use silent opt-outs. + +Do not claim a sample compiles unless the validator or an equivalent repository verification command has compiled it successfully. + +## Namespace Overview Pages + +Every namespace containing public API must have a namespace overview Markdown page. + +The namespace overview page must be named after the namespace: + +```text +X.Y.Z.md +``` + +The page must live in the appropriate DocFX documentation folder for namespace overwrite/custom content. For Codebelt repositories, place namespace overview pages under the `.docfx` documentation structure according to the existing repository layout. + +The namespace page must use DocFX overwrite front matter with the namespace UID: + +```markdown +--- +uid: X.Y.Z +summary: *content +--- +``` + +The page must provide a developer-friendly fly-in explaining what the namespace is for. The fly-in should be similar in usefulness and tone to Microsoft .NET API documentation: + +- Start with what the namespace contains. +- Explain the developer problem it solves. +- Explain when to use it. +- Mention important concepts or type families. +- Avoid marketing language. +- Avoid restating type names without explaining purpose. +- Keep the explanation accurate to the public API. + +Minimum namespace overview structure: + +```markdown +--- +uid: X.Y.Z +summary: *content +--- +The `X.Y.Z` namespace contains types that ... + +[!INCLUDE [availability-default](../../includes/availability-default.md)] +``` + +If the namespace contains extension methods, include an `Extension Members` section. + +## Extension Method Documentation + +Extension methods must be documented at namespace level. + +If any public type exposes public extension members in namespace `X.Y.Z`, then the DocFX documentation must include: + +```text +X.Y.Z.md +``` + +This file must contain an `Extension Members` section. The section must list public extension methods exposed by that namespace. + +Required table format: + +```markdown +### Extension Members + +|Type|Ext|Methods| +|--:|:-:|---| +|ITestOutputHelper|⬇️|`WriteLines`| +|String|⬇️|`ReplaceLineEndings` (TFM netstandard2.0)| +``` + +Rules for the table: + +- `Type` is the extended type, not the static extension class. +- `Ext` must use `⬇️`. +- `Methods` lists public extension methods. +- Use backticks around method names. +- Include TFM-specific availability when a method is conditional. +- Group overloads under the same method name unless overload distinction is essential. +- Do not include internal/private extension methods. +- Do not include extension classes as the primary documentation target unless the class itself has relevant public API beyond extension methods. + +Example: + +```markdown +### Extension Members + +|Type|Ext|Methods| +|--:|:-:|---| +|String|⬇️|`ToSlug`, `NormalizeLineEndings`| +|IEnumerable|⬇️|`ForEach`, `Batch`| +``` + +## Availability Documentation + +Availability information must be present for public API documentation. + +Availability can be documented in either of two ways: + +1. By referencing an existing include file. +2. By writing explicit availability text when no suitable include exists. + +Prefer include files when the repository has an `includes` folder with Markdown files that define availability. + +Example include: + +```markdown +[!INCLUDE [availability-default](../../includes/availability-default.md)] +``` + +Example explicit availability: + +```markdown +Availability: .NET 10, .NET 9 and .NET Standard 2.0. +``` + +If a suitable include exists, reference it instead of duplicating availability text. If no suitable include exists, explicit availability is acceptable. + +Do not add redundant availability text if the page already references an availability include that covers the same API surface. + +When availability differs by type, member, target framework, or platform, document the difference close to the affected item. + +Availability must reflect actual project files, conditional compilation, target frameworks, package metadata, and source code. + +## DocFX Overwrite Files + +Use DocFX overwrite files to modify or add content for generated API items without editing generated metadata directly. + +Overwrite files must include YAML front matter with the target `uid`. Example: + +```markdown +--- +uid: X.Y.Z.MyType +summary: *content +--- +``` + +The `uid` must match the generated DocFX UID. Do not guess UIDs. Verify them from generated metadata, existing API pages, source conventions, or DocFX output. + +Use overwrite files for: + +- Namespace overview pages, +- Additional conceptual remarks, +- Examples, +- Corrected summaries, +- Extension-method namespace documentation, +- Availability notes, +- Developer-oriented usage guidance. + +Do not use overwrite files to conceal inaccurate XML documentation. Correct the source XML documentation when it is wrong. + +## XML Documentation Comments + +Public API should have useful XML documentation comments. Prefer concise source-level XML comments and richer examples/remarks in DocFX overwrite files when documentation becomes long. + +XML documentation should describe: + +- Purpose, +- Parameters, +- Return value, +- Exceptions, +- Type parameters, +- Important behavior, +- Nullability expectations, +- Thread-safety or lifecycle behavior when relevant. + +Do not use empty boilerplate summaries. + +Bad: + +```csharp +/// +/// Gets or sets the value. +/// +``` + +Better: + +```csharp +/// +/// Gets or sets the normalized name used when matching configuration keys. +/// +``` + +## Preservation Rules + +Manual edits must be preserved. + +Before editing an existing Markdown file: + +1. Read the entire file. +2. Identify manually written sections. +3. Preserve structure and tone where possible. +4. Add new information in the most appropriate existing section. +5. Avoid replacing the whole file unless the file is clearly generated or corrupt. +6. Keep existing includes, admonitions, links, and examples unless they are stale. +7. Update stale statements instead of appending contradictory new statements. + +Documentation must stay current. If additive-only editing would leave conflicting or stale information, update the stale information. Accuracy is more important than blindly appending content. Never leave two conflicting descriptions of the same API behavior. + +## Style Rules + +Use developer-friendly documentation style. + +Prefer: + +- Direct explanations, +- Practical examples, +- Concrete behavior, +- Accurate terminology, +- Small complete samples, +- Links to related APIs when useful, +- Namespace-level fly-ins that explain purpose. + +Avoid: + +- Marketing language, +- Placeholder text, +- "Simply", +- "Just", +- "Obviously", +- Pseudo-code, +- Incomplete snippets, +- Unverified claims, +- Duplicating generated API signatures manually, +- Restating the namespace name without explaining its purpose. + +## Documentation Workflow + +When the user names a changed API or namespace: + +1. Run `agents.cs`. +2. Inspect the changed public API. +3. Determine affected namespaces. +4. Determine whether public extension methods are involved. +5. Locate `.docfx/docfx.json` or repository-specific DocFX config. +6. Locate existing overwrite files and namespace pages. +7. Locate availability include files. +8. Locate relevant tests that demonstrate the API. +9. Convert test usage into real-life documentation examples. +10. Update XML documentation where needed. +11. Update or create namespace overview pages. +12. Update extension-member tables. +13. Update or create overwrite files. +14. Preserve manual edits. +15. Run `dotnet build`. +16. Run `dotnet test`. +17. Run `docfx .docfx/docfx.json`. +18. Run `docfx.cs`. +19. Report verification results. + +When no specific API or namespace is named: + +1. Run `agents.cs`. +2. Read repository guidance, especially root `AGENTS.md`. +3. Locate `.docfx/docfx.json` or repository-specific DocFX config. +4. Read `references/docfx-overwrite-files.md`. +5. Run `dotnet run --file skills/dotnet-docfx-digest/scripts/docfx.cs -- --repo-root . --json` to collect deterministic missing-doc findings when the repository is buildable. +6. If the validator fails before documentation diagnostics can be produced, inspect source projects, DocFX config, existing overwrite files, generated metadata when available, tests, and samples manually. +7. Determine every namespace containing public API and whether each namespace exposes public extension methods. +8. Create or update missing namespace overview pages using DocFX overwrite front matter and developer-friendly fly-ins. +9. Add or repair `Extension Members` tables for namespaces with public extension methods. +10. Add or repair overwrite content for public API items that need examples, remarks, corrected summaries, or availability notes. +11. Preserve manual edits and correct stale contradictions instead of replacing whole files. +12. Run `dotnet build`. +13. Run `dotnet test`. +14. Run `docfx .docfx/docfx.json`. +15. Run `docfx.cs`. +16. Report verification results and any remaining findings. + +## Namespace Page Template + +Use this template when creating a new namespace overview page: + +```markdown +--- +uid: X.Y.Z +summary: *content +--- +The `X.Y.Z` namespace contains types that ... + +[!INCLUDE [availability-default](../../includes/availability-default.md)] + +### Extension Members + +|Type|Ext|Methods| +|--:|:-:|---| +|String|⬇️|`ExampleMethod`| +``` + +Remove the `Extension Members` section when the namespace has no public extension methods. Adjust the include path based on the actual file location. + +## Type Example Template + +Use this shape for concrete public type examples: + +````markdown +### Examples + +The following example shows how to use `MyType` in a consuming application. + +```csharp +using X.Y.Z; + +var value = new MyType(); +Console.WriteLine(value); +``` +```` + +The sample must compile. Do not include `using` directives for namespaces that do not exist. Do not use APIs that are internal to the repository unless the sample is explicitly for contributors and not public API consumers. + +## Extension Method Example Template + +Use this shape for extension-method examples: + +````markdown +### Examples + +The following example shows how to call `NormalizeLineEndings` on a string. + +```csharp +using X.Y.Z; + +string text = "first\r\nsecond"; +string normalized = text.NormalizeLineEndings(); +Console.WriteLine(normalized); +``` +```` + +The namespace containing the extension method must be imported. The sample must compile in a consuming project. + +## Verification Checklist + +Before completing documentation work, verify: + +- [ ] `agents.cs` has run successfully. +- [ ] `AGENTS.md` contains the managed DocFX documentation maintenance block. +- [ ] Only public API is documented. +- [ ] Every namespace with public API has a namespace overview page. +- [ ] Namespaces with public extension methods have an `Extension Members` section. +- [ ] Extension methods are documented by extended type, not extension class. +- [ ] Concrete public APIs have at least one example. +- [ ] Abstractions without examples have a clear reason. +- [ ] Examples are realistic and copy/paste-ready. +- [ ] Examples compile. +- [ ] Examples are preferably derived from passing tests. +- [ ] Availability is included or explicitly stated. +- [ ] Availability matches actual target frameworks and conditions. +- [ ] Existing manual edits are preserved. +- [ ] Stale documentation is corrected. +- [ ] No contradictory documentation remains. +- [ ] `dotnet build` has been run or the failure is reported. +- [ ] `dotnet test` has been run or the failure is reported. +- [ ] `docfx .docfx/docfx.json` has been run or the failure is reported. +- [ ] `docfx.cs` has run successfully or the failure is reported. + +## Completion Response + +When reporting completion, include: + +- Public APIs documented, +- Namespace pages added or updated, +- Extension-member tables added or updated, +- Examples added and their source test/sample when applicable, +- Availability handling, +- `AGENTS.md` created, updated, already compliant, or failed, +- Verification commands run, +- Any verification failures or skipped checks. + +Do not claim documentation was verified unless the relevant command actually ran successfully. diff --git a/skills/dotnet-docfx-digest/evals/evals.json b/skills/dotnet-docfx-digest/evals/evals.json new file mode 100644 index 0000000..cf10fa9 --- /dev/null +++ b/skills/dotnet-docfx-digest/evals/evals.json @@ -0,0 +1,78 @@ +{ + "skill_name": "dotnet-docfx-digest", + "evals": [ + { + "id": 1, + "prompt": "I just added a new public class `RetryPolicy` and a public extension method `WithRetry(this HttpClient client, int attempts)` to my .NET library in the `Acme.Net.Http` namespace. Please update the DocFX documentation for this change.", + "expected_output": "Agent runs scripts/agents.cs to seed AGENTS.md, creates/updates the Acme.Net.Http namespace overview page with uid front matter, a fly-in, availability, and an Extension Members table listing the extended type with the WithRetry method, adds a buildable example for RetryPolicy, and runs scripts/docfx.cs to verify.", + "expectations": [ + "Runs the deterministic scripts/agents.cs against the repository before completing", + "Creates or updates a namespace overview page named Acme.Net.Http.md with DocFX overwrite front matter whose uid matches the namespace", + "Adds an Extension Members table documenting the extended type (HttpClient), the ⬇️ marker, and the WithRetry method in backticks", + "Adds at least one copy/paste-ready, buildable example for the concrete RetryPolicy type", + "Includes availability information via an include or explicit Availability text", + "Runs scripts/docfx.cs to verify before claiming the documentation was verified" + ] + }, + { + "id": 2, + "prompt": "Document the new `internal` helper class `BufferPool` and the `private` method `Rent` I added under `Acme.Buffers`. There is no other public type in that namespace yet.", + "expected_output": "Agent declines to create documentation for internal/private members and does not create a namespace overview page for a namespace that contains no public API, explaining the public-API-only rule.", + "expectations": [ + "Does not create documentation pages or overwrite files for internal or private members", + "Does not create a namespace overview page for Acme.Buffers because it contains no public API", + "Explains that only public API is documented and points to the public-API rule", + "Does not fabricate public API that does not exist" + ] + }, + { + "id": 3, + "prompt": "Add a usage example to the `Acme.Text` namespace page for the `Greeter` class. Base it on the existing unit test `GreeterTest.Greet_WithName_ReturnsGreeting`.", + "expected_output": "Agent converts the Arrange/Act/Assert test into a real-life consumer-oriented, buildable example without raw assertions, and verifies it compiles with scripts/docfx.cs.", + "expectations": [ + "Derives the example from the referenced test rather than inventing behavior", + "Converts the Arrange/Act/Assert structure into developer-oriented usage instead of pasting raw assertions", + "Produces a minimal, deterministic, copy/paste-ready C# example with a real using directive for Acme.Text", + "Avoids pseudo-code, ellipses, and hidden helpers in the sample", + "Verifies the sample compiles via scripts/docfx.cs or an equivalent build command" + ] + }, + { + "id": 4, + "prompt": "Run the DocFX documentation validator on this repository and tell me whether the docs are in good shape.", + "expected_output": "Agent runs scripts/docfx.cs (and scripts/agents.cs if needed), reports the exact command, exit code, and the deterministic JSON/console findings, and does not claim verification without running the script.", + "expectations": [ + "Runs scripts/docfx.cs against the repository root", + "Reports the exact command run and its exit code", + "Surfaces the deterministic findings (errors/warnings with their codes) rather than guessing", + "Does not claim the documentation was verified unless the script actually ran successfully" + ] + }, + { + "id": 5, + "prompt": "The `Acme.Text` namespace page already has a hand-written introduction and a couple of links I care about. I changed the `Shout` extension method to also trim whitespace. Update the docs but keep my wording.", + "expected_output": "Agent preserves the manual introduction and links, updates only the stale parts relevant to the behavior change, keeps the Extension Members table accurate, and avoids wholesale file replacement.", + "expectations": [ + "Preserves the existing hand-written introduction and links instead of replacing the whole file", + "Updates only the stale portions affected by the behavior change", + "Keeps the Extension Members table accurate for the Shout method", + "Does not leave contradictory descriptions of the Shout behavior", + "Re-verifies any changed sample compiles" + ] + }, + { + "id": 6, + "prompt": "Use dotnet-docfx-digest on this repository.", + "expected_output": "Agent treats the request as a repo-wide DocFX documentation audit instead of asking what to document first. It runs scripts/agents.cs, inspects AGENTS.md, docfx.json, source projects, public API, tests, samples, overwrite files, namespace pages, and availability includes, runs scripts/docfx.cs to collect deterministic findings, repairs missing complementary DocFX documentation that can be derived from source evidence, reads the DocFX overwrite reference when creating or repairing overwrite files, and asks for clarification only if discovery exposes a correctness-affecting choice.", + "expectations": [ + "Does not start by asking the user which API or namespace to document", + "Runs scripts/agents.cs to ensure the repository AGENTS.md contains the managed DocFX maintenance block", + "Inspects docfx.json and existing DocFX overwrite, namespace, include, source, test, and sample evidence before editing", + "Runs scripts/docfx.cs, preferably with --json when collecting repo-wide findings", + "Creates or updates missing namespace overview pages, Extension Members tables, examples, and availability notes that can be derived from evidence", + "Reads references/docfx-overwrite-files.md before creating or repairing DocFX overwrite files", + "Asks a concise clarifying question only after inspection finds a correctness-affecting unresolved choice" + ] + } + ] +} diff --git a/skills/dotnet-docfx-digest/references/docfx-overwrite-files.md b/skills/dotnet-docfx-digest/references/docfx-overwrite-files.md new file mode 100644 index 0000000..13538ae --- /dev/null +++ b/skills/dotnet-docfx-digest/references/docfx-overwrite-files.md @@ -0,0 +1,45 @@ +# DocFX Overwrite Files Reference + +Use this reference when creating, auditing, or repairing DocFX overwrite files for .NET API documentation. + +Sources: + +- https://dotnet.github.io/docfx/tutorial/intro_overwrite_files.html +- https://dotnet.github.io/docfx/reference/docfx-json-reference.html#overwrite + +## Agent Summary + +DocFX treats generated API metadata and Markdown content as models. An overwrite file is a Markdown file that updates a model by matching its `uid`; this lets documentation add or replace properties such as `summary`, `remarks`, examples, conceptual content, and namespace-level guidance without editing generated metadata. + +Every overwrite section starts with YAML front matter delimited by `---`. The front matter must include `uid`, and the value must match the generated model UID. Do not guess UIDs. Verify them from generated metadata, existing API pages, source conventions, DocFX output, or `docfx build --exportRawModel`. + +The `*content` anchor maps the Markdown body following the YAML header into a chosen model property. For this skill, namespace overview pages normally use: + +```markdown +--- +uid: X.Y.Z +summary: *content +--- +The `X.Y.Z` namespace contains types that ... +``` + +If `*content` is not used, DocFX assigns the Markdown body to the default conceptual content property. Prefer `summary: *content` for namespace fly-ins and other summary replacements that should flow into generated API pages. + +DocFX applies overwrite models by `uid`. If the same `uid` appears more than once in one overwrite file, later sections in that same file override earlier sections. Across different overwrite files, ordering is not deterministic, so keep competing sections for the same `uid` together or consolidate them. + +Overwrite models should follow the target model shape. Existing properties can be replaced or merged depending on the DocFX model rules; properties not already present can be added. For managed reference docs, common useful overwrite targets include `summary`, `remarks`, `example`, `exceptions`, `see`, `seealso`, and parameter descriptions under `syntax`. + +The `build.overwrite` entry in `docfx.json` tells DocFX which conceptual Markdown files contain overwrite sections. All relative paths in `docfx.json` are resolved relative to the directory containing `docfx.json`, not necessarily the repository root. + +When a repository has no obvious overwrite location, inspect `docfx.json` first. Look at `build.content`, `build.overwrite`, `metadata.dest`, include paths, and existing Markdown layout before deciding where a new namespace page belongs. + +## Practical Rules + +- Run `agents.cs` before finishing so root `AGENTS.md` receives persistent DocFX maintenance guidance. +- Use overwrite files to complement generated API metadata, not to hide incorrect XML documentation. +- Correct bad XML comments at source when the generated summary is wrong. +- Use namespace overview pages for namespace fly-ins and extension-member tables. +- Keep examples and remarks close to the API item or namespace they explain. +- Preserve existing hand-written overwrite sections unless they are stale or contradictory. +- Prefer additive edits, but remove or revise contradictions. +- Re-run `docfx.cs` after edits so missing namespace pages, extension tables, availability, and sample compilation are checked deterministically. diff --git a/skills/dotnet-docfx-digest/scripts/README.md b/skills/dotnet-docfx-digest/scripts/README.md new file mode 100644 index 0000000..a65f2c7 --- /dev/null +++ b/skills/dotnet-docfx-digest/scripts/README.md @@ -0,0 +1,110 @@ +# dotnet-docfx-digest scripts + +Two deterministic .NET 10 file-based apps back the skill so that repository +guidance and documentation rules are enforced by code, not by AI memory. Each +script is a single `.cs` file with no `.csproj` and runs directly: + +```bash +dotnet run --file