pst-plan
PST Plan
Read insights.md and snapshots/ from a PST session, analyze the full codebase, ask the user to confirm the test file path, then write an exhaustive plan.md with complete code for every file to create or modify.
When to use
After pst-explore has produced .pst/sessions/[name]/insights.md. Invoke this skill with the session name to produce the implementation plan.
Inputs
- Session name (provided by user or carried over from
pst-explore) .pst/sessions/[name]/insights.md.pst/sessions/[name]/snapshots/(DOM snapshots and screenshots)- Full codebase
Steps
1. Read session artifacts
- Read
.pst/sessions/[name]/insights.md - Read all files in
.pst/sessions/[name]/snapshots/(DOM snapshots / YAML files)
2. Analyze the codebase
Scan the following:
playwright.config.ts— base URL, timeout, reporter, projects, output dirtests/directory tree — all existing spec files, their structure, naming conventions- Any helper files:
tests/helpers/,tests/fixtures/,tests/utils/,tests/pages/ - Page object models if present
package.json— installed Playwright version, test scripts.gitignore— confirm.pst/andnode_modules/are excluded
# Discover codebase structure
ls -R tests/ 2>/dev/null || echo "no tests dir"
- Find all files matching
tests/**/*.spec.ts - Find all files matching
tests/**/*.ts - Read
playwright.config.ts(if it exists) - Read
package.json
3. Determine test file path
Based on the codebase analysis:
- If an existing spec file covers the same feature area, suggest modifying it
- If no related file exists, propose a new path following the project's naming conventions (e.g.
tests/[feature]/[scenario].spec.ts)
Ask the user:
"Based on codebase analysis, I suggest
tests/[suggested-path].spec.tsfor this test. [If existing: This file already exists and covers related scenarios.] Confirm this path, or specify another?"
Wait for the user's response before proceeding.
4. Write plan.md
Write .pst/sessions/[name]/plan.md using the format below. Every code block must be complete and runnable — no pseudocode, no // ... placeholders, no partial implementations.
plan.md Format
# [Test Case Title] — Implementation Plan
## Session
- **Name:** [session-name]
- **Insights:** `.pst/sessions/[name]/insights.md`
## Test File
- **Path:** `[confirmed path]`
- **Action:** CREATE | MODIFY
## File Change Manifest
| File | Action | Description |
|------|--------|-------------|
| `[path]` | CREATE | [what it contains] |
| `[path]` | MODIFY | [what changes] |
| `[path]` | KEEP | [no changes needed] |
## Dependencies & Imports
- `@playwright/test` — already installed (version [X])
- [Any additional packages needed with install command]
## New Files
### `[path/to/spec.ts]`
\`\`\`typescript
import { test, expect } from '@playwright/test';
test.describe('[Scenario Group]', () => {
test('[scenario title]', async ({ page }) => {
// Step 1 — [description]
await page.goto('[URL]');
await expect(page).toHaveTitle('[title]');
await expect(page.locator('[selector]')).toBeVisible();
// Step 2 — [description]
await page.locator('[selector]').click();
await expect(page).toHaveURL('[URL]');
await expect(page.locator('[selector]')).toBeVisible();
// [Continue for every step, every expectation]
});
});
\`\`\`
### `[path/to/helper.ts]` (if needed)
\`\`\`typescript
// full file content
\`\`\`
## Modified Files
### `[path/to/existing-file.ts]`
**Change:** [description of what is added/modified]
\`\`\`typescript
// complete updated file content
\`\`\`
## playwright.config.ts Changes (if needed)
\`\`\`typescript
// complete updated config
\`\`\`
## Selector Strategy
| Step | Element | Selector | Type |
|------|---------|----------|------|
| 1 | [element] | `[selector]` | ARIA / text / CSS |
| 2 | [element] | `[selector]` | ARIA / text / CSS |
## Run Command
\`\`\`bash
npx playwright test [path] --headed
\`\`\`
Rules
- Every code block must be complete. No
// ...or// rest of file. - Use selectors from
insights.md— do not invent new ones. - Prefer ARIA/role/text selectors over CSS selectors.
- Every step from
insights.mdmust map to at least one line of test code. - Every expectation from
insights.mdmust map to at least oneexpect()assertion. - If
playwright.config.tsdoes not exist, include its full creation in the manifest. - The Selector Strategy table must include every selector used in the spec.
More from lautaroleonhardt/pst
analyze-codebase
Use when starting a Playwright testing session or when project structure is unknown. Scans the project for Playwright config, test conventions, routing, and tech stack. Writes output to docs/playwright-spec-testing/project-context.md.
9plan-tests
Use after explore-app to synthesize an exhaustive, human-reviewable test plan from exploration reports and project context. Reads all exploration/<slug>.md files, parsed-spec.md, and project-context.md. Outputs test-plan.md with full steps, assertions, and assigned test file paths.
9ingest-spec
Use when you have a Gherkin .feature file or plain-English test cases to parse into structured scenarios. Writes output to docs/playwright-spec-testing/parsed-spec.md.
9generate-tests
Use after plan-tests to write a Playwright test for one scenario by mechanically translating test-plan.md into Playwright API calls. Requires docs/playwright-spec-testing/test-plan.md. Writes the test file at the path assigned in the plan.
9debug-test
Use when a Playwright test is failing. Diagnoses the root cause and applies a minimal fix. Requires the failing test file path and the full error output.
9explore-app
Use after ingest-spec to walk through one scenario in the live app and capture real selectors and URLs. Requires a running app and a scenario from docs/playwright-spec-testing/parsed-spec.md. Writes output to docs/playwright-spec-testing/exploration/<scenario-slug>.md.
9