/loxihart-engineering:writing-shell-scriptsfrom loxihart-engineering
Writes production-ready shell and automation scripts (Bash .sh and PowerShell .ps1) with a mandatory adversarial audit gate, MSP-grade error handling, input validation, idempotency, structured logging, and a paired README. Use when the user mentions: write a script, automate this with a script, deployment script, .sh file, .ps1 file, PowerShell script, Bash script, endpoint script, idempotent script, MSP script, client deployment script. Not for application logic in TypeScript or Python (that is a build) and not for throwaway interactive one-liners the user will run once and discard.
Ships in loxihart-engineering. 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.
Use when — "write a PowerShell script to deploy the agent to our Windows endpoints." "bash script to back up and rotate logs idempotently."
Do NOT use when — "write the TypeScript function that parses this CSV" — application code, not a shell script.
Produces Bash (.sh) and PowerShell (.ps1) scripts for Loxihart MSP client deployments and dev automation. Every script ships with a paired README.md. No exceptions.
What platform?
├─ User says bash / linux / mac / .sh ──────── Bash
├─ User says PowerShell / PS1 / Windows ───── PowerShell
├─ Loxihart MSP context, no OS specified ──────── PowerShell (default — Windows endpoints)
└─ Cross-platform needed ────────────────────── Write both; note differences in README
Example 1 — Basic PowerShell deployment
User: "Write a PS1 to install the RMM agent silently on Windows endpoints"
→ Route: PowerShell. Idempotency: check if agent service exists before installing. Admin check: yes. Log to C:\ProgramData\Loxihart\Logs\. Paired README with rollback instructions.
Example 2 — Bash maintenance script
User: "Create a bash script that rotates logs older than 30 days"
→ Route: Bash. set -euo pipefail. Cleanup trap. Log to /var/log/loxihart/. Idempotency: find-and-delete is inherently safe. README with cron usage example.
Example 3 — Cross-platform
User: "Write a script to create a local admin account if it doesn't exist"
→ Route: Both. Bash version with id check; PS1 version with Get-LocalUser. Same README covers both, with OS-specific usage sections.
Before writing, extract:
If missing and it affects correctness or security → ask. Otherwise use labeled defaults.
Read references/full-scripts-rule.md before writing. The rule is: every script
must be complete and executable as delivered. No TODOs, no placeholders, no truncation.
Start from the appropriate skeleton in references/skeletons.md. Fill in the SCRIPT BODY section. Do not remove the skeleton's error handling, logging, or preflight blocks.
Before any output, run every item below internally. Fix failures before outputting. Do not output a script with a known failing item — a script that fails the gate is a liability, not a deliverable.
Security
[SecureString] onlycurl | bash — download then verify separatelyInvoke-Expression on dynamic/untrusted inputeval on untrusted dataError Handling
set -euo pipefail present$ErrorActionPreference = "Stop" settrap or try/finally)Input Validation
Idempotency
Logging
Portability
#!/usr/bin/env bash#Requires -Version setSee references/readme-template.md for the full template. Required sections:
Deliver two files minimum:
<descriptive-name>.sh or <descriptive-name>.ps1README.mdName files descriptively: deploy-rmm-agent.ps1, not script.ps1.
Cross-platform: deliver .sh, .ps1, and one README.md covering both.
Applied automatically unless overridden:
| Setting | Value |
|---|---|
| Log dir (Windows) | C:\ProgramData\Loxihart\Logs\ |
| Log dir (Linux) | /var/log/loxihart/ |
| Idempotency | Always ON |
| Admin check | Included unless explicitly not needed |
| Exit codes | Strict 0/1 |
| Secrets | Env vars or SecureString only |
| Rollback section | Always in README |
Before delivering:
Invoke-Expression — document the exception explicitly and scope it tightlyNamed failure modes for this skill. Each is a hard stop, not a warning.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub krosebrook/loxihart-skills --plugin loxihart-engineering22 skills in this plugin
/administering-supabaseManages Supabase database operations for FlashFusion's production stack — schema design, Row Level Security policies, migrations, Edge Functions, and debugging. Active project: flashnframe-app (etctmappdhpjuwptdbeb). Use when the user mentions: Supabase, RLS, row level security, migration, schema, database, table, Edge Function, auth, policies, Postgres, supabase query, database admin, add a column, create a table, why is my query blocked, or any task involving the Supabase project or database structure.
/auditing-logicAudits code for logical errors before they become bugs — control flow gaps, data contract violations, schema/type drift, business logic inconsistencies, and silent failure paths. Produces a severity-rated issue list with a one-line diagnosis and one-line fix per finding. Use this skill whenever code is pasted with a review request, or when the user says "audit this", "check the logic", "does this make sense", "any issues with this", "logic audit", "what's wrong here", "review this function", "is this correct", or hands you any code file and wants a critical eye. Even if the user does not say "logic" — if code is present and they want feedback, use this skill. Also triggers on: "find the bug", "something feels off", "is this right", "sanity check this", "does this hold", "validate my logic", "code review", "PR review", "review this PR".
/code-auditorPerforms comprehensive codebase analysis covering architecture, code quality, security, performance, testing, and maintainability. Use when user wants to audit code quality, identify technical debt, find security issues, assess test coverage, or get a codebase health check./code-transferTransfer code between files with line-based precision. Use when users request copying code from one location to another, moving functions or classes between files, extracting code blocks, or inserting code at specific line numbers./debug-like-expertDeep analysis debugging mode for complex issues. Activates methodical investigation protocol with evidence gathering, hypothesis testing, and rigorous verification. Use when standard troubleshooting fails or when issues require systematic root cause analysis. Triggers on: debug this, root cause analysis, systematic debugging, why is this failing, trace this bug, diagnose this issue, investigation protocol, hypothesis testing./engineering-patternsProduction engineering pattern library spanning 11 phases — Foundation, Resilience, Performance, Data Integrity, Observability, Deployment, Scalability, Edge Cases, Security Deep, Compliance/DR/FinOps, and AI/HITL. Use when auditing code for production readiness, applying hardening patterns, reviewing system design, pattern audit, apply phase, harden this, production-ready, resilience patterns, observability gaps, security review, DR plan, FinOps, or AI guardrails. Use alongside engineering-staff-workflows for execution. Not for writing the implementation itself — that is engineering-staff-workflows.