slipstream
Expert assistance for Slipstream static site generation. Use when building static websites with Slipstream, a SwiftUI-like static site generator.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Expert assistance for Slipstream static site generation. Use when building static websites with Slipstream, a SwiftUI-like static site generator.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | slipstream |
| description | Expert assistance for Slipstream static site generation. Use when building static websites with Slipstream, a SwiftUI-like static site generator. |
You are an expert in the Slipstream static site generation framework. Slipstream is a SwiftUI-like declarative framework for building static HTML websites with Tailwind CSS integration.
View protocol to create HTML in a declarative, hierarchical mannerThe View protocol is the foundation of Slipstream:
public protocol View {
associatedtype Content: View
@ViewBuilder var body: Self.Content { get }
func render(_ container: Element) throws
}
body for custom views@ViewBuilder to enable declarative syntaxrender(_:environment:) when creating new HTML element typesSlipstream uses Swift result builders (@ViewBuilder) to enable hierarchical view construction. This allows:
if/elseForEachVStack(alignment:spacing:) - Vertical stack (maps to flex column)HStack(alignment:spacing:) - Horizontal stack (maps to flex row)Container - Tailwind CSS container for centered, max-width contentResponsiveStack - Adapts between vertical/horizontal based on breakpointsText("content") - Basic paragraph text (renders as <p>)H1, H2, H3, H4, H5, H6 - Heading elementsParagraph - Explicit paragraph wrapperBold, Strong, Italic, Emphasis - Text stylingCode, Variable, SampleOutput - Code-related elementsMarkdownText - Render Markdown as HTMLForm - Form containerTextField(name:type:placeholder:) - Text inputTextArea(name:placeholder:) - Multi-line textButton, SubmitButton, ResetButton - ButtonsCheckbox, RadioButton - Selection inputsPicker with Option and OptGroup - Dropdown selectsSlider, ColorPicker, FileInput - Specialized inputsLabel, Fieldset, Legend - Form organizationImage(URL) - ImagesPicture with Source - Responsive imagesAudio, Video with Source and Track - Media playbackCanvas - Canvas elementIFrame - Embedded contentHeader, Footer, Navigation - Page structureArticle, Section, Aside - Content organizationDocumentMain - Main content areaFigure, FigureCaption - Figures with captionsBlockquote - QuotationsList, ListItem - ListsDescriptionList, DescriptionTerm, DefinitionDescription - Definition listsTable, TableHeader, TableBody, TableFooter, TableRow, TableCell, TableHeaderCell - TablesDetails, Summary - Collapsible contentDivider - Horizontal ruleLineBreak - Line breakSVG, SVGCircle, SVGRect, SVGPath, SVGDefs, SVGLinearGradient, SVGStop - SVG graphicsMath, MRow, MI, MO, MN, MFrac, MSqrt, MSup, MSub - Mathematical notationComment("text") - HTML commentsDOMString("raw html") - Raw HTML injectionForEach(collection, id:) - Iterate over collections.fontSize(.extraLarge)
.fontWeight(.bold)
.bold()
.fontStyle(.italic)
.italic()
.fontDesign(.monospaced) // .serif, .sans
.fontLeading(.loose) // line height
.textAlignment(.center)
.textColor(.blue, shade: .x500)
.textDecoration(.underline) // .lineThrough
.listStyle(.disc) // .decimal, .none
.padding() // all edges
.padding(.horizontal, 16)
.padding(.vertical, 8)
.padding(.top, 4)
.margin(8)
.margin(.bottom, 16)
.frame(width: 48, height: 48)
.frame(minWidth: 48, maxWidth: 96)
.frame(minHeight: 100)
.textColor(.red, shade: .x500)
.backgroundColor(.blue, shade: .x100)
.background(.ultraThin) // material background
.border(1, .black)
.cornerRadius(.large)
.shadow(.large)
.outline(.solid, width: 2, color: .red)
.ring(width: 2, color: .blue)
.display(.block) // .flex, .grid, .none
.position(.absolute, edges: .top, 0)
.placement(top: 10, left: 10, zIndex: 10)
.zIndex(100)
.overflow(.scroll) // .hidden, .auto
.float(.left)
.visibility(.hidden)
.flexDirection(.row) // .column
.justifyContent(.spaceBetween) // .center, .start, .end
.alignItems(.center) // .start, .end, .baseline
.flexGap(16)
.gridCellColumns(2)
.gridCellRows(3)
.offset(x: 16, y: 32)
.opacity(0.5)
.colorInvert()
.animation(.easeIn(duration: 0.25))
.transition(.all)
.fontSize(.base)
.fontSize(.large, condition: .desktop)
.textColor(.blue)
.textColor(.red, condition: .hover)
Available conditions:
.mobile, .tablet, .desktop, .widescreen.hover, .focus, .active, .visited, .disabledSlipstream provides SwiftUI-like environment for passing data down the view hierarchy:
struct PathKey: EnvironmentKey {
static var defaultValue: String = "/"
}
extension EnvironmentValues {
var path: String {
get { self[PathKey.self] }
set { self[PathKey.self] = newValue }
}
}
struct MyView: View {
@Environment(\.path) var path
var body: some View {
Text("Current path: \(path)")
}
}
// Inject environment value
MyView()
.environment(\.path, "/home")
import Slipstream
struct HelloWorld: View {
var body: some View {
Text("Hello, world!")
}
}
let html = try renderHTML(HelloWorld())
print(html)
import Foundation
import Slipstream
let sitemap: Sitemap = [
"index.html": HomePage(),
"about/index.html": AboutPage(),
"blog/post-1.html": BlogPost(id: 1)
]
let outputURL = URL(filePath: #filePath)
.deletingLastPathComponent()
.deletingLastPathComponent()
.appending(path: "site")
try renderSitemap(sitemap, to: outputURL)
All views support W3C global attributes:
.id("unique-id")
.className("custom-class")
.title("Tooltip")
.data("key", "value")
.accessibilityLabel("Screen reader text")
.language("en")
.dir(.ltr) // .rtl
.contentEditable(.true)
.spellcheck(true)
.draggable(true)
.tabindex(1)
.disabled(true)
.hidden()
.inert(true)
.autofocus(true)
Break complex views into smaller, reusable components:
struct Navigation: View {
var body: some View {
Header {
HStack {
Link("Home", destination: "/")
Link("About", destination: "/about")
}
}
}
}
struct HomePage: View {
var body: some View {
Navigation()
DocumentMain {
H1("Welcome")
Text("Home page content")
}
}
}
Choose semantic elements over generic containers:
Header, Footer, Navigation, Article instead of generic divsH1-H6 for headings, not styled TextStrong for semantic emphasis, Bold for visual onlyApply responsive modifiers for different screen sizes:
Text("Responsive")
.fontSize(.base)
.fontSize(.large, condition: .tablet)
.fontSize(.extraLarge, condition: .desktop)
.padding(4)
.padding(8, condition: .tablet)
Remember that Slipstream uses Tailwind's predefined sizes, not exact pixel values. The framework finds the closest Tailwind class to requested values.
Use environment for configuration that needs to flow down the hierarchy:
struct Theme {
var primaryColor: TailwindColor
var accentColor: TailwindColor
}
// Define environment key, inject at top level, read in child views
struct PageTemplate<Content: View>: View {
let title: String
@ViewBuilder let content: () -> Content
var body: some View {
Container {
Header {
Navigation {
Link("Home", destination: "/")
Link("About", destination: "/about")
}
}
DocumentMain {
H1(title)
content()
}
Footer {
Text("© 2025 My Site")
}
}
}
}
// Usage
PageTemplate(title: "About") {
Text("About page content")
}
struct Card<Content: View>: View {
@ViewBuilder let content: () -> Content
var body: some View {
VStack(alignment: .leading, spacing: 16) {
content()
}
.padding(24)
.backgroundColor(.white)
.cornerRadius(.large)
.shadow(.medium)
}
}
struct Hero: View {
let title: String
let subtitle: String
var body: some View {
VStack(alignment: .center, spacing: 24) {
H1(title)
.fontSize(.extraLarge5)
.fontWeight(.bold)
.textColor(.gray, shade: .x900)
Text(subtitle)
.fontSize(.extraLarge)
.textColor(.gray, shade: .x600)
}
.padding(.vertical, 96)
.textAlignment(.center)
}
}
// swift-tools-version: 5.10
import PackageDescription
let package = Package(
name: "mysite",
platforms: [
.macOS("14"),
.iOS("17"),
],
dependencies: [
.package(url: "https://github.com/jverkoey/slipstream.git", branch: "main"),
],
targets: [
.executableTarget(name: "mysite", dependencies: [
.product(name: "Slipstream", package: "slipstream"),
]),
]
)
tailwind.config.js:
module.exports = {
content: ["./site/**/*.html"],
theme: {
extend: {},
},
plugins: [],
}
tailwind.css:
@tailwind base;
@tailwind components;
@tailwind utilities;
swift run && npx tailwindcss -i tailwind.css -o ./site/output.css --minify
Available colors: .black, .white, .gray, .red, .orange, .amber, .yellow, .lime, .green, .emerald, .teal, .cyan, .sky, .blue, .indigo, .violet, .purple, .fuchsia, .pink, .rose
Shades: .x50, .x100, .x200, .x300, .x400, .x500, .x600, .x700, .x800, .x900, .x950
.extraSmall, .small, .base, .large, .extraLarge, .extraLarge2, .extraLarge3, .extraLarge4, .extraLarge5, .extraLarge6, .extraLarge7, .extraLarge8, .extraLarge9
.thin, .extraLight, .light, .normal, .medium, .semibold, .bold, .extraBold, .black
Common values: 0, 1, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 56, 64, 96, 128
.small, .medium, .large, .extraLarge, .extraLarge2, .inner, .none
.none, .small, .medium, .large, .extraLarge, .extraLarge2, .extraLarge3, .full
Use this skill when:
The complete Slipstream documentation is available at:
Local documentation is in: Sources/Slipstream/Documentation.docc/