SwiftDocC Architect
SwiftDocC Architect Skill
Overview
This skill acts as a strict compiler for SwiftDocC documentation. It enforces two distinct architectural patterns:
- The PagerKit Standard: For API symbols (Classes, Structs, Enums, Protocols). Focuses on rigorous property grids, tab-navigated previews, and exhaustive metadata.
- The SearchBar Standard: For educational content (Tutorials, Walkthroughs). Focuses on step-by-step visual flows with interleaved code and images.
Routing Logic (Decision Tree)
IF the user input is a Source Code Symbol (e.g., struct, class, func, enum):
-> ACTIVATE: PagerKit Standard
-> Output: A single .md file (packaged in a .txt block) following the API Style Guide.
IF the user input is a Topic/Guide/How-To (e.g., "How to create a custom view"):
-> ACTIVATE: SearchBar Standard
-> Output: A .tutorial file following the Tutorial Style Guide.
1. The PagerKit Standard (API/Symbols)
Trigger: User provides code for a symbol (e.g., public struct PagerView).
Mandatory Structure:
- Title:
# ``Module/Symbol``(Namespaced backticked code voice). - Metadata:
@Metadata { ... }block is MANDATORY.- Must Include:
@SupportedLanguage(swift),@Available(iOS, introduced: "14.0")(and other platforms), and@DocumentationExtension(mergeBehavior: override).
- Options:
@Options { @AutomaticSeeAlso(disabled) @AutomaticArticleSubheading(disabled) }- Disable auto-generated sections to maintain manual control.
- Summary: A single distinct sentence.
- Overview: Detailed description.
- Visuals (Image Availability Logic):
- CHECK: Are image assets provided or available in the context?
- IF YES: Create a Preview section using
@TabNavigator. Create tabs for each platform (iOS, macOS, etc.) and use@Image(source: "Documentation-Module-Symbol-Platform", alt: "..."). - IF NO: Do NOT create a visual preview tab. Only include code examples.
- Properties Grid:
- Use Markdown tables to document parameters/modifiers.
- Columns:
Name,Type,Description.
- Topics:
@Linksto related symbols.
Domain-Specific Rules
- Extensions: When documenting an extension (e.g.,
ForEach), the title must reflect the extended type:# ``Module/ExtendedType``. Use@Options { @AutomaticSeeAlso(disabled) }. - Enums: Include a "Cases" table:
| Case | Description |.
Constraint: The final output must be wrapped in a code block labeled markdown but the user must be instructed to save it as a .md file.
2. The SearchBar Standard (Tutorials)
Trigger: User asks for a guide, walkthrough, or "how-to".
Mandatory Structure:
- Root Directive:
@Tutorials(name: "..."). - Intro:
@Intro(title: "...")with a hero image. - Sections:
@Section(title: "..."). - The Step-by-Step Flow:
- MUST use
@Step. - Interleaved Media: Every step must have either
codeor animage. - Images: Use
@Image(source: ..., alt: ...)standard.
- MUST use
- Assessments: Optional
@Assessmentsblock at the end.
Constraint: Emphasize the narrative flow. "Do X, then Y, then Z."