natureco-cli 5.18.2 → 5.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/airunway-aks-setup/SKILL.md +73 -0
- package/skills/algorithmic-art/SKILL.md +405 -0
- package/skills/appinsights-instrumentation/SKILL.md +76 -0
- package/skills/azure-ai/SKILL.md +71 -0
- package/skills/azure-aigateway/SKILL.md +129 -0
- package/skills/azure-cloud-migrate/SKILL.md +52 -0
- package/skills/azure-compliance/SKILL.md +108 -0
- package/skills/azure-compute/SKILL.md +46 -0
- package/skills/azure-cost/SKILL.md +45 -0
- package/skills/azure-deploy/SKILL.md +97 -0
- package/skills/azure-diagnostics/SKILL.md +151 -0
- package/skills/azure-enterprise-infra-planner/SKILL.md +54 -0
- package/skills/azure-hosted-copilot-sdk/SKILL.md +89 -0
- package/skills/azure-kubernetes/SKILL.md +153 -0
- package/skills/azure-kusto/SKILL.md +231 -0
- package/skills/azure-messaging/SKILL.md +57 -0
- package/skills/azure-prepare/SKILL.md +165 -0
- package/skills/azure-quotas/SKILL.md +276 -0
- package/skills/azure-rbac/SKILL.md +17 -0
- package/skills/azure-reliability/SKILL.md +387 -0
- package/skills/azure-resource-lookup/SKILL.md +108 -0
- package/skills/azure-resource-visualizer/SKILL.md +183 -0
- package/skills/azure-storage/SKILL.md +100 -0
- package/skills/azure-upgrade/SKILL.md +91 -0
- package/skills/azure-validate/SKILL.md +72 -0
- package/skills/brainstorming/SKILL.md +159 -0
- package/skills/brand-guidelines/SKILL.md +73 -0
- package/skills/brandkit/SKILL.md +798 -0
- package/skills/brutalist-skill/SKILL.md +92 -0
- package/skills/canvas-design/SKILL.md +130 -0
- package/skills/cavecrew/SKILL.md +82 -0
- package/skills/caveman-commit/SKILL.md +65 -0
- package/skills/caveman-help/SKILL.md +63 -0
- package/skills/caveman-review/SKILL.md +55 -0
- package/skills/caveman-stats/SKILL.md +10 -0
- package/skills/claude-api/SKILL.md +356 -0
- package/skills/composition-patterns/SKILL.md +89 -0
- package/skills/decision-mapping/SKILL.md +84 -0
- package/skills/deploy-to-vercel/SKILL.md +296 -0
- package/skills/design-an-interface/SKILL.md +94 -0
- package/skills/design-doc-mermaid/SKILL.md +498 -0
- package/skills/develop-userscripts/SKILL.md +84 -0
- package/skills/doc-coauthoring/SKILL.md +375 -0
- package/skills/documentation/SKILL.md +109 -0
- package/skills/docx/SKILL.md +590 -0
- package/skills/edit-article/SKILL.md +15 -0
- package/skills/entra-agent-id/SKILL.md +356 -0
- package/skills/entra-app-registration/SKILL.md +191 -0
- package/skills/faceless-explainer/SKILL.md +202 -0
- package/skills/fastify/SKILL.md +75 -0
- package/skills/general-video/SKILL.md +143 -0
- package/skills/git-guardrails-claude-code/SKILL.md +95 -0
- package/skills/github-actions-docs/SKILL.md +98 -0
- package/skills/gpt-tasteskill/SKILL.md +74 -0
- package/skills/grill-me/SKILL.md +7 -0
- package/skills/grilling/SKILL.md +10 -0
- package/skills/handoff/SKILL.md +16 -0
- package/skills/hyperframes/SKILL.md +152 -0
- package/skills/hyperframes-animation/SKILL.md +82 -0
- package/skills/hyperframes-cli/SKILL.md +109 -0
- package/skills/hyperframes-core/SKILL.md +78 -0
- package/skills/hyperframes-creative/SKILL.md +68 -0
- package/skills/hyperframes-media/SKILL.md +97 -0
- package/skills/image-to-code-skill/SKILL.md +1228 -0
- package/skills/imagegen-frontend-mobile/SKILL.md +1465 -0
- package/skills/imagegen-frontend-web/SKILL.md +987 -0
- package/skills/implement/SKILL.md +15 -0
- package/skills/init/SKILL.md +91 -0
- package/skills/internal-comms/SKILL.md +32 -0
- package/skills/lark-approval/SKILL.md +56 -0
- package/skills/lark-base/SKILL.md +157 -0
- package/skills/lark-doc/SKILL.md +81 -0
- package/skills/lark-shared/SKILL.md +168 -0
- package/skills/lark-workflow-meeting-summary/SKILL.md +122 -0
- package/skills/linting-neostandard-eslint9/SKILL.md +64 -0
- package/skills/loop-me/SKILL.md +32 -0
- package/skills/microsoft-foundry/SKILL.md +262 -0
- package/skills/migrate-to-shoehorn/SKILL.md +118 -0
- package/skills/minimalist-skill/SKILL.md +85 -0
- package/skills/motion-graphics/SKILL.md +170 -0
- package/skills/music-to-video/SKILL.md +197 -0
- package/skills/node/SKILL.md +94 -0
- package/skills/nodejs-core/SKILL.md +156 -0
- package/skills/oauth/SKILL.md +186 -0
- package/skills/obsidian-vault/SKILL.md +59 -0
- package/skills/octocat/SKILL.md +93 -0
- package/skills/openclaw-secure-linux-cloud/SKILL.md +157 -0
- package/skills/opensource-guide-coach/SKILL.md +218 -0
- package/skills/output-skill/SKILL.md +49 -0
- package/skills/pdf/SKILL.md +314 -0
- package/skills/pptx/SKILL.md +232 -0
- package/skills/pr-to-video/SKILL.md +235 -0
- package/skills/product-launch-video/SKILL.md +205 -0
- package/skills/python-appservice-deploy/SKILL.md +36 -0
- package/skills/qa/SKILL.md +130 -0
- package/skills/react-best-practices/SKILL.md +149 -0
- package/skills/react-native-skills/SKILL.md +121 -0
- package/skills/react-view-transitions/SKILL.md +320 -0
- package/skills/readme-i18n/SKILL.md +176 -0
- package/skills/redesign-skill/SKILL.md +178 -0
- package/skills/remotion/SKILL.md +364 -0
- package/skills/request-refactor-plan/SKILL.md +68 -0
- package/skills/resolving-merge-conflicts/SKILL.md +14 -0
- package/skills/running-claude-code-via-litellm-copilot/SKILL.md +263 -0
- package/skills/scaffold-exercises/SKILL.md +106 -0
- package/skills/secure-linux-web-hosting/SKILL.md +162 -0
- package/skills/setup-pre-commit/SKILL.md +91 -0
- package/skills/shadcn/SKILL.md +267 -0
- package/skills/simple/SKILL.md +52 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-optimizer/SKILL.md +47 -0
- package/skills/skills-cli/SKILL.md +281 -0
- package/skills/slack-gif-creator/SKILL.md +254 -0
- package/skills/snipgrapher/SKILL.md +58 -0
- package/skills/soft-skill/SKILL.md +98 -0
- package/skills/stitch-skill/SKILL.md +184 -0
- package/skills/supabase/SKILL.md +135 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/talking-head-recut/SKILL.md +1191 -0
- package/skills/taste-skill/SKILL.md +1206 -0
- package/skills/taste-skill-v1/SKILL.md +226 -0
- package/skills/tdd/SKILL.md +108 -0
- package/skills/teach/SKILL.md +140 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/theme-factory/SKILL.md +59 -0
- package/skills/to-prd/SKILL.md +75 -0
- package/skills/typescript-magician/SKILL.md +117 -0
- package/skills/tzst/SKILL.md +68 -0
- package/skills/ubiquitous-language/SKILL.md +93 -0
- package/skills/use-my-browser/SKILL.md +110 -0
- package/skills/using-superpowers/SKILL.md +121 -0
- package/skills/vercel-cli-with-tokens/SKILL.md +353 -0
- package/skills/vercel-optimize/SKILL.md +322 -0
- package/skills/viral-instagram-reels/SKILL.md +180 -0
- package/skills/viral-short-form/SKILL.md +147 -0
- package/skills/viral-short-form-ideas/SKILL.md +184 -0
- package/skills/viral-tiktok-content/SKILL.md +180 -0
- package/skills/web-artifacts-builder/SKILL.md +74 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/skills/webapp-testing/SKILL.md +96 -0
- package/skills/website-to-video/SKILL.md +145 -0
- package/skills/writing-beats/SKILL.md +67 -0
- package/skills/writing-fragments/SKILL.md +79 -0
- package/skills/writing-great-skills/SKILL.md +82 -0
- package/skills/writing-guidelines/SKILL.md +39 -0
- package/skills/writing-plans/SKILL.md +174 -0
- package/skills/writing-shape/SKILL.md +79 -0
- package/skills/xdrop/SKILL.md +78 -0
- package/skills/xget/SKILL.md +87 -0
- package/skills/xlsx/SKILL.md +292 -0
- package/src/tools/browser_use.js +2 -1
- package/src/tools/skills_download.js +217 -0
- package/src/utils/tools.js +2 -2
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-doc-mermaid
|
|
3
|
+
description: Create Mermaid diagrams (activity, deployment, sequence, architecture) from text descriptions or source code. Use when asked to "create a diagram", "generate mermaid", "document architecture", "code to diagram", "create design doc", or "convert code to diagram". Supports hierarchical on-demand guide loading, Unicode semantic symbols, and Python utilities for diagram extraction and image conversion.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Mermaid Architect - Hierarchical Diagram and Documentation Skill
|
|
7
|
+
|
|
8
|
+
Mermaid diagram and documentation system with specialized guides and code-to-diagram capabilities.
|
|
9
|
+
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
- [Decision Tree](#decision-tree)
|
|
13
|
+
- [Available Guides and Resources](#available-guides-and-resources)
|
|
14
|
+
- [Usage Patterns](#usage-patterns)
|
|
15
|
+
- [Resilient Workflow](#resilient-workflow)
|
|
16
|
+
- [Unicode Semantic Symbols](#unicode-semantic-symbols)
|
|
17
|
+
- [Python Utilities](#python-utilities)
|
|
18
|
+
- [Decision Tree Examples](#decision-tree-examples)
|
|
19
|
+
- [High-Contrast Styling](#high-contrast-styling)
|
|
20
|
+
- [File Organization](#file-organization)
|
|
21
|
+
- [Workflow Summary](#workflow-summary)
|
|
22
|
+
- [When to Use What](#when-to-use-what)
|
|
23
|
+
- [Best Practices](#best-practices)
|
|
24
|
+
- [Learning Path](#learning-path)
|
|
25
|
+
|
|
26
|
+
## Decision Tree
|
|
27
|
+
|
|
28
|
+
**How this skill works:**
|
|
29
|
+
|
|
30
|
+
1. **User makes a request** → Skill analyzes intent
|
|
31
|
+
2. **Skill determines diagram/document type** → Loads appropriate guide(s)
|
|
32
|
+
3. **AI reads specialized guide** → Generates diagram/document using templates
|
|
33
|
+
4. **Result delivered** → With validation and export options
|
|
34
|
+
|
|
35
|
+
**User Intent Analysis:**
|
|
36
|
+
|
|
37
|
+
```mermaid
|
|
38
|
+
flowchart TD
|
|
39
|
+
Start([User Request]) --> Analyze{Analyze Intent}
|
|
40
|
+
|
|
41
|
+
Analyze -->|"workflow, process, business logic"| Activity[Load Activity Diagram Guide<br/>references/guides/diagrams/activity-diagrams.md]
|
|
42
|
+
Analyze -->|"infrastructure, deployment, cloud"| Deploy[Load Deployment Diagram Guide<br/>references/guides/diagrams/deployment-diagrams.md]
|
|
43
|
+
Analyze -->|"system architecture, components"| Arch[Load Architecture Guide<br/>references/guides/diagrams/architecture-diagrams.md]
|
|
44
|
+
Analyze -->|"API flow, interactions"| Sequence[Load Sequence Diagram Guide<br/>references/guides/diagrams/sequence-diagrams.md]
|
|
45
|
+
Analyze -->|"code to diagram"| CodeToDiag[Load Code-to-Diagram Guide<br/>references/guides/code-to-diagram/ + examples/]
|
|
46
|
+
Analyze -->|"design document, full docs"| DesignDoc[Load Design Document Template<br/>assets/*-design-template.md]
|
|
47
|
+
Analyze -->|"unicode symbols, icons"| Unicode[Load Unicode Symbols Guide<br/>references/guides/unicode-symbols/guide.md]
|
|
48
|
+
Analyze -->|"extract, validate, convert"| Scripts[Use Python Scripts<br/>scripts/extract_mermaid.py<br/>scripts/mermaid_to_image.py]
|
|
49
|
+
|
|
50
|
+
Activity --> Generate[Generate Diagram]
|
|
51
|
+
Deploy --> Generate
|
|
52
|
+
Arch --> Generate
|
|
53
|
+
Sequence --> Generate
|
|
54
|
+
CodeToDiag --> Generate
|
|
55
|
+
DesignDoc --> Generate
|
|
56
|
+
Unicode --> Generate
|
|
57
|
+
Scripts --> Execute[Execute Script]
|
|
58
|
+
|
|
59
|
+
Generate --> Validate{Validate?}
|
|
60
|
+
Validate -->|Yes| RunValidation[Run mmdc validation]
|
|
61
|
+
Validate -->|No| Output
|
|
62
|
+
RunValidation --> Output[Output Result]
|
|
63
|
+
Execute --> Output
|
|
64
|
+
|
|
65
|
+
classDef decision fill:#FFD700,stroke:#333,stroke-width:2px,color:black
|
|
66
|
+
classDef guide fill:#90EE90,stroke:#333,stroke-width:2px,color:darkgreen
|
|
67
|
+
classDef action fill:#87CEEB,stroke:#333,stroke-width:2px,color:darkblue
|
|
68
|
+
|
|
69
|
+
class Analyze,Validate decision
|
|
70
|
+
class Activity,Deploy,Arch,Sequence,CodeToDiag,DesignDoc,Unicode,Scripts guide
|
|
71
|
+
class Generate,Execute,RunValidation,Output action
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Available Guides and Resources
|
|
75
|
+
|
|
76
|
+
### Diagram Type Guides (`references/guides/diagrams/`)
|
|
77
|
+
|
|
78
|
+
| Guide | Full Path | Load When User Wants | Examples |
|
|
79
|
+
|-------|-----------|---------------------|----------|
|
|
80
|
+
| Activity Diagrams | `references/guides/diagrams/activity-diagrams.md` | Workflows, processes, business logic, user flows, decision trees | "Show checkout flow", "Document ETL pipeline", "Create approval workflow" |
|
|
81
|
+
| Deployment Diagrams | `references/guides/diagrams/deployment-diagrams.md` | Infrastructure, cloud architecture, K8s, serverless, network topology | "Show AWS architecture", "Document GCP deployment", "Create K8s diagram" |
|
|
82
|
+
| Architecture Diagrams | `references/guides/diagrams/architecture-diagrams.md` | System architecture, component design, high-level structure | "Show system components", "Document microservices", "Architecture overview" |
|
|
83
|
+
| Sequence Diagrams | `references/guides/diagrams/sequence-diagrams.md` | API interactions, service communication, request/response flows | "Show API call sequence", "Document auth flow", "Service interactions" |
|
|
84
|
+
|
|
85
|
+
### Code-to-Diagram Guide & Examples
|
|
86
|
+
|
|
87
|
+
| Resource | Full Path | What It Provides |
|
|
88
|
+
|----------|-----------|------------------|
|
|
89
|
+
| **Master Guide** | `references/guides/code-to-diagram/README.md` | Complete workflow for analyzing any codebase and extracting diagrams |
|
|
90
|
+
| **Spring Boot** | `examples/spring-boot/README.md` | Controller→Service→Repository architecture, deployment config, sequence from methods, activity from business logic |
|
|
91
|
+
| **FastAPI** | `examples/fastapi/README.md` | Python async patterns, Pydantic models, dependency injection, cloud deployment |
|
|
92
|
+
| **React** | `examples/react/README.md` | Component hierarchy, state management, data flow, build pipeline |
|
|
93
|
+
| **Python ETL** | `examples/python-etl/README.md` | Data pipeline, transformation steps, error handling, scheduling |
|
|
94
|
+
| **Node/Express** | `examples/node-webapp/README.md` | Middleware chain, route handlers, async patterns, deployment |
|
|
95
|
+
| **Java Web App** | `examples/java-webapp/README.md` | Traditional MVC, servlet containers, WAR deployment |
|
|
96
|
+
|
|
97
|
+
### Design Document Templates
|
|
98
|
+
|
|
99
|
+
| Template | Full Path | Use For | Load When |
|
|
100
|
+
|----------|-----------|---------|-----------|
|
|
101
|
+
| Architecture Design | `assets/architecture-design-template.md` | System-wide architecture | "Create architecture doc", "Document system design" |
|
|
102
|
+
| API Design | `assets/api-design-template.md` | API specifications | "API design doc", "Document REST API" |
|
|
103
|
+
| Feature Design | `assets/feature-design-template.md` | Feature planning | "Feature design", "Plan new feature" |
|
|
104
|
+
| Database Design | `assets/database-design-template.md` | Database schema | "Database design", "Document schema" |
|
|
105
|
+
| System Design | `assets/system-design-template.md` | Complete system | "System design doc", "Full system documentation" |
|
|
106
|
+
|
|
107
|
+
### Unicode Symbols Guide
|
|
108
|
+
|
|
109
|
+
**Full Path:** `references/guides/unicode-symbols/guide.md`
|
|
110
|
+
|
|
111
|
+
**Load when user mentions:** "unicode symbols", "emoji in diagrams", "semantic icons", "add symbols"
|
|
112
|
+
|
|
113
|
+
**Quick Reference:**
|
|
114
|
+
- 📦 Infrastructure: ☁️ 🌐 🔌 📡 🗄️
|
|
115
|
+
- ⚙️ Compute: ⚙️ ⚡ 🔄 ♻️ 🚀 💨
|
|
116
|
+
- 💾 Data: 💾 📦 📊 📈 🗃️ 🧊
|
|
117
|
+
- 📨 Messaging: 📨 📬 📤 📥 🐰 📢
|
|
118
|
+
- 🔐 Security: 🔐 🔑 🛡️ 🚪 👤 🎫
|
|
119
|
+
- 📝 Monitoring: 📝 📊 🚨 ⚠️ ��� ❌
|
|
120
|
+
|
|
121
|
+
### Python Scripts (`scripts/`)
|
|
122
|
+
|
|
123
|
+
| Script | Use For | Load When |
|
|
124
|
+
|--------|---------|-----------|
|
|
125
|
+
| `extract_mermaid.py` | Extract diagrams from Markdown, validate syntax, replace with images | "extract diagrams", "validate mermaid", "find all diagrams" |
|
|
126
|
+
| `mermaid_to_image.py` | Convert .mmd to PNG/SVG, batch conversion, custom themes | "convert to image", "render diagram", "create PNG" |
|
|
127
|
+
| `resilient_diagram.py` | Full workflow: save .mmd, generate image, validate, error recovery | "generate diagram", "create diagram with validation", "resilient diagram" |
|
|
128
|
+
|
|
129
|
+
## Usage Patterns
|
|
130
|
+
|
|
131
|
+
Common request patterns and guide selection. See [When to Use What](#when-to-use-what) for complete mapping.
|
|
132
|
+
|
|
133
|
+
| Pattern | Example Request | Guides to Load |
|
|
134
|
+
|---------|-----------------|----------------|
|
|
135
|
+
| Single Diagram | "Create activity diagram for login flow" | Diagram type guide + Unicode symbols |
|
|
136
|
+
| Code-to-Diagram | "Generate deployment from application.yml" | Framework example + Deployment guide |
|
|
137
|
+
| Design Document | "Create API design document" | Template from assets/ + Relevant diagram guides |
|
|
138
|
+
| Extract/Validate | "Extract diagrams from design.md" | Use `scripts/extract_mermaid.py` |
|
|
139
|
+
| Batch Convert | "Convert all .mmd to PNG" | Use `scripts/mermaid_to_image.py` |
|
|
140
|
+
|
|
141
|
+
## Resilient Workflow
|
|
142
|
+
|
|
143
|
+
**CRITICAL:** This is the recommended approach for ALL diagram generation. It ensures validation, error recovery, and consistent file organization.
|
|
144
|
+
|
|
145
|
+
**Full Guide:** `references/guides/resilient-workflow.md`
|
|
146
|
+
|
|
147
|
+
### Workflow Overview
|
|
148
|
+
|
|
149
|
+
```mermaid
|
|
150
|
+
flowchart LR
|
|
151
|
+
A[1. Identify Type] --> B[2. Save .mmd + Image]
|
|
152
|
+
B --> C{3. Valid?}
|
|
153
|
+
C -->|Yes| D[4. Add to Markdown]
|
|
154
|
+
C -->|No| E[5. Error Recovery]
|
|
155
|
+
E --> F{Fix Found?}
|
|
156
|
+
F -->|Yes| A
|
|
157
|
+
F -->|No| G[Search External]
|
|
158
|
+
G --> A
|
|
159
|
+
|
|
160
|
+
classDef step fill:#90EE90,stroke:#333,color:darkgreen
|
|
161
|
+
classDef decision fill:#FFD700,stroke:#333,color:black
|
|
162
|
+
class A,B,D,E,G step
|
|
163
|
+
class C,F decision
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Key Principle
|
|
167
|
+
|
|
168
|
+
**NEVER add a diagram to markdown until it passes validation.** This prevents broken diagrams in documentation.
|
|
169
|
+
|
|
170
|
+
### Using the Script (Recommended)
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Generate with full error recovery
|
|
174
|
+
python scripts/resilient_diagram.py \
|
|
175
|
+
--code "flowchart TD; A-->B" \
|
|
176
|
+
--markdown-file design_doc \
|
|
177
|
+
--diagram-num 1 \
|
|
178
|
+
--title "process_flow" \
|
|
179
|
+
--format png \
|
|
180
|
+
--json
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Output:** Both `.mmd` and `.png` files in `./diagrams/` directory.
|
|
184
|
+
|
|
185
|
+
### File Naming Convention
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
./diagrams/<markdown_file>_<num>_<type>_<title>.mmd
|
|
189
|
+
./diagrams/<markdown_file>_<num>_<type>_<title>.png
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Example:** `./diagrams/api_design_01_sequence_auth_flow.png`
|
|
193
|
+
|
|
194
|
+
### Error Recovery Priority
|
|
195
|
+
|
|
196
|
+
When validation fails, the workflow automatically:
|
|
197
|
+
|
|
198
|
+
1. **Check troubleshooting guide** - `references/guides/troubleshooting.md` (28 documented errors)
|
|
199
|
+
2. **Search with perplexity** - `perplexity_ask` MCP for syntax questions
|
|
200
|
+
3. **Search with brave** - `brave_web_search` MCP for recent solutions
|
|
201
|
+
4. **Ask gemini** - `gemini` skill for alternative perspective
|
|
202
|
+
5. **General search** - `WebSearch` tool as fallback
|
|
203
|
+
|
|
204
|
+
### Manual Fallback Steps
|
|
205
|
+
|
|
206
|
+
If the script is unavailable:
|
|
207
|
+
|
|
208
|
+
1. **Identify diagram type** from first line (flowchart, sequence, etc.)
|
|
209
|
+
2. **Load reference guide** from `references/guides/diagrams/`
|
|
210
|
+
3. **Save to** `./diagrams/<markdown_file>_<num>_<type>_<title>.mmd`
|
|
211
|
+
4. **Validate:** `mmdc -i file.mmd -o file.png -b transparent`
|
|
212
|
+
5. **On error:** Search `references/guides/troubleshooting.md` for matching error
|
|
213
|
+
6. **If not found:** Use search tools in priority order above
|
|
214
|
+
7. **Add reference:** ``
|
|
215
|
+
|
|
216
|
+
### Pattern 6: Resilient Diagram Generation
|
|
217
|
+
|
|
218
|
+
**User:** "Create a sequence diagram and add it to the design doc"
|
|
219
|
+
|
|
220
|
+
**Skill Actions:**
|
|
221
|
+
1. Identify intent: **diagram generation** + **markdown integration**
|
|
222
|
+
2. Load workflow guide: `references/guides/resilient-workflow.md`
|
|
223
|
+
3. Identify diagram type: **sequence**
|
|
224
|
+
4. Load diagram guide: `references/guides/diagrams/sequence-diagrams.md`
|
|
225
|
+
5. Generate Mermaid code using templates
|
|
226
|
+
6. Execute resilient workflow:
|
|
227
|
+
```bash
|
|
228
|
+
python scripts/resilient_diagram.py \
|
|
229
|
+
--code "[generated code]" \
|
|
230
|
+
--markdown-file design_doc \
|
|
231
|
+
--diagram-num 1 \
|
|
232
|
+
--title "api_sequence" \
|
|
233
|
+
--json
|
|
234
|
+
```
|
|
235
|
+
7. If validation fails → Apply troubleshooting fix → Retry
|
|
236
|
+
8. On success → Add `` to markdown
|
|
237
|
+
|
|
238
|
+
## Unicode Semantic Symbols
|
|
239
|
+
|
|
240
|
+
Always use Unicode symbols to enhance diagram clarity. Common patterns:
|
|
241
|
+
|
|
242
|
+
### Infrastructure & Deployment
|
|
243
|
+
```mermaid
|
|
244
|
+
graph TB
|
|
245
|
+
Client[👤 User] --> LB[🌐 Load Balancer]
|
|
246
|
+
LB --> App1[⚙️ App Server 1]
|
|
247
|
+
LB --> App2[⚙️ App Server 2]
|
|
248
|
+
App1 --> DB[(💾 Database)]
|
|
249
|
+
App1 --> Cache[(⚡ Redis)]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Activity Flow with States
|
|
253
|
+
```mermaid
|
|
254
|
+
flowchart TD
|
|
255
|
+
Start([🚀 Start]) --> Process[⚙️ Process Data]
|
|
256
|
+
Process --> Check{✓ Valid?}
|
|
257
|
+
Check -->|Yes| Save[💾 Save]
|
|
258
|
+
Check -->|No| Error[❌ Error]
|
|
259
|
+
Save --> Complete([✅ Complete])
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Microservices Architecture
|
|
263
|
+
```mermaid
|
|
264
|
+
graph TB
|
|
265
|
+
API[🌐 API Gateway] --> Auth[🔐 Auth Service]
|
|
266
|
+
API --> Orders[📋 Order Service]
|
|
267
|
+
Orders --> Queue[📬 Message Queue]
|
|
268
|
+
Queue --> Worker[⚙️ Background Worker]
|
|
269
|
+
Worker --> Storage[📦 Object Storage]
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**For complete symbol reference, load:** `references/guides/unicode-symbols/guide.md`
|
|
273
|
+
|
|
274
|
+
## Python Utilities
|
|
275
|
+
|
|
276
|
+
### Extract Mermaid Diagrams
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# List all diagrams
|
|
280
|
+
python scripts/extract_mermaid.py document.md --list-only
|
|
281
|
+
|
|
282
|
+
# Extract to separate files
|
|
283
|
+
python scripts/extract_mermaid.py document.md --output-dir diagrams/
|
|
284
|
+
|
|
285
|
+
# Validate all diagrams
|
|
286
|
+
python scripts/extract_mermaid.py document.md --validate
|
|
287
|
+
|
|
288
|
+
# Replace with image references (for Confluence upload)
|
|
289
|
+
python scripts/extract_mermaid.py document.md --replace-with-images \
|
|
290
|
+
--image-format png --output-markdown output.md
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Convert to Images
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
# Single conversion
|
|
297
|
+
python scripts/mermaid_to_image.py diagram.mmd output.png
|
|
298
|
+
|
|
299
|
+
# With custom settings
|
|
300
|
+
python scripts/mermaid_to_image.py diagram.mmd output.svg \
|
|
301
|
+
--theme dark --background white --width 1200
|
|
302
|
+
|
|
303
|
+
# Batch convert directory
|
|
304
|
+
python scripts/mermaid_to_image.py diagrams/ output/ --format png --recursive
|
|
305
|
+
|
|
306
|
+
# From stdin
|
|
307
|
+
echo "graph TD; A-->B" | python scripts/mermaid_to_image.py - output.png
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Decision Tree Examples
|
|
311
|
+
|
|
312
|
+
### Example 1: User Asks for Workflow Diagram
|
|
313
|
+
|
|
314
|
+
**Input:** "Show the checkout process workflow"
|
|
315
|
+
|
|
316
|
+
**Skill Decision Path:**
|
|
317
|
+
```
|
|
318
|
+
1. Analyze: workflow, process → ACTIVITY DIAGRAM
|
|
319
|
+
2. Load guide: guides/diagrams/activity-diagrams.md
|
|
320
|
+
3. Find pattern: E-commerce checkout (template exists in guide)
|
|
321
|
+
4. Generate using template + Unicode symbols
|
|
322
|
+
5. Output activity diagram with decision points
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Output:** Complete activity diagram with Unicode symbols for cart, payment, order states.
|
|
326
|
+
|
|
327
|
+
### Example 2: User Provides Spring Boot Code
|
|
328
|
+
|
|
329
|
+
**Input:** "Here's my Spring Boot controller, create diagrams"
|
|
330
|
+
|
|
331
|
+
**Skill Decision Path:**
|
|
332
|
+
```
|
|
333
|
+
1. Analyze: Spring Boot, code provided → CODE-TO-DIAGRAM + SPRING BOOT
|
|
334
|
+
2. Load guides:
|
|
335
|
+
- examples/spring-boot/README.md
|
|
336
|
+
- guides/diagrams/architecture-diagrams.md (for structure)
|
|
337
|
+
- guides/diagrams/sequence-diagrams.md (for method calls)
|
|
338
|
+
- guides/diagrams/activity-diagrams.md (for business logic)
|
|
339
|
+
3. Generate multiple diagrams:
|
|
340
|
+
a. Architecture diagram from @RestController/@Service/@Repository annotations
|
|
341
|
+
b. Sequence diagram from method call chain
|
|
342
|
+
c. Activity diagram from business logic flow
|
|
343
|
+
4. Output all diagrams with explanations
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**Output:** 3-4 diagrams showing different views of the Spring Boot application.
|
|
347
|
+
|
|
348
|
+
### Example 3: User Wants Infrastructure Documentation
|
|
349
|
+
|
|
350
|
+
**Input:** "Document my GCP Cloud Run deployment with AlloyDB"
|
|
351
|
+
|
|
352
|
+
**Skill Decision Path:**
|
|
353
|
+
```
|
|
354
|
+
1. Analyze: infrastructure, GCP, Cloud Run → DEPLOYMENT DIAGRAM
|
|
355
|
+
2. Load guides:
|
|
356
|
+
- guides/diagrams/deployment-diagrams.md
|
|
357
|
+
- examples/spring-boot/ or examples/fastapi/ (if code provided)
|
|
358
|
+
3. Check for IaC files (Pulumi, Terraform, docker-compose)
|
|
359
|
+
4. Generate deployment diagram with:
|
|
360
|
+
- Cloud Run services with specs
|
|
361
|
+
- VPC connector
|
|
362
|
+
- AlloyDB cluster
|
|
363
|
+
- Security (IAM, Secret Manager)
|
|
364
|
+
- Monitoring
|
|
365
|
+
5. Apply Unicode symbols for clarity
|
|
366
|
+
6. Output with resource specifications
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**Output:** Complete GCP deployment diagram with all resources labeled.
|
|
370
|
+
|
|
371
|
+
## High-Contrast Styling
|
|
372
|
+
|
|
373
|
+
**ALL diagrams MUST use high-contrast colors:**
|
|
374
|
+
|
|
375
|
+
```mermaid
|
|
376
|
+
graph TB
|
|
377
|
+
classDef primary fill:#90EE90,stroke:#333,stroke-width:2px,color:darkgreen
|
|
378
|
+
classDef secondary fill:#87CEEB,stroke:#333,stroke-width:2px,color:darkblue
|
|
379
|
+
classDef database fill:#E6E6FA,stroke:#333,stroke-width:2px,color:darkblue
|
|
380
|
+
classDef error fill:#FFB6C1,stroke:#DC143C,stroke-width:2px,color:black
|
|
381
|
+
|
|
382
|
+
%% Every classDef MUST have color: property
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**Rules:**
|
|
386
|
+
- Light background → Dark text color
|
|
387
|
+
- Dark background → Light text color
|
|
388
|
+
- Always specify `color:` in every `classDef`
|
|
389
|
+
|
|
390
|
+
## File Organization
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
design-doc-mermaid/
|
|
394
|
+
├── SKILL.md # This file - Main orchestrator
|
|
395
|
+
├── README.md # User documentation
|
|
396
|
+
├── CLAUDE.md # Claude Code instructions
|
|
397
|
+
│
|
|
398
|
+
├── references/ # Reference materials
|
|
399
|
+
│ ├── mermaid-diagram-guide.md # Legacy general guide
|
|
400
|
+
│ └── guides/ # Specialized guides (load on-demand)
|
|
401
|
+
│ ├── diagrams/
|
|
402
|
+
│ │ ├── activity-diagrams.md # Workflows, processes
|
|
403
|
+
│ │ ├── deployment-diagrams.md # Infrastructure, cloud
|
|
404
|
+
│ │ ├─�� architecture-diagrams.md # System architecture
|
|
405
|
+
│ │ └── sequence-diagrams.md # API interactions
|
|
406
|
+
│ ├── code-to-diagram/
|
|
407
|
+
│ │ └── README.md # Master guide for code analysis
|
|
408
|
+
│ ├── unicode-symbols/
|
|
409
|
+
│ │ └── guide.md # Complete symbol reference
|
|
410
|
+
│ └── troubleshooting.md # Common syntax errors & fixes
|
|
411
|
+
│
|
|
412
|
+
├── assets/ # Design document templates
|
|
413
|
+
│ ├── architecture-design-template.md
|
|
414
|
+
│ ├── api-design-template.md
|
|
415
|
+
│ ├── feature-design-template.md
|
|
416
|
+
│ ├── database-design-template.md
|
|
417
|
+
│ └── system-design-template.md
|
|
418
|
+
│
|
|
419
|
+
├── scripts/ # Python utilities
|
|
420
|
+
│ ├── extract_mermaid.py # Extract & validate diagrams
|
|
421
|
+
│ └── mermaid_to_image.py # Convert to PNG/SVG
|
|
422
|
+
│
|
|
423
|
+
├── examples/ # Language-specific patterns
|
|
424
|
+
│ ├── spring-boot/ # Spring Boot patterns
|
|
425
|
+
│ ├── fastapi/ # FastAPI patterns
|
|
426
|
+
│ ├── react/ # React patterns
|
|
427
|
+
│ ├── python-etl/ # Data pipeline patterns
|
|
428
|
+
│ ├── node-webapp/ # Express.js patterns
|
|
429
|
+
│ └── java-webapp/ # Traditional Java patterns
|
|
430
|
+
│
|
|
431
|
+
└── references/ # General Mermaid reference
|
|
432
|
+
└── mermaid-diagram-guide.md # Complete Mermaid syntax guide
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
## Workflow Summary
|
|
436
|
+
|
|
437
|
+
1. **Analyze user intent** → Determine diagram type, document type, or action needed
|
|
438
|
+
2. **Load appropriate guide(s)** → Read only what's needed (token efficient)
|
|
439
|
+
3. **Apply templates and patterns** → Use examples from guides
|
|
440
|
+
4. **Generate output** → Create diagram or document
|
|
441
|
+
5. **Validate** (optional) → Use scripts to verify
|
|
442
|
+
6. **Convert** (optional) → Export to images if needed
|
|
443
|
+
|
|
444
|
+
## When to Use What
|
|
445
|
+
|
|
446
|
+
| User Request | Load This |
|
|
447
|
+
|--------------|-----------|
|
|
448
|
+
| "activity diagram", "workflow", "process flow" | `references/guides/diagrams/activity-diagrams.md` |
|
|
449
|
+
| "deployment", "infrastructure", "cloud", "k8s" | `references/guides/diagrams/deployment-diagrams.md` |
|
|
450
|
+
| "architecture", "system design", "components" | `references/guides/diagrams/architecture-diagrams.md` + design template |
|
|
451
|
+
| "API", "sequence", "interactions", "flow" | `references/mermaid-diagram-guide.md` (sequence section) |
|
|
452
|
+
| "Spring Boot code" | `examples/spring-boot/` + relevant diagram guides |
|
|
453
|
+
| "FastAPI code", "Python API" | `examples/fastapi/` + relevant diagram guides |
|
|
454
|
+
| "React app", "frontend" | `examples/react/` + architecture guide |
|
|
455
|
+
| "ETL", "data pipeline", "Python batch" | `examples/python-etl/` + activity guide |
|
|
456
|
+
| "symbols", "unicode", "emoji" | `references/guides/unicode-symbols/guide.md` |
|
|
457
|
+
| "syntax error", "diagram won't render", "troubleshoot" | `references/guides/troubleshooting.md` |
|
|
458
|
+
| "extract diagrams" | `scripts/extract_mermaid.py` |
|
|
459
|
+
| "convert to image", "PNG", "SVG" | `scripts/mermaid_to_image.py` |
|
|
460
|
+
| "create diagram", "generate diagram", "add diagram to markdown" | `scripts/resilient_diagram.py` + `references/guides/resilient-workflow.md` |
|
|
461
|
+
| "design document", "full docs" | `assets/*-design-template.md` + diagram guides |
|
|
462
|
+
|
|
463
|
+
## Best Practices
|
|
464
|
+
|
|
465
|
+
1. **Single Responsibility**: One diagram = One concept
|
|
466
|
+
2. **Unicode Enhancement**: Always use semantic symbols for clarity
|
|
467
|
+
3. **High Contrast**: Never skip the `color:` property in styles
|
|
468
|
+
4. **Validate Early**: Use scripts to catch syntax errors
|
|
469
|
+
5. **Template Reuse**: Leverage existing templates and examples
|
|
470
|
+
6. **Load On-Demand**: Only read guides needed for the specific request
|
|
471
|
+
7. **Token Efficiency**: Use hierarchical loading instead of reading everything
|
|
472
|
+
|
|
473
|
+
## Learning Path
|
|
474
|
+
|
|
475
|
+
**New to Mermaid?** Start here:
|
|
476
|
+
1. Read `references/guides/unicode-symbols/guide.md` for symbol meanings
|
|
477
|
+
2. Read `references/guides/diagrams/activity-diagrams.md` for basic patterns
|
|
478
|
+
3. Try examples in `examples/spring-boot/` or `examples/fastapi/`
|
|
479
|
+
4. Use `scripts/extract_mermaid.py --validate` to check your work
|
|
480
|
+
|
|
481
|
+
**Need to document code?** Follow this:
|
|
482
|
+
1. Identify your framework → Load relevant `examples/{framework}/`
|
|
483
|
+
2. Match code pattern to diagram type
|
|
484
|
+
3. Use templates from guide
|
|
485
|
+
4. Validate with scripts
|
|
486
|
+
|
|
487
|
+
**Creating design docs?** Follow this:
|
|
488
|
+
1. Choose document type → Load template from `assets/`
|
|
489
|
+
2. Fill in text sections
|
|
490
|
+
3. Load diagram guides as needed for each section
|
|
491
|
+
4. Use Unicode symbols throughout
|
|
492
|
+
5. Save to `docs/design/` with timestamp
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
**Version:** 2.0 (Hierarchical Architecture)
|
|
497
|
+
**Last Updated:** 2025-01-13
|
|
498
|
+
**Maintained by:** Claude Code Skills
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: develop-userscripts
|
|
3
|
+
description: Use when building, debugging, packaging, or publishing browser userscripts for Tampermonkey or ScriptCat, including GM APIs, metadata blocks, permission issues, @match/@grant/@connect setup, ScriptCat background or scheduled scripts, UserConfig blocks, or subscription workflows.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Userscript work usually breaks at the runtime and metadata boundary, not in the page logic. Choose the runtime first, declare the minimum permissions up front, then debug in the environment where the script actually runs.
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
Use this skill for:
|
|
11
|
+
|
|
12
|
+
- writing or fixing a Tampermonkey or ScriptCat userscript
|
|
13
|
+
- debugging injection timing, missing permissions, CSP workarounds, update checks, or `GM_*` behavior
|
|
14
|
+
- deciding between a portable foreground script and ScriptCat-only `@background` or `@crontab`
|
|
15
|
+
- adding config UI with `==UserConfig==`
|
|
16
|
+
- packaging a ScriptCat `==UserSubscribe==` bundle or preparing a CloudCat-compatible script
|
|
17
|
+
|
|
18
|
+
Do not use this skill for full browser extension development or general browser automation outside userscript managers.
|
|
19
|
+
|
|
20
|
+
## Runtime Selection
|
|
21
|
+
|
|
22
|
+
```dot
|
|
23
|
+
digraph userscript_runtime {
|
|
24
|
+
"Need page DOM or page context?" [shape=diamond];
|
|
25
|
+
"Need persistent or scheduled work?" [shape=diamond];
|
|
26
|
+
"Need to install many scripts as one package?" [shape=diamond];
|
|
27
|
+
"Portable foreground script" [shape=box];
|
|
28
|
+
"ScriptCat background or crontab script" [shape=box];
|
|
29
|
+
"ScriptCat subscription package" [shape=box];
|
|
30
|
+
|
|
31
|
+
"Need page DOM or page context?" -> "Portable foreground script" [label="yes"];
|
|
32
|
+
"Need page DOM or page context?" -> "Need persistent or scheduled work?" [label="no"];
|
|
33
|
+
"Need persistent or scheduled work?" -> "ScriptCat background or crontab script" [label="yes"];
|
|
34
|
+
"Need persistent or scheduled work?" -> "Need to install many scripts as one package?" [label="no"];
|
|
35
|
+
"Need to install many scripts as one package?" -> "ScriptCat subscription package" [label="yes"];
|
|
36
|
+
"Need to install many scripts as one package?" -> "Portable foreground script" [label="no"];
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Preflight
|
|
41
|
+
|
|
42
|
+
- Confirm the manager and browser. On Manifest V3 browsers, ScriptCat may require `Allow User Scripts` or browser developer mode before scripts run.
|
|
43
|
+
- Decide page script versus background script before writing code. ScriptCat background scripts cannot touch the DOM.
|
|
44
|
+
- Start with metadata, not implementation: `@match`, `@grant`, `@connect`, `@run-at`, and any update URLs.
|
|
45
|
+
- Prefer portable `==UserScript==` patterns for ordinary page scripts. Only switch to ScriptCat-only headers when the requested behavior actually needs them.
|
|
46
|
+
|
|
47
|
+
## Workflow
|
|
48
|
+
|
|
49
|
+
1. Choose the runtime and metadata first.
|
|
50
|
+
2. Declare the smallest permission surface that fits the task.
|
|
51
|
+
3. Implement against the runtime you chose.
|
|
52
|
+
4. Debug where the code really runs.
|
|
53
|
+
- Foreground scripts: page console plus manager logs.
|
|
54
|
+
- ScriptCat background scripts: run log first, then `background.html` for real-environment debugging.
|
|
55
|
+
5. Publish with the right update model.
|
|
56
|
+
- Normal scripts: keep `@version` accurate and add `@updateURL` or `@downloadURL` only when needed.
|
|
57
|
+
- Subscription bundles: use `==UserSubscribe==`, HTTPS URLs, and subscription-level `@connect`.
|
|
58
|
+
|
|
59
|
+
## Quick Reference
|
|
60
|
+
|
|
61
|
+
| Intent | Default choice | Watch for |
|
|
62
|
+
| ------------------------------------ | -------------------------------------------- | ------------------------------------------------------------------------- |
|
|
63
|
+
| Page UI, DOM scraping, page patching | Portable `==UserScript==` | `@match`, `@grant`, `@run-at`, CSP-sensitive injection |
|
|
64
|
+
| Cross-origin API access | `GM_xmlhttpRequest` with explicit `@connect` | Missing hosts, cookie behavior differences, user authorization |
|
|
65
|
+
| Long-running worker | ScriptCat `@background` | No DOM, must return `Promise` for async work |
|
|
66
|
+
| Scheduled task | ScriptCat `@crontab` | Only first `@crontab` counts, prefer 5-field cron, avoid interval overlap |
|
|
67
|
+
| User-editable settings | `==UserConfig==` plus `GM_getValue` | Block placement and `group.key` naming |
|
|
68
|
+
| Silent bundle install and updates | `==UserSubscribe==` | HTTPS, `user.sub.js`, subscription `connect` overrides child scripts |
|
|
69
|
+
|
|
70
|
+
## Common Mistakes
|
|
71
|
+
|
|
72
|
+
- Missing `@grant` for APIs the script actually uses.
|
|
73
|
+
- Missing `@connect` for hosts used by `GM_xmlhttpRequest` or `GM_cookie`.
|
|
74
|
+
- Treating `@include` as a better default than `@match` for ordinary host targeting.
|
|
75
|
+
- Using DOM APIs inside ScriptCat background or cron scripts.
|
|
76
|
+
- Returning from a ScriptCat background script before async GM work is truly finished.
|
|
77
|
+
- Mixing `==UserScript==` and `==UserSubscribe==` packaging concepts.
|
|
78
|
+
- Putting `==UserConfig==` in the wrong place or reading config keys without the `group.key` name.
|
|
79
|
+
- Assuming Tampermonkey and ScriptCat storage, notification, or request behavior is identical.
|
|
80
|
+
|
|
81
|
+
## References
|
|
82
|
+
|
|
83
|
+
- [`references/metadata-and-api-map.md`](./references/metadata-and-api-map.md)
|
|
84
|
+
- [`references/scriptcat-extensions.md`](./references/scriptcat-extensions.md)
|