/linux:netmiko-ssh-automationfrom linux
Builds and reviews Python/Netmiko SSH scripts for network device automation. Collects show command output, parses with TextFSM, and plans gated config pushes for routers, switches, and firewalls.
Ships in linux. 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.
Not applicable in the engine's Debian/Ubuntu-vs-RHEL-family sense — the
target devices here are network appliances (Cisco IOS/IOS-XE and similar),
not a Linux distribution, so there is no package-manager matrix to state for
them. The control host running this Python automation can be either Linux
family; its only real requirement is a Python 3 interpreter and the
netmiko package (pip install netmiko), which behaves identically on
Debian/Ubuntu and RHEL-family hosts. If you need a distro matrix for
provisioning the control host itself, see
linux-server-provisioning.
This skill is exempt from scripts/tests/check-distro-matrix.sh by naming
convention (it does not match the linux-* glob), signalling deliberately
that it targets network-equipment automation, not a Linux host.
show command output across routers, switches, or firewalls.linux-config-management
or linux-bash-scripting.cisco-ios-patterns.network-config-validation as the
gate this skill's guarded-config path should run through.| Artefact | Source | Required? | If absent |
|---|---|---|---|
| Explicit device inventory and approved commands | Operator or change record | yes | Stop; do not scan address ranges or infer a target set. |
| Credential source and access boundary | Vault, environment, or operator | yes | Do not request or embed secrets in code, logs, or arguments. |
| Change flag, peer review, maintenance window, and rollback | Approved change record | for config push | Keep the workflow read-only. |
network-config-validation.Stop on an unknown inventory, missing credential boundary, or unreviewed configuration change. Recover by returning to read-only collection and recording the missing evidence. Verify device behavior and capture sanitised before/after output; do not equate a successful SSH command with a successful network change.
send_command() collection.getpass; never hardcode
credentials.send_config_set().save_config() until the change has been verified and
approved.import os
from getpass import getpass
from netmiko import ConnectHandler
from netmiko.exceptions import (
NetmikoAuthenticationException,
NetmikoTimeoutException,
ReadTimeout,
)
device = {
"device_type": "cisco_ios",
"host": "192.0.2.10",
"username": os.environ.get("NETMIKO_USERNAME") or input("Username: "),
"password": os.environ.get("NETMIKO_PASSWORD") or getpass("Password: "),
"secret": os.environ.get("NETMIKO_ENABLE_SECRET"),
"conn_timeout": 10,
"auth_timeout": 20,
"banner_timeout": 15,
"read_timeout_override": 30,
}
try:
with ConnectHandler(**device) as conn:
if device.get("secret") and not conn.check_enable_mode():
conn.enable()
output = conn.send_command("show ip interface brief", read_timeout=30)
print(output)
except NetmikoAuthenticationException:
print("Authentication failed")
except NetmikoTimeoutException:
print("SSH connection timed out")
except ReadTimeout:
print("Command read timed out")
Use placeholder addresses from documentation ranges in examples. Keep real inventory in an ignored local file or a secrets-managed system.
from concurrent.futures import ThreadPoolExecutor, as_completed
from typing import Any
def collect_show(device: dict[str, Any], command: str) -> dict[str, Any]:
host = device["host"]
try:
with ConnectHandler(**device) as conn:
output = conn.send_command(command, read_timeout=45)
return {"host": host, "ok": True, "output": output}
except (NetmikoAuthenticationException, NetmikoTimeoutException, ReadTimeout) as exc:
return {"host": host, "ok": False, "error": type(exc).__name__}
results = []
with ThreadPoolExecutor(max_workers=8) as pool:
futures = [pool.submit(collect_show, device, "show version") for device in devices]
for future in as_completed(futures):
results.append(future.result())
Keep max_workers low unless the device estate and AAA systems are known to
handle higher connection volume.
Netmiko can ask TextFSM, TTP, or Genie to parse supported command output. Treat parser output as an optimization, not the only evidence path.
with ConnectHandler(**device) as conn:
parsed = conn.send_command(
"show ip interface brief",
use_textfsm=True,
raise_parsing_error=False,
read_timeout=30,
)
if isinstance(parsed, str):
print("No parser template matched; store raw output for review")
else:
for row in parsed:
print(row)
If parsing drives a blocking decision, keep the raw command output alongside the parsed result so an operator can inspect mismatches.
import os
commands = [
"interface GigabitEthernet0/1",
"description CHANGE-1234 UPLINK-TO-CORE",
]
apply_changes = os.environ.get("APPLY_NETWORK_CHANGES") == "1"
if not apply_changes:
print("Dry run only. Candidate commands:")
print("\n".join(commands))
else:
with ConnectHandler(**device) as conn:
conn.enable()
before = conn.send_command("show running-config interface GigabitEthernet0/1")
output = conn.send_config_set(commands)
after = conn.send_command("show running-config interface GigabitEthernet0/1")
print(before)
print(output)
print(after)
print("Verify behavior before saving startup config.")
Saving the config is a separate approval step. In production, include a
rollback snippet and capture before/after evidence in the change record. Run
candidate commands through
network-config-validation's
dangerous-command and management-plane checks before setting
APPLY_NETWORK_CHANGES=1.
conn_timeout, auth_timeout, and command read_timeout set?save_config() separate from the initial push and tied to
verification?| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Read-only collection script or review | Network operator | Targets, commands, timeouts, and secret source are explicit. |
| Per-device evidence and error summary | Change reviewer | Partial failures remain visible and output is sanitised. |
| Gated change plan | Change owner | Diff, approval, rollback, verification, and save decision are distinct. |
| Category | Artefact | Acceptance condition |
|---|---|---|
| Correctness | Raw command output plus parsed data | Parser gaps are visible and key observations can be checked. |
| Safety | Inventory, timeout, change, and rollback record | Execution scope and each approval boundary are traceable. |
Read and static code review are the default. Network access, device login, configuration changes, and saving device state require explicit authority. Never execute a proposed push as a test of the skill.
Without Netmiko, credentials, a reachable lab, or target devices, review the
script statically and mark connection and behavior checks NOT_ASSESSED.
Do not claim a successful device run from syntax review alone.
| Condition | Action | Wrong-choice failure |
|---|---|---|
| Inventory and read-only command set are approved | Collect bounded evidence | Broad or ambiguous scope can overload devices or expose data. |
| Candidate config lacks review, change window, or rollback | Do not push | A partial change can disrupt service or strand access. |
| Parser result conflicts with raw output | Preserve both and escalate | Parsed data alone can hide a state mismatch. |
For a request to collect interface status from three named lab switches, use
only the approved inventory, run the read-only command with bounded timeouts,
and report a row per device including failures. Preserve raw output for any
unparsed response. Since this is collection only, do not send configuration
commands or call save_config(). Without access to the lab, record the run as
NOT_ASSESSED rather than inventing results.
cisco-ios-patterns — the manual
show/config vocabulary this automation wraps.network-config-validation — the
pre-flight gate for any config this skill's guarded path would push.linux-secrets —
where NETMIKO_USERNAME/NETMIKO_PASSWORD/NETMIKO_ENABLE_SECRET should
come from on the control host, instead of hardcoding.cisco-ios-patterns — device command and change-review boundary.network-config-validation — static candidate preflight.linux-secrets — control-host secret handling.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
45 skills in this plugin
/cisco-ios-patternsUse when reading or reviewing Cisco IOS/IOS-XE configuration, selecting read-only show commands, or planning and verifying bounded router or switch configuration work. Not for Linux host networking, bulk SSH automation, or config preflight parsing; route those to linux-network-admin, netmiko-ssh-automation, or network-config-validation./linux-access-controlUse when creating, revoking, or auditing Linux users, groups, SSH keys, sudo/wheel access, PAM settings, SELinux user mappings, or file permissions. Use linux-secrets for credential material and linux-server-hardening for broader host policy./linux-archive-integrityUse when creating, signing, encrypting, listing, comparing, or restoring metadata-preserving tar archives on Debian/Ubuntu or RHEL-family hosts. Covers ACLs, xattrs, incrementals, and verification; use linux-rsync-sync for file-tree mirrors.npx claudepluginhub peterbamuhigire/linux-skills --plugin linuxOther plugins' skills for the same job