Community이미지github.com

bbg-diagram

Architect and render production-grade system design, protocol sequence, storage/memory internals, Cloud VPC and hybrid networking, Deployment rollouts, DevSecOps Infinity and Terraform IaC, Git Flow branching, Kubernetes internals, decision trees, GenAI/ML, UML/OOD class and state machine, and cheat-sheet diagrams in authentic ByteByteGo visual styles (grounded in 400 guides across 15 categories and 6 ByteByteGo course tracks). Also recommends which architecture pattern, diagram archetype, icon set, color role, and layout to use from English or Vietnamese requirements. Strictly avoids Mermaid, Archify, box-stuffing, and meaningless layer codes.

bbg-diagram란 무엇인가요?

bbg-diagram is a Claude Code agent skill that architect and render production-grade system design, protocol sequence, storage/memory internals, Cloud VPC and hybrid networking, Deployment rollouts, DevSecOps Infinity and Terraform IaC, Git Flow branching, Kubernetes internals, decision trees, GenAI/ML, UML/OOD class and state machine, and cheat-sheet diagrams in authentic ByteByteGo visual styles (grounded in 400 guides across 15 categories and 6 ByteByteGo course tracks). Also recommends which architecture pattern, diagram archetype, icon set, color role, and layout to use from English or Vietnamese requirements. Strictly avoids Mermaid, Archify, box-stuffing, and meaningless layer codes.

지원 대상✓Claude Code~Codex CLI~Cursor✓Antigravity✓Gemini CLI
npx skills add https://github.com/phamtandang/bbg-diagram/tree/HEAD

Installed? Explore more 이미지 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

ByteByteGo Architect & Diagram Skill (bbg-diagram)

Draws high-signal engineering diagrams grounded in an empirical crawl of all 415 unique pages on bytebytego.com/guides/ (15 categories, 400 child guide pages, 400 measured diagrams) and 6 course tracks (System Design, GenAI, ML, OOD/UML, Mobile, Coding Patterns), reinforced by a visual audit of 254 category diagrams across Cloud, DevOps/CI/CD, Git Flow, Security, AI/ML, Databases, Software Architecture, and Case Studies.

Hard Rules

  • Render deterministic SVGs with bbg_svg_kit.py and rasterize 2x Retina PNGs with render_bbg.py. Never use mermaid or archify.
  • Follow the ByteByteGo 60/40 Icon-First Rule: draw standalone infrastructure/actors with add_actor_node(...) (~40%–60% unboxed glyphs) and reserve add_node(...) boxes for compute clusters (replicas > 1), nested in-process boundaries (inner_box), or multi-icon service trays.
  • Show concrete technical mechanics on every canvas: wire payloads, memory/struct strips, SQL/ACL tables, scoring formulas, packet drops, CIDR/HPA bounds, or state guards. Never draw generic rectangles stuffed with framework names.
  • Never label components Layer 1, Layer 2, D1, R1, Y1, V1, or [NO-LLM]. Use real service names, true process/VPC boundaries, pure integer step circles (1..N), and a compact Legend when multiple arrow styles appear.

Step 0: Auto-Select Architecture Pattern, Archetype, Icons & Colors

When the user asks what architecture or diagram fits a requirement (in English or Vietnamese), or before drawing an unfamiliar system, run bbg_advisor.py:

python3 ./scripts/bbg_advisor.py recommend "<requirement or prompt>"
python3 ./scripts/bbg_advisor.py resolve-components "Browser, Kong, FastAPI, Redis, PostgreSQL, Kafka"
python3 ./scripts/bbg_advisor.py search-guides "<keyword>" --limit 5
python3 ./scripts/bbg_advisor.py stats
python3 ./scripts/bbg_advisor.py scaffold --archetype D01 --theme course --out diagram.py

Read architect_decision_playbook.md for the decision matrix across 60 Architecture Patterns (P01–P60 across 12 Domains) and icon_and_color_catalog.md for all 94 vector icons and 13 semantic color roles.


Step 1: Pick Surface Theme (T1–T5) and Diagram Type (D01–D18)

Consult archetypes_and_themes.md for exact hex palettes and category_style_matrix.md for empirical counts across the 400 guides and 6 course tracks.

Diagram TypeShare (n=400)Default ThemeConcrete Mechanics & Working Example
D01 (A1) Numbered Topology23.8% (95)T2 / T5Icon-first actors, replicas=3 clusters, 1..N steps, Legend -> ex01_a1_production_web_topology.py
D02 (A1+Inset) Topology + Zoom2.0% (8)T1 / T5Macro path + add_zoom_inset SQL/RRF/DNS details -> demo_light_blueprint_and_inset.py
D03 (A2) Sequence Lifeline2.2% (9)T1add_lifeline_actor, activation bars, self-calls, alt frames, lost=True -> demo_sequence_oauth_and_selfcall.py
D04 (A3) Memory & OS Anatomy6.2% (25)T1add_struct_strip (vertical/horizontal), Application vs Kernel Context, lock table -> ex04_a3_kernel_zerocopy_and_memory.py
D05 (A4) Split Comparison (VS)9.5% (38)T4 / T1Symmetric columns + add_vs_badge + tradeoff matrix -> ex05_a4_split_comparison_btree_vs_lsm.py
D06 (A5-Radial) Radial Donut Hub4.5% (18)T2 / T3Central add_radial_wheel + colored dashed spokes to cards -> demo_dark_topology_and_radial.py
D07 (A5-Grid) Multi-Card Grid29.0% (116)T3 / T22x3 / 3x3 neo_header=True cards, micro-diagram + checkmark takeaway -> ex07_a5_grid_database_scaling_cheatsheet.py
D08 (A6) Swimlane & Chevrons2.5% (10)T4add_chevron_rail + colored add_swimlane rails + Action Legend -> ex08_a6_swimlane_gitops_and_data_pipeline.py
D09 (A7) Ecosystem Stack2.8% (11)T2Left icon stems -> stepped trays + add_bracket (never for runtime flow) -> ex09_a7_ecosystem_modern_ai_data_stack.py
D10 (A8) Two-Phase / Evolution3.2% (13)T1 / T2add_split_divider separating Sync Auth vs Async Clearing or Before vs After -> ex10_a8_twophase_visa_payment_settlement.py
D11 (A9) UML Class & State FSM0.5% (2 + OOD)T5add_uml_class ((I)/(C)), add_uml_relation, add_state_node -> demo_ood_uml_and_state_machine.py
D12 (A10) Cloud / K8s Multi-AZ0.2% (1 + Infra)T5 / T2add_boundary_frame (Region -> VPC -> AZ), HPA pods, WAL sync -> demo_icon_first_cloud_architecture.py
D13 (A11) GenAI / ML / Agent Loop0.8% (3 + GenAI)T5 / T2ReAct loop, hybrid memory, guardrails, offline chunk/embed -> ex13_a11_genai_agentic_rag_pipeline.py
D14 (A12) Git Flow & Merge/Rebase2.0% (8)T1 / T2add_git_branch_lane, add_git_commit, Merge vs Rebase, 4-Zone transport -> ex14_a12_gitflow_and_merge_vs_rebase.py
D15 (A13) Cloud Network & DR4.5% (18)T2 / T5add_cloud_service_tile (IGW/NAT/TGW/DX/VPN), add_rpo_rto_timeline -> ex15_a13_aws_hybrid_cloud_vpc_and_dr.py
D16 (A14) Deployment Rollouts0.8% (3)T4 / T1add_traffic_weight_pill, add_toggle_switch, Blue/Green, Canary, Shadow -> ex16_a14_deployment_strategies_matrix.py
D17 (A15) DevSecOps & IaC Rail2.8% (11)T1add_devops_infinity_loop, add_stage_rail_card (Terraform HCL/Plan/Apply) -> ex17_a15_devsecops_infinity_and_terraform_iac.py
D18 (A16) K8s Internals & Trees2.8% (11)T5Control Plane/Worker pods + Service tiles + add_decision_diamond tree -> ex18_a16_k8s_internals_and_architect_decision_tree.py

Step 2: Budget & Multi-Agent Decomposition

Review anti_patterns_and_qa_checklist.md before writing coordinates:

  1. Keep <= 14 primary macro nodes per canvas and 35%–45% open whitespace (44px outer margins, >= 24px gutter between panels).
  2. Keep node titles to 1–4 words and takeaway lines <= 16 words.
  3. For enterprise platforms spanning multiple concerns (such as Payment + OAuth + Ledger, or Cloud K8s + RAG + CDC), split into 2–3 focused diagrams. Use parallel delegation when available:
    • Antigravity: launch parallel subagents (invoke_subagent), one per diagram in the suite.
    • Claude Code: delegate each diagram concurrently to the bbg-architect subagent (Agent tool).
    • GitHub Copilot: generate each diagram sequentially via @bbg-diagram custom agent or /bbg-diagram prompt.

Step 3: Build SVG Using BBGCanvas (scripts/bbg_svg_kit.py)

Resolve the scripts directory dynamically without hardcoding user-specific paths:

import os
from pathlib import Path
import sys

_CANDIDATES = []
if os.environ.get("CLAUDE_PLUGIN_ROOT"):
    _CANDIDATES.append(Path(os.environ["CLAUDE_PLUGIN_ROOT"]) / "scripts")
_CANDIDATES.extend([
    Path.cwd() / ".agents" / "skills" / "bbg-diagram" / "scripts",
    Path.cwd() / ".claude" / "skills" / "bbg-diagram" / "scripts",
    Path.cwd() / ".github" / "skills" / "bbg-diagram" / "scripts",
    Path.home() / ".gemini" / "config" / "skills" / "bbg-diagram" / "scripts",
    Path.home() / ".claude" / "skills" / "bbg-diagram" / "scripts",
    Path.home() / ".copilot" / "skills" / "bbg-diagram" / "scripts",
])
_SKILL_SCRIPTS = next(p for p in _CANDIDATES if (p / "bbg_svg_kit.py").exists())
sys.path.insert(0, str(_SKILL_SCRIPTS))
from bbg_svg_kit import BBGCanvas

c = BBGCanvas(1600, 1080, theme="course")  # "light" | "dark" | "cheatsheet" | "swimlane" | "course"
y0 = c.add_header("Title with Highlighted Concept", subtitle="Concise mechanism summary", highlight="Highlighted Concept", right_badge="Archetype A1")

client = c.add_actor_node(140, y0 + 220, "browser", "Web Client", "HTTPS / TLS 1.3")
gw = c.add_actor_node(400, y0 + 220, "api_gateway", "API Gateway", "OIDC + Rate Limit")
svc = c.add_node(610, y0 + 165, 250, 110, "Order Service", "FastAPI (:8000)", role="yellow", icon_kind="microservice_hex", replicas=3, badge="x3")

c.add_arrow(client.right, gw.left, step=1, label="POST /v1/orders")
c.add_arrow(gw.right, svc.left, step=2, label="Verified JWT")
c.save("diagram.svg")

Inspect working compositions across all 18 Diagram Types (D01–D18) in examples/:


Step 4: Strict Lint & Rasterize 2x Retina PNG

Run render_bbg.py with --strict:

python3 ./scripts/render_bbg.py diagram.svg diagram.png --strict

This checks valid XML, explicit viewBox, zero forbidden anti-pattern labels, wall-of-boxes density (<= 18 boxed nodes), text clipping, text overlaps (with NFC-normalized English and Vietnamese width math), and 2x Retina dimensions via headless Chrome + sips. Fix every reported error or warning before proceeding.


Step 5: Mandatory Visual Inspection

Verify the rendered 2x Retina .png directly before presenting results:

  • Antigravity: call read_file on the rendered .png.
  • Claude Code: call Read on the rendered .png.
  • GitHub Copilot: enforce render_bbg.py --strict (0 errors, 0 warnings) in headless/CLI runs and preview the .png directly inside VS Code.

Check all 12 items in the Post-Render Visual QA Checklist. If any label touches a border, a pill crowds a title, or an arrow crosses text, adjust coordinates and re-run Step 4.

For installing or adapting this skill across Antigravity, Claude Code, and GitHub Copilot, see cross_agent_adapters.md and install_skill.py.

관련 스킬