Five engineering primitives for batch structured content generation — Schema First, Anti-Pollution, Tiered Audit, Single Truth Registry, Tier Retry. Use when generating 50+ structured content cards (法律条文 / 词条 / 商品 / 报告 / 菜谱 / etc.) and needing reproducible quality at scale.
Resources
13Install
npx skillscat add asteriya-phd/structured-content-factory Install via the SkillsCat registry.
🌐 English | 中文
Structured Content Factory
Five primitives distilled from running 600+ pages of batch structured content through real LLM pipelines. Pick the primitives that fit; skip the rest.
The Five Primitives
- Schema First — design the JSON schema + validation rules before writing prompts. Schema is the contract; prompts serve it.
- Anti-Pollution — block 4 recurring LLM failure modes before they reach the audit stage.
- Tiered Audit — Layer 1 heuristic (free, 1s/item) + Layer 2 LLM (smart-routed, ~30% of items). ROI: 60-70% cost reduction vs. blanket LLM audit.
- Single Truth Registry — one git-tracked JSON file as the canonical state of every item across sessions. Replaces ad-hoc test_results/ folders.
- Tier Retry — Tier 1 (5 min, fix weak fields) / Tier 2 (20 min, full rewrite) / Tier 3 (≤45 min, flag
irreducible-<Y>and skip).
Read `references/01-schema-first.md` through 05-tier-retry.md for the full anatomy.
Quick Start (5 minutes)
# 1. Clone
git clone https://github.com/liuzhewen/structured-content-factory.git
cd structured-content-factory
# 2. Run L1 audit on a demo domain
python3 scripts/smart_audit.py --curated examples/classical-poetry/data --dry-run --json
# 3. Apply audit + build registry
python3 scripts/smart_audit.py --curated examples/classical-poetry/data
python3 scripts/update_registry.py --rebuild --curated examples/classical-poetry/data
# 4. Verify
python3 scripts/validate_registry.py examples/classical-poetry/registry.json --strictSee `docs/quickstart.md` for the full walkthrough.
CLI Cheatsheet
| Script | Common Flags |
|---|---|
smart_audit.py |
--curated <dir> --dry-run --json --limit N --sample-rate 0.1 --force |
update_registry.py |
--rebuild --from-file <path> --from-dir <dir> --from-stdin --stats |
validate_registry.py |
<registry.json> --strict --stats |
backfill_fields.py |
--curated <dir> --check --apply --only <fields> |
When This Skill Fits
✅ You are producing 50+ structured content cards (any domain).
✅ Items share a schema (12-20 fields each).
✅ You need reproducible quality scoring, not "looks good".
✅ Single-source-of-truth state matters (cross-session, cross-team).
❌ You are writing 1-10 hand-crafted articles — skip this skill.
❌ Your content has no schema — start with references/01-schema-first.md before anything else.
Boundaries (what this is NOT)
- ❌ Not an LLM provider wrapper. Use any LLM SDK; scripts only route calls.
- ❌ Not a frontend renderer. Render however you like.
- ❌ Not a governance framework. No release gates, no claim guards, no evidence ledger.
- ❌ Not gaokao-specific. Generic 5 primitives work for any batch content domain.
Extension Points
Override 4 hooks in your project's config:
style_to_category_map— style label → categorycategory_keywords— title/category keywords → subcategory regexcategory_palette— category → theme_palettel1_rules_path— path to your domain-specific anti-pollution rules YAML
See `docs/architecture.md` for how to wire them.