home / skills / anton-abyzov / specweave / preview

preview skill

/plugins/specweave-docs/skills/preview

This skill launches and manages a zero-config Docusaurus docs server for SpecWeave projects, enabling hot reload, auto-generated sidebars, and Mermaid diagrams.

This is most likely a fork of the sw-preview skill from openclaw
npx playbooks add skill anton-abyzov/specweave --skill preview

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.9 KB
---
name: preview
description: Documentation view expert for Docusaurus integration. Launches interactive server for SpecWeave living documentation with hot reload, auto-generated sidebar, and Mermaid diagrams. Works in ANY SpecWeave project with auto-setup. Supports both internal (port 3015) and public (port 3016) docs. Activates for preview docs, view documentation, Docusaurus server, docs UI, documentation website, local docs server, hot reload docs, static site build.
---

# Documentation View Skill

Expert in launching and managing Docusaurus documentation server for SpecWeave projects.

## What I Do

I help you view your SpecWeave living documentation with Docusaurus:

### Key Features
- **Zero-config setup** - Works in any SpecWeave project automatically
- **Internal & Public docs** - Internal on port 3015, public on port 3016
- **Cached installation** - Docusaurus cached in `.specweave/cache/docs-site/` (gitignored)
- **Hot reload** - Edit markdown, see changes instantly
- **Mermaid diagrams** - Architecture diagrams render beautifully
- **Auto sidebar** - Generated from folder structure
- **Bypasses private registries** - Uses public npm to avoid Azure DevOps/corporate issues

## How It Works

1. **First run (~30 seconds)**:
   - Creates Docusaurus in `.specweave/cache/docs-site/` (internal) or `.specweave/cache/docs-site-public/` (public)
   - Installs dependencies from public npm registry
   - Configures to read from `.specweave/docs/internal/` or `.specweave/docs/public/`

2. **Subsequent runs (instant)**:
   - Uses cached installation
   - Starts server immediately

## Available Commands

### View Internal Documentation (Default)
```bash
/sw-docs:view
```

**What it does:**
1. Checks if `.specweave/docs/internal/` exists
2. Runs pre-flight validation (auto-fixes common issues)
3. Sets up Docusaurus in cache (if first run)
4. Starts dev server on **http://localhost:3015**
5. Enables hot reload

### View Public Documentation
```bash
/sw-docs:view --public
```

**What it does:**
1. Checks if `.specweave/docs/public/` exists
2. Runs pre-flight validation (auto-fixes common issues)
3. Sets up Docusaurus in cache (if first run)
4. Starts dev server on **http://localhost:3016**
5. Enables hot reload

### Build Static Site
```bash
/sw-docs:build
```

**What it does:**
1. Builds production-ready static site
2. Outputs to `.specweave/cache/docs-site/build/`
3. Ready for deployment to any static host

## When to Use This Skill

### Activate for:
- "View my documentation"
- "Preview my docs"
- "Show me my docs in a browser"
- "Launch Docusaurus"
- "View my living documentation"
- "Start docs server"
- "I want to see my internal docs"
- "View public docs"

### Workflow

```
User: "I want to preview my docs"
You: "I'll launch the documentation view server."
     [Run: /sw-docs:view]
```

```
User: "Show me my public documentation"
You: "I'll launch the public documentation server."
     [Run: /sw-docs:view --public]
```

## Port Reference

| Docs Type | Port | Path |
|-----------|------|------|
| Internal (default) | 3015 | `.specweave/docs/internal/` |
| Public | 3016 | `.specweave/docs/public/` |

## Troubleshooting

### Port 3015 or 3016 already in use
```bash
# For internal docs
lsof -i :3015 && kill -9 $(lsof -t -i :3015)

# For public docs
lsof -i :3016 && kill -9 $(lsof -t -i :3016)
```

### Reinstall from scratch
```bash
# For internal docs
rm -rf .specweave/cache/docs-site
# Then run /sw-docs:view again

# For public docs
rm -rf .specweave/cache/docs-site-public
# Then run /sw-docs:view --public again
```

### npm registry issues
The setup explicitly uses `--registry=https://registry.npmjs.org` to bypass private/corporate registry configurations.

## See Also

- `/sw-docs:build` - Build static site for deployment
- `/sw-docs:organize` - Organize large folders with themed indexes
- `/sw-docs:health` - Documentation health report
- `/sw-docs:validate` - Validate documentation before viewing

Overview

This skill launches and manages a Docusaurus-based documentation server for SpecWeave projects so you can preview living docs locally or publicly. It auto-sets up a cached Docusaurus site, generates a sidebar, supports Mermaid diagrams, and provides hot reload for instant feedback. Internal docs run on port 3015 and public docs on port 3016 with zero-config setup in any SpecWeave repo.

How this skill works

On first run the skill scaffolds a Docusaurus site into a gitignored cache folder and installs dependencies from the public npm registry to avoid private registry issues. It configures the site to read from .specweave/docs/internal/ or .specweave/docs/public/, generates a sidebar from folders, and enables Mermaid rendering. Subsequent runs reuse the cached installation for near-instant startup and open a dev server with hot reload on the chosen port.

When to use it

  • You want to preview SpecWeave living documentation in a browser
  • You need internal docs available locally (port 3015)
  • You need a public preview of docs (port 3016)
  • You want hot reload while editing markdown or diagrams
  • You need a zero-config docs server that bypasses private npm registries

Best practices

  • Keep internal and public docs in .specweave/docs/internal/ and .specweave/docs/public/ respectively
  • Run the internal server for sensitive or team-only drafts and the public server for wider previews
  • Use the cached install for fast restarts; clear cache only when you need a fresh reinstall
  • Commit docs content but leave the cached Docusaurus folder gitignored
  • Use /sw-docs:build to produce a static site for deployment after preview

Example use cases

  • Developer requests to preview documentation changes before merging; run /sw-docs:view and review live site
  • Product manager wants to demo public docs to stakeholders; run /sw-docs:view --public on port 3016
  • Writer edits architecture diagrams in Markdown with Mermaid and sees updates immediately via hot reload
  • CI step builds a static documentation site with /sw-docs:build and publishes build output from .specweave/cache/docs-site/build/
  • Troubleshoot corporate npm registry issues by relying on the skill’s public npm install and cache

FAQ

What ports does the server use?

Internal docs default to localhost:3015; public docs use localhost:3016.

How long is the first run?

First-time setup typically takes around 30 seconds to scaffold and install dependencies; subsequent runs are instant using the cache.

How do I rebuild the cached Docusaurus from scratch?

Remove the appropriate cache folder ( .specweave/cache/docs-site or .specweave/cache/docs-site-public ) and restart the view command to reinstall.