Agent Skills Pipeline v1.0

8-stage pipeline: Scout → Filter → Reader → Extractor → Score → Generator → Reviewer → Publisher
- Scout: GitHub search with token auth + rate limit retry
- Filter: Deterministic rules (language, stars, age, keywords)
- Reader: Incremental context loading (README → docs → examples → code)
- Extractor: LLM workflow extraction with JSON retry
- Score: Rule-based evaluation (no LLM)
- Generator: Standardized Hermes Skill format
- Reviewer: Independent LLM review (separate from generator)
- Publisher: Branch + PR to Gitea

First run: 5 repos discovered, 0 extracted (correct — all frameworks, no workflows)
This commit is contained in:
VPS admin
2026-08-05 05:51:06 +00:00
commit 8da8d703da
25 changed files with 1159 additions and 0 deletions
+103
View File
@@ -0,0 +1,103 @@
"""Stage 6: Skill Generator — Transform workflow into standardized Hermes Skill."""
import yaml
import json
def generate_skill(score_result, config):
"""
Generate a standardized Hermes Skill package from an approved workflow.
"""
if score_result.get("decision") != "PASS":
return {
"status": "BLOCKED",
"reason": "Score check failed",
}
workflow = score_result.get("workflow", {})
skill_name = workflow.get("skill_name", "unknown").lower().replace(" ", "-").replace("_", "-")
repo = score_result.get("repository", "")
# Generate SKILL.md (frontmatter + markdown body)
frontmatter = {
"name": skill_name,
"version": "1.0.0",
"description": workflow.get("goal", ""),
"inputs": workflow.get("inputs", []),
"steps": workflow.get("steps", []),
"outputs": workflow.get("outputs", []),
"tags": [],
"metadata": {
"source_repo": repo,
"extracted_at": "",
"confidence": workflow.get("confidence", 0),
},
}
skill_md = "---\n"
skill_md += yaml.dump(frontmatter, default_flow_style=False, sort_keys=False)
skill_md += "---\n\n"
skill_md += f"# {skill_name}\n\n"
skill_md += f"{workflow.get('goal', '')}\n\n"
skill_md += f"## Steps\n\n"
for i, step in enumerate(workflow.get("steps", []), 1):
skill_md += f"{i}. {step}\n"
skill_md += f"\n## Inputs\n\n"
for inp in workflow.get("inputs", []):
skill_md += f"- {inp}\n"
skill_md += f"\n## Outputs\n\n"
for out in workflow.get("outputs", []):
skill_md += f"- {out}\n"
skill_md += f"\n## Failure Modes\n\n"
for fm in workflow.get("failure_modes", []):
skill_md += f"- {fm}\n"
skill_md += f"\n## Source\n\n"
skill_md += f"Extracted from: [{repo}]({repo})\n"
skill_md += f"Confidence: {workflow.get('confidence', 0)}\n"
# Generate examples.md
examples_md = f"# Examples: {skill_name}\n\n"
examples_md += f"## Usage Example\n\n"
examples_md += f"```python\n# How to use this skill\n# Inputs: {', '.join(workflow.get('inputs', []))}\n# Process: {''.join(workflow.get('steps', [])[:3])}\n# Outputs: {', '.join(workflow.get('outputs', []))}\n```\n"
# Generate commands.md
commands_md = f"# Commands: {skill_name}\n\n"
commands_md += f"## Available Commands\n\n"
commands_md += f"- `/skill {skill_name}` — Load this skill\n"
commands_md += f"- `/run {skill_name}` — Execute workflow\n"
# Generate metadata.json
metadata = {
"name": skill_name,
"version": "1.0.0",
"goal": workflow.get("goal", ""),
"inputs": workflow.get("inputs", []),
"steps": workflow.get("steps", []),
"outputs": workflow.get("outputs", []),
"failure_modes": workflow.get("failure_modes", []),
"confidence": workflow.get("confidence", 0),
"explanation": workflow.get("explanation", ""),
"source_repo": repo,
"score": score_result.get("score", 0),
}
# Generate tests.md
tests_md = f"# Tests: {skill_name}\n\n"
tests_md += f"## Test Checklist\n\n"
tests_md += f"- [ ] Workflow has at least 3 steps\n"
tests_md += f"- [ ] All inputs are defined\n"
tests_md += f"- [ ] All outputs are defined\n"
tests_md += f"- [ ] Failure modes are documented\n"
tests_md += f"- [ ] Skill can be loaded without errors\n"
return {
"status": "GENERATED",
"skill_name": skill_name,
"repository": repo,
"files": {
"SKILL.md": skill_md,
"examples.md": examples_md,
"commands.md": commands_md,
"metadata.json": json.dumps(metadata, indent=2),
"tests.md": tests_md,
},
"metadata": metadata,
}