Extracts inline code blocks from an input .NET documentation article file into article-relative ./snippets/ files and compilable projects. Use when moving fenced C#, Visual Basic, or XAML examples out of Markdown, adding :::code references and snippet markers, or converting embedded samples to standalone snippet projects.
89%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Move eligible inline code blocks from the target article into standalone files under an article-relative ./snippets/ folder. Add compilable project scaffolding and replace each extracted block with a :::code reference.
This skill requires one Markdown article file as input. Treat the supplied file as the target article. If the user doesn't provide a file, ask for one before you begin the extraction.
Extract an inline code block when any of these conditions apply:
Keep blocks of six lines or fewer inline unless another condition applies. Keep pseudocode and conceptual examples inline.
Follow these steps in order.
Choose every required platform, subject, and language path segment. For a language-guide article, omit the language segment. For XAML-only snippets, request only the csharp language segment.
Load and follow the create-snippet-folders skill with the target article and the complete list of chosen segments. Use the returned directories for the extracted files.
If the article discusses single-file applications, stop and ask the user whether to use single-file applications or traditional project-based applications.
Otherwise, use project-based applications. Reuse an existing project only when its language, platform, project type, and dependencies are compatible with the new code. For each new project, change to its intended snippet directory and use the dotnet CLI to create it. Never create project files manually, and don't specify an output folder with -o. Specify a meaningful project name with -n when practical. Use dotnet new console unless the snippet requires another project type, such as dotnet new winforms.
Use single-file applications only when the user requests them or confirms their use for an article that discusses them. Single-file applications:
Program.cs.dotnet run file.cs.The code must compile, but the project entry point doesn't need to execute every snippet.
Wrap each extracted snippet in comments with a meaningful CamelCase identifier. Use the same identifier in equivalent C# and Visual Basic examples.
C# markers:
// <ButtonClick>
...code here...
// </ButtonClick>Visual Basic markers:
' <ButtonClick>
...code here...
' </ButtonClick>Don't use identifiers such as 1, 2, code1, or snippet1.
Replace each inline block with a :::code reference:
:::code language="{code-language}" source="{relative-file-path}" id="{snippet-identifier}":::For example:
:::code language="csharp" source="./snippets/doc-name/csharp/File.cs" id="ButtonClick":::
:::code language="vb" source="./snippets/doc-name/vb/File.vb" id="ButtonClick":::Place C# and Visual Basic references one after the other. Don't put them in language tabs. Verify every source path and identifier against the created files.
When the article includes both C# and Visual Basic examples, ensure its frontmatter contains an entry for each language:
dev_langs:
- "csharp"
- "vb"Omit dev_langs when the article uses only one language, such as an article in a language guide.
Markup languages don't require languages in the frontmatter. For example, XAML snippets don't require a dev_langs entry.
Because this workflow rewrites an existing article, ensure its frontmatter contains ai-usage: ai-assisted unless the user asks only for a review without edits.
dotnet build.dotnet run file.cs.:::code paths resolve and all identifiers match their markers.dotnet/docs
bcbe167
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.