[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BTDA0ZYZ7JMGEE1B756XR1":3,"skill-same:01M6BTDA0ZYZ7JMGEE1B756XR1":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":17,"ownerHtmlUrl":51,"ownerBlogUrl":52,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M6BTDA0ZYZ7JMGEE1B756XR1","generate-code-cs","TypeSpec 生成 C# 代码","Generate the code from typespec for C#. Parameter: C# SDK repository root location \u003Ccs_root>.","从 TypeSpec 生成 C# 代码。参数：C# SDK 仓库根目录位置 \u003Ccs_root>。","Azure\u002Fazure-sdk-for-net","Azure","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6844498?v=4","01M6BT15ZBDTV4D9RM7HCC4D8A","Microsoft Azure","01M6BT163EEHB7Y52MKZJ322Q8",6072,"MIT",null,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fai\u002F.github\u002Fskills\u002Fazure-ai-projects-generate-code\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BT7QVANT4709358VEJK53E","代码实现","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40],"generate","code","generate code cs","sdk","typespec","repository","location","C#","root","for","2026-11-10 10:12:30",false,"---\nname: generate-code-cs\ndescription: \"Generate the code from typespec for C#. Parameter: C# SDK repository root location \u003Ccs_root>.\"\n---\n\n# Basic information\nThe C# repository root location is provided by \u003Ccs_root>. C# source codes of interest are located in \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects, \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents and \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Extensions.OpenAI. Each folder contains subfolder `src`, which contains all the source codes. The `src\u002FGenerated` folder contains generated code; the folder `Custom` contains the code customizations. Please review the `references\u002Fcustomization.md` for more information on code customization. The typespec repository, used for code generation is located at https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-rest-api-specs.git. Please use the branch provided by user, if it is not provided use `feature\u002Ffoundry-release`.\n\n# Updating the code\n1. Take the latest commit hash from this branch and set it in `commit` field in three files: \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\u002Ftsp-location.yaml, \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects\u002Ftsp-location.yaml and \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Extensions.OpenAI\u002Ftsp-location.yaml.\n2. After the files are modified, remove the directory \u003Ccs_root>\\eng\\common\\tsp-client\\node_modules if present.\n3. Generate code for the first package. This command may fail with EPERM error.\n\n```powershell\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\ndotnet build \u002Ft:GenerateCode\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\ndotnet build \u002Ft:GenerateCode\n```\n\nIf the EPERM error has happened, run the next code and make sure it passes:\n\n```powershell\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects.Agents\\src\u002F..\u002F\n```\n\n```bash\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects.Agents\\src\u002F..\u002F\n```\n\n4. Generate code using the script below.\n\n```powershell\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Extensions.OpenAI\\src\u002F..\u002F\ncd ..\u002FAzure.AI.Projects\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects\\src\u002F..\u002F\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\ndotnet build \u002Ft:GenerateCode\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Extensions.OpenAI\\src\u002F..\u002F\ncd ..\u002FAzure.AI.Projects\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects\\src\u002F..\u002F\n```\n\n# Post processing\n\n1. For each package, check that it compiles without errors (replace \u003Cpackage> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`):\n\n```powershell\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet build \u002Ft:GenerateCode\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet build \u002Ft:GenerateCode\n```\n\n2. If there are any errors, customize the code so that it compiles.\n3. `Azure.AI.Projects.Agents` package after code generation may get new tool classes, inherited from `Tool`. The same classes will be generated in `Azure.AI.Extensions.OpenAI` projects. If that is the case, add into the file `\u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Extensions.OpenAI\u002Fsrc\u002FCustom.CodeGenStubs.Tools.cs` entries to rename the generated tool classes and their parameters so that they have `Responses` prefix. For example, if the class `FabricIQPreviewTool` was added, add the next entries:\n\n```C#\n[CodeGenType(\"FabricIQPreviewTool\")] public partial class ResponsesFabricIQPreviewTool { }\n[CodeGenType(\"FabricIQPreviewToolParameters\")] public partial class ResponsesFabricIQPreviewToolParameters { }\n```\n\nOrder the entries in the file alphabetically; do not remove the entries already present.\n4. Make sure that all projects build without errors by running `dotnet build` inside the project folder.\n5. Update the API-view by running the script (replace \u003Cpackage> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`):\n\n```powershell\ncd \u003Ccs_root>\neng\\scripts\\Export-API.ps1 ai\\\u003Cpackage>\n```\n\n```bash\ncd \u003Ccs_root>\neng\\scripts\\Export-API.ps1 ai\\\u003Cpackage>\n```\n\n\n# Sample generation\n1. Provide the summary of changes.\n2. If there were significant changes in the code, please provide the samples as explained below.\n\nA C# sample consists of two parts: the source code in the folder \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage_name>\u002Ftests\u002FSamples and corresponding .md files go to \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage_name>\u002FSamples.\nThe C# file should demonstrate both sync and async API when appropriate. See the example below:\n\n## Asynchronous Sample\n```C#\n#if SNIPPET\n        var projectEndpoint = System.Environment.GetEnvironmentVariable(\"FOUNDRY_PROJECT_ENDPOINT\");\n        var modelDeploymentName = System.Environment.GetEnvironmentVariable(\"FOUNDRY_MODEL_NAME\");\n#else\n        var projectEndpoint = TestEnvironment.FOUNDRY_PROJECT_ENDPOINT;\n        var modelDeploymentName = TestEnvironment.FOUNDRY_MODEL_NAME;\n#endif\n        AIProjectClient projectClient = new(endpoint: new Uri(projectEndpoint), tokenProvider: new DefaultAzureCredential());\nDeclarativeAgentDefinition agentDefinition = new(model: modelDeploymentName)\n{\n    Instructions = \"You are a prompt agent.\"\n};\nProjectsAgentVersion agentVersion1 = await projectClient.AgentAdministrationClient.CreateAgentVersionAsync(\n    agentName: \"myAgent1\",\n    options: new(agentDefinition));\n```\n\n## Synchronous Sample\n```C#\n#if SNIPPET\n        var projectEndpoint = System.Environment.GetEnvironmentVariable(\"FOUNDRY_PROJECT_ENDPOINT\");\n        var modelDeploymentName = System.Environment.GetEnvironmentVariable(\"FOUNDRY_MODEL_NAME\");\n#else\n        var projectEndpoint = TestEnvironment.FOUNDRY_PROJECT_ENDPOINT;\n        var modelDeploymentName = TestEnvironment.FOUNDRY_MODEL_NAME;\n#endif\n        AIProjectClient projectClient = new(endpoint: new Uri(projectEndpoint), tokenProvider: new DefaultAzureCredential());\nDeclarativeAgentDefinition agentDefinition = new(model: modelDeploymentName)\n{\n    Instructions = \"You are a prompt agent.\"\n};\nProjectsAgentVersion agentVersion1 = projectClient.AgentAdministrationClient.CreateAgentVersion(\n    agentName: \"myAgent1\",\n    options: new(agentDefinition));\n```\n\nThe code needs to be logically split into blocks, whose usage should be explained in .md file. Each block is marked in the source code as follows:\n\n```C#\n#region Snippet:Sample_FunctionFoo_MySampl_Async\npublic async Task Foo()\n{\n    await Task.Delay(1000);\n    Console.WriteLine(\"Hello world!\")\n} \n#endregion\n```\n\nThese blocks will be rendered in the .md file code block based on the region name (it will be done by automation):\n```C# Snippet:Sample_FunctionFoo_MySampl_Async\npublic async Task Foo()\n{\n    await Task.Delay(1000);\n    Console.WriteLine(\"Hello world!\")\n}\n```\n\nIf the code block has sync and async counterpart, please create code block for each of them. Provide the short explanation for each code block. Please make sure that there is one-to-one consistency between C# regions and .md file code blocks.\nTo make sure that it is so, call the script (replace \u003Cpackage> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`):\n\n```powershell\ncd \u003Ccs_root>\neng\\scripts\\Update-Snippets.ps1 ai\\\u003Cpackage>\n```\n\n```bash\ncd \u003Ccs_root>\neng\\scripts\\Update-Snippets.ps1 ai\\\u003Cpackage>\n```\n\n# Updating changelog\nGet the differences by running\n\n```powershell\ncd \u003Ccs_root>\ngit diff\n```\n\n```bash\ncd \u003Ccs_root>\ngit diff\n```\n\nFigure out, which classes are public facing and based on that populate the latest section of `Release History`. Append the found changes to the `### Features Added`, `### Breaking Changes`, `### Bugs Fixed` or `### Other Changes` section. It is also possible to add `### Sample Updates` section or append data to it. Do not modify the header, denoting version and release date, for example `## 2.1.0-beta.2 (Unreleased)`.\n\n# [Optional] Create a pull request\n\n1. Prompt user if the PR is required. If it is not, go to the section \"Package generation\".\n2. Get the user's github alias by running `gh api user --jq .login`.\n3. Stash the changes and make sure to use the latest main branch.\n    ```powershell\n    git stash\n    git checkout main\n    git pull origin main\n    ```\n\n    ```bash\n    git stash\n    git checkout main\n    git pull origin main\n    ```\n4. Create a branch and apply stashed changes; replace \\\u003Cuser_alias\\> by user github alias from step 2. Replace \\\u003Ccommit\\> by the commit hash from the typespec.\n\n    ```bash\n    git checkout -b \u003Cuser_alias>\u002Fcode_generation_\u003Ccommit>\n    git stash apply\n    ```\n\n    ```powershell\n    git checkout -b \u003Cuser_alias>\u002Fcode_generation_\u003Ccommit>\n    git stash apply\n    ```\n5. Add all new files by running `git add` and modified files by `git add -u`.\n6. Commit changes with the short summary of added features as a comment `git commit -m \"new features\"`\n7. Create a pull request by calling `gh pr create --title \"\u003Ctitle>\" --body \"\u003Cchangelog> --assignee @me\"`; replace \\\u003Ctitle\\> and \\\u003Cchangelog\\> by short PR title and the changes from the changelog, we have generated in \"Updating changelog\" section.\n\n# [Optional] Create an alpha package release\n\n1. Prompt user if alpha package release is required. If it is not, go to the section \"Package generation\".\n2. Check the next prerequisites:\n   * azure-cli must be installed and present in the path (please check by running `az az pipelines show --id 7296 --organization https:\u002F\u002Fdev.azure.com\u002Fazure-sdk\u002F --project internal`).\n   * User needs to have a permission to access (check by running `curl https:\u002F\u002Fdev.azure.com\u002Fazure-sdk\u002Finternal\u002F_artifacts\u002Ffeed\u002Fazure-sdk-for-net-pr`)\n3. Run the pipeline `az pipelines run --id 7296 --organization https:\u002F\u002Fdev.azure.com\u002Fazure-sdk\u002F --project internal --branch nirovins\u002Ffix_pipelines --variables \"SetDevVersion=true\" --open`; replace the \\\u003Cbranch\\> by the branch from \"Create a pull request\" section.\n\n# Package generation\nAfter everything is ready, please generate the packages for all \\\u003Cpackage\\> i.e. (replace \\\u003Cpackage\\> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`).\n\n\n```powershell\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet pack\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet pack\n```\n\nProvide the location of each package in the summary and provide the simple instruction on installation.\nIf the alpha package was released to Azure (in section \"Create an alpha package release\"), please add to the instructions command to add a new NuGet repository to the project. `dotnet nuget add source https:\u002F\u002Fpkgs.dev.azure.com\u002Fazure-sdk\u002Fpublic\u002F_packaging\u002Fazure-sdk-for-net\u002Fnuget\u002Fv3\u002Findex.json`\n","# Basic information\nThe C# repository root location is provided by \u003Ccs_root>. C# source codes of interest are located in \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects, \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents and \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Extensions.OpenAI. Each folder contains subfolder `src`, which contains all the source codes. The `src\u002FGenerated` folder contains generated code; the folder `Custom` contains the code customizations. Please review the `references\u002Fcustomization.md` for more information on code customization. The typespec repository, used for code generation is located at https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-rest-api-specs.git. Please use the branch provided by user, if it is not provided use `feature\u002Ffoundry-release`.\n\n# Updating the code\n1. Take the latest commit hash from this branch and set it in `commit` field in three files: \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\u002Ftsp-location.yaml, \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects\u002Ftsp-location.yaml and \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Extensions.OpenAI\u002Ftsp-location.yaml.\n2. After the files are modified, remove the directory \u003Ccs_root>\\eng\\common\\tsp-client\\node_modules if present.\n3. Generate code for the first package. This command may fail with EPERM error.\n\n```powershell\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\ndotnet build \u002Ft:GenerateCode\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\ndotnet build \u002Ft:GenerateCode\n```\n\nIf the EPERM error has happened, run the next code and make sure it passes:\n\n```powershell\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects.Agents\\src\u002F..\u002F\n```\n\n```bash\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects.Agents\\src\u002F..\u002F\n```\n\n4. Generate code using the script below.\n\n```powershell\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Extensions.OpenAI\\src\u002F..\u002F\ncd ..\u002FAzure.AI.Projects\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects\\src\u002F..\u002F\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\ndotnet build \u002Ft:GenerateCode\ncd ..\u002FAzure.AI.Extensions.OpenAI\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Extensions.OpenAI\\src\u002F..\u002F\ncd ..\u002FAzure.AI.Projects\nnpm exec --prefix \u003Ccs_root>\\eng\\common\u002Ftsp-client --no -- tsp-client update --no-prompt --output-dir\u003Ccs_root>\\sdk\\ai\\Azure.AI.Projects\\src\u002F..\u002F\n```\n\n# Post processing\n\n1. For each package, check that it compiles without errors (replace \u003Cpackage> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`):\n\n```powershell\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet build \u002Ft:GenerateCode\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet build \u002Ft:GenerateCode\n```\n\n2. If there are any errors, customize the code so that it compiles.\n3. `Azure.AI.Projects.Agents` package after code generation may get new tool classes, inherited from `Tool`. The same classes will be generated in `Azure.AI.Extensions.OpenAI` projects. If that is the case, add into the file `\u003Ccs_root>\u002Fsdk\u002Fai\u002FAzure.AI.Extensions.OpenAI\u002Fsrc\u002FCustom.CodeGenStubs.Tools.cs` entries to rename the generated tool classes and their parameters so that they have `Responses` prefix. For example, if the class `FabricIQPreviewTool` was added, add the next entries:\n\n```C#\n[CodeGenType(\"FabricIQPreviewTool\")] public partial class ResponsesFabricIQPreviewTool { }\n[CodeGenType(\"FabricIQPreviewToolParameters\")] public partial class ResponsesFabricIQPreviewToolParameters { }\n```\n\nOrder the entries in the file alphabetically; do not remove the entries already present.\n4. Make sure that all projects build without errors by running `dotnet build` inside the project folder.\n5. Update the API-view by running the script (replace \u003Cpackage> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`):\n\n```powershell\ncd \u003Ccs_root>\neng\\scripts\\Export-API.ps1 ai\\\u003Cpackage>\n```\n\n```bash\ncd \u003Ccs_root>\neng\\scripts\\Export-API.ps1 ai\\\u003Cpackage>\n```\n\n\n# Sample generation\n1. Provide the summary of changes.\n2. If there were significant changes in the code, please provide the samples as explained below.\n\nA C# sample consists of two parts: the source code in the folder \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage_name>\u002Ftests\u002FSamples and corresponding .md files go to \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage_name>\u002FSamples.\nThe C# file should demonstrate both sync and async API when appropriate. See the example below:\n\n## Asynchronous Sample\n```C#\n#if SNIPPET\n        var projectEndpoint = System.Environment.GetEnvironmentVariable(\"FOUNDRY_PROJECT_ENDPOINT\");\n        var modelDeploymentName = System.Environment.GetEnvironmentVariable(\"FOUNDRY_MODEL_NAME\");\n#else\n        var projectEndpoint = TestEnvironment.FOUNDRY_PROJECT_ENDPOINT;\n        var modelDeploymentName = TestEnvironment.FOUNDRY_MODEL_NAME;\n#endif\n        AIProjectClient projectClient = new(endpoint: new Uri(projectEndpoint), tokenProvider: new DefaultAzureCredential());\nDeclarativeAgentDefinition agentDefinition = new(model: modelDeploymentName)\n{\n    Instructions = \"You are a prompt agent.\"\n};\nProjectsAgentVersion agentVersion1 = await projectClient.AgentAdministrationClient.CreateAgentVersionAsync(\n    agentName: \"myAgent1\",\n    options: new(agentDefinition));\n```\n\n## Synchronous Sample\n```C#\n#if SNIPPET\n        var projectEndpoint = System.Environment.GetEnvironmentVariable(\"FOUNDRY_PROJECT_ENDPOINT\");\n        var modelDeploymentName = System.Environment.GetEnvironmentVariable(\"FOUNDRY_MODEL_NAME\");\n#else\n        var projectEndpoint = TestEnvironment.FOUNDRY_PROJECT_ENDPOINT;\n        var modelDeploymentName = TestEnvironment.FOUNDRY_MODEL_NAME;\n#endif\n        AIProjectClient projectClient = new(endpoint: new Uri(projectEndpoint), tokenProvider: new DefaultAzureCredential());\nDeclarativeAgentDefinition agentDefinition = new(model: modelDeploymentName)\n{\n    Instructions = \"You are a prompt agent.\"\n};\nProjectsAgentVersion agentVersion1 = projectClient.AgentAdministrationClient.CreateAgentVersion(\n    agentName: \"myAgent1\",\n    options: new(agentDefinition));\n```\n\nThe code needs to be logically split into blocks, whose usage should be explained in .md file. Each block is marked in the source code as follows:\n\n```C#\n#region Snippet:Sample_FunctionFoo_MySampl_Async\npublic async Task Foo()\n{\n    await Task.Delay(1000);\n    Console.WriteLine(\"Hello world!\")\n} \n#endregion\n```\n\nThese blocks will be rendered in the .md file code block based on the region name (it will be done by automation):\n```C# Snippet:Sample_FunctionFoo_MySampl_Async\npublic async Task Foo()\n{\n    await Task.Delay(1000);\n    Console.WriteLine(\"Hello world!\")\n}\n```\n\nIf the code block has sync and async counterpart, please create code block for each of them. Provide the short explanation for each code block. Please make sure that there is one-to-one consistency between C# regions and .md file code blocks.\nTo make sure that it is so, call the script (replace \u003Cpackage> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`):\n\n```powershell\ncd \u003Ccs_root>\neng\\scripts\\Update-Snippets.ps1 ai\\\u003Cpackage>\n```\n\n```bash\ncd \u003Ccs_root>\neng\\scripts\\Update-Snippets.ps1 ai\\\u003Cpackage>\n```\n\n# Updating changelog\nGet the differences by running\n\n```powershell\ncd \u003Ccs_root>\ngit diff\n```\n\n```bash\ncd \u003Ccs_root>\ngit diff\n```\n\nFigure out, which classes are public facing and based on that populate the latest section of `Release History`. Append the found changes to the `### Features Added`, `### Breaking Changes`, `### Bugs Fixed` or `### Other Changes` section. It is also possible to add `### Sample Updates` section or append data to it. Do not modify the header, denoting version and release date, for example `## 2.1.0-beta.2 (Unreleased)`.\n\n# [Optional] Create a pull request\n\n1. Prompt user if the PR is required. If it is not, go to the section \"Package generation\".\n2. Get the user's github alias by running `gh api user --jq .login`.\n3. Stash the changes and make sure to use the latest main branch.\n    ```powershell\n    git stash\n    git checkout main\n    git pull origin main\n    ```\n\n    ```bash\n    git stash\n    git checkout main\n    git pull origin main\n    ```\n4. Create a branch and apply stashed changes; replace \\\u003Cuser_alias\\> by user github alias from step 2. Replace \\\u003Ccommit\\> by the commit hash from the typespec.\n\n    ```bash\n    git checkout -b \u003Cuser_alias>\u002Fcode_generation_\u003Ccommit>\n    git stash apply\n    ```\n\n    ```powershell\n    git checkout -b \u003Cuser_alias>\u002Fcode_generation_\u003Ccommit>\n    git stash apply\n    ```\n5. Add all new files by running `git add` and modified files by `git add -u`.\n6. Commit changes with the short summary of added features as a comment `git commit -m \"new features\"`\n7. Create a pull request by calling `gh pr create --title \"\u003Ctitle>\" --body \"\u003Cchangelog> --assignee @me\"`; replace \\\u003Ctitle\\> and \\\u003Cchangelog\\> by short PR title and the changes from the changelog, we have generated in \"Updating changelog\" section.\n\n# [Optional] Create an alpha package release\n\n1. Prompt user if alpha package release is required. If it is not, go to the section \"Package generation\".\n2. Check the next prerequisites:\n   * azure-cli must be installed and present in the path (please check by running `az az pipelines show --id 7296 --organization https:\u002F\u002Fdev.azure.com\u002Fazure-sdk\u002F --project internal`).\n   * User needs to have a permission to access (check by running `curl https:\u002F\u002Fdev.azure.com\u002Fazure-sdk\u002Finternal\u002F_artifacts\u002Ffeed\u002Fazure-sdk-for-net-pr`)\n3. Run the pipeline `az pipelines run --id 7296 --organization https:\u002F\u002Fdev.azure.com\u002Fazure-sdk\u002F --project internal --branch nirovins\u002Ffix_pipelines --variables \"SetDevVersion=true\" --open`; replace the \\\u003Cbranch\\> by the branch from \"Create a pull request\" section.\n\n# Package generation\nAfter everything is ready, please generate the packages for all \\\u003Cpackage\\> i.e. (replace \\\u003Cpackage\\> by `Azure.AI.Projects`, `Azure.AI.Extensions.OpenAI` or `Azure.AI.Projects.Agents`).\n\n\n```powershell\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet pack\n```\n\n```bash\ncd \u003Ccs_root>\u002Fsdk\u002Fai\u002F\u003Cpackage>\ndotnet pack\n```\n\nProvide the location of each package in the summary and provide the simple instruction on installation.\nIf the alpha package was released to Azure (in section \"Create an alpha package release\"), please add to the instructions command to add a new NuGet repository to the project. `dotnet nuget add source https:\u002F\u002Fpkgs.dev.azure.com\u002Fazure-sdk\u002Fpublic\u002F_packaging\u002Fazure-sdk-for-net\u002Fnuget\u002Fv3\u002Findex.json`\n",{"name":5,"description":7},"main","dbc5eb654c3492137a4fbeeb6776c804f0042063","sdk\u002Fai\u002F.github\u002Fskills\u002Fazure-ai-projects-generate-code",5228,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net","https:\u002F\u002Fgithub.com\u002FAzure","https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fazure\u002F","APIs, SDKs and open source projects from Microsoft Azure","2026-11-14 22:39:26",{"source":9,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add Azure\u002Fazure-sdk-for-net --skill generate-code-cs",{"tool":61,"command":62},"bunx","bunx skills add Azure\u002Fazure-sdk-for-net --skill generate-code-cs",{"tool":64,"command":65},"pnpm","pnpm dlx skills add Azure\u002Fazure-sdk-for-net --skill generate-code-cs","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fai\u002F.github\u002Fskills\u002Fazure-ai-projects-generate-code\u002FSKILL.md",true,[69],{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fcustomization.md","REFERENCE","参考文档",34378,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fai\u002F.github\u002Fskills\u002Fazure-ai-projects-generate-code\u002Freferences\u002Fcustomization.md",[76,99,132,161,187,211],{"skillNo":77,"name":78,"nameZh":79,"description":80,"descriptionZh":81,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":82,"categories":83,"keywords":86,"publishedAt":41},"01M6BTE1QTJPYDAN115GS2EHDQ","update-chat-api","WebPubSub Chat API 基线维护","Use when: updating, exporting, refreshing, or validating the public API baseline for Azure.Messaging.WebPubSub.Chat after a public API change.","使用场景：在公共 API 发生变更后，更新、导出、刷新或验证 Azure.Messaging.WebPubSub.Chat 的公共 API 基线。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fwebpubsub\u002F.github\u002Fskills\u002Fupdate-chat-api\u002FSKILL.md",[84,85],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[87,88,89,90,91,92,93,94,95,96,97,40,98],"update","api","update chat api","chat","change","azure","messaging","baseline","public","use","public api","when",{"skillNo":100,"name":101,"nameZh":102,"description":103,"descriptionZh":104,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":105,"categories":106,"keywords":111,"publishedAt":41},"01M6BTDYJS2RSGZR2T2BTJJ6YC","search-documents","Azure 搜索文档 SDK 端到端工作流","E2E workflow skill for Azure.Search.Documents SDK (TypeSpec + heavy customization). Handles full release cycles and partial updates: SHA update; code generation; build; customization fixes; ServiceVersion sync; testing; API export; changelog; version; samples; formatting; release metadata. WHEN: create new package version for Azure.Search.Documents; regenerate Azure.Search.Documents; fix Azure.Search.Documents bug; release Azure.Search.Documents; update Azure.Search.Documents spec. Do not use for Azure.ResourceManager.Search or Azure.Provisioning.Search.","Azure.Search.Documents SDK 的端到端（E2E）工作流技能（TypeSpec + 大量定制）。处理完整发布周期和部分更新：SHA 更新；代码生成；构建；定制修复；ServiceVersion 同步；测试；API 导出；变更日志；版本；示例；格式化；发布元数据。使用场景：为 Azure.Search.Documents 创建新包版本；重新生成 Azure.Search.Documents；修复 Azure.Search.Documents 错误；发布 Azure.Search.Documents；更新 Azure.Search.Documents 规范。不适用于 Azure.ResourceManager.Search 或 Azure.Provisioning.Search。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fsearch\u002FAzure.Search.Documents\u002F.github\u002Fskills\u002Fsearch-documents\u002FSKILL.md",[107,108],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":109,"categoryName":110,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C6RHQSB2BGY8CHB7AN49N9","Microsoft 应用生命周期管理",[112,113,114,115,116,34,117,118,92,35,119,87,32,120,121,122,123,124,125,88,126,127,128,129,130,98,131],"documents","search","search documents","testing","spec","workflow","sync","create","release","changelog","package","Code Generation","e2e","provisioning","fix","bug","workflow skill","updates","new package","new",{"skillNo":133,"name":134,"nameZh":135,"description":136,"descriptionZh":137,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":138,"categories":139,"keywords":144,"publishedAt":41},"01M6BTDVJGZ0N7F7DXR5Z7E0QH","search-documents-version-diff","Search.Documents 版本差异检测","Diff the current Azure.Search.Documents public API surface against a previous published version and detect preview-to-preview regressions where the SDK customization layer was not bubbled up after a TypeSpec change. Use whenever the user asks to compare Azure.Search.Documents betas, verify no Azure.Search.Documents preview features dropped, regression audit between Azure.Search.Documents versions, sanity-check a release branch for Azure.Search.Documents, or investigate a missing Azure.Search.Documents preview feature — even if they don't say the word \"diff\". Specifically catches dropped wrappers (QueryAnswer\u002FQueryCaption\u002FQueryRewrites style), lost SearchOptions aggregator redirectors, `@@access(\"internal\")` flips, deleted-instead-of-gated `#if AZURE_SEARCH_PREVIEW` blocks, dropped `ServiceVersion` enum values, and convenience-to-protocol downgrades.","将当前 Azure.Search.Documents 公共 API 接口与之前发布的版本进行对比，检测因 TypeSpec 变更后 SDK 自定义层未向上传播而导致的预览版之间的回归。当用户要求比较 Azure.Search.Documents 各 beta 版本、确认 Azure.Search.Documents 预览功能未丢失、审计 Azure.Search.Documents 各版本间的回归、对 Azure.Search.Documents 发布分支进行健全性检查，或排查 Azure.Search.Documents 预览功能缺失时使用——即使用户没有提到“diff”一词。专门捕获丢失的包装器（QueryAnswer\u002FQueryCaption\u002FQueryRewrites 类型）、丢失的 SearchOptions 聚合重定向器、`@@access(\"internal\")` 翻转、被直接删除而非通过条件门控的 `#if AZURE_SEARCH_PREVIEW` 代码块、丢失的 `ServiceVersion` 枚举值，以及便捷方法降级为协议方法等问题。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fsearch\u002FAzure.Search.Documents\u002F.github\u002Fskills\u002Fsearch-documents-version-diff\u002FSKILL.md",[140,141],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":142,"categoryName":143,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[112,113,145,114,146,147,34,91,92,35,120,148,149,88,150,151,152,153,154,155,156,157,97,158,159,160],"search documents version diff","version","diff","protocol","audit","verify","investigate","access","regression","branch","up","preview","aggregator","sanity","layer","features",{"skillNo":162,"name":163,"nameZh":164,"description":165,"descriptionZh":166,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":167,"categories":168,"keywords":171,"publishedAt":41},"01M6BTDRCG0SXKPKCFWR75FY8T","search-documents-typespec-validation","Search.Documents TypeSpec 一致性验证","TypeSpec validation skill for Azure.Search.Documents SDK. Performs a COMPLETE validation of ALL operations, ALL models, ALL enums, and ALL properties against the TypeSpec definition at any pinned commit. Works for any API version. Generates a full gap report: missing features, extra features, naming mismatches, and recommended fix location. WHEN: \"validate Azure.Search.Documents SDK against TypeSpec\", \"detect Azure.Search.Documents typespec feature gaps\", \"what is missing from the Azure.Search.Documents SDK\", \"compare Azure.Search.Documents SDK to spec\", \"full spec coverage audit for Azure.Search.Documents\". Do NOT use for version-to-version diff or regression detection — use search-documents-version-diff instead.","面向 Azure.Search.Documents SDK 的 TypeSpec 验证技能。针对任意固定 commit 的 TypeSpec 定义，对全部操作、全部模型、全部枚举和全部属性执行完整验证。适用于任何 API 版本。生成完整的差距报告：缺失功能、多余功能、命名不匹配以及建议的修复位置。适用场景：“根据 TypeSpec 验证 Azure.Search.Documents SDK”、“检测 Azure.Search.Documents TypeSpec 功能差距”、“Azure.Search.Documents SDK 缺少哪些功能”、“将 Azure.Search.Documents SDK 与规范对比”、“对 Azure.Search.Documents 进行完整的规范覆盖审计”。请勿用于版本间差异对比或回归检测——此类情况请使用 search-documents-version-diff。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fsearch\u002FAzure.Search.Documents\u002F.github\u002Fskills\u002Fsearch-documents-typespec-validation\u002FSKILL.md",[169,170],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":142,"categoryName":143,"taxonomyType":28,"taxonomyTypeDesc":29},[112,35,172,113,173,114,116,34,174,175,176,177,92,178,149,179,88,153,180,181,126,182,183,184,160,185,186,98],"validation","search documents typespec validation","to spec","commit","validate","gap report","report","detection","extra","coverage","do","full","at","api version","definition",{"skillNo":188,"name":189,"nameZh":190,"description":191,"descriptionZh":192,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":193,"categories":194,"keywords":201,"publishedAt":41},"01M6BTDP9JS9KNT1H9ED8AGZF5","test-skill_file","掷骰子技能文件测试","Roll dice using a random number generator.","使用随机数生成器掷骰子。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\u002Ftests\u002FTestData\u002Froll-dice\u002FSKILL.md",[195,198],{"categoryNo":196,"categoryName":197,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BS5011KJDVSRXG1DC4P666","普通用户",{"categoryNo":199,"categoryName":200,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C9521NCBJVNZKB553TX3WK","抽奖活动与随机抽取",[202,203,204,205,206,207,208,209,210],"test","Test Skill","file","test skill file","roll dice","dice","random","generator","number",{"skillNo":212,"name":213,"nameZh":214,"description":215,"descriptionZh":216,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":217,"categories":218,"keywords":221,"publishedAt":41},"01M6BTDMF2VK2CM53SSHZNWX7T","roll-dice","随机数掷骰子","Roll dice using a random number generator. Use when asked to roll a die (d6, d20, etc.), roll dice, or generate a random dice roll.","使用随机数生成器掷骰子。当用户要求掷单个骰子（d6、d20 等）、掷骰子或生成随机掷骰结果时使用。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\u002Ftests\u002FSamples\u002Froll-dice\u002FSKILL.md",[219,220],{"categoryNo":196,"categoryName":197,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":199,"categoryName":200,"taxonomyType":28,"taxonomyTypeDesc":29},[206,207,31,96,208,209,210,98]]