Agent Skillsyifanfeng97/Hyper-Extract › template-optimizer

template-optimizer

GitHub

自动分析并优化YAML模板,应用最佳实践修复命名、多语言一致性、字段数量及结构分离等问题。适用于模板创建后或审查阶段的质量提升与Lint检查。

hyperextract-skills/template-optimizer/SKILL.md yifanfeng97/Hyper-Extract

Trigger Scenarios

optimize template fix YAML issues improve quality lint template

Install

npx skills add yifanfeng97/Hyper-Extract --skill template-optimizer -g -y
More Options

Non-standard path

npx skills add https://github.com/yifanfeng97/Hyper-Extract/tree/main/hyperextract-skills/template-optimizer -g -y

Use without installing

npx skills use yifanfeng97/Hyper-Extract@template-optimizer

指定 Agent (Claude Code)

npx skills add yifanfeng97/Hyper-Extract --skill template-optimizer -a claude-code -g -y

安装 repo 全部 skill

npx skills add yifanfeng97/Hyper-Extract --all -g -y

预览 repo 内 skill

npx skills add yifanfeng97/Hyper-Extract --list

SKILL.md

Frontmatter
{
    "name": "template-optimizer",
    "description": "Optimize YAML templates for Hyper-Extract.\nUse when: \"optimize template\", \"fix YAML issues\", \"improve quality\", \"lint template\"\nTrigger: After creating templates or during review\nSkip: Creating new templates (use brainstorm + designer instead)"
}

Template Optimizer

Automatically analyze and optimize YAML templates by applying best practices and fixing common issues.

Workflow

1. Parse YAML → 2. Analyze Issues → 3. Apply Fixes → 4. Generate Report

Step 1: Parse YAML

Load the YAML template and validate basic structure.

Step 2: Analyze Issues

Check against these rules:

Rule What to Check
rules-naming.md Field naming standardization
rules-multilingual.md Language consistency
rules-field-count.md Information density
rules-consistency.md Schema vs Guideline separation
rules-hypergraph-grouping.md Hypergraph grouping strategy

Step 3: Apply Fixes

Apply fixes based on optimization level:

Level Description Example
Auto-fix Safe changes that always improve relation_typetype
Suggest Changes that may need review Field count > 5
Review Design decisions Relation type openness

Step 4: Generate Report

Output changes with explanations for learning.


Detection Rules

Rule 1: Multi-language Consistency

❌ Pattern: [a-zA-Z]+\([^)]+\) in zh fields
❌ Pattern: Chinese chars in en fields

Fix: Separate language content, use pure Chinese in zh, pure English in en.

Rule 2: Field Naming

❌ relation_type → type
❌ event_date → time
❌ entity_type → type

Fix: Standardize to concise names.

Rule 3: Field Count

⚠️ entities.fields > 5 → Flag for review
⚠️ relations.fields > 5 → Flag for review

Fix: Simplify to essential fields, use priority: Essential → Important → Optional.

Rule 4: Schema-Guideline Separation

❌ Repetition of field definitions in guideline
❌ Schema descriptions in rules

Fix: Schema defines WHAT, Guideline defines HOW TO DO WELL.

Rule 5: Hypergraph Grouping

❌ relation_members: participants (string) + role field exists
❌ relation_id contains participant field

Fix: Use nested grouping relation_members: [group_a, group_b] when entities partition by roles.


Design Principles

Schema vs Guideline

Schema Defines Guideline Defines
Field names Extraction strategy
Field types Quality requirements
Field descriptions Creation conditions
Required/optional Common mistakes

❌ Wrong: Guideline repeats schema definitions ✅ Correct: Guideline explains how to extract well

Information Density

For entities and relations:

Field Priority Examples
Essential source, target, participants
Important type, time, location
Optional description, metadata

Max: 5 fields per component

Naming Conventions

For Use Example
Template name CamelCase EarningsSummary
Field names snake_case company_name
Tags lowercase finance, investor

Reference Files

Topic When to Check
rules-naming.md Field naming issues
rules-multilingual.md Language consistency
rules-field-count.md Too many fields
rules-consistency.md Schema-guideline overlap
rules-hypergraph-grouping.md Role field vs nested grouping

Output Format

# Optimization Report

## Changes Made

| File | Issue | Fix | Level |
|------|-------|-----|-------|
| template.yaml | `relation_type` | renamed to `type` | Auto-fix |
| template.yaml | Mixed language | Fixed zh/en separation | Auto-fix |
| template.yaml | 7 relation fields | Suggested simplification | Suggest |

## Summary

- Auto-fix: 2
- Suggestions: 1
- Manual review: 0

Integration

Full workflow: brainstorm → designer → optimizer → validator
                           ↓
                    Apply best practices
                    Auto-fix common issues

When to use:

  • After creating new templates
  • Before validator
  • During template review
  • Batch optimization of existing templates

Version History

  • e698804 Current 2026-07-25 05:14

Same Skill Collection

hyperextract-skills/brainstorm/SKILL.md
hyperextract-skills/graph-designer/SKILL.md
hyperextract-skills/multilingual/SKILL.md
hyperextract-skills/record-designer/SKILL.md
hyperextract-skills/SKILL.md
hyperextract-skills/yaml-validator/SKILL.md

Metadata

Files
0
Version
ecba6c5
Hash
239d3b07
Indexed
2026-07-25 05:14

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 08:00
浙ICP备14020137号-1 $mapa de visitantes$