Enforces Divio documentation standards when writing or updating iOS SDK documentation. Use this skill whenever a user mentions writing docs, updating documentation, adding a new feature, creating a tutorial, writing a how-to, adding API reference, or any task that involves documentation for the iOS SDK. Triggers on phrases like "write docs", "document this", "add a tutorial", "update the README", "write a guide", "new feature docs", "API reference", "explain how to use", or any commit/PR that touches source code and needs corresponding documentation. This skill must be used even if the user only asks for "a quick doc update" — Divio compliance is non-negotiable.
This skill enforces the Divio Documentation System — a framework that organizes all documentation into four distinct types. Each type serves a different user need and must never be mixed together.
Core Rule: Every doc artifact you produce must belong to exactly one Divio quadrant. Never blend types in a single document. If content spans multiple types, split it.
| Type | Oriented toward | Answers | Analogy |
|---|---|---|---|
| Tutorial | Learning | "How do I get started?" | Teaching a child to cook |
| How-To Guide | Tasks | "How do I solve X?" | A recipe |
| Explanation | Understanding | "Why does it work this way?" | An essay |
| API Reference | Information | "What does X do exactly?" | An encyclopedia entry |
Every document that describes a flow, lifecycle, or architecture must include a Mermaid diagram. This is mandatory, not optional.
| Scenario | Mermaid type | Example |
|---|---|---|
| Multi-party communication (SDK ↔ backend ↔ PSP) | sequenceDiagram | Card tokenization flow |
| State transitions (pending → authorized → captured) | stateDiagram-v2 | Payment lifecycle |
| Decision logic (if card → do X, if PayPal → do Y) | flowchart TD | Payment method routing |
| Module/layer relationships | classDiagram or graph TD | SDK architecture layers |
Merchant App, Payrails SDK, Payrails API, PSP — not
abbreviations like MA, PS, PA.```mermaid
sequenceDiagram
participant App as Merchant App
participant SDK as Payrails SDK
participant API as Payrails API
participant PSP as Payment Provider
App->>SDK: tokenizeCard(cardData)
SDK->>API: POST /tokens
API->>PSP: Forward card data
PSP-->>API: Token response
API-->>SDK: PaymentToken
SDK-->>App: .success(token)
```
The iOS SDK already has flat docs in docs/ and structured docs in docs/public/
and docs/internal/. When creating or updating documentation:
docs/public/ — these are merchant-facing.docs/internal/ — these are for SDK contributors.docs/ root are legacy and should be left as-is.Before writing anything, identify what triggered the doc task:
Before creating new files, check if a relevant doc already exists:
Fill in every section of the appropriate quadrant template. Do not skip sections — if content is thin, that signals the feature needs more thought, not that sections should be omitted.
For any document that describes a flow, lifecycle, or multi-step process:
After writing, run through the checklist below before declaring the doc complete.
When a new feature is added to the SDK, all four of the following must exist or be created:
[ ] TUTORIAL entry or update
- Does the getting-started tutorial still work end-to-end with this feature available?
- If the feature is significant, does it deserve its own tutorial?
[ ] HOW-TO GUIDE
- At least one guide showing the most common use case for the feature
- Title must start with "How to..."
- Must include a Mermaid diagram if the feature involves a multi-step flow
[ ] EXPLANATION
- Why was this feature designed this way?
- What problem does it solve? What tradeoffs were made?
- What should users understand conceptually before using it?
- Must include a Mermaid diagram for architecture or state-related concepts
[ ] API REFERENCE
- Every public function, class, method, parameter, return type, and thrown error
- Must be generated from or consistent with Swift source code
- Includes a short Swift example per function/method
If any quadrant is missing, the documentation task is incomplete. Flag this explicitly in your response: "Missing: Explanation doc for [feature]. Creating now."
docs/
├── public/ ← Merchant-facing documentation
│ ├── quick-start.md ← Tutorial: primary onboarding
│ ├── concepts.md ← Explanation: core concepts
│ ├── sdk-api-reference.md ← Reference: full API surface
│ ├── merchant-styling-guide.md ← How-To: customizing UI
│ ├── how-to-tokenize-card.md ← How-To: card tokenization
│ ├── how-to-query-session-data.md ← How-To: querying session data
│ ├── how-to-update-checkout-amount.md ← How-To: updating amounts
│ └── troubleshooting.md ← Reference: common issues
│
├── internal/ ← Contributor documentation
│ ├── architecture.md ← Explanation: SDK internals
│ ├── coding-guidelines.md ← Reference: code standards
│ ├── error-handling.md ← Explanation: error strategy
│ ├── merchant-usage-guide.md ← How-To: integration patterns
│ ├── payrails-query-extension-guide.md ← How-To: query extensions
│ ├── public-api-audit.md ← Reference: API audit trail
│ └── releasing.md ← How-To: release process
│
└── *.md ← Legacy flat docs (do not modify)
Never mix quadrant types in one document. A How-To that turns into an explanation halfway through is wrong. Split it.
Tutorials must always work. Every Swift snippet in a tutorial must be compilable and correct. Never write tutorial code you haven't mentally traced through completely.
How-To Guides assume competence. Do not explain concepts in a How-To. Link to the Explanation instead.
API Reference is descriptive, not instructional. It describes what exists, not what to do. No "you should" language. No narrative.
Explanations have no steps. If you find yourself writing numbered steps in an Explanation, stop — that content belongs in a How-To or Tutorial.
Every public API surface must be documented. If code is exported/public and undocumented, flag it and create the Reference entry.
Swift only. No Objective-C examples, ever. All code must be idiomatic Swift.
Diagrams are mandatory for flows. Any document describing a payment flow, lifecycle, authentication sequence, or multi-step process must include at least one Mermaid diagram. A flow doc without a diagram is incomplete.
[ ] Document belongs to exactly ONE Divio quadrant
[ ] Title clearly signals the quadrant type
[ ] All Swift code compiles and is idiomatic
[ ] No Objective-C anywhere
[ ] Flow-oriented docs include at least one Mermaid diagram
[ ] Diagrams appear BEFORE the prose that explains them
[ ] Diagrams have ≤ 12 nodes and use full labels (not abbreviations)
[ ] Cross-references link to the correct quadrant (How-To links to Explanation, not vice versa)
[ ] No concepts explained inside a How-To (link to Explanation instead)
[ ] No steps inside an Explanation (move to How-To)
[ ] API Reference entries match current Swift source signatures
[ ] File is in the correct directory (public/ or internal/)