A Powershell GitHub template repository. It comes wired with Pester, PSScriptAnalyzer, and Invoke-Build for test, lint, and build automation.
Import the module and call the sample public function:
# git clone this repo
# or sign in and click use this template
Import-Module .\PSTemplate.psd1
Write-PublicTestPSTemplate repo is correctly configured
Run the default build:
Invoke-BuildRunning tests.
PSTemplate repo is correctly configured
hello
[+] PSTemplate\Tests\Write-PublicTest.Tests.ps1 1.41s (347ms|787ms)
Tests completed in 1.52s
Tests Passed: 6, Failed: 0, Skipped: 0, Inconclusive: 0, NotRun: 0
Processing code coverage result.
Covered 50% / 75%. 4 analyzed Commands in 2 Files.
Done /test_pester 00:00:03.6772325
Results and coverage land in Generated/ as PesterTests.xml and
PesterCodeCoverage.xml.
This template repository comes wired with all the DevOps tooling you need for your new powershell project.
Drop your functions into Public/ and Private/, drop their tests into
Tests/, and the existing wiring carries them — no loader edits, no manifest
bookkeeping per function.
Public/— exported functions, one per file, file name matches the function. Ships withWrite-PublicTest.ps1.Private/— internal helpers, dot-sourced but not exported. Ships withWrite-PrivateTest.ps1.Tests/— Pester specs (*.Tests.ps1). Ships withWrite-PublicTest.Tests.ps1.Docs/— bundled PowerShell authoring references: cmdlet design rules (Docs/Rules/), Pester help (Docs/Pester/), path cmdlets (Docs/Path/), and worked examples (Docs/Examples/).PSTemplate.psm1— loader: dot-sourcesPrivate/thenPublic/, exports the public surface.PSTemplate.psd1— module manifest.PSTemplate.Build.ps1— InvokeBuild tasks.PSTemplate.ScriptAnalyzer.psd1— PSScriptAnalyzer rule profile.
- Create
Public/Verb-Noun.ps1with a single advanced function namedVerb-Noun. - Create
Tests/Verb-Noun.Tests.ps1next to the existing sample spec. - Re-import:
Import-Module ./PSTemplate.psd1 -Force. The loader exports it automatically — no manifest edit required.
The build runs on InvokeBuild.
Install it once with Install-Module InvokeBuild, then:
# Pester tests + code coverage -> Generated/
Invoke-Build test_pester -File ./PSTemplate.Build.ps1
# PSScriptAnalyzer report -> Generated/ScriptAnalyzer.txt
Invoke-Build test_ps_script_analyzer -File ./PSTemplate.Build.ps1MIT. See LICENSE.