Opinionated PowerShell module template with Pester v5 tests, PSScriptAnalyzer, and SHA-pinned CI. Green out of the box — create a repository from it and the workflow passes with no edits, giving you a working reference to extend rather than a blank canvas.
- Reviewable public contract. Functions are split into
Public/(exported) andPrivate/(internal), one per file, with an explicitFunctionsToExportlist — no wildcard exports. - Publish-ready. The manifest satisfies the PowerShell Gallery's requirements and the PSGallery PSScriptAnalyzer ruleset, so a module can be published without rework.
- Cross-edition. Declares
CompatiblePSEditions = @('Core', 'Desktop')with a 5.1 floor; CI exercises PowerShell 7 (Core) on Ubuntu. - Safe CI. Least-privilege permissions, SHA-pinned actions, per-job timeouts, and concurrency cancellation.
The reasoning is recorded in ADR-template/0001.
Click Use this template on NWarila/powershell-template, create your repository, and clone it.
git mv src/SampleModule src/<YourModule>
git mv src/<YourModule>/SampleModule.psm1 src/<YourModule>/<YourModule>.psm1
git mv src/<YourModule>/SampleModule.psd1 src/<YourModule>/<YourModule>.psd1
git mv tests/SampleModule.Tests.ps1 tests/<YourModule>.Tests.ps1Then edit:
src/<YourModule>/<YourModule>.psd1— setRootModule, a freshGUID(pwsh -c "[guid]::NewGuid()"),Author,Description, and theProjectUri/LicenseUri.tests/<YourModule>.Tests.ps1— set$script:ModuleNameto your module name.
pwsh -c "Invoke-ScriptAnalyzer -Path . -Settings PSGallery -Recurse"
pwsh -File tests/Invoke-Tests.ps1Full walkthrough: docs/tutorials/getting-started.md.
src/<ModuleName>/
<ModuleName>.psd1 # Manifest: export contract + metadata
<ModuleName>.psm1 # Root module: dot-sources Public/ + Private/, exports Public/
Public/ # Exported functions (one per file)
Private/ # Internal helpers (not exported)
tests/
<ModuleName>.Tests.ps1 # Pester v5 spec
Invoke-Tests.ps1 # PesterConfiguration runner (NUnit + coverage)
docs/ # Diátaxis documentation + ADRs + diagrams
.github/workflows/ci.yaml # actionlint + PSScriptAnalyzer + Pester
PSScriptAnalyzerSettings.psd1
See docs/reference/module-structure.md for the full reference and conventions.
The CI workflow runs on every push and pull request:
| Job | What it does |
|---|---|
| actionlint | Lints GitHub Actions workflows |
| PSScriptAnalyzer | Invoke-ScriptAnalyzer -Settings PSGallery -Recurse |
| Pester | Pester v5 suite, NUnit output, coverage target (≥ 80%) |
Documentation follows the Diátaxis framework. Start at docs/README.md.
See SECURITY.md for how to report a vulnerability.
MIT.