andocs
npx skills add https://github.com/blogic-cz/blogic-marketplace --skill andocs
Agent 安装分布
Skill 文档
Write documentation using Andocs rendering capabilities. All features work out of the box.
Prerequisites â Bun & Local Server
Andocs CLI requires the Bun runtime. Before writing docs, ensure the user has Bun installed and the local server running.
1. Check if Bun is installed
command -v bun
2. If Bun is NOT installed â install it
macOS/Linux:
curl -fsSL https://bun.sh/install | bash
Windows PowerShell:
powershell -c "irm bun.sh/install.ps1 | iex"
3. Determine the documentation folder
Before starting the server, you MUST identify the correct folder containing the user’s documentation. Do NOT guess â ask the user if unclear.
How to find the docs folder:
- Look for common documentation directories in the project:
docs/,documentation/,wiki/,content/ - Check if the user mentioned a specific path in their request
- Look for existing
.mdfiles â the folder containing them is likely the docs root - Check the project’s
README.mdorpackage.jsonfor documentation path hints
If you cannot determine the folder, ASK:
“Which folder contains your documentation? I see these candidates:
docs/,content/. Or provide the path.”
NEVER start the server pointing at the project root or a random folder. The --path flag must point to the actual documentation directory.
4. Start the local andocs server
The user MUST have the andocs server running to preview documentation. Always start it â do NOT try to detect if it’s already running (e.g., via pgrep), because it may be running for a different project/directory.
Andocs automatically finds an available port â if port 3030 is taken, it tries 3031, 3032, etc. (up to 10 attempts). So just start it; it will never fail due to a port conflict.
bunx andocs@latest --path ./docs &
This starts a local server at http://localhost:3030 (default). The browser opens automatically.
Full help: bunx andocs@latest -h
Custom port/path:
bunx andocs@latest --port 8080 --path ./my-docs &
Code Blocks
Fenced with language identifier. 100+ languages supported (TypeScript, Python, SQL, YAML, Bash, etc.).
```typescript
const config = yield * ConfigService;
```
Mermaid Diagrams
Use mermaid language identifier. Renders with zoom, pan, fullscreen.
Supported types: flowchart, sequenceDiagram, erDiagram, pie, gitGraph, gantt, classDiagram, stateDiagram-v2
```mermaid
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Action]
B -->|No| D[Other]
```
```mermaid
sequenceDiagram
participant User
participant API
participant DB
User->>API: GET /resource
API->>DB: SELECT query
DB-->>API: Result
API-->>User: JSON response
```
```mermaid
erDiagram
ORGANIZATION ||--o{ PROJECT : has
PROJECT ||--o{ DOCUMENT : stores
```
```mermaid
pie title Distribution
"Category A" : 65
"Category B" : 25
"Category C" : 10
```
Math / LaTeX
Block equations via KaTeX with $$ delimiters. Inline $...$ is NOT enabled.
$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$
Common patterns: \frac{}{}, \sum_{i=1}^{n}, \int_{a}^{b}, \sqrt{}, \begin{bmatrix}...\end{bmatrix}
HTML Preview Blocks
Use html-preview language identifier for interactive HTML in sandboxed iframes.
```html-preview
<div style="padding: 20px; font-family: sans-serif;">
<h2>Interactive Demo</h2>
<button onclick="alert('Hello!')">Click me</button>
</div>
```
Capabilities: full HTML/CSS/JS, external CDNs, auto-height (200â800px), toolbar (copy/open/fullscreen).
For auto-resize, add to your script:
function postHeight() {
window.parent.postMessage(
{
type: "html-preview-height",
height: document.documentElement.scrollHeight,
},
"*",
);
}
postHeight();
new MutationObserver(postHeight).observe(document.body, {
childList: true,
subtree: true,
attributes: true,
});
Andocs Prototypes (prototype)
Use prototype.json as the directory marker for external HTML prototypes. Prototypes are full HTML pages rendered in sandboxed iframes with auto-injected Alpine.js, Tailwind CSS v4, and design tokens.
prototype.json convention
Create prototype.json at the prototype root. The JSON Schema is published at the production URL and also stored locally:
- Published URL:
https://andocs.blogic.cz/schemas/prototype-schema.json - Local source:
packages/common/src/schemas/prototype-schema.json
Use $schema for editor validation:
{
"$schema": "https://andocs.blogic.cz/schemas/prototype-schema.json",
"version": 1
}
Directory structure convention
prototypes/
prototype.json # Root marker (required)
shared.css # Optional shared styles (auto-discovered)
shared.js # Optional shared scripts (auto-discovered)
pages/
counter.html
dashboard.html
detail.html
Markdown syntax
Reference a prototype page by repository-relative path. Optional title= and height= parameters:
```prototype path=prototypes/pages/dashboard.html
```
With title and height:
```prototype path=prototypes/pages/dashboard.html title="Client Dashboard" height=800
```
Parameters:
| Parameter | Description | Default |
|---|---|---|
path= |
Repository-relative path to HTML file (required) | â |
title= |
Display title in toolbar. Falls back to <title> tag from HTML, then raw path |
extracted from HTML |
height= |
Initial iframe height in pixels (200â800) | 600 |
Title resolution chain: title= from markdown â <title> tag extracted from HTML â raw file path fallback.
Runtime behavior
- Andocs auto-injects Alpine.js (v3 CDN) and Tailwind CSS v4 (
@tailwindcss/browserfrom jsdelivr) into the iframe - Andocs injects light-theme design tokens as CSS custom properties
shared.cssis auto-discovered from the nearest parentprototype.jsonroot and injected automaticallyshared.jsis auto-discovered from the nearest parentprototype.jsonroot and injected as<script data-andocs-shared-js>in<head>â ideal for Web Component class definitions shared across pages- Shared JS executes before the HTML body renders (injected in
<head>, before Tailwind/Alpine CDN scripts) - Iframe runs in sandbox mode (
allow-scriptsonly) - “Open in new tab” uses a resolvable server URL (
/api/prototype-preview) instead of fragile blob URLs (web-app only; CLI falls back to blob)
IMPORTANT â Tailwind v4 CDN: The injected CDN is https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4 (NOT cdn.tailwindcss.com which only supports v3). All Tailwind v4 utility classes work out of the box.
Live reference endpoint
For current design tokens (CSS custom properties with exact values), CDN library URLs, shared.css utility classes, sandbox restrictions, iframe dimensions, and supported file types â fetch:
GET https://andocs.blogic.cz/llms-andocs-skill
Reference implementation repository
Use the public Andocs demo repository as the canonical reference implementation for prototype blocks and demo content structure:
- Repository:
https://github.com/blogic-cz/andocs-demo - Purpose: public reference implementation for real-world
prototypeusage (prototype.json,shared.css,shared.js, multi-page HTML examples)
When users ask for a working example, point them to this repository first.
Multi-page navigation pattern
Use Alpine.js x-data to manage page state. Use <template x-if> blocks for each page and navigate via methods:
<div
x-data="{
page: 'list',
selectedItem: null,
items: [ /* ... */ ],
openDetail(item) { this.selectedItem = item; this.page = 'detail'; },
goBack() { this.page = 'list'; this.selectedItem = null; }
}"
class="prototype-shell"
>
<!-- List page -->
<template x-if="page === 'list'">
<div>
<template x-for="item in items" :key="item.id">
<button
@click="openDetail(item)"
class="prototype-btn-ghost w-full text-left"
>
<span x-text="item.name"></span>
</button>
</template>
</div>
</template>
<!-- Detail page -->
<template x-if="page === 'detail'">
<div>
<button @click="goBack()" class="prototype-btn-ghost">â Back</button>
<h2 class="prototype-title" x-text="selectedItem?.name"></h2>
</div>
</template>
</div>
Minimal prototype page example
<div x-data="{ count: 0 }" class="prototype-shell">
<div class="px-8 pt-8 pb-7">
<h2 class="prototype-title">Counter</h2>
<p class="prototype-subtitle mt-1">A simple interactive demo</p>
<div class="mt-6">
<span class="prototype-label">Count</span>
<span class="prototype-value" x-text="count"></span>
</div>
<button
class="prototype-btn prototype-btn-primary mt-6"
x-on:click="count++"
>
Increment
</button>
</div>
</div>
References:
- Alpine.js: https://alpinejs.dev/start-here
- Tailwind CSS v4 browser CDN: https://www.jsdelivr.com/package/npm/@tailwindcss/browser
Web Components in prototypes
Prototypes can use native Custom Elements with Shadow DOM â no build step required. Define components in a plain <script> block (NOT type="module" â see gotchas).
<title>Web Components</title>
<script>
class StatusBadge extends HTMLElement {
static observedAttributes = ["status"];
#shadow;
constructor() {
super();
this.#shadow = this.attachShadow({ mode: "open" });
}
connectedCallback() {
this.#render();
}
attributeChangedCallback() {
this.#render();
}
#render() {
const status = this.getAttribute("status") ?? "unknown";
this.#shadow.innerHTML = ``;
}
}
customElements.define("status-badge", StatusBadge);
</script>
<status-badge status="active"></status-badge>
Key patterns for interactive components (smooth transitions):
For components with state changes (toggles, tabs, accordions), build the DOM once and toggle CSS classes instead of replacing innerHTML. Otherwise CSS transitions can’t animate because elements are destroyed and recreated:
<script>
class ToggleSwitch extends HTMLElement {
#shadow;
#track; // Hold DOM references
connectedCallback() {
this.#shadow.innerHTML = ``;
this.#track = this.#shadow.querySelector(".track");
// On state change: toggle class, don't replace innerHTML
this.#shadow.addEventListener("click", () => {
this.#track.classList.toggle("on");
});
}
}
</script>
Prototype gotchas
CRITICAL â these will silently break your prototype:
-
Use
<script>, NOT<script type="module">â The iframe sandbox (allow-scriptswithoutallow-same-origin) creates an opaque origin.type="module"may not execute under opaque origins. Plain<script>works fine since no imports are needed. -
Declare ALL private class fields â If you use
#fieldsyntax, every private field MUST be declared in the class body. A missing#shadow;declaration will throw a syntax error that kills the entire<script>block, breaking ALL components in the file (not just the one with the error). -
<title>tag for toolbar display â Add a<title>My App</title>at the top of your HTML file. Andocs extracts it for the toolbar display alongside the file path. -
Click listeners on Shadow DOM â Attach event listeners to the shadow root (
this.#shadow.addEventListener), not to child elements. Child element listeners are lost wheninnerHTMLis re-rendered. -
</script>inside template literals â If your JavaScript contains the string</script>(e.g., in a template literal), it terminates the script block early. Escape it as<\/script>or split:'</' + 'script>'.
Tables
Standard markdown with alignment:
| Left | Center | Right |
| :--- | :----: | ----: |
| text | text | text |
Task Lists
- [x] Completed
- [ ] Pending
Links
- External:
[GitHub](https://github.com)â opens new tab - Relative:
[Auth docs](./auth.md)â in-app navigation - Anchor:
[Section](#heading-id)â smooth scroll
Frontmatter
YAML metadata stripped from output:
---
title: My Document
description: Summary
---
Rules
- Start with
# Titleâ becomes sidebar entry - Use headings hierarchically (don’t skip h1 â h3)
- Keep code blocks short â show relevant snippet only
- Use Mermaid instead of image diagrams when possible
- Use
html-previewfor interactive content, not raw HTML - One topic per document â prefer focused docs over giant files
- Use relative
.mdlinks between docs for in-app navigation
Anti-Patterns
- Don’t use raw HTML instead of markdown (use
html-previewblocks for interactive content) - Don’t create diagrams as images when Mermaid can express them
- Don’t use deeply nested headings (h5, h6) â restructure into separate documents instead