agentleFS
henrik-dmghenrik-dmg/ui-network-mcp/skills/firewall-change/SKILL.md

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.

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
  1. Very specific:

    Make sure that the write tools are available, for example create_firewall_policy.

    line 14
  2. Very specific:

    Current state: Call get_firewall_overview, and get_firewall_policy_ordering for the zone pair.

    line 16
  3. Very specific:

    Before you call delete_firewall_policy, call get_firewall_policy, and make sure that the policy is the policy of the plan.

    line 32
  4. Distinctive:

    If a write fails, stop, and show the error to the user.

    line 34
  5. Very specific:

    Check: Call get_firewall_overview again.

    line 35

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. 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.
  2. 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.
  3. Current state. Call get_firewall_overview, and get_firewall_policy_ordering for the zone pair. Get the IDs for the filters from list_networks, list_traffic_matching_lists, list_vpn_servers, list_dpi_applications, or list_dpi_categories.
  4. 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.
  5. 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.

  6. Apply. Make the writes of the plan, in the order of the plan:

    • create_firewall_policy puts a new policy before the system-defined policies of the zone pair.
    • To move a policy, call get_firewall_policy_ordering again, then call reorder_firewall_policies with all policy IDs of the zone pair in the new order.
    • update_firewall_policy replaces each given field completely. The console does not let you change a system-defined policy, except logging_enabled and report_flow_enabled.
    • Before you call delete_firewall_policy, call get_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.

  7. Check. Call get_firewall_overview again. Make sure that each policy of the plan is in the correct zone pair, at the correct position, with the correct enabled state.

The change is complete when the check of step 7 agrees with the plan.

Report

  1. The policies that changed, with their IDs.
  2. The order of the zone pair after the change.
  3. How to undo the change: delete_firewall_policy for a new policy, or update_firewall_policy with the old values for a changed policy. A deleted policy cannot be restored, only created again.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.