Expert assistant for working with Saga, a Swift-based static site generator with a strongly-typed Reader → Processor → Writer pipeline architecture
This skill provides expert guidance for working with Saga, a static site generator written in Swift that emphasizes strong typing, testability, and extensible plugin architecture.
Assists developers working with the Saga static site generator by providing context-aware guidance on its architecture, development workflows, and best practices. Saga follows a Reader → Processor → Writer pipeline pattern with compile-time type safety for content metadata.
When helping users work with Saga projects, follow these guidelines:
Before making changes, familiarize yourself with these key directories:
Use these commands for common tasks:
**Building and Testing:**
```bash
swift build
swift test
```
**Running the Development Server:**
```bash
swift run watch --watch content --watch Sources --output deploy
swift run watch --watch content --output deploy --ignore "*.tmp"
swift run watch content Sources deploy
```
**Documentation:**
```bash
./generate_docs.sh
```
Saga follows a three-stage pipeline:
**Stage 1: Readers**
**Stage 2: Processors**
**Stage 3: Writers**
**Item System:**
**Processing Pipeline:**
**I/O Abstraction:**
When implementing Saga pipelines, follow this pattern:
```swift
try await Saga(input: "content", output: "deploy")
.register(
folder: "articles",
metadata: ArticleMetadata.self,
readers: [.parsleyMarkdownReader],
itemProcessor: customProcessor,
filter: \.public,
writers: [
.itemWriter(swim(renderArticle)),
.listWriter(swim(renderArticles), paginate: 20),
.tagWriter(swim(renderTag), tags: \.metadata.tags)
]
)
.run()
.staticFiles()
```
When suggesting changes or implementations:
**Adding a new content type:**
1. Define a metadata struct conforming to `Metadata`
2. Register folder with appropriate reader
3. Create writer functions for rendering
4. Add tests with sample content
**Customizing rendering:**
1. Choose renderer (Swim for type-safe, Stencil for templates)
2. Implement render functions matching writer type
3. Use appropriate rendering context (item, list, tag, year, feed)
**Extending functionality:**
1. Consider plugin architecture for readers/renderers
2. Implement as external package if reusable
3. Follow existing patterns in plugin packages
**Example 1: Checking build status**
```bash
swift build
swift test
```
**Example 2: Starting development with live reload**
```bash
swift run watch --watch content --watch Sources --output deploy
```
**Example 3: Understanding a writer configuration**
When you see:
```swift
.tagWriter(swim(renderTag), tags: \.metadata.tags)
```
This creates a tag-based writer that:
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/saga-static-site-generator-helper/raw