port-killer
Kills processes that are listening on specific network ports. Detects the operating system (Windows, macOS, or Linux) and uses the appropriate native commands to find PIDs by port and terminate them. Use this skill whenever the user wants to free up a port, kill something running on a port, stop a server on a port, or mentions that a port is "already in use" or "blocked". Also triggers when the user says things like "something is running on port 3000" or "I can't start my server because port 8080 is taken". Supports multiple ports at once.
What this skill does
# Port Killer
Kill processes occupying network ports. Works on Windows, macOS, and Linux.
## How It Works
1. Detect the operating system from the platform/shell environment
2. For each requested port, find the PID of the process listening on it
3. Kill each process by PID
4. Report what was killed (PID, port) and any ports that were already free
## OS Detection
Determine the OS using `uname` or environment context:
| OS | Detection |
|----|-----------|
| **Windows** | `uname` returns something containing "MINGW", "MSYS", or "CYGWIN", or the platform is `win32` |
| **macOS** | `uname` returns "Darwin" |
| **Linux** | `uname` returns "Linux" |
If you already know the OS from the environment context (e.g., the system prompt says `Platform: win32`), skip the detection step.
## Finding PIDs by Port
### Windows
Determine whether the shell is **PowerShell** or **Git Bash** from the environment context (the system prompt typically says `Shell: powershell` or `Shell: bash`). Use the matching approach below.
#### PowerShell
`Get-NetTCPConnection` is the cleanest way — it returns structured objects so there's no text parsing needed:
```powershell
# Find PID listening on port 3000
$conn = Get-NetTCPConnection -LocalPort 3000 -State Listen -ErrorAction SilentlyContinue
if ($conn) {
$conn | ForEach-Object {
Stop-Process -Id $_.OwningProcess -Force
Write-Output "Killed PID $($_.OwningProcess) on port 3000"
}
} else {
Write-Output "Port 3000 - no process found (already free)"
}
```
If `Get-NetTCPConnection` is unavailable (older systems), fall back to `netstat`:
```powershell
# Fallback: parse netstat output
$line = netstat -ano | Select-String ':3000\s.*LISTENING'
if ($line) {
$pid = ($line -split '\s+')[-1]
Stop-Process -Id $pid -Force
Write-Output "Killed PID $pid on port 3000"
}
```
#### Git Bash / MSYS / Cygwin
Use `netstat` with `grep` and `awk`:
```bash
# Find PID on a port (e.g., 3000)
# Use \s after port number to avoid matching 30001 when looking for 3000
netstat -ano | grep -E ':3000\s' | grep 'LISTENING'
```
The PID is the last column in the output. Extract it with `awk '{print $NF}'` and kill:
```bash
# Extract PID and kill (example for port 3000)
PID=$(netstat -ano | grep -E ':3000\s' | grep 'LISTENING' | awk '{print $NF}' | head -1)
if [ -n "$PID" ]; then
taskkill //F //PID "$PID"
fi
```
Note: In Git Bash, use `//F //PID` (double slashes) because single slashes get interpreted as paths.
### macOS
Use `lsof` — the `-t` flag outputs just PID(s), and `-i` filters by port:
```bash
# Find PID(s) listening on port 3000
lsof -ti tcp:3000
# Kill all PIDs found
lsof -ti tcp:3000 | xargs kill -9
```
If `lsof` returns nothing, the port is already free.
### Linux
Use `lsof` (most common) or fall back to `ss` + `fuser`:
```bash
# Option 1: lsof (same as macOS)
lsof -ti tcp:3000 | xargs kill -9
# Option 2: fuser (if lsof is not installed)
fuser -k 3000/tcp
```
On some Linux systems, `lsof` may require `sudo` to see processes owned by other users. If `lsof -ti tcp:<port>` returns empty but the port is known to be in use, retry with `sudo`.
## Handling Multiple Ports
When the user provides multiple ports (e.g., "kill 3000, 8080, and 5432"), process each port sequentially. Run the find-and-kill commands for each port one at a time so you can report results clearly.
## Output
After killing, report a brief summary. For example:
```
Killed PID 12345 on port 3000
Killed PID 67890 on port 8080
Port 5432 - no process found (already free)
```
## Edge Cases
- **No process on port**: Report that the port is already free. This is not an error.
- **Permission denied**: If a kill fails due to permissions, suggest running with elevated privileges (`sudo` on macOS/Linux, or running the terminal as Administrator on Windows).
- **Multiple PIDs on one port**: Some ports may have multiple processes (e.g., parent + child). Kill all of them.
- **Port format**: Accept bare numbers (3000), or with context ("port 3000", ":3000"). Strip any non-numeric prefix.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.