ai-agents powershell.instructions.md

ai-agents powershell.instructions.md is an instructions file for GitHub Copilot from rjmurillo/ai-agents. It costs 1,225 tokens per session, scanned A, original, MIT.

PowerShell 7 coding rules covering function structure, pipeline behavior, error handling, and paths that work across Windows, macOS, and Linux.

In plain words
What is it for?
Writing or reviewing PowerShell scripts and modules for cross-platform automation.
Why use it?
They prevent scripts from relying on Windows-only behavior, unclear output, fragile paths, or functions that fail repository analysis.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/rjmurillo/ai-agents/powershell
Clone the repo
git clone --depth 1 https://github.com/rjmurillo/ai-agents

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ai-agents powershell.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/rjmurillo/ai-agents/powershell.svg)](https://agentmods.dev/instructions/rjmurillo/ai-agents/powershell)
Your own site
<a href="https://agentmods.dev/instructions/rjmurillo/ai-agents/powershell"><img src="https://agentmods.dev/badge/instructions/rjmurillo/ai-agents/powershell.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,225 This file is loaded in full into every session.
When invoked 1,225 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01225 $0.01225
Opus 5 $0.00613 $0.00613
Sonnet 5 $0.00245 $0.00245
Haiku 4.5 $0.00122 $0.00122

Measured yesterday against content hash b69ba32fc7d8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ai-agents powershell.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/instructions/powershell.instructions.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PowerShell Rules

These rules apply when you write or review PowerShell. Baseline is PowerShell 7+ (cross-platform pwsh), NOT Windows PowerShell 5.1. Write for Linux and macOS runners as well as Windows. Defer to PSScriptAnalyzer settings in the repo.

Structure

  • Make every non-trivial function an advanced function: [CmdletBinding()] plus a param() block with typed, attributed parameters ([Parameter(Mandatory)], [ValidateNotNullOrEmpty()], [ValidateSet(...)]).
  • Use approved verbs (Get-Verb) and Verb-Noun names. Get-, Set-, New-, Remove-, Test-. A function named DoStuff will not pass review.
  • Emit objects to the pipeline; let the caller format. Do not Write-Host data. Use Write-Output (or bare output) for results, Write-Verbose/Write-Warning/ Write-Error for diagnostics, and Write-Host only for genuine console UX.
  • Support the pipeline with process {} blocks and ValueFromPipeline when a function operates on a stream of inputs.

Cross-Platform

  • Build paths with Join-Path or [IO.Path]::Combine, never string concatenation with \. Use [IO.Path]::DirectorySeparatorChar when you must.
  • Use $env:TEMP via [IO.Path]::GetTempPath() and $HOME, not Windows-only paths. Do not assume C:\ or backslashes.
  • Prefer [Environment]::NewLine awareness in tests; normalize line endings when comparing multi-line output across platforms.

Error Handling

  • Set $ErrorActionPreference = 'Stop' at the top of scripts that must fail fast, or pass -ErrorAction Stop per call. Non-terminating errors are silent by default and hide failures.
  • Wrap risky calls in try/catch/finally. Catch specific exception types where you can. Clean up in finally.
  • After calling an external (native) executable, check $LASTEXITCODE explicitly and reset it. A non-zero $LASTEXITCODE left over from one command makes a later step or the whole workflow look failed.
  • Standardize process exit codes per ADR-035: 0 success, 1 logic or validation error, 2 usage or configuration error, 3 external or dependency failure, 4 authentication or authorization failure (5-99 reserved, 100+ documented script-specific). exit with the matching code so callers and CI branch on the cause, not just pass or fail.

Read the full file on GitHub · 89 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 89 lines · 1,225 tokens per session scan A b69ba32fc7d8

Subscribe to this mod's changes

ai-agents powershell.instructions.md is an instructions file published in the GitHub repository rjmurillo/ai-agents (45 stars, last pushed yesterday), licensed MIT. It adds 1,225 tokens to every session, about $0.0061 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.