Skip to content

Add tools vs. controllers and raw-data output to the PowerShell standard #2

Description

Context

Our PowerShell standard (src/docs/Coding-Standards/PowerShell/) already tells scripts to stay thin and keep logic in functions or modules, and to emit objects rather than text. It does not yet distinguish the two kinds of PowerShell we write, nor say how much a command should shape its output.

Gap

The community guide draws a foundational distinction we are missing:

  • A tool is a reusable function (usually in a module) — it takes input only through parameters and emits raw, least-manipulated objects, so it stays reusable in the widest range of situations.
  • A controller is a script that automates one specific process by calling tools — it may format or reduce data for presentation and is not intended to be reusable.
  • Tools emit raw data (for example bytes, not gigabytes); presentation — rounding, units, tables — happens at the edge, in a controller or via a format view, never inside the tool.

Proposed change

Add a short "Tools vs. controllers" section to Coding-Standards/PowerShell/index.md (or Scripts.md), and an "emit raw data, format at the edge" rule to the output guidance. Tie it to the existing "keep scripts thin" rule in Scripts.md and the "emit objects" rule in index.md.

Source

PoshCode — PowerShell Practice and Style, Best Practices, "Building Reusable Tools" (TOOL-01…TOOL-07).

Acceptance

The PowerShell standard defines tool vs. controller and states that tools emit raw objects while formatting happens at the edge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions