Skip to content

Commit cbf0b5d

Browse files
Expand module standard: Usage section, agent files, module types, PS 7.6+
- Rename README showcase heading Capabilities -> Usage (Examples allowed); disallow Capabilities and add to README validation. - Each repo stands on its own: carries own governance files, no reliance on org .github fallback; README has no Contributing section (repo ships self-contained CONTRIBUTING.md). - Add agent onboarding files (AGENTS.md, CLAUDE.md, .github/copilot-instructions.md) to required files + Distributor mandatory sets, pointing to PSModule/docs and MSXOrg/docs. - Placeholder guard: a module exporting any real command is not a placeholder. - Modern PowerShell only: minimum 7.6, track current + LTS; drop 5.1 accommodation. - New Module-Types.md (integration/API + data modules) + Naming.md rules (REST->verb, ConvertTo/From + Format/Import/Export); Hashtable is the data-module reference; Context for user + module settings.
1 parent 85fbc3c commit cbf0b5d

6 files changed

Lines changed: 173 additions & 14 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Module types
2+
3+
Most PSModule modules fall into one of a few archetypes. The general rules in
4+
[PowerShell module standard](Standards.md) and [Naming](../Standard/Naming.md) always apply; this
5+
page adds the conventions that are specific to a module's type so that modules of the same kind feel
6+
the same to use.
7+
8+
Two archetypes have enough shared shape to standardize:
9+
10+
- **Integration (API) modules** wrap an external service's REST or GraphQL API.
11+
- **Data modules** convert or manage a data format or in-memory structure.
12+
13+
A module can be both (for example, an integration module that also exposes conversion helpers).
14+
Apply each relevant section.
15+
16+
## Integration (API) modules
17+
18+
Integration modules are the PowerShell face of an external service. `GitHub`, and the
19+
service-client modules such as `Anthropic`, `OpenAI`, `Bluesky`, and `Domeneshop`, are integration
20+
modules.
21+
22+
### Command naming maps to the resource, not the HTTP method
23+
24+
Name commands after the resource and the intent, using approved verbs. Never name a command after
25+
the HTTP method or the endpoint path. Map REST methods to verbs:
26+
27+
| REST method | PowerShell verb | Example |
28+
| ----------- | --------------- | ------- |
29+
| `GET` | `Get-` | `Get-GitHubRepository` |
30+
| `POST` (create) | `New-` / `Add-` | `New-GitHubRepository` |
31+
| `PUT` / `PATCH` (update) | `Set-` / `Update-` | `Set-GitHubRepository` |
32+
| `DELETE` | `Remove-` | `Remove-GitHubRepository` |
33+
| Non-CRUD action | Approved verb for the intent | `Invoke-`, `Start-`, `Stop-`, `Enable-`, … |
34+
35+
Prefix the noun with the service's term of art (`GitHubRepository`, not `Repository`). See
36+
[integration command naming](../Standard/Naming.md#integration-commands-and-rest-methods).
37+
38+
### Transport stays private
39+
40+
Public functions accept resolved inputs and typed objects; private helpers own the concrete
41+
`Invoke-RestMethod` / GraphQL / HTTP calls. This is the Dependency Inversion rule from
42+
[Standards](Standards.md#solid-applied) applied to the network boundary.
43+
44+
### Use Context for user and module settings
45+
46+
Integration modules persist state with the [`Context`](https://github.com/PSModule/Context) module
47+
rather than inventing bespoke storage. Two kinds of state are both standard:
48+
49+
- **User settings and secrets** — accounts, tokens, sessions, and per-user configuration. Store these
50+
in a per-user context. `Context` encrypts secrets at rest (via `Sodium`), so a user can resume work
51+
without reconfiguring or logging in again when the service supports session refresh.
52+
- **Module settings** — module-wide defaults, endpoints, and feature flags that are not tied to a
53+
single user. Store these in a module-scoped context.
54+
55+
Persisting both through `Context` gives every integration module the same, discoverable settings
56+
model, and keeps secrets out of source, logs, and plain files.
57+
58+
## Data modules
59+
60+
Data modules convert between representations or manage an in-memory structure. `Hashtable` is the
61+
reference shape; `Base64`, `Json`, `Lua`, `Hcl`, `Sodium`, and `Uri` follow the same pattern.
62+
63+
### The neutral object is the pivot
64+
65+
Every conversion goes through the neutral PowerShell object model
66+
(`[PSCustomObject]` / `[hashtable]` / `[PSObject]`). `ConvertFrom-<Format>` parses a
67+
format-specific representation *into* an object; `ConvertTo-<Format>` renders an object *into* the
68+
format. Converting through the object as a common pivot means any format interoperates with any
69+
other, instead of writing a direct converter for every pair.
70+
71+
Always ship **both** directions so data round-trips.
72+
73+
### Verb vocabulary
74+
75+
| Verb pattern | Purpose |
76+
| ------------ | ------- |
77+
| `ConvertFrom-<Format>` | Format-specific text/representation → `[PSCustomObject]` / `[hashtable]` |
78+
| `ConvertTo-<Format>` | Object → format-specific text/representation |
79+
| `Import-<Noun>` | Read from a file or store into objects |
80+
| `Export-<Noun>` | Write objects to a file or store |
81+
| `Format-<Noun>` | Produce a normalized or pretty rendering |
82+
| `Merge-<Noun>` | Combine two structures |
83+
| `Compare-<Noun>` | Diff two structures |
84+
| `Test-<Noun>` | Validate a value or structure |
85+
| `Remove-<Noun>Entry` | Remove elements by criteria |
86+
87+
The `Hashtable` module demonstrates the full set: `ConvertFrom-Hashtable`, `ConvertTo-Hashtable`,
88+
`Import-Hashtable`, `Export-Hashtable`, `Format-Hashtable`, `Merge-Hashtable`, and
89+
`Remove-HashtableEntry`. See [data conversion and I/O verbs](../Standard/Naming.md#data-conversion-and-io-verbs).
90+
91+
## Where this connects
92+
93+
- [Naming](../Standard/Naming.md) — the concrete verb rules for both types.
94+
- [PowerShell module standard](Standards.md) — layout, private functions, and the mandatory context parameter.
95+
- [Repository Defaults](Repository-Defaults.md) — repository files, README shape, and agent onboarding.

src/docs/PowerShell/Modules/Repository-Defaults.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This page defines the default repository contract for PowerShell module repositories in the PSModule organization. It describes what a newly created or maintained module repository should look like before module-specific code, tests, documentation, and managed repository files are considered.
44

5-
The implementation standard still lives in [PowerShell module standard](Standards.md). This page covers repository defaults: files, metadata, README shape, release integration, placeholder handling, shared community files, and managed-file distribution.
5+
The implementation standard still lives in [PowerShell module standard](Standards.md). Type-specific conventions for integration (API) and data modules live in [Module types](Module-Types.md). This page covers repository defaults: files, metadata, README shape, release integration, placeholder handling, shared community files, agent onboarding files, and managed-file distribution.
66

77
## Scope
88

@@ -62,10 +62,13 @@ Module repositories use the PSModule framework layout:
6262
| ---- | --------------- |
6363
| `README.md` | Concise start page for the module. |
6464
| `LICENSE` | Repository license. PSModule module repositories default to MIT unless a different license is explicitly decided. |
65-
| `CONTRIBUTING.md` | Contribution workflow or a repository-level pointer to the organization contribution guide. |
65+
| `CONTRIBUTING.md` | Self-contained contribution workflow for this repository. Does not rely on an organization-level fallback. |
6666
| `SECURITY.md` | Security support policy and private vulnerability reporting instructions. |
6767
| `SUPPORT.md` | Support expectations and where users ask for help. |
6868
| `CODE_OF_CONDUCT.md` | Community conduct expectations. |
69+
| `AGENTS.md` | Agent onboarding entry point. Points agents to the PSModule and MSX documentation for the why, how, and what. |
70+
| `CLAUDE.md` | Claude Code entry point. Imports `AGENTS.md` so Claude reads the same instructions. |
71+
| `.github/copilot-instructions.md` | VS Code and GitHub Copilot repository instructions. Points to the same documentation. |
6972
| `.github/PSModule.yml` | Module workflow configuration overrides. |
7073
| `.github/workflows/workflow.yml` | Reusable Process-PSModule workflow entry point. |
7174
| `.github/dependabot.yml` | Dependency and supply-chain update configuration. |
@@ -102,10 +105,13 @@ Required baseline files for module repositories:
102105
| ---- | ------------------ |
103106
| `README.md` | Repository landing page and evergreen context for humans and agents. |
104107
| `LICENSE` | Clear legal terms for reuse, packaging, and redistribution. |
105-
| `CONTRIBUTING.md` | Shared contribution workflow and expectations. |
108+
| `CONTRIBUTING.md` | Self-contained contribution workflow and expectations for this repository. |
106109
| `SECURITY.md` | Private vulnerability reporting and latest-version support policy. |
107110
| `SUPPORT.md` | Support channel and issue-routing expectations. |
108111
| `CODE_OF_CONDUCT.md` | Community participation rules. |
112+
| `AGENTS.md` | Cross-tool agent instructions pointing to the PSModule and MSX documentation. |
113+
| `CLAUDE.md` | Claude Code entry point that imports `AGENTS.md`. |
114+
| `.github/copilot-instructions.md` | VS Code and GitHub Copilot repository instructions pointing to the documentation. |
109115
| `.github/dependabot.yml` | Supply-chain maintenance for GitHub Actions and PowerShell dependencies. |
110116
| `.github/CODEOWNERS` | Review routing for source, docs, and GitHub workflow files. |
111117
| `.github/pull_request_template.md` | Consistent PR Manager-style PR descriptions and change classification. |
@@ -118,6 +124,18 @@ Required baseline files for module repositories:
118124

119125
Repositories can add local files, but they should not remove these baseline files unless the repository is explicitly outside the module standard.
120126

127+
Each repository must stand on its own. It carries its own copy of every file above and does not depend on the organization `.github` fallback: that fallback is only surfaced in GitHub's web UI, and agents, linters, and local tooling do not read it.
128+
129+
## Agent onboarding files
130+
131+
Every repository must be usable by an agent that has never seen it before, without special configuration. Each repository carries its own agent entry points that *point to* the authoritative documentation instead of restating it:
132+
133+
- `AGENTS.md` — the cross-tool entry point, read by the GitHub Copilot coding agent, VS Code, and other AGENTS.md-aware tools. It names what the repository is in a line or two and points to the PSModule documentation (`https://psmodule.io`, source in [`PSModule/docs`](https://github.com/PSModule/docs)) for the module's why/how/what, and to the MSX documentation (`https://msxorg.github.io/docs`, source in [`MSXOrg/docs`](https://github.com/MSXOrg/docs)) for organization-level principles and ways of working.
134+
- `CLAUDE.md` — a thin file that imports `AGENTS.md` with `@AGENTS.md` so Claude Code reads the same instructions. Claude-specific notes, if any, go below the import.
135+
- `.github/copilot-instructions.md` — repository instructions for VS Code and GitHub Copilot that point to the same documentation.
136+
137+
These files are the agent equivalent of the README: pointers, not copies. Keep them short so the linked documentation stays the single source of truth. Like the other governance files, they live in the repository itself so it can stand on its own.
138+
121139
## Managed file distribution
122140

123141
Shared files should be treated as managed files. The current distribution service is [`PSModule/Distributor`](https://github.com/PSModule/Distributor). It keeps source file sets under `Repos/{Type}/{Selection}/` and syncs those files into repositories through pull requests.
@@ -133,7 +151,7 @@ The current Distributor model is subscription-based:
133151
Two follow-up Distributor capabilities define the desired direction:
134152

135153
- **Global file sets** should allow common file sets such as `.gitattributes`, `.gitignore`, and `License` to be defined once and made available to all repository types while still requiring subscription.
136-
- **Mandatory file sets** should allow organization-critical files such as `SECURITY.md`, `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, and supply-chain configuration to be pushed to applicable repositories without each repository having to subscribe manually.
154+
- **Mandatory file sets** should allow organization-critical files such as `SECURITY.md`, `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, the agent onboarding files (`AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`), and supply-chain configuration to be pushed to applicable repositories without each repository having to subscribe manually.
137155

138156
Until mandatory file sets exist, repository owners are still responsible for ensuring the required common files exist. Distributor is the preferred implementation mechanism; this document is the standard that says what must exist and why.
139157

@@ -180,7 +198,7 @@ The README answers these questions, in this order:
180198
| What is it? | Name the module and define its scope in one short paragraph. |
181199
| Why should I care? | State the value or kind of task the module makes easier. |
182200
| How do I get it? | Show the PowerShell Gallery install and import commands. |
183-
| How does it work? | Show one to three representative capabilities or usage examples. |
201+
| How does it work? | Show one to three representative usage examples. |
184202
| How do I get more info? | Link to generated module documentation and PowerShell help. |
185203

186204
Module installation examples must use PSResourceGet:
@@ -207,11 +225,11 @@ Install-PSResource -Name <ModuleName>
207225
Import-Module -Name <ModuleName>
208226
```
209227

210-
## Capabilities
228+
## Usage
211229

212-
Use this section as a short showcase and introduction to how the module works. Show the most important things the module makes possible with one to three realistic examples.
230+
Use this section as a short showcase and introduction to how the module works. Show the most important things the module makes possible with one to three realistic examples; `### Example: <scenario>` subsections are fine when you have more than one.
213231

214-
The goal is discovery and marketing, not exhaustive command documentation. A reader should understand why the module exists and what kind of tasks it helps with.
232+
The goal is discovery, not exhaustive command documentation. A reader should understand why the module exists and what kind of tasks it helps with.
215233

216234
```powershell
217235
# Replace this with a real example that demonstrates the module's value.
@@ -232,19 +250,19 @@ Get-Help -Name <Command> -Examples
232250

233251
In the documentation examples, replace `<Command>` with a real command exported by the module, for example `Get-Help -Name Get-GitHubRepository -Examples`, so the snippet runs as written. Do not ship placeholder tokens such as `'CommandName'` or `<CommandName>` as if they were runnable commands.
234252

235-
Implemented modules must include the capabilities or usage showcase before the documentation link. Keep it focused on discovery: show one to three representative outcomes, not every command, parameter, or edge case. A landing page with only an installation snippet and a documentation link is not enough for a module that has working commands.
253+
Implemented modules must include the `## Usage` showcase before the documentation link. Keep it focused on discovery: show one to three representative outcomes, not every command, parameter, or edge case. A landing page with only an installation snippet and a documentation link is not enough for a module that has working commands. Do not title this section `## Capabilities`; use `## Usage` (or `## Examples`).
236254

237255
Keep, trim, or relocate content — do not delete it:
238256

239-
- **Keep on the landing page:** the overview, prerequisites and requirements (PowerShell version, supported platforms, module or native dependencies), installation, the capabilities showcase, and the short operational notes a reader needs before first use.
257+
- **Keep on the landing page:** the overview, prerequisites and requirements (PowerShell version, supported platforms, module or native dependencies), installation, the usage showcase, and the short operational notes a reader needs before first use.
240258
- **Trim:** exhaustive command inventories, parameter tables, and repetitive examples that differ only by a parameter. These come from comment-based help — point to `Get-Help` and the documentation site instead of restating them.
241259
- **Relocate only to a published home — never drop:** long-form guides and unique conceptual content (authentication and setup walkthroughs, deep operational detail, end-to-end scenarios) may move out of the README only into a surface that is actually published: a command group's overview page under `src/functions/public/<Group>/<Group>.md`, or comment-based help. A bare top-level `docs/` folder is not published by the current docs build, so moving content there drops it from the site. When there is no published home for it yet, keep the full content in the README. A longer landing page is acceptable and expected for feature-rich modules; do not shorten by deleting.
242260

243261
Retain upstream attribution and licensing context. Credit, acknowledgements, donation notes, and third-party license notices for wrapped or bundled work must stay in the README, or move to a clearly linked place. The rule below about community and policy sections does not apply to attribution the project is expected to carry.
244262

245263
README pages should not duplicate generated command documentation. Do not add full command inventories, parameter tables, or long reference sections when those details are already produced from comment-based help.
246264

247-
Do not add a community-file or policy link section by default. Readers can find standard repository files such as `LICENSE`, `CONTRIBUTING.md`, `SECURITY.md`, and `CODE_OF_CONDUCT.md` through GitHub conventions and the repository file tree. Link them only when the module has an unusual rule the user must know before using it, or when it carries required upstream attribution.
265+
Do not add a community-file, policy, or Contributing link section to the README by default, and do not add a `## Contributing` section. Each repository carries its own `CONTRIBUTING.md`, `SECURITY.md`, `SUPPORT.md`, and `CODE_OF_CONDUCT.md`; readers and tools find them through the repository file tree and GitHub renders them in its UI. The README links or restates them only when the module has an unusual rule the user must know before using it, or when it carries required upstream attribution.
248266

249267
## Placeholder and in-progress repositories
250268

@@ -280,13 +298,14 @@ Before opening a README-only PR, check that the README follows the default and d
280298
Select-String -Path README.md -SimpleMatch -Pattern 'Greet-Entity', 'PSModuleTemplate', 'YourModuleName'
281299
Select-String -Path README.md -SimpleMatch -Pattern '{{ NAME }}', '{{ DESCRIPTION }}'
282300
Select-String -Path README.md -SimpleMatch -Pattern "-Name 'CommandName'", '<CommandName>'
283-
Select-String -Path README.md -Pattern '^## Commands$'
301+
Select-String -Path README.md -Pattern '^## (Commands|Capabilities)$'
302+
Select-String -Path README.md -Pattern '^Install-Module\b'
284303
git diff --check -- README.md
285304
```
286305

287306
`Template-PSModule` is the exception: it intentionally keeps `{{ NAME }}` and `{{ DESCRIPTION }}` tokens because those are template inputs.
288307

289-
For an implemented module, also confirm the README keeps a capabilities or usage showcase and that any unique content removed from the previous version — prerequisites, setup or authentication guidance, operational notes, or upstream attribution — was relocated to `docs/`, `examples/`, or comment-based help rather than deleted.
308+
For an implemented module, also confirm the README keeps a `## Usage` showcase and that any unique content removed from the previous version — prerequisites, setup or authentication guidance, operational notes, or upstream attribution — was relocated to a published surface (`src/functions/public/<Group>/<Group>.md`, `examples/`, or comment-based help) rather than deleted.
290309

291310
## Documentation ownership
292311

src/docs/PowerShell/Modules/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Version increments are driven by PR labels (`Major`, `Minor`, `Patch`, `Prerelea
2222

2323
- **[Repository Defaults](Repository-Defaults.md)** — Required repository defaults for PSModule PowerShell module repos, including README shape, placeholder handling, metadata, and documentation ownership.
2424
- **[Standards](Standards.md)** — Repository layout, naming, style, parameter design, comment-based help, and SOLID applied to PowerShell modules.
25+
- **[Module types](Module-Types.md)** — Type-specific conventions for integration (API) modules and data modules, including function-to-REST naming and using Context for user and module settings.
2526
- **[Test Specification](Test-Specification.md)** — How we write Pester tests: structure, hierarchy, and naming conventions.
2627
- **[Versioning](Versioning.md)** — How changes to the public interface determine the SemVer version bump.
2728

0 commit comments

Comments
 (0)