Powershell-Copilot-Standards: Command for GitHub Copilot

.github/prompts/optimize-performance.prompt.md

optimize-performance is a command for GitHub Copilot from fadwen/Powershell-Copilot-Standards. It costs 7 tokens per session (401 once invoked), scanned A, original, MIT.

A PowerShell code review focused on making programs use less time and memory. It considers data size, PowerShell version, loops, strings, collections, external resources, and parallel work.

In plain words
What is it for?
Use it to improve execution time, memory use, or throughput, and to assess pipeline choices, resource cleanup, database or network calls, and parallel processing.
Why use it?
It helps locate inefficient operations such as repeated searching, unnecessary work, poor data structures, and unbatched resource calls.

Command for GitHub Copilot

Written for GitHub Copilot: a Copilot chat mode or prompt.

This is fadwen/Powershell-Copilot-Standards's own configuration. It tells GitHub Copilot how to work on Powershell-Copilot-Standards itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Powershell-Copilot-Standards configures →

Reuse

Borrowing it

Nothing to install: this file belongs to fadwen/Powershell-Copilot-Standards. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/fadwen/Powershell-Copilot-Standards/main/.github/prompts/optimize-performance.prompt.md
Clone the repo
git clone --depth 1 https://github.com/fadwen/Powershell-Copilot-Standards

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 optimize-performance

README.md
[![agentmods](https://agentmods.dev/badge/commands/fadwen/powershell-copilot-standards/optimize-performance/github.svg)](https://agentmods.dev/commands/fadwen/powershell-copilot-standards/optimize-performance)
Your own site
<a href="https://agentmods.dev/commands/fadwen/powershell-copilot-standards/optimize-performance"><img src="https://agentmods.dev/badge/commands/fadwen/powershell-copilot-standards/optimize-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for optimize-performance

Your own site · 80×15
<a href="https://agentmods.dev/commands/fadwen/powershell-copilot-standards/optimize-performance"><img src="https://agentmods.dev/badge/commands/fadwen/powershell-copilot-standards/optimize-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 401 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00007 $0.00401
Opus 5.5 $0.00003 $0.00160
Sonnet 5.5 $0.00001 $0.00080
Haiku 4.5 $0.00001 $0.00040

Measured 1mo ago against content hash 01a70521147f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

optimize-performance 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 1mo ago.

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/prompts/optimize-performance.prompt.md · 42 lines

What it actually says

Analyze and optimize this PowerShell code from ${fileBasename} in the ${workspaceFolderBasename} project:

Performance Context:

  • Dataset Size: ${input:datasetSize:Small (<100 items),Medium (100-1000 items),Large (1000+ items)}
  • Performance Target: ${input:performanceTarget:Execution time,Memory usage,Throughput,All}
  • Current Environment: ${input:environment:PowerShell 7.6,Windows PowerShell 5.1,Cross-platform}
  • Criticality: ${input:criticality:Development,Production,Mission-critical}

Selected Code:

${selection}

Optimization Analysis:

  1. Memory Usage: Resource disposal, StringBuilder usage, collection handling
  2. Pipeline Efficiency: Pipeline vs. foreach loops for dataset size: ${input:datasetSize}
  3. String Operations: Concatenation methods and efficiency
  4. Algorithm Complexity: Identify O(n²) operations, inefficient filtering and searching, redundant work, and poor data structure choices
  5. Resource Management: COM objects, file handles, database connections, network call batching
  6. Parallel Processing: ForEach-Object -Parallel opportunities (PowerShell 7.4+; 7.6 is the current LTS - 7.0 through 7.3 are retired)

Deliverables:

  • Before/after code examples with performance impact estimates
  • Memory usage improvements for ${input:datasetSize} datasets
  • Scalability recommendations for ${input:criticality} environments
  • Benchmarking code for validation
  • Reference to .\Troubleshooting\Performance\ documentation

Focus on ${input:performanceTarget} optimization with measurable improvements.

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. 1mo ago First seen · 42 lines · 7 tokens per session scan A 01a70521147f

Subscribe to this mod's changes

optimize-performance is a command published in the GitHub repository fadwen/Powershell-Copilot-Standards (19 stars, last pushed 1mo ago), licensed MIT. It adds 7 tokens to every session and 401 once invoked, about $0.0000 per session on Opus 5.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-16.