Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .agents/skills/tiny-powershell-projects/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: tiny-powershell-projects
description: Codex harness entrypoint for Tiny PowerShell Projects skills. Use this to apply chapter-derived PowerShell script patterns and testing workflows.
---

# Tiny PowerShell Projects (Codex)

Use `.github/skills/tiny-powershell-projects/SKILL.md` as the source of truth for the full skill content.

When this skill is invoked, follow that file exactly and apply the patterns to the current task.
7 changes: 7 additions & 0 deletions .claude/commands/tiny-powershell-projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
description: Use Tiny PowerShell Projects skill patterns (CLI args, file IO, regex transforms, randomness, and Pester TDD) for implementation tasks.
---

Use `.github/skills/tiny-powershell-projects/SKILL.md` as the source of truth for the full skill content.

When this command is used, apply those patterns directly to the current request.
75 changes: 75 additions & 0 deletions .github/skills/tiny-powershell-projects/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: tiny-powershell-projects
description: Reusable PowerShell development skills derived from Tiny PowerShell Projects chapters, including CLI parsing, file IO, regex transforms, deterministic randomness, and Pester-driven TDD.
---

# Tiny PowerShell Projects Skill Pack

Use this skill when building or refactoring PowerShell scripts in this repository style.

## 1) Build robust PowerShell CLI parameters
- **Use when:** creating command-line tools with optional/required inputs.
- **Source chapters:** 01, 02, 03, 09, 17
- **Skill instructions:** add a `param(...)` block, support positional and named args, validate required input early, and print clear usage on bad input.

## 2) Handle file input/output and pipeline input
- **Use when:** scripts need to read files, stdin, and write to stdout/files.
- **Source chapters:** 05, 06, 15
- **Skill instructions:** accept file paths plus pipeline content, verify files with `Test-Path`, and keep output stream-friendly for chaining.

## 3) Count and summarize text metrics
- **Use when:** implementing `wc`-style line/word/character summaries.
- **Source chapters:** 06
- **Skill instructions:** compute per-input totals and overall totals, support multiple files, and format output in a consistent tabular style.

## 4) Transform text using hash-table lookups
- **Use when:** encoding/decoding characters or token substitution.
- **Source chapters:** 04, 07
- **Skill instructions:** store mappings in a hashtable, iterate characters/tokens, replace only known keys, and preserve unknown values.

## 5) Apply regex-based parsing and rewriting
- **Use when:** extracting placeholders, matching word patterns, or rewriting text.
- **Source chapters:** 14, 15, 17
- **Skill instructions:** use `-match`/`-replace` with anchored, readable patterns and keep punctuation/whitespace intact while modifying matched words.

## 6) Implement reproducible randomness
- **Use when:** random output must be testable and repeatable.
- **Source chapters:** 09, 10, 12, 16
- **Skill instructions:** accept a seed parameter, initialize a deterministic random generator, and ensure tests can assert exact output for known seeds.

## 7) Generate controlled random content
- **Use when:** creating synthetic phrases, insults, or transformed text.
- **Source chapters:** 09, 10, 12, 16
- **Skill instructions:** separate source word lists from generation logic, enforce output constraints, and keep generators pure where possible.

## 8) Build word games and verse generators
- **Use when:** generating structured multi-line text (songs, rhymes, templates).
- **Source chapters:** 11, 13, 14
- **Skill instructions:** write small formatting functions per verse/line, handle singular/plural edge cases, and compose full output from those units.

## 9) Split and reconstruct tokenized text safely
- **Use when:** transforming only words while preserving punctuation and spacing.
- **Source chapters:** 15, 16
- **Skill instructions:** tokenize with regex capture groups, mutate only word tokens, and rejoin all tokens in original order.

## 10) Add defensive input validation and errors
- **Use when:** scripts receive user input or external files.
- **Source chapters:** 05, 06, 17, 20
- **Skill instructions:** validate file existence and argument ranges, fail fast with clear messages, and avoid partial output on invalid input.

## 11) Use Pester-driven TDD for scripts
- **Use when:** implementing or refactoring chapter scripts.
- **Source chapters:** all chapters with `test.ps1`/`AllTest.ps1`
- **Skill instructions:** write/adjust behavior in small steps, run `Invoke-Pester` frequently, and keep deterministic tests for random logic using seeds.

## 12) Keep multiple solution variants testable
- **Use when:** exploring alternative implementations.
- **Source chapters:** all chapters with `AllTest.ps1`
- **Skill instructions:** keep `solution*.ps1` variants, copy target file in `AllTest.ps1`, and verify each variant against the same test contract.

## Prompt snippets
1. **Create a PowerShell CLI script with validated `param(...)` arguments, friendly usage text, and Pester tests for valid/invalid inputs.**
2. **Write a deterministic random text generator in PowerShell that accepts `-Seed` and has tests asserting exact output.**
3. **Implement a regex-based word transformer that preserves punctuation/whitespace and includes edge-case tests.**
4. **Build a `wc`-style script that supports stdin and multiple files, with aligned summary output and totals.**
5. **Refactor this script into small pure functions and wire it through `AllTest.ps1` so multiple `solution*.ps1` variants can be tested.**
79 changes: 79 additions & 0 deletions AI_SKILLS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# AI Skills from Tiny PowerShell Projects

These reusable skills are derived from the chapter projects in this repository and are available in harness-ready formats:

- VS Code Copilot skill: `.github/skills/tiny-powershell-projects/SKILL.md`
- Codex skill: `.agents/skills/tiny-powershell-projects/SKILL.md`
- Claude Code command: `.claude/commands/tiny-powershell-projects.md`

The shared source-of-truth content is in `.github/skills/tiny-powershell-projects/SKILL.md`.

## 1) Build robust PowerShell CLI parameters
- **Use when:** creating command-line tools with optional/required inputs.
- **Source chapters:** 01, 02, 03, 09, 17
- **Skill instructions:** add a `param(...)` block, support positional and named args, validate required input early, and print clear usage on bad input.

## 2) Handle file input/output and pipeline input
- **Use when:** scripts need to read files, stdin, and write to stdout/files.
- **Source chapters:** 05, 06, 15
- **Skill instructions:** accept file paths plus pipeline content, verify files with `Test-Path`, and keep output stream-friendly for chaining.

## 3) Count and summarize text metrics
- **Use when:** implementing `wc`-style line/word/character summaries.
- **Source chapters:** 06
- **Skill instructions:** compute per-input totals and overall totals, support multiple files, and format output in a consistent tabular style.

## 4) Transform text using hash-table lookups
- **Use when:** encoding/decoding characters or token substitution.
- **Source chapters:** 04, 07
- **Skill instructions:** store mappings in a hashtable, iterate characters/tokens, replace only known keys, and preserve unknown values.

## 5) Apply regex-based parsing and rewriting
- **Use when:** extracting placeholders, matching word patterns, or rewriting text.
- **Source chapters:** 14, 15, 17
- **Skill instructions:** use `-match`/`-replace` with anchored, readable patterns and keep punctuation/whitespace intact while modifying matched words.

## 6) Implement reproducible randomness
- **Use when:** random output must be testable and repeatable.
- **Source chapters:** 09, 10, 12, 16
- **Skill instructions:** accept a seed parameter, initialize a deterministic random generator, and ensure tests can assert exact output for known seeds.

## 7) Generate controlled random content
- **Use when:** creating synthetic phrases, insults, or transformed text.
- **Source chapters:** 09, 10, 12, 16
- **Skill instructions:** separate source word lists from generation logic, enforce output constraints, and keep generators pure where possible.

## 8) Build word games and verse generators
- **Use when:** generating structured multi-line text (songs, rhymes, templates).
- **Source chapters:** 11, 13, 14
- **Skill instructions:** write small formatting functions per verse/line, handle singular/plural edge cases, and compose full output from those units.

## 9) Split and reconstruct tokenized text safely
- **Use when:** transforming only words while preserving punctuation and spacing.
- **Source chapters:** 15, 16
- **Skill instructions:** tokenize with regex capture groups, mutate only word tokens, and rejoin all tokens in original order.

## 10) Add defensive input validation and errors
- **Use when:** scripts receive user input or external files.
- **Source chapters:** 05, 06, 17, 20
- **Skill instructions:** validate file existence and argument ranges, fail fast with clear messages, and avoid partial output on invalid input.

## 11) Use Pester-driven TDD for scripts
- **Use when:** implementing or refactoring chapter scripts.
- **Source chapters:** all chapters with `test.ps1`/`AllTest.ps1`
- **Skill instructions:** write/adjust behavior in small steps, run `Invoke-Pester` frequently, and keep deterministic tests for random logic using seeds.

## 12) Keep multiple solution variants testable
- **Use when:** exploring alternative implementations.
- **Source chapters:** all chapters with `AllTest.ps1`
- **Skill instructions:** keep `solution*.ps1` variants, copy target file in `AllTest.ps1`, and verify each variant against the same test contract.

---

## Prompt snippets you can give an AI

1. **“Create a PowerShell CLI script with validated `param(...)` arguments, friendly usage text, and Pester tests for valid/invalid inputs.”**
2. **“Write a deterministic random text generator in PowerShell that accepts `-Seed` and has tests asserting exact output.”**
3. **“Implement a regex-based word transformer that preserves punctuation/whitespace and includes edge-case tests.”**
4. **“Build a `wc`-style script that supports stdin and multiple files, with aligned summary output and totals.”**
5. **“Refactor this script into small pure functions and wire it through `AllTest.ps1` so multiple `solution*.ps1` variants can be tested.”**
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ One of the many cool aspects of this not only the approach to learning `PowerShe

Either way, it's the same puzzles implemented in both languages, and you can use the tests provided, to do Test Driven Development and prove these and your solutions work, as you make changes.

## AI Skills

Want reusable AI skills derived from this repo?

- Overview: [AI_SKILLS.md](./AI_SKILLS.md)
- VS Code Copilot: [`.github/skills/tiny-powershell-projects/SKILL.md`](./.github/skills/tiny-powershell-projects/SKILL.md)
- Codex: [`.agents/skills/tiny-powershell-projects/SKILL.md`](./.agents/skills/tiny-powershell-projects/SKILL.md)
- Claude Code: [`.claude/commands/tiny-powershell-projects.md`](./.claude/commands/tiny-powershell-projects.md)

## The Video
Scripting Success A Deep Dive into Tiny PowerShell Projects.

Expand Down