Automatically checks and starts .NET WebAPI service at the end of agent work...
This skill automatically checks if a .NET WebAPI service is running after the agent completes work on a .NET WebAPI project. If the service is not running, it offers to start it and open the Scalar API documentation in the browser.
This skill activates automatically at the end of agent work when:
.csproj file with ASP.NET Core referenceslaunchSettings.json file (or Properties/launchSettings.json)Follow these steps sequentially at the end of agent work:
.csproj files in the workspace root.csproj file to verify it contains ASP.NET Core references:Microsoft.AspNetCore.App framework referenceMicrosoft.AspNetCore.App package referenceMicrosoft.NET.Sdk.Web SDKlaunchSettings.json in:Properties/launchSettings.json (preferred location)launchSettings.json (root directory)launchSettings.json as JSONprofiles object"http" (if exists)"https" (if exists)launchUrl exists, use it as-is (it may already include a path)applicationUrl (split by semicolon if multiple URLs)applicationUrl contains multiple URLs separated by semicolons, prefer HTTP over HTTPS for faster startuplaunchUrl exists and doesn't end with /scalar, replace it with /scalarlaunchUrl, append /scalar to the base URL from applicationUrlhttp://localhost:5000 โ http://localhost:5000/scalarExtract the port number from the base URL (from Step 2)
Try to check if the service is running using one of these methods:
Method A: HTTP Request (preferred)
curl -f --max-time 2 <base-url> or similar HTTP requestMethod B: Port Check (fallback)
lsof -i :<port> or netstat -an | grep :<port>netstat -an | findstr :<port>If service is running:
If the service is not running:
Use the AskQuestion tool with this question:
["Yes", "No"]If user selects "No":
If user selects "Yes":
Determine the launch profile name (from Step 2)
Run the service in the background:
dotnet run --launch-profile <profile-name>
run_terminal_cmd with is_background: true.csproj fileWait for service startup:
Open browser to Scalar documentation:
open <scalar-url>xdg-open <scalar-url>start <scalar-url>Inform the user:
http://localhost:5000https://localhost:5001 (if HTTPS is preferred)"http" or "https" when running dotnet rundotnet run without --launch-profile"http" over "https" for faster startup (no certificate setup)applicationUrl if multiple URLs are presentdotnet run fails, inform the user about the error{
"profiles": {
"http": {
"commandName": "Project",
"applicationUrl": "http://localhost:5000",
"launchUrl": "swagger"
},
"https": {
"commandName": "Project",
"applicationUrl": "https://localhost:5001",
"launchUrl": "swagger"
}
}
}
HTTP Request:
curl -f --max-time 2 http://localhost:5000
Port Check (macOS/Linux):
lsof -i :5000
# or
netstat -an | grep :5000
Port Check (Windows):
netstat -an | findstr :5000
# From project root directory
dotnet run --launch-profile http
macOS:
open http://localhost:5000/scalar
Linux:
xdg-open http://localhost:5000/scalar
Windows:
start http://localhost:5000/scalar