skilldrop-cli 0.2.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/LICENSE +21 -0
- package/README.md +413 -0
- package/bin/skilldrop.js +338 -0
- package/model-routing.json +147 -0
- package/package.json +36 -0
- package/packs.json +90 -0
- package/skills/accessibility-audit/SKILL.md +74 -0
- package/skills/accessibility-audit/examples/login-form.md +76 -0
- package/skills/accessibility-audit/manifest.json +11 -0
- package/skills/accessibility-audit/reference.md +69 -0
- package/skills/adr-generator/SKILL.md +49 -0
- package/skills/adr-generator/manifest.json +11 -0
- package/skills/adr-generator/templates/madr.md +56 -0
- package/skills/adr-generator/templates/nygard.md +19 -0
- package/skills/ai-usage-report/SKILL.md +111 -0
- package/skills/ai-usage-report/examples/weekly-engineering-team.md +133 -0
- package/skills/ai-usage-report/manifest.json +11 -0
- package/skills/ai-usage-report/scripts/build_report.py +436 -0
- package/skills/ai-usage-report/templates/report-per-user.md +42 -0
- package/skills/ai-usage-report/templates/report-team-rollup.md +49 -0
- package/skills/ai-usage-report/templates/usage-event-schema.md +76 -0
- package/skills/api-contract-draft/SKILL.md +69 -0
- package/skills/api-contract-draft/manifest.json +11 -0
- package/skills/api-contract-draft/reference.md +73 -0
- package/skills/api-contract-draft/templates/openapi-skeleton.yaml +148 -0
- package/skills/architecture-diagrams/SKILL.md +66 -0
- package/skills/architecture-diagrams/examples/aws-three-tier.md +44 -0
- package/skills/architecture-diagrams/examples/c4-container-saas.md +51 -0
- package/skills/architecture-diagrams/examples/microservices-sequence.md +49 -0
- package/skills/architecture-diagrams/manifest.json +28 -0
- package/skills/architecture-diagrams/templates/c4-container.puml +31 -0
- package/skills/architecture-diagrams/templates/mermaid-aws.md +52 -0
- package/skills/architecture-diagrams/templates/mermaid-flowchart.md +37 -0
- package/skills/architecture-diagrams/templates/mermaid-sequence.md +39 -0
- package/skills/audience-profile/SKILL.md +73 -0
- package/skills/audience-profile/manifest.json +11 -0
- package/skills/audience-profile/reference.md +175 -0
- package/skills/brief-intake/SKILL.md +78 -0
- package/skills/brief-intake/manifest.json +11 -0
- package/skills/brief-intake/templates/brief-adr.md +41 -0
- package/skills/brief-intake/templates/brief-decision-log.md +35 -0
- package/skills/brief-intake/templates/brief-deck.md +43 -0
- package/skills/brief-intake/templates/brief-design-doc.md +48 -0
- package/skills/brief-intake/templates/brief-exec-summary.md +47 -0
- package/skills/brief-intake/templates/brief-generic.md +45 -0
- package/skills/brief-intake/templates/brief-runbook.md +44 -0
- package/skills/brief-intake/templates/brief-tech-comparison.md +38 -0
- package/skills/bug-triage/SKILL.md +67 -0
- package/skills/bug-triage/manifest.json +11 -0
- package/skills/bug-triage/templates/bug-ticket.md +86 -0
- package/skills/business-case/SKILL.md +64 -0
- package/skills/business-case/manifest.json +11 -0
- package/skills/business-case/templates/business-case.md +60 -0
- package/skills/capacity-cost-model/SKILL.md +64 -0
- package/skills/capacity-cost-model/manifest.json +11 -0
- package/skills/capacity-cost-model/reference.md +54 -0
- package/skills/capacity-cost-model/templates/cost-model.md +68 -0
- package/skills/council-review/SKILL.md +106 -0
- package/skills/council-review/examples/redis-cache-decision.md +75 -0
- package/skills/council-review/manifest.json +11 -0
- package/skills/council-review/reference.md +76 -0
- package/skills/council-review/seats/architect.md +29 -0
- package/skills/council-review/seats/bench.md +39 -0
- package/skills/council-review/seats/operator.md +27 -0
- package/skills/council-review/seats/pragmatist.md +29 -0
- package/skills/council-review/seats/security-engineer.md +29 -0
- package/skills/council-review/seats/user-advocate.md +27 -0
- package/skills/council-review/templates/council-review.md +59 -0
- package/skills/data-contract/SKILL.md +67 -0
- package/skills/data-contract/manifest.json +11 -0
- package/skills/data-contract/reference.md +46 -0
- package/skills/data-contract/templates/data-contract.md +69 -0
- package/skills/db-schema-design/SKILL.md +68 -0
- package/skills/db-schema-design/manifest.json +11 -0
- package/skills/db-schema-design/reference.md +56 -0
- package/skills/db-schema-design/templates/schema-design.md +75 -0
- package/skills/decision-log/SKILL.md +67 -0
- package/skills/decision-log/manifest.json +11 -0
- package/skills/deck-builder/SKILL.md +114 -0
- package/skills/deck-builder/examples/exec-board-update.md +108 -0
- package/skills/deck-builder/manifest.json +17 -0
- package/skills/deck-builder/reference.md +92 -0
- package/skills/deck-builder/requirements.txt +1 -0
- package/skills/deck-builder/scripts/build_deck.py +309 -0
- package/skills/deck-builder/templates/deck-spec.json +97 -0
- package/skills/deck-builder/templates/palettes.json +59 -0
- package/skills/design-doc/SKILL.md +49 -0
- package/skills/design-doc/manifest.json +11 -0
- package/skills/design-doc/templates/design-doc.md +98 -0
- package/skills/devils-advocate/SKILL.md +142 -0
- package/skills/devils-advocate/lenses/adversarial-review.md +88 -0
- package/skills/devils-advocate/lenses/edge-cases.md +95 -0
- package/skills/devils-advocate/lenses/future-proofing.md +75 -0
- package/skills/devils-advocate/lenses/test-coverage.md +90 -0
- package/skills/devils-advocate/manifest.json +11 -0
- package/skills/devils-advocate/templates/challenge.md +118 -0
- package/skills/doc-critique/SKILL.md +119 -0
- package/skills/doc-critique/manifest.json +11 -0
- package/skills/doc-critique/rubrics/adr.md +36 -0
- package/skills/doc-critique/rubrics/decision-log.md +39 -0
- package/skills/doc-critique/rubrics/deck.md +45 -0
- package/skills/doc-critique/rubrics/design-doc.md +42 -0
- package/skills/doc-critique/rubrics/exec-summary.md +41 -0
- package/skills/doc-critique/rubrics/generic.md +40 -0
- package/skills/doc-critique/rubrics/runbook.md +42 -0
- package/skills/doc-critique/rubrics/tech-comparison.md +40 -0
- package/skills/doc-critique/templates/critique.md +49 -0
- package/skills/exec-summary/SKILL.md +45 -0
- package/skills/exec-summary/manifest.json +11 -0
- package/skills/exec-summary/templates/exec-summary.md +48 -0
- package/skills/feature-implement-loop/SKILL.md +83 -0
- package/skills/feature-implement-loop/manifest.json +11 -0
- package/skills/figma-diagrams/SKILL.md +85 -0
- package/skills/figma-diagrams/manifest.json +35 -0
- package/skills/figma-diagrams/reference.md +91 -0
- package/skills/figma-diagrams/requirements.txt +1 -0
- package/skills/figma-diagrams/scripts/_figma_client.py +71 -0
- package/skills/figma-diagrams/scripts/frame_to_mermaid.py +102 -0
- package/skills/figma-diagrams/scripts/inspect_file.py +46 -0
- package/skills/figma-diagrams/scripts/list_comments.py +35 -0
- package/skills/figma-diagrams/scripts/post_comment.py +52 -0
- package/skills/figma-diagrams/templates/figjam-import.json +20 -0
- package/skills/guide-builder/SKILL.md +76 -0
- package/skills/guide-builder/examples/local-setup-guide.md +127 -0
- package/skills/guide-builder/manifest.json +11 -0
- package/skills/guide-builder/templates/api-reference.md +120 -0
- package/skills/guide-builder/templates/design-walkthrough.md +72 -0
- package/skills/guide-builder/templates/setup-guide.md +109 -0
- package/skills/incident-comms/SKILL.md +68 -0
- package/skills/incident-comms/manifest.json +11 -0
- package/skills/incident-comms/reference.md +43 -0
- package/skills/incident-comms/templates/messages.md +82 -0
- package/skills/llm-eval-harness/SKILL.md +73 -0
- package/skills/llm-eval-harness/manifest.json +11 -0
- package/skills/llm-eval-harness/reference.md +58 -0
- package/skills/llm-eval-harness/templates/eval-plan.md +63 -0
- package/skills/llm-eval-harness/templates/golden-case.jsonl +5 -0
- package/skills/migration-plan/SKILL.md +68 -0
- package/skills/migration-plan/manifest.json +11 -0
- package/skills/migration-plan/templates/migration-plan.md +68 -0
- package/skills/nfr-spec/SKILL.md +63 -0
- package/skills/nfr-spec/manifest.json +11 -0
- package/skills/nfr-spec/reference.md +74 -0
- package/skills/nfr-spec/templates/nfr-spec.md +56 -0
- package/skills/observability-plan/SKILL.md +70 -0
- package/skills/observability-plan/manifest.json +11 -0
- package/skills/observability-plan/reference.md +67 -0
- package/skills/observability-plan/templates/observability-plan.md +62 -0
- package/skills/okr-cascade/SKILL.md +59 -0
- package/skills/okr-cascade/evals/eval_queries.json +12 -0
- package/skills/okr-cascade/evals/evals.json +28 -0
- package/skills/okr-cascade/manifest.json +11 -0
- package/skills/okr-cascade/templates/okr-cascade.md +46 -0
- package/skills/postmortem-generator/SKILL.md +65 -0
- package/skills/postmortem-generator/manifest.json +11 -0
- package/skills/postmortem-generator/templates/postmortem.md +67 -0
- package/skills/prd-draft/SKILL.md +62 -0
- package/skills/prd-draft/manifest.json +11 -0
- package/skills/prd-draft/templates/prd.md +66 -0
- package/skills/prfaq/SKILL.md +75 -0
- package/skills/prfaq/evals/eval_queries.json +13 -0
- package/skills/prfaq/evals/evals.json +32 -0
- package/skills/prfaq/manifest.json +11 -0
- package/skills/prfaq/templates/prfaq.md +60 -0
- package/skills/release-notes/SKILL.md +61 -0
- package/skills/release-notes/manifest.json +11 -0
- package/skills/release-notes/templates/release-notes.md +83 -0
- package/skills/requirements-interview/SKILL.md +61 -0
- package/skills/requirements-interview/manifest.json +11 -0
- package/skills/requirements-interview/templates/interview-kit.md +63 -0
- package/skills/reverse-architecture/SKILL.md +103 -0
- package/skills/reverse-architecture/manifest.json +11 -0
- package/skills/reverse-architecture/reference.md +150 -0
- package/skills/reverse-architecture/templates/description.md +52 -0
- package/skills/reverse-architecture/templates/extraction.md +55 -0
- package/skills/runbook-generator/SKILL.md +42 -0
- package/skills/runbook-generator/manifest.json +11 -0
- package/skills/runbook-generator/templates/runbook.md +109 -0
- package/skills/slide-outliner/SKILL.md +58 -0
- package/skills/slide-outliner/manifest.json +11 -0
- package/skills/slide-outliner/templates/deck-outline.md +131 -0
- package/skills/sonar-onboard/SKILL.md +170 -0
- package/skills/sonar-onboard/manifest.json +11 -0
- package/skills/sonar-onboard/reference.md +151 -0
- package/skills/sonar-onboard/templates/github-actions-sonar-server.yml.tmpl +50 -0
- package/skills/sonar-onboard/templates/github-actions-sonarcloud.yml.tmpl +53 -0
- package/skills/sonar-onboard/templates/readme-snippet.md +38 -0
- package/skills/sonar-onboard/templates/sonar-project.properties.tmpl +31 -0
- package/skills/sonar-review/SKILL.md +220 -0
- package/skills/sonar-review/lenses/bugs.md +48 -0
- package/skills/sonar-review/lenses/code-smells.md +64 -0
- package/skills/sonar-review/lenses/coverage-and-duplication.md +74 -0
- package/skills/sonar-review/lenses/security-hotspots.md +56 -0
- package/skills/sonar-review/lenses/vulnerabilities.md +52 -0
- package/skills/sonar-review/manifest.json +37 -0
- package/skills/sonar-review/reference.md +167 -0
- package/skills/sonar-review/templates/report.md +84 -0
- package/skills/strategy-analysis/SKILL.md +63 -0
- package/skills/strategy-analysis/evals/eval_queries.json +13 -0
- package/skills/strategy-analysis/evals/evals.json +36 -0
- package/skills/strategy-analysis/manifest.json +11 -0
- package/skills/success-metrics/SKILL.md +63 -0
- package/skills/success-metrics/evals/eval_queries.json +11 -0
- package/skills/success-metrics/evals/evals.json +27 -0
- package/skills/success-metrics/manifest.json +11 -0
- package/skills/success-metrics/templates/metrics-plan.md +55 -0
- package/skills/tech-comparison-matrix/SKILL.md +56 -0
- package/skills/tech-comparison-matrix/manifest.json +11 -0
- package/skills/tech-comparison-matrix/templates/matrix.md +45 -0
- package/skills/test-plan-generator/SKILL.md +59 -0
- package/skills/test-plan-generator/manifest.json +11 -0
- package/skills/test-plan-generator/templates/test-plan.md +83 -0
- package/skills/threat-model/SKILL.md +65 -0
- package/skills/threat-model/examples/document-upload.md +56 -0
- package/skills/threat-model/manifest.json +11 -0
- package/skills/threat-model/reference.md +69 -0
- package/skills/user-journey-map/SKILL.md +64 -0
- package/skills/user-journey-map/evals/eval_queries.json +12 -0
- package/skills/user-journey-map/evals/evals.json +30 -0
- package/skills/user-journey-map/examples/b2b-saas-onboarding.md +69 -0
- package/skills/user-journey-map/manifest.json +11 -0
- package/skills/user-journey-map/templates/journey-map.md +47 -0
- package/skills/user-story-splitter/SKILL.md +88 -0
- package/skills/user-story-splitter/examples/notifications-epic.md +123 -0
- package/skills/user-story-splitter/manifest.json +11 -0
- package/skills/user-story-splitter/templates/story.md +40 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "api-contract-draft",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Draft an OpenAPI 3.1 contract from a feature brief or story โ resource-oriented paths, a full error catalog (RFC 9457), pagination/idempotency/versioning decided not deferred, examples on every operation, plus a decisions log so review argues choices instead of YAML. Use when the user wants to design an API, draft an OpenAPI/Swagger spec, define request/response shapes, or agree a contract between frontend/backend or two teams before code.",
|
|
5
|
+
"entrypoint": "SKILL.md",
|
|
6
|
+
"deps": { "npm": [], "pip": [] },
|
|
7
|
+
"env": { "required": [], "optional": [] },
|
|
8
|
+
"related": ["council-review", "doc-critique", "guide-builder", "tech-comparison-matrix", "user-story-splitter"],
|
|
9
|
+
"tags": ["api-design", "openapi", "contract-first", "rest", "swagger", "asyncapi"],
|
|
10
|
+
"model": { "tier": "standard", "rationale": "Schema synthesis against fixed conventions. The resource modeling needs judgment; the conventions bound it. Escalate via ambiguous-input on contested multi-team contracts." }
|
|
11
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# api-contract-draft reference โ house conventions
|
|
2
|
+
|
|
3
|
+
These are defaults, not laws: deviate when the brief forces it, and log every deviation in the decisions table with its reason. An unlogged deviation is a bug in the contract.
|
|
4
|
+
|
|
5
|
+
## Naming & paths
|
|
6
|
+
|
|
7
|
+
- Resources are **plural nouns**: `/refunds`, `/payment-methods`. Kebab-case in paths, `snake_case` in JSON bodies.
|
|
8
|
+
- No verbs in paths. State changes are either a `PATCH` of a status field or a **sub-resource action collection** when the transition has its own data/lifecycle: โ
`POST /orders/{id}/cancellations` โ โ `POST /orders/{id}/cancel` (acceptable only when the action is truly fire-and-forget and modeling it as a resource adds nothing โ log it).
|
|
9
|
+
- Nest **one level max** (`/customers/{id}/payment-methods`). Deeper relationships flatten to filters: โ
`/invoices?customer_id=โฆ` โ โ `/customers/{id}/orders/{id}/invoices`.
|
|
10
|
+
- IDs are opaque strings with a type prefix in examples (`"ord_8f4k2m"`) โ prefixed IDs make logs and support tickets self-describing.
|
|
11
|
+
|
|
12
|
+
## Errors โ RFC 9457 `application/problem+json`
|
|
13
|
+
|
|
14
|
+
Every error response is a `Problem`:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
Problem:
|
|
18
|
+
type: object
|
|
19
|
+
required: [type, title, status, code]
|
|
20
|
+
properties:
|
|
21
|
+
type: { type: string, format: uri, description: "Stable URI identifying the error class" }
|
|
22
|
+
title: { type: string, description: "Human summary, not for switching on" }
|
|
23
|
+
status: { type: integer }
|
|
24
|
+
code: { type: string, pattern: "^[a-z0-9_]+$", description: "Stable machine-readable code clients switch on" }
|
|
25
|
+
detail: { type: string }
|
|
26
|
+
errors: { type: array, description: "Field-level validation failures", items: { type: object, properties: { field: {type: string}, code: {type: string}, message: {type: string} } } }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Enumerate **every 4xx the operation can produce**, each with its `code` values: `validation_failed`, `idempotency_key_reused`, `insufficient_funds`, โฆ
|
|
30
|
+
- `5xx`: document `500` once globally with a generic Problem; never invent per-operation 500 variants.
|
|
31
|
+
- The `code` list is contract โ adding one is additive; changing one is breaking.
|
|
32
|
+
|
|
33
|
+
## Pagination, filtering, sorting
|
|
34
|
+
|
|
35
|
+
- **Cursor pagination is the default**: request `?cursor=&limit=` (limit capped, cap stated), response `{ "data": [...], "next_cursor": "..." | null }`. Offset pagination only with a logged reason (e.g. "UI needs page numbers; dataset < 100k and stable").
|
|
36
|
+
- Every list endpoint paginates **from day one** โ even "small" lists; retrofitting is a breaking change.
|
|
37
|
+
- Filters are query params named after the field (`?status=pending&created_after=โฆ`). Sorting: `?sort=-created_at` (leading `-` = descending). Document which fields are filterable/sortable โ "all of them" is never true.
|
|
38
|
+
|
|
39
|
+
## Idempotency & retries
|
|
40
|
+
|
|
41
|
+
- Every **unsafe POST** accepts `Idempotency-Key` (UUID, 24h retention stated). Same key + same body โ replay the original response; same key + different body โ `409` `idempotency_key_reused`.
|
|
42
|
+
- `PUT` and `DELETE` are idempotent by construction; `DELETE` of a missing resource is `404` first time, `404` every time (not `204` โ log if you choose tombstone semantics instead).
|
|
43
|
+
- State the retry guidance in the operation description: which errors are retryable (`503`, `429` with `Retry-After`) and which never are (`4xx` except `429`).
|
|
44
|
+
|
|
45
|
+
## Versioning
|
|
46
|
+
|
|
47
|
+
- URL major version: `/v1/`. The policy sentence for `info.description`: *"Additive changes (new optional fields, new endpoints, new enum values where the field is documented as open) do not bump the version; removals, renames, type changes, and semantic changes do."*
|
|
48
|
+
- Mark enums **open or closed** explicitly (`x-extensible-enum` note or description) โ clients must know whether to tolerate unknown values.
|
|
49
|
+
- Deprecation: `deprecated: true` + `Sunset` header mention + the replacement named in the description. No silent removals, ever.
|
|
50
|
+
|
|
51
|
+
## Field typing rules
|
|
52
|
+
|
|
53
|
+
| Concern | Rule |
|
|
54
|
+
|---|---|
|
|
55
|
+
| Money | Integer minor units + ISO-4217 `currency` field. Float money fails review. |
|
|
56
|
+
| Timestamps | `type: string, format: date-time`, UTC, ISO-8601. Field names end `_at`. |
|
|
57
|
+
| IDs | `type: string` opaque; never `integer` (leaks sequence, blocks resharding). |
|
|
58
|
+
| Enums | `enum: [...]` with every value, plus open/closed declared. |
|
|
59
|
+
| Free text | `maxLength` always โ unbounded strings are a storage and abuse contract. |
|
|
60
|
+
| Booleans | Name as predicate: `is_default`, `has_failed`. Never tri-state a boolean โ use an enum. |
|
|
61
|
+
| Optionality | `required` array on every object schema; absent โ null โ pick one and state it. |
|
|
62
|
+
| Quantities | `minimum`/`maximum` on every numeric the business bounds. |
|
|
63
|
+
|
|
64
|
+
## Request/response shape separation
|
|
65
|
+
|
|
66
|
+
Per resource, three schemas minimum: `{Resource}` (response), `{Resource}CreateRequest`, `{Resource}UpdateRequest`. Server-set fields (`id`, `created_at`, `status` when machine-driven) appear **only** in the response schema. The update schema has no required fields (PATCH semantics) unless the business requires atomically-paired fields โ log that decision.
|
|
67
|
+
|
|
68
|
+
## Event/webhook contracts (AsyncAPI-shaped)
|
|
69
|
+
|
|
70
|
+
- Channel names: `{domain}.{resource}.{event}` past-tense โ `payments.refund.completed`.
|
|
71
|
+
- Payload: the same typing rigor; include `event_id` (UUID, for consumer dedupe), `occurred_at`, and a `schema_version`.
|
|
72
|
+
- Delivery semantics stated per channel: default **at-least-once** โ consumers must dedupe on `event_id`; say so in the channel description.
|
|
73
|
+
- Webhooks out: HMAC signature header named, timestamp-skew window stated, retry schedule with backoff and a cap, and the consumer's expected 2xx contract ("respond 2xx within 10s; processing happens async on your side").
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# OpenAPI 3.1 skeleton โ one fully-worked resource (refunds) showing every convention.
|
|
2
|
+
# Replace the resource; keep the structure, the Problem schema, and the security wiring.
|
|
3
|
+
openapi: 3.1.0
|
|
4
|
+
info:
|
|
5
|
+
title: "{Service} API"
|
|
6
|
+
version: "1.0.0"
|
|
7
|
+
license: { name: "{license, e.g. Proprietary}" }
|
|
8
|
+
description: |
|
|
9
|
+
Versioning policy: additive changes (new optional fields, new endpoints, new enum
|
|
10
|
+
values on open enums) do not bump the major version; removals, renames, type
|
|
11
|
+
changes, and semantic changes do. Deprecated operations carry `deprecated: true`,
|
|
12
|
+
a Sunset header, and a named replacement.
|
|
13
|
+
servers:
|
|
14
|
+
- url: https://api.example.com/v1
|
|
15
|
+
security:
|
|
16
|
+
- bearerAuth: []
|
|
17
|
+
paths:
|
|
18
|
+
/refunds:
|
|
19
|
+
post:
|
|
20
|
+
operationId: createRefund
|
|
21
|
+
summary: Request a refund for a captured payment
|
|
22
|
+
description: |
|
|
23
|
+
Retry guidance: retryable on 429 (honor Retry-After) and 503; never retryable
|
|
24
|
+
on other 4xx. Replays with the same Idempotency-Key return the original response.
|
|
25
|
+
parameters:
|
|
26
|
+
- name: Idempotency-Key
|
|
27
|
+
in: header
|
|
28
|
+
required: true
|
|
29
|
+
schema: { type: string, format: uuid }
|
|
30
|
+
description: Retained 24h. Same key + different body returns 409.
|
|
31
|
+
requestBody:
|
|
32
|
+
required: true
|
|
33
|
+
content:
|
|
34
|
+
application/json:
|
|
35
|
+
schema: { $ref: "#/components/schemas/RefundCreateRequest" }
|
|
36
|
+
example:
|
|
37
|
+
payment_id: "pay_8f4k2mq7"
|
|
38
|
+
amount: 2500
|
|
39
|
+
currency: "EUR"
|
|
40
|
+
reason: "customer_request"
|
|
41
|
+
responses:
|
|
42
|
+
"201":
|
|
43
|
+
description: Refund created and queued for processing.
|
|
44
|
+
content:
|
|
45
|
+
application/json:
|
|
46
|
+
schema: { $ref: "#/components/schemas/Refund" }
|
|
47
|
+
example:
|
|
48
|
+
id: "ref_3j9x1pd4"
|
|
49
|
+
payment_id: "pay_8f4k2mq7"
|
|
50
|
+
amount: 2500
|
|
51
|
+
currency: "EUR"
|
|
52
|
+
reason: "customer_request"
|
|
53
|
+
status: "pending"
|
|
54
|
+
created_at: "2026-06-10T14:02:11Z"
|
|
55
|
+
"400":
|
|
56
|
+
description: "Validation failed. codes: validation_failed"
|
|
57
|
+
content: { application/problem+json: { schema: { $ref: "#/components/schemas/Problem" } } }
|
|
58
|
+
"402":
|
|
59
|
+
description: "Refund exceeds refundable balance. codes: insufficient_refundable_amount"
|
|
60
|
+
content: { application/problem+json: { schema: { $ref: "#/components/schemas/Problem" } } }
|
|
61
|
+
"404":
|
|
62
|
+
description: "Payment not found. codes: payment_not_found"
|
|
63
|
+
content: { application/problem+json: { schema: { $ref: "#/components/schemas/Problem" } } }
|
|
64
|
+
"409":
|
|
65
|
+
description: "Idempotency conflict. codes: idempotency_key_reused"
|
|
66
|
+
content: { application/problem+json: { schema: { $ref: "#/components/schemas/Problem" } } }
|
|
67
|
+
get:
|
|
68
|
+
operationId: listRefunds
|
|
69
|
+
summary: List refunds
|
|
70
|
+
parameters:
|
|
71
|
+
- { name: cursor, in: query, schema: { type: string } }
|
|
72
|
+
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100, default: 25 } }
|
|
73
|
+
- { name: payment_id, in: query, schema: { type: string } }
|
|
74
|
+
- { name: status, in: query, schema: { $ref: "#/components/schemas/RefundStatus" } }
|
|
75
|
+
- { name: sort, in: query, schema: { type: string, enum: ["created_at", "-created_at"], default: "-created_at" } }
|
|
76
|
+
responses:
|
|
77
|
+
"200":
|
|
78
|
+
description: Paginated refunds, newest first by default.
|
|
79
|
+
content:
|
|
80
|
+
application/json:
|
|
81
|
+
schema:
|
|
82
|
+
type: object
|
|
83
|
+
required: [data, next_cursor]
|
|
84
|
+
properties:
|
|
85
|
+
data: { type: array, items: { $ref: "#/components/schemas/Refund" } }
|
|
86
|
+
next_cursor: { type: [string, "null"] }
|
|
87
|
+
/refunds/{refund_id}:
|
|
88
|
+
get:
|
|
89
|
+
operationId: getRefund
|
|
90
|
+
summary: Fetch one refund
|
|
91
|
+
parameters:
|
|
92
|
+
- { name: refund_id, in: path, required: true, schema: { type: string } }
|
|
93
|
+
responses:
|
|
94
|
+
"200":
|
|
95
|
+
description: The refund.
|
|
96
|
+
content: { application/json: { schema: { $ref: "#/components/schemas/Refund" } } }
|
|
97
|
+
"404":
|
|
98
|
+
description: "codes: refund_not_found"
|
|
99
|
+
content: { application/problem+json: { schema: { $ref: "#/components/schemas/Problem" } } }
|
|
100
|
+
components:
|
|
101
|
+
securitySchemes:
|
|
102
|
+
bearerAuth: { type: http, scheme: bearer, bearerFormat: JWT }
|
|
103
|
+
schemas:
|
|
104
|
+
RefundStatus:
|
|
105
|
+
type: string
|
|
106
|
+
description: "Closed enum โ clients may exhaustively switch."
|
|
107
|
+
enum: [pending, processing, succeeded, failed]
|
|
108
|
+
RefundCreateRequest:
|
|
109
|
+
type: object
|
|
110
|
+
required: [payment_id, amount, currency]
|
|
111
|
+
properties:
|
|
112
|
+
payment_id: { type: string, maxLength: 64 }
|
|
113
|
+
amount: { type: integer, minimum: 1, description: "Minor units (cents)." }
|
|
114
|
+
currency: { type: string, pattern: "^[A-Z]{3}$", description: "ISO 4217." }
|
|
115
|
+
reason:
|
|
116
|
+
type: string
|
|
117
|
+
description: "Open enum โ clients must tolerate unknown values."
|
|
118
|
+
enum: [customer_request, duplicate, fraud, other]
|
|
119
|
+
Refund:
|
|
120
|
+
type: object
|
|
121
|
+
required: [id, payment_id, amount, currency, status, created_at]
|
|
122
|
+
properties:
|
|
123
|
+
id: { type: string }
|
|
124
|
+
payment_id: { type: string }
|
|
125
|
+
amount: { type: integer, minimum: 1 }
|
|
126
|
+
currency: { type: string, pattern: "^[A-Z]{3}$" }
|
|
127
|
+
reason: { type: string, enum: [customer_request, duplicate, fraud, other] }
|
|
128
|
+
status: { $ref: "#/components/schemas/RefundStatus" }
|
|
129
|
+
failure_code: { type: [string, "null"], description: "Set only when status=failed." }
|
|
130
|
+
created_at: { type: string, format: date-time }
|
|
131
|
+
Problem:
|
|
132
|
+
type: object
|
|
133
|
+
required: [type, title, status, code]
|
|
134
|
+
properties:
|
|
135
|
+
type: { type: string, format: uri }
|
|
136
|
+
title: { type: string }
|
|
137
|
+
status: { type: integer }
|
|
138
|
+
code: { type: string, pattern: "^[a-z0-9_]+$" }
|
|
139
|
+
detail: { type: string }
|
|
140
|
+
errors:
|
|
141
|
+
type: array
|
|
142
|
+
items:
|
|
143
|
+
type: object
|
|
144
|
+
required: [field, code]
|
|
145
|
+
properties:
|
|
146
|
+
field: { type: string }
|
|
147
|
+
code: { type: string }
|
|
148
|
+
message: { type: string }
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-diagrams
|
|
3
|
+
description: Generate architecture diagrams (Mermaid, PlantUML, C4) from a written description of a system. Supports AWS/Azure/GCP cloud topologies, microservice landscapes, sequence flows, container diagrams, and ER models. Use whenever the user asks for an architecture diagram, system sketch, flow diagram, or visualization of a design.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# architecture-diagrams
|
|
7
|
+
|
|
8
|
+
You help the user turn a written system description into a clean, renderable architecture diagram.
|
|
9
|
+
|
|
10
|
+
## How to respond
|
|
11
|
+
|
|
12
|
+
1. **Clarify only what blocks correctness.** Before drawing, you may ask 1โ2 short questions if the description is missing something load-bearing (e.g., "Is auth synchronous or via a sidecar?"). Don't pepper the user with questions for taste preferences โ pick a reasonable default and call it out.
|
|
13
|
+
|
|
14
|
+
2. **Pick the right notation.** Use this rough mapping unless the user requests otherwise:
|
|
15
|
+
|
|
16
|
+
| User's intent | Use |
|
|
17
|
+
|---|---|
|
|
18
|
+
| Cloud architecture (AWS/Azure/GCP) โ boxes, arrows, services | **Mermaid** `flowchart` or `graph` |
|
|
19
|
+
| Request flow across services / call order matters | **Mermaid** `sequenceDiagram` |
|
|
20
|
+
| Strategic / multi-level view (context โ container โ component) | **C4 (PlantUML !include c4)** |
|
|
21
|
+
| Data model, tables, relationships | **Mermaid** `erDiagram` |
|
|
22
|
+
| State machine / workflow | **Mermaid** `stateDiagram-v2` |
|
|
23
|
+
| Class / type hierarchy | **Mermaid** `classDiagram` |
|
|
24
|
+
| Looks-pretty UML-style for slides | **PlantUML** |
|
|
25
|
+
|
|
26
|
+
3. **Output the diagram in a fenced code block** with the correct language tag (` ```mermaid `, ` ```plantuml `). Then add 2โ4 bullet points underneath explaining the key design choices ("Why two ECS services and not one?") so the diagram is reviewable, not just renderable.
|
|
27
|
+
|
|
28
|
+
4. **Offer next steps**, e.g., "Want me to export this as SVG via the Mermaid CLI?" or "Want me to push this into a Figma file? (use the `figma-diagrams` skill)".
|
|
29
|
+
|
|
30
|
+
## Useful references in this skill
|
|
31
|
+
|
|
32
|
+
When you need a starting shape, copy from one of the templates rather than inventing notation from scratch โ it cuts down on syntax errors and keeps style consistent across diagrams.
|
|
33
|
+
|
|
34
|
+
- [`templates/mermaid-flowchart.md`](templates/mermaid-flowchart.md) โ basic boxes-and-arrows starter
|
|
35
|
+
- [`templates/mermaid-sequence.md`](templates/mermaid-sequence.md) โ sequenceDiagram with actors and async messages
|
|
36
|
+
- [`templates/mermaid-aws.md`](templates/mermaid-aws.md) โ AWS-flavoured flowchart using emojis as service icons
|
|
37
|
+
- [`templates/c4-container.puml`](templates/c4-container.puml) โ C4 container diagram skeleton (PlantUML)
|
|
38
|
+
|
|
39
|
+
Worked examples to learn from:
|
|
40
|
+
|
|
41
|
+
- [`examples/aws-three-tier.md`](examples/aws-three-tier.md) โ three-tier web app on AWS, Mermaid flowchart
|
|
42
|
+
- [`examples/microservices-sequence.md`](examples/microservices-sequence.md) โ order-placement flow across 4 services
|
|
43
|
+
- [`examples/c4-container-saas.md`](examples/c4-container-saas.md) โ SaaS app, C4 container level
|
|
44
|
+
|
|
45
|
+
## Quality bar
|
|
46
|
+
|
|
47
|
+
A good diagram from this skill should:
|
|
48
|
+
|
|
49
|
+
- **Fit on one screen.** If you have more than ~15 nodes, split into two diagrams (e.g., "Context" and "Container") rather than cramming everything in.
|
|
50
|
+
- **Show direction of data flow,** not just connections. Arrows should mean something.
|
|
51
|
+
- **Label every arrow** that crosses a trust boundary or a network hop.
|
|
52
|
+
- **Use subgraphs / groups** to make zones explicit (VPC, public/private subnets, account boundaries, on-prem vs cloud).
|
|
53
|
+
- **Be valid syntax.** Mentally trace through the Mermaid/PlantUML once before responding. Common breakers: unescaped `(` `)` `<` `>` inside labels, missing `end` for subgraphs, mixing graph types.
|
|
54
|
+
|
|
55
|
+
## What this skill does NOT do
|
|
56
|
+
|
|
57
|
+
- It doesn't render to PNG/SVG itself. To render, suggest the user use the Mermaid Live Editor (https://mermaid.live), the Mermaid CLI (`mmdc`), or the VS Code Mermaid preview.
|
|
58
|
+
- It doesn't push to Figma directly. For that, hand off to the [`figma-diagrams`](../figma-diagrams/SKILL.md) skill.
|
|
59
|
+
- It doesn't generate Visio/Lucid native files.
|
|
60
|
+
|
|
61
|
+
## Anti-patterns to avoid
|
|
62
|
+
|
|
63
|
+
- โ Inventing service names ("ServiceA", "ServiceB"). Use the user's vocabulary or ask.
|
|
64
|
+
- โ Putting every box at the top level. Group by concern.
|
|
65
|
+
- โ Mermaid flowchart with 30+ nodes โ split it.
|
|
66
|
+
- โ Using a sequence diagram when the user asked "what does the system look like" โ that's a structural question, use a flowchart or C4.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Example: Three-tier web app on AWS
|
|
2
|
+
|
|
3
|
+
**Prompt the user gave:** *"Draw me a three-tier web app on AWS with an ALB, two ECS services (web + worker), and an RDS Postgres backend."*
|
|
4
|
+
|
|
5
|
+
**Response:**
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
flowchart TB
|
|
9
|
+
Internet([๐ Internet])
|
|
10
|
+
|
|
11
|
+
subgraph AWS["โ๏ธ AWS us-east-1"]
|
|
12
|
+
subgraph VPC["๐ก๏ธ VPC 10.0.0.0/16"]
|
|
13
|
+
subgraph PubSub["Public subnet"]
|
|
14
|
+
ALB[๐ Application Load Balancer]
|
|
15
|
+
end
|
|
16
|
+
subgraph PrivSub["Private subnet"]
|
|
17
|
+
Web[๐ฆ ECS web service]
|
|
18
|
+
Worker[๐ฆ ECS worker service]
|
|
19
|
+
end
|
|
20
|
+
subgraph DataSub["Data subnet"]
|
|
21
|
+
RDS[(๐ RDS Postgres Multi-AZ)]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
SQS{{๐จ SQS jobs}}
|
|
25
|
+
S3[(๐ชฃ S3 user uploads)]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Internet -->|HTTPS 443| ALB
|
|
29
|
+
ALB -->|HTTP 8080| Web
|
|
30
|
+
Web -->|SQL| RDS
|
|
31
|
+
Web -->|enqueue| SQS
|
|
32
|
+
Worker -->|dequeue| SQS
|
|
33
|
+
Worker -->|SQL| RDS
|
|
34
|
+
Web -.signed URLs.-> S3
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Design notes:**
|
|
38
|
+
|
|
39
|
+
- **Why two ECS services and not one?** Long-running background work (image resize, email, exports) needs its own scaling profile and shouldn't share CPU with request-serving containers.
|
|
40
|
+
- **RDS Multi-AZ** for automatic failover โ single-AZ is fine for dev/test but rarely acceptable in production for a three-tier app.
|
|
41
|
+
- **Uploads bypass the API** via S3 pre-signed URLs to avoid a 100 MB file streaming through ECS containers.
|
|
42
|
+
- **No NAT gateway shown** โ add one (or VPC endpoints) if the private subnet containers need to reach S3/SQS over the AWS network without a public IP.
|
|
43
|
+
|
|
44
|
+
**Want to extend?** Common follow-ups: add CloudFront in front of ALB, add ElastiCache Redis for sessions, add WAF rules, split into multi-region active/passive.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Example: C4 container diagram for a SaaS app
|
|
2
|
+
|
|
3
|
+
**Prompt the user gave:** *"Give me a C4 container view of a B2B SaaS app โ single tenant per database schema, with Stripe for billing."*
|
|
4
|
+
|
|
5
|
+
**Response:**
|
|
6
|
+
|
|
7
|
+
```plantuml
|
|
8
|
+
@startuml
|
|
9
|
+
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
|
10
|
+
|
|
11
|
+
LAYOUT_WITH_LEGEND()
|
|
12
|
+
|
|
13
|
+
title Container diagram โ Acme SaaS
|
|
14
|
+
|
|
15
|
+
Person(admin, "Tenant admin", "Configures workspace, invites users")
|
|
16
|
+
Person(user, "End user", "Day-to-day usage")
|
|
17
|
+
|
|
18
|
+
System_Boundary(saas, "Acme SaaS") {
|
|
19
|
+
Container(web, "Web app", "Next.js", "Tenant-aware UI")
|
|
20
|
+
Container(api, "API", "Node, Fastify", "REST/JSON, business logic")
|
|
21
|
+
Container(worker, "Worker", "Python, Celery", "Async jobs, billing sync")
|
|
22
|
+
ContainerDb(db, "Tenant DB", "Postgres", "One schema per tenant")
|
|
23
|
+
ContainerDb(cache, "Cache", "Redis", "Session + rate-limit")
|
|
24
|
+
ContainerQueue(queue, "Job queue", "SQS", "Async work")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
System_Ext(stripe, "Stripe", "Subscriptions + invoicing")
|
|
28
|
+
System_Ext(idp, "Auth0", "OIDC identity provider")
|
|
29
|
+
System_Ext(post, "Postmark", "Transactional email")
|
|
30
|
+
|
|
31
|
+
Rel(admin, web, "Uses", "HTTPS")
|
|
32
|
+
Rel(user, web, "Uses", "HTTPS")
|
|
33
|
+
Rel(web, idp, "Auth (OIDC)", "HTTPS")
|
|
34
|
+
Rel(web, api, "Calls", "HTTPS / JSON")
|
|
35
|
+
Rel(api, db, "Reads/writes (per-tenant schema)", "SQL")
|
|
36
|
+
Rel(api, cache, "Reads/writes", "RESP")
|
|
37
|
+
Rel(api, queue, "Publishes", "HTTPS")
|
|
38
|
+
Rel(worker, queue, "Consumes", "HTTPS")
|
|
39
|
+
Rel(worker, db, "Reads/writes", "SQL")
|
|
40
|
+
Rel(worker, stripe, "Syncs subscriptions", "HTTPS")
|
|
41
|
+
Rel(worker, post, "Sends mail", "HTTPS")
|
|
42
|
+
Rel(stripe, api, "Webhooks (invoice.*)", "HTTPS")
|
|
43
|
+
@enduml
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Design notes:**
|
|
47
|
+
|
|
48
|
+
- **One schema per tenant** is shown via the relationship label on `api -> db` โ keeps the diagram clean while making the isolation strategy reviewable.
|
|
49
|
+
- **Webhooks back from Stripe** (note arrow reversal) โ a common trip-up; if it's missing, billing state drift is hard to debug.
|
|
50
|
+
- **Worker hits external services**, not the API โ avoids the API being a chokepoint for outbound integrations and keeps retries close to the queue.
|
|
51
|
+
- For **context-level** (one box per system, no internals), drop everything inside `System_Boundary` and replace with one `System(saas, ...)`. For **component-level** (one container's internals), drill into `api` with `C4_Component.puml`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Example: Order placement across microservices
|
|
2
|
+
|
|
3
|
+
**Prompt the user gave:** *"Show me the sequence of calls when a customer places an order โ we have an Order service, an Inventory service, a Payment service, and a Notification service."*
|
|
4
|
+
|
|
5
|
+
**Response:**
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
sequenceDiagram
|
|
9
|
+
autonumber
|
|
10
|
+
actor C as Customer
|
|
11
|
+
participant W as Web frontend
|
|
12
|
+
participant O as Order service
|
|
13
|
+
participant I as Inventory service
|
|
14
|
+
participant P as Payment service
|
|
15
|
+
participant N as Notification service
|
|
16
|
+
participant Q as Event bus
|
|
17
|
+
|
|
18
|
+
C->>W: Click "Place order"
|
|
19
|
+
W->>O: POST /orders
|
|
20
|
+
O->>I: Reserve(items)
|
|
21
|
+
alt items in stock
|
|
22
|
+
I-->>O: ReservationId
|
|
23
|
+
O->>P: Charge(amount, cardToken)
|
|
24
|
+
alt payment OK
|
|
25
|
+
P-->>O: PaymentId
|
|
26
|
+
O->>Q: Publish OrderPlaced
|
|
27
|
+
O-->>W: 201 Created
|
|
28
|
+
W-->>C: "Order confirmed"
|
|
29
|
+
Q-->>N: OrderPlaced
|
|
30
|
+
N->>C: Email + push notification
|
|
31
|
+
else payment declined
|
|
32
|
+
P-->>O: 402 Declined
|
|
33
|
+
O->>I: Release(reservationId)
|
|
34
|
+
O-->>W: 402 Payment failed
|
|
35
|
+
W-->>C: "Card declined"
|
|
36
|
+
end
|
|
37
|
+
else out of stock
|
|
38
|
+
I-->>O: 409 OutOfStock
|
|
39
|
+
O-->>W: 409 Unavailable
|
|
40
|
+
W-->>C: "Sold out"
|
|
41
|
+
end
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Design notes:**
|
|
45
|
+
|
|
46
|
+
- **Two-step inventory** (reserve โ confirm) avoids the classic race where two customers buy the last unit between stock-check and charge.
|
|
47
|
+
- **Compensating action** (`Release`) on payment failure โ explicit in the diagram so reviewers can spot the rollback gap if it's missing.
|
|
48
|
+
- **Notification is async** (event bus, dashed line) โ slow email shouldn't block the customer's response.
|
|
49
|
+
- **`autonumber`** makes every step referenceable in design-review comments ("what happens at step 8?").
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "architecture-diagrams",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generate architecture diagrams (Mermaid, PlantUML, C4) from a written description of a system. Supports AWS/Azure/GCP cloud topologies, microservice landscapes, sequence flows, container diagrams, and ER models. Use whenever the user asks for an architecture diagram, system sketch, flow diagram, or visualization of a design.",
|
|
5
|
+
"entrypoint": "SKILL.md",
|
|
6
|
+
"deps": {
|
|
7
|
+
"npm": [],
|
|
8
|
+
"pip": []
|
|
9
|
+
},
|
|
10
|
+
"env": {
|
|
11
|
+
"required": [],
|
|
12
|
+
"optional": []
|
|
13
|
+
},
|
|
14
|
+
"related": [
|
|
15
|
+
"figma-diagrams"
|
|
16
|
+
],
|
|
17
|
+
"tags": [
|
|
18
|
+
"diagrams",
|
|
19
|
+
"mermaid",
|
|
20
|
+
"plantuml",
|
|
21
|
+
"c4",
|
|
22
|
+
"architecture"
|
|
23
|
+
],
|
|
24
|
+
"model": {
|
|
25
|
+
"tier": "standard",
|
|
26
|
+
"rationale": "Prose to diagram syntax. Correctness matters; reasoning is bounded."
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@startuml
|
|
2
|
+
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
|
3
|
+
|
|
4
|
+
LAYOUT_WITH_LEGEND()
|
|
5
|
+
|
|
6
|
+
title Container diagram for <System name>
|
|
7
|
+
|
|
8
|
+
Person(user, "End user", "Description of who this is")
|
|
9
|
+
|
|
10
|
+
System_Boundary(sys, "<System name>") {
|
|
11
|
+
Container(web, "Web application", "React, TypeScript", "Customer-facing UI")
|
|
12
|
+
Container(api, "API", "Node, Express", "REST API, business logic")
|
|
13
|
+
Container(worker, "Background worker", "Python, Celery", "Async jobs, retries")
|
|
14
|
+
ContainerDb(db, "Primary DB", "PostgreSQL 16", "Customer + transactional data")
|
|
15
|
+
ContainerDb(cache, "Cache", "Redis 7", "Session + hot lookups")
|
|
16
|
+
ContainerQueue(queue, "Job queue", "RabbitMQ", "Async work coordination")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
System_Ext(stripe, "Stripe", "Payment provider")
|
|
20
|
+
System_Ext(ses, "AWS SES", "Transactional email")
|
|
21
|
+
|
|
22
|
+
Rel(user, web, "Uses", "HTTPS")
|
|
23
|
+
Rel(web, api, "Calls", "HTTPS / JSON")
|
|
24
|
+
Rel(api, db, "Reads/writes", "SQL/TCP")
|
|
25
|
+
Rel(api, cache, "Reads/writes", "RESP")
|
|
26
|
+
Rel(api, queue, "Publishes jobs", "AMQP")
|
|
27
|
+
Rel(worker, queue, "Consumes jobs", "AMQP")
|
|
28
|
+
Rel(worker, db, "Reads/writes", "SQL/TCP")
|
|
29
|
+
Rel(api, stripe, "Charges", "HTTPS / JSON")
|
|
30
|
+
Rel(worker, ses, "Sends email", "HTTPS / JSON")
|
|
31
|
+
@enduml
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# AWS-flavoured Mermaid starter
|
|
2
|
+
|
|
3
|
+
Mermaid doesn't ship native AWS icons, but emojis + clear naming get you 80% of the visual clarity for free, and the diagram still renders anywhere Markdown does.
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
flowchart TB
|
|
7
|
+
Internet([๐ Internet])
|
|
8
|
+
|
|
9
|
+
subgraph AWS["โ๏ธ AWS โ us-east-1"]
|
|
10
|
+
subgraph VPC["๐ก๏ธ VPC 10.0.0.0/16"]
|
|
11
|
+
subgraph Public["Public subnet"]
|
|
12
|
+
ALB[๐ ALB]
|
|
13
|
+
end
|
|
14
|
+
subgraph Private["Private subnet"]
|
|
15
|
+
ECS1[๐ฆ ECS web]
|
|
16
|
+
ECS2[๐ฆ ECS worker]
|
|
17
|
+
end
|
|
18
|
+
subgraph DataZone["Data"]
|
|
19
|
+
RDS[(๐ RDS Postgres)]
|
|
20
|
+
Redis[(โก ElastiCache)]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
S3[(๐ชฃ S3 assets)]
|
|
24
|
+
SQS{{๐จ SQS queue}}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Internet --> ALB --> ECS1
|
|
28
|
+
ECS1 --> Redis
|
|
29
|
+
ECS1 --> RDS
|
|
30
|
+
ECS1 --> SQS --> ECS2
|
|
31
|
+
ECS2 --> RDS
|
|
32
|
+
ECS1 -.reads.-> S3
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Service โ emoji cheat sheet
|
|
36
|
+
|
|
37
|
+
| Service | Emoji | Service | Emoji |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| EC2 / ECS / Fargate | ๐ฆ | RDS / Aurora | ๐ |
|
|
40
|
+
| Lambda | ฮป or โก | DynamoDB | ๐๏ธ |
|
|
41
|
+
| S3 | ๐ชฃ | ElastiCache | โก |
|
|
42
|
+
| ALB / NLB / API GW | ๐ | CloudFront | ๐ |
|
|
43
|
+
| SQS / SNS | ๐จ | EventBridge | ๐ |
|
|
44
|
+
| Cognito / IAM | ๐ | KMS | ๐ |
|
|
45
|
+
| Route 53 | ๐งญ | CloudWatch | ๐ |
|
|
46
|
+
|
|
47
|
+
## Tips
|
|
48
|
+
|
|
49
|
+
- Use `subgraph` to make VPC โ subnet โ service nesting visible โ it's the single biggest readability win.
|
|
50
|
+
- Mark public vs private subnets explicitly.
|
|
51
|
+
- Dotted arrows (`-.label.->`) for async / read-only / observability paths so the primary request path stays prominent.
|
|
52
|
+
- For multi-region, draw one region in detail and a thin "replica" box for the others, with a labeled arrow between them.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Mermaid flowchart starter
|
|
2
|
+
|
|
3
|
+
Use for: boxes-and-arrows structural diagrams. Top-down (`TD`) reads like a deployment stack; left-right (`LR`) reads like a request flow.
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
flowchart LR
|
|
7
|
+
User([User])
|
|
8
|
+
|
|
9
|
+
subgraph Edge["Edge"]
|
|
10
|
+
CDN[CDN]
|
|
11
|
+
WAF[WAF]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
subgraph App["App tier"]
|
|
15
|
+
LB[Load balancer]
|
|
16
|
+
Web1[Web server 1]
|
|
17
|
+
Web2[Web server 2]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
subgraph Data["Data tier"]
|
|
21
|
+
DB[(Primary DB)]
|
|
22
|
+
Cache[(Cache)]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
User --> CDN --> WAF --> LB
|
|
26
|
+
LB --> Web1 & Web2
|
|
27
|
+
Web1 & Web2 --> Cache
|
|
28
|
+
Web1 & Web2 --> DB
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Tips
|
|
32
|
+
|
|
33
|
+
- `[Box]` rectangle ยท `([Stadium])` user/external ยท `[(Cylinder)]` database ยท `{Diamond}` decision ยท `>Flag]` event
|
|
34
|
+
- Use `&` to fan-out from one source to many destinations: `LB --> Web1 & Web2 & Web3`
|
|
35
|
+
- Use `subgraph Name["Display label"]` to draw zones (VPC, account, region)
|
|
36
|
+
- Annotate links with `--label-->` to name the arrow
|
|
37
|
+
- Pick *one* direction (`TD`, `LR`) per diagram; mixing kills readability
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Mermaid sequence diagram starter
|
|
2
|
+
|
|
3
|
+
Use for: showing the **order** of messages between participants. Best when "who calls whom in what order" is the question.
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
sequenceDiagram
|
|
7
|
+
autonumber
|
|
8
|
+
actor User
|
|
9
|
+
participant Web as Web app
|
|
10
|
+
participant API as API gateway
|
|
11
|
+
participant Auth as Auth service
|
|
12
|
+
participant DB as Database
|
|
13
|
+
|
|
14
|
+
User->>Web: Click "sign in"
|
|
15
|
+
Web->>API: POST /login {email, pwd}
|
|
16
|
+
API->>Auth: Validate credentials
|
|
17
|
+
Auth->>DB: SELECT user WHERE email=?
|
|
18
|
+
DB-->>Auth: User row
|
|
19
|
+
Auth-->>API: JWT (15 min) + refresh
|
|
20
|
+
API-->>Web: Set-Cookie, 200 OK
|
|
21
|
+
Web-->>User: Dashboard
|
|
22
|
+
|
|
23
|
+
Note over API,Auth: All hops over mTLS
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Tips
|
|
27
|
+
|
|
28
|
+
- `->>` solid arrow (call) ยท `-->>` dashed arrow (return/async) ยท `-x` lost message
|
|
29
|
+
- `autonumber` adds 1, 2, 3 to each step โ great for design reviews
|
|
30
|
+
- `Note over A,B: text` annotates a span; `Note left of A: text` annotates one side
|
|
31
|
+
- `loop`, `alt`/`else`, `par` for control flow:
|
|
32
|
+
```
|
|
33
|
+
alt token valid
|
|
34
|
+
API-->>Web: 200
|
|
35
|
+
else token expired
|
|
36
|
+
API-->>Web: 401
|
|
37
|
+
end
|
|
38
|
+
```
|
|
39
|
+
- Don't overuse โ past ~12 messages it becomes a wall. Split into "happy path" and "error path" diagrams.
|