firewall-change
Skill1 starsChanged 15 days agoMITView on GitHub
Safe change of the UniFi firewall, to create, change, delete, or reorder a firewall policy, with a plan and the approval of the user before each write. Use when the user asks to block or allow traffic on a UniFi network, or to fix a finding of a firewall audit.
In this repository4 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- client-troubleshootingSkill
- firewall-auditSkill
- health-checkSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Make sure that the write tools are available, for example create_firewall_policy.
- Very specific: line 16
Current state: Call get_firewall_overview, and get_firewall_policy_ordering for the zone pair.
- Very specific: line 32
Before you call delete_firewall_policy, call get_firewall_policy, and make sure that the policy is the policy of the plan.
- Distinctive: line 34
If a write fails, stop, and show the error to the user.
- Very specific: line 35
Check: Call get_firewall_overview again.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
UniFi firewall change
Change the firewall in four phases: intent, plan, apply, and check. Write nothing before the user approves the plan.
Caution: A wrong policy can block the access to the console, and also the access of this server. Before you block traffic to the Gateway zone, or between the zone of the user and other zones, make sure that the user keeps a way to reach the console, for example the UniFi app through unifi.ui.com.
Steps
- Make sure that the write tools are available, for example
create_firewall_policy. If they are not available, tell the user to turn on the plugin option "Allow changes", and to use an API key with write access. Then stop. - Intent. Write the change as these parts: the action (ALLOW, BLOCK, or REJECT), the source zone and source filter, the destination zone and destination filter, the protocols and ports, the schedule, and the position in the order. Ask the user about each part that is not clear. The direction of the traffic is frequently not clear: "block the cameras from the internet" can mean either direction.
- Current state. Call
get_firewall_overview, andget_firewall_policy_orderingfor the zone pair. Get the IDs for the filters fromlist_networks,list_traffic_matching_lists,list_vpn_servers,list_dpi_applications, orlist_dpi_categories. - Conflicts. In the zone pair, find:
- A policy that already does the change. Then no change is necessary. Tell the user.
- An earlier enabled policy that matches the same traffic. The new policy would never apply, so the plan must also reorder the policies.
- A later policy that the new policy would shadow. Tell the user.
Plan. Show the plan to the user:
- Each write, in plain words and with the tool arguments.
- The order of the zone pair after the change.
- The risks, from the caution above.
- How to undo the change.
Get the approval of the user for the plan. Any change to the plan needs a new approval.
Apply. Make the writes of the plan, in the order of the plan:
create_firewall_policyputs a new policy before the system-defined policies of the zone pair.- To move a policy, call
get_firewall_policy_orderingagain, then callreorder_firewall_policieswith all policy IDs of the zone pair in the new order. update_firewall_policyreplaces each given field completely. The console does not let you change a system-defined policy, exceptlogging_enabledandreport_flow_enabled.- Before you call
delete_firewall_policy, callget_firewall_policy, and make sure that the policy is the policy of the plan.
If a write fails, stop, and show the error to the user. Make no other writes that the plan did not include.
- Check. Call
get_firewall_overviewagain. Make sure that each policy of the plan is in the correct zone pair, at the correct position, with the correctenabledstate.
The change is complete when the check of step 7 agrees with the plan.
Report
- The policies that changed, with their IDs.
- The order of the zone pair after the change.
- How to undo the change:
delete_firewall_policyfor a new policy, orupdate_firewall_policywith the old values for a changed policy. A deleted policy cannot be restored, only created again.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

