mirror of
https://github.com/dotnet/skills.git
synced 2026-09-20 09:49:54 +08:00
7e6954f9a9
* Add testability migration skills and agent for dotnet-test Introduces three skills and one orchestrator agent to help developers incrementally replace hard-to-test static dependencies with injectable abstractions: - detect-static-dependencies: scans C# code for DateTime.Now, File.*, Environment.*, HttpClient, Console.*, Process.* and ranks by frequency - generate-testability-wrappers: generates wrapper interfaces or guides adoption of built-in abstractions (TimeProvider, IHttpClientFactory, System.IO.Abstractions) - migrate-static-to-wrapper: mechanical codemod-style bulk replacement of static call sites with wrapper calls, scoped per project/namespace - testability-migration agent: orchestrates the Detect-Generate-Migrate pipeline end-to-end Includes eval.yaml tests and fixture projects for all three skills and the agent. * Fix activation, token overhead, and eval timeouts - Expand skill descriptions with more trigger phrases for migrate-static-to-wrapper and generate-testability-wrappers to fix NOT ACTIVATED issues - Collapse verbose replacement mapping tables and constructor examples to reduce token overhead (~30% fewer tokens) - Increase generate-testability-wrappers eval timeouts from 120s to 240s to prevent timeout-impacted scoring - Soften detect-static-dependencies scenario 2 rubric to reduce run-to-run variance in plugin mode - Increase migrate-static-to-wrapper non-activation timeout
51 lines
2.3 KiB
YAML
51 lines
2.3 KiB
YAML
scenarios:
|
|
- name: "Full pipeline: detect statics and recommend migration plan"
|
|
prompt: |
|
|
I have a SubscriptionManager class that's impossible to unit test because it
|
|
uses DateTime.UtcNow, File.*, Directory.*, Environment.*, and Console.* all
|
|
directly. Can you analyze it and help me make it testable?
|
|
setup:
|
|
copy_test_files: true
|
|
additional_required_skills:
|
|
- detect-static-dependencies
|
|
- generate-testability-wrappers
|
|
- migrate-static-to-wrapper
|
|
assertions:
|
|
- type: "output_matches"
|
|
pattern: "(DateTime\\.UtcNow|DateTime\\.Now|time)"
|
|
- type: "output_matches"
|
|
pattern: "(File\\.|Directory\\.|file system|filesystem)"
|
|
- type: "output_matches"
|
|
pattern: "(TimeProvider|IFileSystem|System\\.IO\\.Abstractions|wrapper|abstraction)"
|
|
- type: "exit_success"
|
|
rubric:
|
|
- "Identified the static dependencies in SubscriptionManager (time, filesystem, environment, console)"
|
|
- "Recommended TimeProvider for replacing DateTime.UtcNow calls"
|
|
- "Recommended System.IO.Abstractions or a wrapper for File/Directory calls"
|
|
- "Proposed an incremental migration plan rather than changing everything at once"
|
|
- "Produced concrete code changes or clear next steps"
|
|
timeout: 300
|
|
|
|
- name: "Targeted request: just migrate DateTime to TimeProvider"
|
|
prompt: |
|
|
I only care about making the time calls testable right now. Replace DateTime.UtcNow
|
|
with TimeProvider in my SubscriptionManager class. I'm on .NET 10.
|
|
setup:
|
|
copy_test_files: true
|
|
additional_required_skills:
|
|
- migrate-static-to-wrapper
|
|
assertions:
|
|
- type: "file_contains"
|
|
path: "**/SubscriptionManager.cs"
|
|
value: "TimeProvider"
|
|
- type: "file_not_contains"
|
|
path: "**/SubscriptionManager.cs"
|
|
value: "DateTime.UtcNow"
|
|
- type: "exit_success"
|
|
rubric:
|
|
- "Replaced all DateTime.UtcNow calls in SubscriptionManager with TimeProvider equivalents"
|
|
- "Added TimeProvider as a dependency to SubscriptionManager via constructor injection"
|
|
- "Registered TimeProvider.System in the DI container in Program.cs"
|
|
- "Did not modify the File.*, Directory.*, Environment.*, or Console.* calls — stayed focused"
|
|
timeout: 300
|