/unifi:unifi-context-mapfrom unifi
Builds and maintains a site map file for UniFi networks: networks, devices, SSIDs, reservations, zones, and a Gotchas list. Includes provenance checks and security rules for a file that is a burglary aid if it leaks.
Ships in unifi. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This repo deliberately ships no network inventory, because the useful one is yours. This skill is how the agent builds it.
An agent working a UniFi network without a map guesses: which AP is the one in
the back bedroom, whether 10.x.x.50 is the NAS or a decommissioned print
server, whether that camera reservation reflects where the camera actually is.
UniFi answers with MAC addresses and machine names, and it is confidently wrong
in a specific way: the config is not the operational reality. A reservation
exists whether or not the device honors it. A port override is stored whether or
not the hardware enforces it.
One markdown file, one human pass, fixes this.
A complete UniFi map is a burglary aid. Not being dramatic: assembled in one file it contains camera names and their physical placements, which cameras are on which segment, your WAN address, the MAC address of every device in the building, your alarm panel's IP, and which SSID is the trusted one. That is a casing document with a network diagram attached.
So, before the first line:
.gitignore it by name in whatever repo you do network work from. A
suggested pattern is in this repo's .gitignore.unifi-connect.This warning exists because the private skill this repo was distilled from could not be published as-written. Roughly seventy percent of it was exactly the inventory described above.
Wherever your agent reads context from and nowhere else: the private repo you do network work from, or a local notes directory. Keep it in one place so there is one thing to protect.
Every section dated. The date is what tells a future agent how much to trust it.
# <Site> network map (snapshot YYYY-MM-DD)
## Gateway
- Host: <UDM_HOST>, web UI https://<UDM_HOST>
- Model, UniFi OS version, Network controller version
- Auth: X-API-Key, key name "agent", stored in env var; NOT in this file
- SSH: open/closed
## Networks and VLANs (as of YYYY-MM-DD)
| Name | Purpose | VLAN | Subnet | DHCP |
## Firewall zones (as of YYYY-MM-DD)
- Zone name, id, and in one line what it is allowed to reach
- Which networks belong to it
## Devices (as of YYYY-MM-DD)
| Name | Type | Model | IP | Firmware |
- Flag which have DHCP reservations and which hold dynamic leases:
the dynamic ones drift, so pull `devices` before targeting one
## SSIDs (as of YYYY-MM-DD)
| SSID | Band | Security | Network | Enabled |
## Reservations (as of YYYY-MM-DD, N total)
| Name | IP | MAC |
## Port forwards (as of YYYY-MM-DD)
| Name | Protocol | External port | Destination |
## Reservation vs reality
The section that earns the file. See below.
## Gotchas (append-only, dated)
- YYYY-MM-DD: <thing that cost you an hour>
The commands produce candidates. The human pass produces meaning.
udm networks --json | python3 -c '
import json,sys
for n in json.load(sys.stdin):
print(n.get("name"), n.get("vlan","-"), n.get("ip_subnet"))'
udm devices --json | python3 -c '
import json,sys
for d in json.load(sys.stdin):
print(d.get("name"), d.get("type"), d.get("model"), d.get("ip"), d.get("version"))'
udm wlans --json | python3 -c '
import json,sys
for w in json.load(sys.stdin):
print(w.get("name"), w.get("enabled"), w.get("security"))'
udm reservations --json | python3 -c '
import json,sys
r=json.load(sys.stdin); print(len(r),"reservations")
for u in r: print(" ", u.get("name") or u.get("hostname"), u.get("fixed_ip"))'
udm zones --json | python3 -c '
import json,sys
for z in json.load(sys.stdin): print(z.get("_id"), z.get("name"))'
udm portforward --json | python3 -c '
import json,sys
for p in json.load(sys.stdin):
print(p.get("name"), p.get("dst_port"), "->", p.get("fwd"), p.get("fwd_port"))'
What no query can tell you is that the AP named U7PG2-a3f4 is the one in the
back bedroom, or that a given reservation belongs to hardware you threw out in
2023. Do that pass once, write it down, mark it verified.
Give this its own section. It is the highest-value thing in the file and it is never what you expect.
A DHCP reservation applies only if the device asks that DHCP server. Devices that join over a different SSID, sit behind an unmanaged switch, or were re-cabled at some point get an address from wherever they actually are, and the reservation sits dormant looking authoritative. In one real audit, of seven cameras with reservations on a dedicated camera VLAN, exactly one was actually on it. The rest had joined over Wi-Fi to an IoT SSID and held dynamic leases on a completely different subnet. Every one of them looked correctly segmented in the reservation table.
Check the live client list against the reservation list and record every mismatch with the reason:
udm clients --all --json | python3 -c '
import json,sys
for c in json.load(sys.stdin):
print(c.get("hostname") or c.get("name"), c.get("ip"), c.get("mac"), c.get("network"))'
Then write lines like: "dormant reservation, device actually joins over the IoT SSID and lives on that subnet", or "permanent exception, behind an unmanaged switch, cannot be segmented". That is the knowledge the API cannot give back.
The highest-value section and the one nobody writes. Every network accumulates local traps no vendor doc can predict. The shape:
devices before
targeting either."Append with a date, never rewrite history. When something costs more than five minutes, the fix is not finished until the gotcha is in the map.
A map that rots silently is worse than no map, because the agent trusts it. Two rules.
1. Date every snapshot section.
2. Ship a re-verify one-liner beside every volatile claim, with an expected value. Then any session can re-check cheaply:
## Provenance
Last full verification: YYYY-MM-DD
- Controller version: `udm status`, expect Network <VERSION>
- Networks: `udm networks --json | python3 -c '...'`, expect N, including <VLANs>
- Devices: `udm devices --json | ...`, expect N devices
- Reservations: `udm reservations --json | python3 -c 'import json,sys;print(len(json.load(sys.stdin)))'`, expect N
- Port forwards: `udm portforward --json | ...`, expect <names>
- SSIDs: `udm wlans --json | ...`, <SSID> must show enabled=False
That last line is the pattern worth copying: encode the invariant you care about, not just the count. "This SSID must be disabled" is a check that catches a real regression. "There are six SSIDs" is a check that catches nothing.
If a check disagrees with the map, trust the live output, fix the map, re-date the section. That loop is the entire maintenance burden: a couple of minutes, only when a check fails.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub t3chnaztea/unifi-skills --plugin unifi5 skills in this plugin
/unifi-clientsUse when operating on UniFi clients, devices, switch ports, or DHCP: "block a device", "kick a client off wifi", "restart an access point", "power cycle a PoE port", "move a device to a different VLAN", "my device is on the wrong subnet after I changed the port", "set a DHCP reservation", "change DHCP DNS servers", "forget an old client", "why did my PUT reset all the other ports", or reading UniFi events and alarms. Covers full-object PUT discipline, the wired VLAN migration trap, and where events moved. Assumes unifi-connect. Not for firewall policy between zones (unifi-firewall), radios and SSIDs (unifi-wifi)./unifi-connectUse when connecting an agent to a UniFi gateway (UDM Pro, UDM SE, Cloud Gateway) for the first time, or when API calls to one are failing: empty response bodies, curl returning HTTP 000, 401 on a key that works elsewhere, "how do I get a UniFi API key", "SSH is closed on my UDM", "connect to UniFi", "talk to my UniFi controller". Covers minting an API key over the API, which endpoint families accept a key, the cookie-session fallback, the HTTP/2 empty-body trap, the endpoint map, and the safety doctrine: dry-run, read-only mode, snapshot-before-mutate rollback, and the audit trail. Start here: the other skills assume this one. Not for firewall policy (unifi-firewall), Wi-Fi and radios (unifi-wifi), client and port operations (unifi-clients)./unifi-firewallUse when working on UniFi firewall rules, zones, or network segmentation: "my firewall rules are empty", "rest/firewallrule returns nothing", "isolate my IoT devices", "block cameras from the internet", "create a firewall zone", "VLAN isolation", "zone-based firewall", "my IoT devices lost DNS after I segmented them", or auditing what a zone actually permits. Covers the zone-based firewall model, where policies live, the block-by-default trap on new zones, and lockout safety. Assumes unifi-connect. Not for assigning devices to VLANs or switch ports (unifi-clients), Wi-Fi and SSID-to-network mapping (unifi-wifi)./unifi-wifiUse when UniFi Wi-Fi is slow, unstable, or being tuned: "my wifi is slow but speedtest on the router is fast", "great signal, terrible speed", "should I use 80MHz or 40MHz", "channel planning", "co-channel interference", "DFS channels", "my APs keep picking the same channel", "audit my SSIDs", "hidden SSID", or diagnosing throughput that collapses under load. Also roaming: "my phone stays stuck on the far AP", "sticky clients", "improve roaming", "should I enable fast roaming", "minimum RSSI", "TX power tuning". Covers the diagnostic ladder for slow Wi-Fi, channel width and DFS tradeoffs, safe radio writes, cell sizing and roaming persuasion, SSID hygiene, and the in-wall AP port trap. Assumes unifi-connect. Not for firewall policy between networks (unifi-firewall), wired port and client operations (unifi-clients).Other plugins' skills for the same job