Przejdź do treści
Biblioteka skilli
Programowanie · Konwersja i formaty

docs-diagram

/docs-diagram

Generuje diagram Mermaid, taki jak ER, architektury, wdrożenia lub bezpieczeństwa, na podstawie faktycznej bazy kodu i zapisuje go w docs/.

Repozytorium
cc-arsenal ↗
Licencja
MIT
Ostatnia zmiana repozytorium
25.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
9
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 25.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Generuje diagram Mermaid, taki jak ER, architektury, wdrożenia lub bezpieczeństwa, na podstawie faktycznej bazy kodu i zapisuje go w docs/.

Wyzwalacze z opisu

draw an ER diagram of these tablesshow me the architecturediagram the deployment setupvisualize the security data flowgenerate a system diagram

Argumenty

/docs-diagram <type> [context]
Oryginalny opis (EN)

Generate a Mermaid diagram (ER, architecture, deployment, or security) by reading the actual codebase and writing it to docs/. Use for requests like "draw an ER diagram of these tables", "show me the architecture", "diagram the deployment setup", "visualize the security data flow", or "generate a system diagram". Not for scaffolding a new docs directory structure (use docs-init), syncing existing prose docs with code changes (use docs-update), or recording a design decision's rationale (use docs-adr), this skill only produces diagrams generated from code.

Jak działa

  1. Supported Diagram Types
  2. Workflow
  3. Worked Examples
  4. Notes
Sekcje z nagłówków SKILL.md, w oryginale · 124 linii, 865 słów
Podgląd SKILL.md
---
name: docs-diagram
description: Generate a Mermaid diagram (ER, architecture, deployment, or security)
  by reading the actual codebase and writing it to docs/. Use for requests like
  "draw an ER diagram of these tables", "show me the architecture", "diagram the
  deployment setup", "visualize the security data flow", or "generate a system
  diagram". Not for scaffolding a new docs directory structure (use docs-init),
  syncing existing prose docs with code changes (use docs-update), or recording a
  design decision's rationale (use docs-adr), this skill only produces diagrams
  generated from code.
metadata:
  summary: "Architecture diagrams generation (Mermaid)"
  author: mgiovani
  version: 1.1.1
disable-model-invocation: true
argument-hint: <type> [context]
context: fork
agent: general-purpose
---

# Generate System Diagrams

Generate a Mermaid diagram (ER, architecture, deployment, or security) from the
real codebase and write it to `docs/`.

## Supported Diagram Types

| Type | Output File | Description |
|------|------------|-------------|
| `er` | `docs/data-model.md` | Entity-Relationship diagram from database models |
| `arch` | `docs/architecture.md` | System architecture and component relationships |
| `deployment` | `docs/deployment.md` | Deployment infrastructure and CI/CD |
| `security` | `docs/security.md` | Security architecture and data flow |

## Workflow

### 1. Parse the request

Extract the diagram type (`er`, `arch`, `deployment`, `security`) and any optional
scope context (e.g. "for the user and order tables"). If the type is missing or
invalid, don't guess: stop, and end your response with a direct question naming
the supported types, e.g. "Which diagram type do you want: architecture, er,
deployment, or security?". Listing the types without asking, or asking without
listing them, is not enough. Go no further until the user answers.

### 2. Analyze the codebase

- **Scoped request** (e.g. "er diagram for the user and order tables"): Read/Grep
  the named files directly.
- **Broad or ambiguous request** (e.g. "show me the architecture" on an unfamiliar
  codebase): when a Task tool is available, spawn one Explore subagent per aspect
  that matters for the diagram type (e.g. for `arch`: services, databases,
  external integrations, data flow). Without a Task tool, run the same per-aspect
  checks sequentially inline with Read/Grep/Glob instead: same checks, no
  parallelism, just slower.

See [references/detection-patterns.md](references/detection-patterns.md) for
detection commands per diagram type.

### 3. Verify before adding anything

Diagrams must represent real, existing components, never a plausible guess.

- Read the file that defines a component before adding it; don't add it from
  memory or inference.
- Confirm a relationship by finding the actual import/reference/FK in code, not
  by assuming two similarly-named things are connected.
- Get counts by running a command (e.g. `find . -name "*service*" | wc -l`), then
  use that number, never estimate "about 5 services".
- Drop anything that can't be verified this way. An empty directory or an unused
  stub file is not a component.

### 4. Generate the Mermaid diagram

Use the syntax for the diagram type from
[references/mermaid-patterns.md](references/mermaid-patterns.md). Keep it
readable: if a system has too many pieces for one clear diagram, split it into
multiple focused views rather than cramming everything into one.

### 5. Populate the template

Load `assets/templates/<type>.md` (`er` → `data-model.md`, `arch` →
`architecture.md`, `deployment` → `deployment.md`, `security` → `security.md`).
Replace `{{PROJECT_NAME}}` and `{{DATE}}`, plus the diagram placeholder and
the entity/component list placeholders, with the verified content from steps 3-4.

### 6. Write the output

Write to the file in `docs/` named in the table above. If it already exists, ask
before overwriting, and preserve any hand-written sections you can identify
(anything outside the placeholder fields).

### 7. Validate the diagram renders

Needs `mmdc`: install with `npm i -g @mermaid-js/mermaid-cli`, or run it ad hoc by defining `mmdc() { npx -y -p @mermaid-js/mermaid-cli mmdc "$@"; }` first. If Chromium refuses to launch in a sandbox, add `-p` with a puppeteer config of `{"args":["--no-sandbox"]}`.

Run this on the file you wrote; each `FAIL <name>-N.mmd` names the doc and the Nth mermaid block in it:

```bash
d=$(mktemp -d)
for md in docs/<file>.md; do
  awk -v out="$d/${md//\//__}" '/^```mermaid/{f=out "-" ++n ".mmd"; next} /^```/{f=""} f{print > f}' "$md"
done
for f in "$d"/*.mmd; do mmdc -q -i "$f" -o "${f%.mmd}.svg" || echo "FAIL $f"; done
```

Fix each failing block using its parser error, then re-run until nothing prints `FAIL`. Cap at 3 rounds, then report the blocks that still fail. An unreplaced `{{PLACEHOLDER}}` in a block also fails here. If `mmdc` can't be installed (no Node or no network), say so in the report and fall back to a careful syntax review against [references/mermaid-patterns.md](references/mermaid-patterns.md).

### 8. Report results

State the diagram type and the output file, then report the actual counts
detected (e.g. "4 entities, 6 relationships"). These must be the numbers from
step 3's commands, not a summary written from memory. Suggest regenerating
when the diagrammed subsystem changes.

## Worked Examples

**Scoped ER request** (`docs-diagram er for the user and order tables`): Grep for
`class User` / `class Order` in the ORM models directory, read both files, extract
columns and FKs, check the `Order.user_id` FK is actually declared
in the model, then write `docs/data-model.md` with an `erDiagram` block containing
only `USER` and `ORDER`.

**Broad architecture request** (`docs-diagram arch`): with a Task tool, spawn
Explore agents for services, databases, and external integrations; without one,
run `find . -name "*service*"`, `find . -name "*.config.*"`, and a grep for known
client SDKs sequentially. Merge only the components every check confirms into one
`graph TB` diagram.

**Missing/invalid type** (`docs-diagram`): do not guess a type or generate
anything; end the response with "Which diagram type do you want: architecture,
er, deployment, or security?" alongside their output files.

## Notes

- Regenerate after the diagrammed subsystem changes (schema migration, new
  service, new deploy target, new auth flow), this skill is meant to be re-run,
  not written once and left stale.
- Additional context on codebase detection commands and Mermaid syntax lives in
  [references/detection-patterns.md](references/detection-patterns.md) and
  [references/mermaid-patterns.md](references/mermaid-patterns.md), load them
  when doing the actual detection/generation work, not before.
Pliki w paczce (9)
  • SKILL.md 7 KB
  • assets/templates/architecture.md 1 KB
  • assets/templates/data-model.md 1 KB
  • assets/templates/deployment.md 1 KB
  • assets/templates/security.md 1 KB
  • evals/evals.json 3 KB
  • evals/trigger-eval.json 2 KB
  • references/detection-patterns.md 2 KB
  • references/mermaid-patterns.md 3 KB

Wersje

W bazie nie ma innych skilli o nazwie docs-diagram.

Migawka bazy z 28.10.2026 · wersja paczki e102648f1a79 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100c4-architecture
    Tworzy dokumentację architektury w modelu C4 z diagramami Mermaid: kontekst, kontenery, komponenty i wdrożenie.
  • 84diagram-excalidraw
    Generuje diagramy architektury w Excalidraw na podstawie analizy kodu, pokazując strukturę komponentów i przepływ danych.
  • 90doncheli-diagram
    Generuje diagramy Mermaid lub C4 z analizy kodu: architekturę, klasy, sekwencje i diagramy encji.
  • 100architecture-diagram
    Tworzy diagramy architektury, systemów, wdrożeń, przepływu danych, sieci i chmury, w tym diagramy AWS i Kubernetes.
  • 100mermaid-diagramming
    Tworzy diagramy Mermaid w niebiesko-szarym motywie projektu, na przykład przepływy, sekwencje i diagramy architektury w plikach markdown.
  • 100diagrams
    Pomaga tworzyć diagramy techniczne jako kod w Mermaid: architektura, sekwencje i przepływy, dobór typu diagramu i utrzymanie dokładności wraz ze zmianą systemu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.