-
Notifications
You must be signed in to change notification settings - Fork 369
add a new dotnet11 plugin and a new system text json skill to it. #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
03a0174
add a new dotnet11 plugin and a new system text json skill to it.
ManishJayaswal 9fb7b74
Update plugins/dotnet11/skills/system-text-json-net11/SKILL.md
ManishJayaswal 3714018
added the option to run dotnet11 skills. by default they don't get in…
c9a5eea
Update tests/dotnet11/system-text-json-net11/eval.yaml
ManishJayaswal 8b42d8b
Add JSON output assertions to system-text-json-net11 eval.yaml
Copilot 7095cff
addressed CR comments
fc43d78
addressed more CR comments
2c502a3
fixed agument to pass while enabling dotnet11 skills
83482b4
Remove dotnet11-specific filtering from skill-validator and evaluatio…
e45ee82
address code review comments after rebase
efbf387
added the plugin to cursor and added MIT license to skill
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -426,3 +426,6 @@ FodyWeavers.xsd | |
| .DS_Store | ||
| .nuget/ | ||
| validation_report.md | ||
|
|
||
| # Roslyn / C# language server cache files | ||
| *.lscache | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # dotnet11 | ||
|
|
||
| Skills focused on new APIs and language features introduced in .NET 11. | ||
|
|
||
| ## Skills | ||
|
|
||
| - system-text-json-net11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "dotnet11", | ||
| "version": "0.1.0", | ||
| "description": "Skills for .NET 11 APIs and language features.", | ||
| "skills": ["./skills/"] | ||
| } |
130 changes: 130 additions & 0 deletions
130
plugins/dotnet11/skills/system-text-json-net11/SKILL.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| --- | ||
| name: system-text-json-net11 | ||
| description: > | ||
| Provides guidance on new System.Text.Json APIs introduced in .NET 11. | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
| It covers typed JsonTypeInfo access via GetTypeInfo<T> and TryGetTypeInfo<T> on | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
| JsonSerializerOptions, and the new JsonNamingPolicy.PascalCase static property. | ||
| Use when serializing or deserializing JSON in .NET 11 applications and needing | ||
| typed metadata access or PascalCase property naming. | ||
| --- | ||
|
|
||
| # System.Text.Json — .NET 11 | ||
|
|
||
| New APIs added to `System.Text.Json` across .NET 11 releases. | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
|
|
||
| ## When to Use | ||
|
|
||
| - Serializing or deserializing JSON in a .NET 11 (or later) project | ||
| - Needing strongly-typed `JsonTypeInfo<T>` access instead of the untyped `JsonTypeInfo` overload | ||
| - Wanting to safely check whether type metadata is available without catching exceptions (`TryGetTypeInfo<T>`) | ||
| - Requiring PascalCase property naming during JSON serialization | ||
|
|
||
| ## When Not to Use | ||
|
|
||
| - The project targets .NET 10 or earlier — these APIs are not available before .NET 11 | ||
| - Using a JSON library that is not `System.Text.Json` (e.g., Newtonsoft.Json) | ||
| - The existing untyped `GetTypeInfo(Type)` / `TryGetTypeInfo(Type, ...)` overloads are sufficient | ||
|
|
||
| ## Target Framework | ||
|
|
||
| ```xml | ||
| <TargetFramework>net11.0</TargetFramework> | ||
| ``` | ||
|
|
||
| ## New APIs | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
|
|
||
| ### Typed `JsonTypeInfo` Access | ||
|
|
||
| #### `JsonSerializerOptions.GetTypeInfo<T>()` | ||
|
|
||
| Returns a strongly-typed `JsonTypeInfo<T>` for the specified type, using the | ||
| options' configured type-info resolver. | ||
|
|
||
| ```csharp | ||
| JsonTypeInfo<T> GetTypeInfo<T>() | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| #### `JsonSerializerOptions.TryGetTypeInfo<T>(out JsonTypeInfo<T>?)` | ||
|
|
||
| Attempts to retrieve typed metadata without throwing if the type is not resolved. | ||
|
|
||
| ```csharp | ||
| bool TryGetTypeInfo<T>(out JsonTypeInfo<T>? typeInfo) | ||
| ``` | ||
|
|
||
| ### `JsonNamingPolicy.PascalCase` | ||
|
|
||
| A new static property that converts property names to PascalCase during | ||
| serialization. | ||
|
|
||
| ```csharp | ||
| static JsonNamingPolicy PascalCase { get; } | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Get Typed JsonTypeInfo | ||
|
|
||
| ```csharp | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization.Metadata; | ||
|
|
||
| var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); | ||
|
|
||
| // Retrieve strongly-typed metadata for MyClass | ||
| JsonTypeInfo<MyClass> typeInfo = options.GetTypeInfo<MyClass>(); | ||
| Console.WriteLine($"Type: {typeInfo.Type.Name}"); | ||
| ``` | ||
|
|
||
| ### TryGetTypeInfo for Safe Access | ||
|
|
||
| ```csharp | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization.Metadata; | ||
|
|
||
| var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); | ||
|
|
||
| if (options.TryGetTypeInfo<MyClass>(out var info)) | ||
| { | ||
| Console.WriteLine($"Resolved type info for {info!.Type.Name}"); | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine("Type info not available"); | ||
| } | ||
| ``` | ||
|
|
||
| ### PascalCase Naming Policy | ||
|
|
||
| ```csharp | ||
| using System.Text.Json; | ||
|
|
||
| var opts = new JsonSerializerOptions | ||
| { | ||
| PropertyNamingPolicy = JsonNamingPolicy.PascalCase | ||
| }; | ||
|
|
||
| var obj = new { firstName = "John", lastName = "Doe" }; | ||
| string json = JsonSerializer.Serialize(obj, opts); | ||
| Console.WriteLine(json); | ||
| // Output: {"FirstName":"John","LastName":"Doe"} | ||
| ``` | ||
|
|
||
| ### Combined: Serialize with Typed Metadata | ||
|
|
||
| ```csharp | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization.Metadata; | ||
|
|
||
| var options = new JsonSerializerOptions | ||
| { | ||
| PropertyNamingPolicy = JsonNamingPolicy.PascalCase | ||
| }; | ||
|
|
||
| JsonTypeInfo<Person> typeInfo = options.GetTypeInfo<Person>(); | ||
| string json = JsonSerializer.Serialize(new Person("Jane", 30), typeInfo); | ||
| Console.WriteLine(json); | ||
| // Output: {"Name":"Jane","Age":30} | ||
|
|
||
| public record Person(string Name, int Age); | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| scenarios: | ||
| # --- Scenario 1: Serialize JSON in .NET 11 with PascalCase property names --- | ||
| # The prompt deliberately does NOT name any specific API. The skill description | ||
| # mentions "serializing JSON in .NET 11" and "PascalCase property naming" — those | ||
| # are the trigger words the agent should pick up on to load this skill. | ||
| - name: "Serialize JSON in .NET 11 with PascalCase property names" | ||
| prompt: | | ||
| I'm starting a new console app on .NET 11 and I need to serialize this record to JSON: | ||
|
|
||
| ```csharp | ||
| public record Person(string name, int age); | ||
| ``` | ||
|
|
||
| In the output JSON the property names should be PascalCase (so `Name` and `Age`, | ||
| not `name`/`age` or `firstName` style). I want to use whatever the framework | ||
| provides out of the box rather than writing my own naming-policy class. | ||
|
|
||
| Please show me the full program targeting `net11.0` and run it so I can see the | ||
| JSON output. | ||
| assertions: | ||
| - type: "exit_success" | ||
| - type: "output_matches" | ||
| pattern: "JsonNamingPolicy\\.PascalCase" | ||
| - type: "output_matches" | ||
| pattern: "net11\\.0" | ||
| - type: "output_not_matches" | ||
| pattern: "class\\s+\\w+\\s*:\\s*JsonNamingPolicy" | ||
| - type: "output_matches" | ||
| pattern: "\"Name\"" | ||
| - type: "output_matches" | ||
| pattern: "\"Age\"" | ||
| rubric: | ||
| - "Uses the new built-in JsonNamingPolicy.PascalCase static property (added in .NET 11) and does not implement a custom JsonNamingPolicy subclass" | ||
| - "Targets net11.0 in the project / file-based app" | ||
| - "Actually runs the program and shows JSON output with PascalCase property names (e.g. \"Name\", \"Age\")" | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
| timeout: 180 | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
|
|
||
| # --- Scenario 2: Typed metadata access on JsonSerializerOptions in .NET 11 --- | ||
| # Trigger words from the skill description: "typed metadata access", | ||
| # "JsonSerializerOptions", ".NET 11". The prompt asks for the desired *behavior* | ||
| # (type-safe metadata, no exception when missing) rather than naming the API. | ||
| - name: "Type-safe JsonTypeInfo access without exceptions in .NET 11" | ||
| prompt: | | ||
| In a .NET 11 library I'm working on, I have a `JsonSerializerOptions` instance | ||
| and I want to get the JSON metadata for a specific type `T` in a strongly-typed | ||
| way (i.e. I want back a `JsonTypeInfo<T>`, not a non-generic `JsonTypeInfo` that | ||
| I have to cast). | ||
|
|
||
| I also need a way to *probe* whether metadata for `T` is available without | ||
| having an exception thrown at me if it isn't — so I can branch on "have it" | ||
| vs "don't have it". I'd rather not wrap things in try/catch. | ||
|
|
||
| Show me a minimal `net11.0` program that demonstrates both: getting the typed | ||
| metadata when it's available, and checking-without-throwing for a case where | ||
| it might not be. Run the program. | ||
| assertions: | ||
| - type: "exit_success" | ||
| - type: "output_contains" | ||
| value: "GetTypeInfo<" | ||
| - type: "output_contains" | ||
| value: "TryGetTypeInfo<" | ||
| - type: "output_matches" | ||
| pattern: "out\\s+(var|JsonTypeInfo)" | ||
| - type: "output_matches" | ||
| pattern: "net11\\.0" | ||
| - type: "output_not_matches" | ||
| pattern: "\\bcatch\\b\\s*(\\(|\\{)" | ||
| - type: "output_matches" | ||
| pattern: "(True|False|found|Found|JsonTypeInfo)" | ||
| rubric: | ||
| - "Uses the new generic JsonSerializerOptions.GetTypeInfo<T>() overload (added in .NET 11) for the typed-access part" | ||
| - "Uses the new generic JsonSerializerOptions.TryGetTypeInfo<T>(out JsonTypeInfo<T>? info) overload (added in .NET 11) for the probing part" | ||
| - "Does NOT wrap GetTypeInfo in try/catch as a workaround" | ||
| - "Targets net11.0 and actually runs the program" | ||
| timeout: 180 | ||
|
|
||
| # --- Scenario 3: Negative — skill should NOT activate --- | ||
| # This is a JSON serialization task on .NET 8, with camelCase naming. None of the | ||
| # APIs covered by this skill (PascalCase policy, generic GetTypeInfo<T>/ | ||
| # TryGetTypeInfo<T>) are relevant. The agent should solve the task without | ||
| # loading the system-text-json-net11 skill. | ||
| - name: "Non-activation: camelCase JSON serialization on .NET 8" | ||
| prompt: | | ||
| I have a .NET 8 console app and I need to serialize this record to JSON with | ||
| camelCase property names: | ||
|
|
||
| ```csharp | ||
| public record Person(string Name, int Age); | ||
| ``` | ||
|
|
||
| Show me a minimal program targeting `net8.0` that produces output like | ||
| `{"name":"Jane","age":30}` and run it. | ||
| expect_activation: false | ||
| assertions: | ||
|
ManishJayaswal marked this conversation as resolved.
|
||
| - type: "exit_success" | ||
| - type: "output_matches" | ||
| pattern: "net8\\.0" | ||
| - type: "output_matches" | ||
| pattern: "JsonNamingPolicy\\.CamelCase" | ||
| - type: "output_not_matches" | ||
| pattern: "JsonNamingPolicy\\.PascalCase" | ||
| - type: "output_not_matches" | ||
| pattern: "net11\\.0" | ||
| - type: "output_matches" | ||
| pattern: "\"name\"" | ||
| - type: "output_matches" | ||
| pattern: "\"age\"" | ||
| rubric: | ||
| - "Solves the task using only pre-.NET 11 APIs (JsonNamingPolicy.CamelCase, standard JsonSerializer.Serialize)" | ||
| - "Does NOT load or reference the system-text-json-net11 skill — none of its APIs are needed here" | ||
| - "Targets net8.0 and produces camelCase JSON output" | ||
| timeout: 180 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.