Skip to content

Repository files navigation

PSModuleTemplate

CI

A GitHub template repository for authoring high-quality PowerShell modules in VS Code.

What you get

  • Module layoutsrc/<Module>/ with Public/ and Private/ function folders, a dev-mode .psm1 loader, and a proper manifest
  • Build systemInvoke-Build script that assembles functions into a single distributable .psm1 and syncs FunctionsToExport
  • TestingPester v5 suite covering the manifest, exports, and function behavior
  • LintingPSScriptAnalyzer with a checked-in settings file shared by VS Code and CI
  • CI/CD — GitHub Actions: tests on Windows/Linux/macOS (PowerShell 7) plus Windows PowerShell 5.1; publish to the PowerShell Gallery on release
  • VS Code integration — tasks (build/test/analyze/docs), debug configs, formatting settings, recommended extensions
  • Docs — optional platyPS markdown help generation (./build.ps1 -Task Docs)
  • Community files — issue templates, PR template, Dependabot for actions

Quick start

  1. Click Use this template on GitHub and create your repository

  2. Clone it, then initialize:

    ./Initialize-Template.ps1 -ModuleName 'MyModule' -Author 'Your Name' -Description 'What it does.' -GitHubOwner 'yourusername'

    This renames everything, regenerates the module GUID, and deletes itself.

  3. Verify the build:

    ./build.ps1        # Analyze + Test (installs build dependencies on first run)
  4. Start writing functions in src/MyModule/Public/ — one file per function, matching the function name.

Build tasks

Command Purpose
./build.ps1 Default: Analyze + Test
./build.ps1 -Task Build Assemble the module into output/
./build.ps1 -Task Test Build, then run Pester tests
./build.ps1 -Task Analyze Run PSScriptAnalyzer
./build.ps1 -Task Docs Generate markdown help (requires platyPS)

The same tasks are available in VS Code via Terminal → Run Task.

Publishing

Create a GitHub release and the publish workflow pushes the built module to the PowerShell Gallery. Requires a PSGALLERY_API_KEY repository secret.

Conventions

  • One public function per file in Public/, filename = function name
  • Internal helpers live in Private/ and are never exported
  • Comment-based help on every public function
  • master is protected by CI; all changes come through PRs

Acknowledgments

This template was scaffolded with Claude Code, powered by the Claude Fable 5 model (claude-fable-5).

License

MIT

About

Template repository for authoring high-quality PowerShell modules in VS Code — Invoke-Build, Pester v5, PSScriptAnalyzer, GitHub Actions CI/CD

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages