/sfutils:network-rulefrom sfutils
Setup and manage Snowflake network rules and policies using sfutils CLI with TOML manifest tracking. Use when: setting up network rules, creating network rules with GitHub Actions or Google IPs or local IP allowlisting, managing INGRESS/EGRESS/POSTGRES/INTERNAL_STAGE rules, CIDR allowlisting, firewall setup, dry-run preview, replaying network setup from manifest, cleaning up network resources, exporting network manifest for sharing. Triggers: sfutils-networks, setup-network-rules, network-rule, setup network, setup nw, allow gh, allow github, allow google, allow local, CIDR, egress rule, postgres ingress, AWSVPCEID, HOST_PORT, dry-run network, replay network, replay manifest, recreate network, export manifest, cleanup network, remove network rule, network manifest, multiple network rules, external access, call external API, OpenFlow connector, SPCS app, Snowpark external, EAI, integration, slack alert, pull from S3, HuggingFace, OpenAI from Snowflake.
Ships in sfutils. 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.
Read when SKILL.md points to them.
Creates and manages network rules and policies for IP-based access control in Snowflake.
Supports multiple rules per project via a TOML manifest — no .env required.
📋 PREREQUISITE: None. This skill can be used standalone or alongside other sfutils skills.
📍 MANIFEST FILE: .sfutils/manifest.toml (ALWAYS this exact path and filename)
⛔ DO NOT hand-edit manifests. Manifests are machine-managed by Cortex Code. Manual edits can corrupt the format and break replay, cleanup, and export flows. Use skill commands to modify resources instead.
🔗 CONNECTION NOTE: The nw CLI reads the Snowflake connection directly from manifest.toml [snowflake].connection and auto-injects -c <connection> for every snow sql call. No source .env or set -a && source .env && set +a is needed.
🔄 IDEMPOTENCY NOTE: Network rules use CREATE OR REPLACE (Snowflake does not support IF NOT EXISTS for network rules). Network policies use CREATE IF NOT EXISTS to preserve existing policies. Re-running create operations is safe for automation.
🚫 FORBIDDEN ACTIONS - NEVER DO THESE:
--auto-setup, --auto-approve, --quiet, --non-interactive--yes / -y is REQUIRED when executing commands after user has approved the dry-run (CLIs prompt interactively which does not work in Cortex Code's non-interactive shell)rule delete handles this automatically.<command> --help and use ONLY those options.env for connection or configuration — manifest.toml is the source of truth✅ INTERACTIVE PRINCIPLE: This skill is designed to be interactive. At every decision point, ASK the user and WAIT for their response before proceeding.
Classify the user's request and dispatch to the appropriate workflow:
| User intent | Dispatch to |
|---|---|
| INGRESS — IP allowlist, CIDR, VPC, GitHub Actions connecting TO Snowflake | → ingress-flows.md |
| EGRESS HOST_PORT — SPCS/Snowpark/OpenFlow/Cortex calling external services, EAI | → egress-flows.md (Section 1: EAI Builder) |
| EGRESS + Network Policy — account/user-level outbound restriction | → egress-flows.md (Section 2) |
| POSTGRES_INGRESS / INTERNAL_STAGE | → ingress-flows.md |
| Both EGRESS and INGRESS in the same message | → egress-flows.md first, complete it, then → ingress-flows.md |
| Replay, export, share manifest | → Replay Flows |
| Validate, migrate, or repair manifest | → Network Manifest Gate + Step 0 below |
After completing Steps 0–2 (connection + infra), dispatch to the appropriate flow above. If the user message contains both EGRESS signals ("my SPCS app calls Slack") AND INGRESS signals ("allow my local IP"), use the "Both" row — complete EAI Builder, then INGRESS.
Run this check before any replay, remove, or manage-existing operation:
<SKILL_DIR>/nw validate-manifest
<SKILL_DIR>/nw validate-manifest --fix, then re-validate.--fix: Show the issues to the user and STOP. Do not proceed until the manifest is valid.This gate is also enforced automatically by the CLI before every subcommand. The output will warn you with
⚠️ manifest.toml has N issue(s)if the manifest needs attention.
Check what state the project is in:
ls .sfutils/ 2>/dev/null
Case A — Legacy .sfutils/sfutils-manifest.md exists (no manifest.toml yet):
<SKILL_DIR>/nw migrate --dry-run
Show the dry-run output. Ask user to confirm migration:
The project has a legacy sfutils-manifest.md.
Migrate to manifest.toml format? [yes/no]
On confirmation:
<SKILL_DIR>/nw migrate
After migration, infra_ready = false is always set — proceed to Step 2 to re-verify infrastructure.
Case B — manifest.toml exists but has issues:
<SKILL_DIR>/nw validate-manifest
If issues found:
<SKILL_DIR>/nw validate-manifest --fix
Re-validate. If issues remain, show them and STOP.
Case C — New project (no .sfutils/ or no manifest):
Continue to Step 1.
⚠️ STOP: Resolve migration/validation issues before any resource creation.
Check manifest for existing connection:
<SKILL_DIR>/nw validate-manifest 2>&1 | grep connection || true
cat .sfutils/manifest.toml 2>/dev/null | grep "connection"
If [snowflake].connection is already set and valid: Skip to Step 2.
If connection is empty or manifest does not exist:
List available connections:
snow connection list --format json
Use ask_user_question to let the user pick a connection:
Which Snowflake connection should this project use?
(Options from snow connection list output)
Test and cache the connection:
<SKILL_DIR>/nw setup-connection -c <chosen_connection>
This writes [snowflake].connection, account, user, and account_url to manifest.toml.
⚠️ STOP: Do not proceed without a working connection.
Read infra status from manifest:
cat .sfutils/manifest.toml 2>/dev/null | grep -E "sf_utils_db|infra_ready"
Strict ordered evaluation:
sf_utils_db is empty → Run check-setup (always):
<SKILL_DIR>/nw check-setup --suggest
If not ready, run with --run-setup:
<SKILL_DIR>/nw check-setup --run-setup
sf_utils_db set AND infra_ready = true → Skip infra check, go to Step 2a.
sf_utils_db set AND infra_ready = false → Run check-setup to verify:
<SKILL_DIR>/nw check-setup --suggest
On success, check-setup writes infra_ready = true to manifest automatically.
⚠️ STOP: Do not proceed until infra_ready = true in manifest.
Check admin_role from manifest [snowflake].admin_role (defaults to ACCOUNTADMIN).
If a non-ACCOUNTADMIN role is configured, verify it has required privileges:
| Privilege | Scope | Required For |
|---|---|---|
| USAGE | Database | Accessing SF_UTILS_DB |
| CREATE NETWORK RULE | Schema | Creating network rules |
| CREATE NETWORK POLICY | Account | Creating network policies |
If privileges are missing, show the required GRANT statements and STOP for user to execute.
After completing Step 2a (admin role check), dispatch based on rule intent:
check-setup and nw commands, options, and mode-type constraintscli-reference.md (opens in a new tab)egress-flows.md (opens in a new tab)ingress-flows.md (opens in a new tab)manifest-flows.md (opens in a new tab)mode-type-reference.md (opens in a new tab)nw (opens in a new tab)prereqs.md (opens in a new tab)pyproject.toml (opens in a new tab)replay-flows.md (opens in a new tab)supplemental.md (opens in a new tab)uv.lock (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (snowflake-labs/sfutils-plugins) — no native marketplace selected
npx claudepluginhub p/snowflake-labs-sfutils3 skills in this plugin
/external-volume**[REQUIRED]** Create Snowflake external volumes with cloud storage. Use when: setting up external storage, creating external volume, configuring S3 for Snowflake, azure blob storage, GCS for Snowflake, Iceberg tables, unloading data, cloud storage, COPY INTO unload, external stage storage, data lake storage. Triggers: sfutils-extvolumes, setup-external-volume, external volume, create external volume, s3 snowflake, iceberg storage, data lake storage, COPY INTO location, external stage, unload to S3, replay volumes, replay volume manifest, recreate external volume, replay all manifests, replay all sfutils, export manifest for sharing, setup from shared manifest, replay from shared manifest, setup from manifest URL, replay from URL, use manifest from URL, azure, gcs, blob storage, cloud storage, multiple volumes, list volumes, setup connection, validate manifest, migrate manifest, second external volume./programmatic-access-tokenCreate Snowflake Programmatic Access Tokens (PATs) for service accounts. Use when: setting up service user, creating PAT, configuring authentication policy, network policy for PAT. Triggers: programmatic-access-token, sfutils-pat, create-access-token, programmatic access token, PAT, service account, snowflake authentication, replay pat, replay pat manifest, recreate pat, replay all manifests, replay all sfutils, export manifest for sharing, setup from shared manifest, replay from shared manifest, setup from manifest URL, replay from URL, use manifest from URL, multiple pats, multi-pat, add second pat, list pats, setup connection, validate manifest, migrate manifest, repair manifest, second service account.