From economist-agents
Codify editorial failure patterns as deterministic prevention rules. Use when a new bug pattern is detected by the editorial judge, when adding post-mortem rules after a defective article ships.
npx claudepluginhub oviney/economist-agentsThis skill uses the workspace's default tool permissions.
Automatically converts detected failure patterns into deterministic prevention rules so future articles avoid the same defect. Closes the feedback loop between detection and prevention.
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Guides strict Test-Driven Development (TDD): write failing tests first for features, bugfixes, refactors before any production code. Enforces red-green-refactor cycle.
Share bugs, ideas, or general feedback.
Automatically converts detected failure patterns into deterministic prevention rules so future articles avoid the same defect. Closes the feedback loop between detection and prevention.
economist-writing1. Editorial Judge detects failure
↓
2. Log failure pattern to logs/defect_patterns.json
↓
3. Pattern analysis: new or known?
↓
4. If new → generate prevention rule method
↓
5. Add to DefectPrevention.check_all()
↓
6. Add deterministic fix to stage4_crew._apply_editorial_fixes() if possible
↓
7. Write test in tests/test_defect_prevention.py
↓
8. Next article benefits from prevention
Each prevention rule is a method on DefectPrevention that:
content: str and optional metadata: dictlist[str] of violation messages (empty if clean)"[SEVERITY] Description (Pattern: BUG-NNN-pattern)"def _check_layout_field(self, content: str) -> list[str]:
"""BUG-028 prevention: Ensure layout: post in frontmatter."""
if content.startswith("---"):
parts = content.split("---", 2)
if len(parts) >= 3 and "layout:" not in parts[1]:
return ["[CRITICAL] Missing layout: post in frontmatter (Pattern: BUG-028-pattern)"]
return []
{
"patterns": [
{
"id": "PATTERN-001",
"detected_by": "editorial_judge",
"check_name": "image_exists",
"failure_message": "Image not found: /assets/images/test.png",
"article": "2026-04-04-article.md",
"timestamp": "2026-04-04T12:00:00Z",
"prevention_rule_added": true,
"rule_location": "defect_prevention_rules.py::_check_image_path"
}
]
}
| Rationalization | Reality |
|---|---|
| "This bug only happened once" | If it happened once without a rule, it will happen again — codify it |
| "The LLM can just learn not to do that" | LLMs have no memory between runs; only deterministic rules persist |
| "We'll fix it in code review" | Human review doesn't scale; automated prevention catches 100% of known patterns |
| "The rule is too strict" | Better to have a false positive that gets refined than a missed defect in production |
check_all() but no corresponding test written[SEVERITY] ... (Pattern: BUG-NNN))DefectPrevention class with _check_ prefixcheck_all() — evidence: grep shows the method in the call chaintests/test_defect_prevention.py covering both pass and fail caseslogs/defect_patterns.json with prevention_rule_added: truestage4_crew._apply_editorial_fixes()scripts/defect_prevention_rules.py — add new _check_* methodssrc/crews/stage4_crew.py — add deterministic fixes to _apply_editorial_fixes()scripts/publication_validator.py — add validation checksscripts/editorial_judge.py — source of failure patterns