pst-plan

Installation
SKILL.md

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 dir
  • tests/ 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/ and node_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.ts for 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.md must map to at least one line of test code.
  • Every expectation from insights.md must map to at least one expect() assertion.
  • If playwright.config.ts does not exist, include its full creation in the manifest.
  • The Selector Strategy table must include every selector used in the spec.
Related skills
Installs
3
First Seen
Apr 8, 2026