agentleFS
thesawdawgthesawdawg/agent-skills/lan-viewer/SKILL.md

lan-viewer

Skill2 starsChanged 57 days agoMITView on GitHub

Serve markdown docs, code, diffs, JSON/CSV, and Mermaid diagrams as one themed, searchable web page with live reload, on localhost or (opt-in) the local network. Use when the user wants to view, browse, present, or share documents or session output in a browser or on another LAN device. Not for public hosting or deployment to the internet.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Start it detached from the loaded skill path (never the user's cwd), keeping the token in a private file rather than chat or logs.

    line 22
  2. Very specific:

    Stop it with kill <pid> (from record.json) when finished, then delete ./.lan-viewer.

    line 45
  3. Very specific:

    Do not serve a directory the user has not agreed to share, especially with --lan.

    line 58
  4. Very specific:

    Verify with bash scripts/preflight.sh from this skill directory (no network, no server left running) or python3 scripts/viewer.py …

    line 67

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LAN document viewer

Turn files into a navigable page: sidebar, table of contents, content search, light/dark/auto theme, syntax highlighting, sortable CSV tables, Mermaid diagrams, callouts (> [!NOTE]), copy buttons, print styles, phone layout, and live reload when files change. Python 3.9+ stdlib only; libraries are vendored in assets/vendor/, so viewing needs no internet.

Workflow

  1. Decide the content. For session output (a plan, findings, a diff, a table), write it to a file in a scratch directory first; the viewer serves files only. Reuse existing user files in place; do not copy or edit them.
  2. Choose exposure. Default is loopback only. Pass --lan only when the user wants another device to view it, and say so: anyone on that network who gets the URL (it carries the token) can read every served file.
  3. Start it detached from the loaded skill path (never the user's cwd), keeping the token in a private file rather than chat or logs. Set FILES to the paths to serve (space-separated, no spaces inside names; for example ./docs plan.md); add --lan only if step 2 chose it:

    for d in "$HOME/.pi/agent/skills/lan-viewer" "$HOME/.agents/skills/lan-viewer" ".pi/skills/lan-viewer" ".agents/skills/lan-viewer" ./lan-viewer; do
      [ -f "$d/scripts/viewer.py" ] && printf 'DIR=%s\n' "$(cd "$d" && pwd)" && break
    done
    DIR="/absolute/path/from/above"
    FILES="./docs plan.md"
    mkdir -p -m 700 ./.lan-viewer
    # shellcheck disable=SC2086
    nohup python3 "$DIR/scripts/viewer.py" $FILES --title "Project docs" \
      > ./.lan-viewer/record.json 2> ./.lan-viewer/err.log &
    for i in $(seq 1 20); do [ -s ./.lan-viewer/record.json ] && break; sleep 0.5; done
    cat ./.lan-viewer/record.json ./.lan-viewer/err.log

    Success is one JSON line with url (carries the ?t= token), pid, files and warnings; otherwise err.log explains. Give the user the url; do not paste it into commits, shared logs, or other channels, and do not commit ./.lan-viewer.

  4. Edit the served files to update the page; it reloads itself within ~2 seconds.
  5. Stop it with kill <pid> (from record.json) when finished, then delete ./.lan-viewer. It also exits after --idle-timeout minutes without requests (default 120; 0 disables). Stop only a server you started.

Boundaries

  • Serves only files named at startup (directories expand once, recursively, skipping dot-entries, node_modules, .git, builds); request paths never select files. Symlinks inside a directory that leave it are skipped. Credential-like files (.env*, keys, *credential*/*secret*/*token* data files, kubeconfig, tfstate, SSH private keys) and files over 5 MB are refused with a warning, even when named explicitly. Do not rename around the filter.
  • Do not serve a directory the user has not agreed to share, especially with --lan.
  • Markdown raw HTML is shown as text, scripts are blocked by CSP, and diagrams use Mermaid strict mode. This is for trusted-network viewing, not the public internet; there is no TLS. For public sharing, use a separate, explicitly authorized deploy.
  • Markdown images are not served (the page loads nothing but its own assets); inline diagrams as Mermaid or link to the file instead.
  • Formats: .md, .json, .csv/.tsv, .diff/.patch, .mmd, and common source or config files (highlighted). Other explicitly named files render as plain text.

Verify with bash scripts/preflight.sh from this skill directory (no network, no server left running) or python3 scripts/viewer.py --selftest.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.