powershell-pipeline-support-adder

Adds pipeline input support to existing PowerShell functions using begin/process/end blocks.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/MartiXDev/ai-dev-strategy --skill powershell-pipeline-support-adder-martixdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: powershell-pipeline-support-adder
Source: https://github.com/MartiXDev/ai-dev-strategy/tree/main/custom/PowerShell/skills/powershell-pipeline-support-adder
Command: npx skills add https://github.com/MartiXDev/ai-dev-strategy --skill powershell-pipeline-support-adder-martixdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Existing PowerShell functions often cannot accept piped input, forcing users to write manual loops instead of composing functions with cmdlets like Get-Process or Import-Csv. This Skill refactors those functions to accept pipeline input idiomatically. ## Core Features & Use Cases - Pipeline Attribute Addition: Adds ValueFromPipeline and ValueFromPipelineByPropertyName attributes to the correct target parameter. - Block Refactoring: Restructures function bodies into begin/process/end blocks so initialization runs once and per-item logic streams correctly. - Array and Pipeline Compatibility: Ensures functions work with both array parameters and piped input, with error handling per item. - Use Case: You have a legacy Stop-MyService function that only accepts one service name at a time. Use this Skill to refactor it so Get-Service output can be piped directly into it with -WhatIf support. ## Quick Start Ask the AI to add pipeline support to your existing PowerShell function so it accepts input from the pipeline.

Frequently Asked Questions about powershell-pipeline-support-adder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add pipeline support to a PowerShell function?

Add [Parameter(ValueFromPipeline)] or ValueFromPipelineByPropertyName to the target parameter, then move per-item logic into a process block. Use begin for one-time setup and end for cleanup or summary output.

What is the difference between ValueFromPipeline and ValueFromPipelineByPropertyName?

ValueFromPipeline binds piped values directly to the parameter, while ValueFromPipelineByPropertyName binds object properties matching the parameter name. Use both together for maximum flexibility with strings and objects.

Why does my PowerShell function only process the last piped item?

This happens when logic sits outside a process block, so it runs only once after the pipeline finishes. Move per-item code into a process block, which executes once per piped object.

Can a PowerShell function accept both arrays and pipeline input?

Yes, declare the parameter as an array type like [string[]] with pipeline attributes, then iterate with foreach inside the process block. This handles both -Name @('a','b') and 'a','b' | Function styles.

When should I not add pipeline support to a function?

Skip it for new functions, which should include pipeline support from the start, and for functions whose logic cannot process items individually. Functions requiring all input at once before processing are poor pipeline candidates.