feat(quality): add skill completeness checks (#207)

Add _check_skill_completeness() method to quality checker that validates:
- Prerequisites/verification sections (helps Claude check conditions first)
- Error handling/troubleshooting guidance (common issues and solutions)
- Workflow steps (sequential instructions using first/then/next/finally)

This addresses G2.3 and G2.4 from the roadmap:
- G2.3: Add readability scoring (via workflow step detection)
- G2.4: Add completeness checker

New checks use info-level messages (not warnings) to avoid affecting
quality scores for existing skills while still providing helpful guidance.

Includes 4 new unit tests for completeness checks.

Contributed by the AI Writing Guide project.
This commit is contained in:
Joseph Magly
2026-01-01 11:54:48 -05:00
committed by GitHub
parent 9949cdcdca
commit 8a111eb526
2 changed files with 221 additions and 0 deletions

View File

@@ -126,6 +126,9 @@ class SkillQualityChecker:
# Link validation
self._check_links()
# Completeness checks
self._check_skill_completeness()
return self.report
def _check_skill_structure(self):
@@ -363,6 +366,94 @@ class SkillQualityChecker:
'SKILL.md'
)
def _check_skill_completeness(self):
"""Check skill completeness based on best practices.
Validates that skills include verification/prerequisites sections,
error handling guidance, and clear workflow steps.
"""
if not self.skill_md_path.exists():
return
content = self.skill_md_path.read_text(encoding='utf-8')
# Check for grounding/verification section (prerequisites)
grounding_patterns = [
r'before\s+(executing|running|proceeding|you\s+start)',
r'verify\s+that',
r'prerequisites?',
r'requirements?:',
r'make\s+sure\s+you\s+have',
]
has_grounding = any(
re.search(pattern, content, re.IGNORECASE)
for pattern in grounding_patterns
)
if has_grounding:
self.report.add_info(
'completeness',
'✓ Found verification/prerequisites section',
'SKILL.md'
)
else:
self.report.add_info(
'completeness',
'Consider adding prerequisites section - helps Claude verify conditions first',
'SKILL.md'
)
# Check for error handling/troubleshooting guidance
error_patterns = [
r'if\s+.*\s+(fails?|errors?)',
r'troubleshoot',
r'common\s+(issues?|problems?)',
r'error\s+handling',
r'when\s+things\s+go\s+wrong',
]
has_error_handling = any(
re.search(pattern, content, re.IGNORECASE)
for pattern in error_patterns
)
if has_error_handling:
self.report.add_info(
'completeness',
'✓ Found error handling/troubleshooting guidance',
'SKILL.md'
)
else:
self.report.add_info(
'completeness',
'Consider adding troubleshooting section for common issues',
'SKILL.md'
)
# Check for workflow steps (numbered or sequential indicators)
step_patterns = [
r'step\s+\d',
r'##\s+\d\.',
r'first,?\s+',
r'then,?\s+',
r'finally,?\s+',
r'next,?\s+',
]
steps_found = sum(
1 for pattern in step_patterns
if re.search(pattern, content, re.IGNORECASE)
)
if steps_found >= 3:
self.report.add_info(
'completeness',
f'✓ Found clear workflow indicators ({steps_found} step markers)',
'SKILL.md'
)
elif steps_found > 0:
self.report.add_info(
'completeness',
f'Some workflow guidance found ({steps_found} markers) - '
'consider adding numbered steps for clarity',
'SKILL.md'
)
def print_report(report: QualityReport, verbose: bool = False):
"""Print quality report to console.