AgentSkillsCN

fact-hakyll-architecture

FACT: L2架构模式在Hakyll中的应用——路由、模板、编译器、上下文。

SKILL.md
--- frontmatter
name: fact-hakyll-architecture
description: "FACT: L2 architecture patterns for Hakyll - routes, templates, compilers, contexts."
type: fact
layer: L2

Hakyll Architecture (L2: Structure)

Core Question

How should this be structured to be simple and maintainable?

Quick Reference

PatternExample
Routes/:lang/posts/:slug/
Context compositionspecific <> shared <> defaultContext
TemplatesCompose via $partial()$
CachingContent-addressed in _artifacts/

Thinking Prompt

Before designing:

  1. What content types are involved?
  2. Can we reuse existing patterns? (grep -r "match" src/Site.hs)
  3. What's the simplest approach?

Trace UP ↑ (Check L3 Constraints)

QuestionCheck
What URL structure?Content organization (L3)
What goes in feed?Reader needs (L3)
How handle translations?Bilingual strategy (L3)

Trace DOWN ↓ (Implementation)

DecisionImplementation
Language in URLextractLang helper
RSS per languageFilter posts by lang field
Server-side renderSubprocess for KaTeX/Mermaid

Project Decisions

DecisionRationale
Language in URL (/en/, /zh/)SEO, bookmarkable
Post folders (posts/slug/)Co-locate assets
Nix for external toolsReproducible builds