Overview
The new skills-frontmatter feature now parses and classifies remote skill specs in two different code paths: validation and compile-time pinning. Both paths trim the raw spec, reject/skip expressions and local paths, split on @, treat empty refs specially, and short-circuit full SHA refs.
Key metrics/issues
- Severity: Medium
- Occurrences: 2
- Analyzed files: 4 changed non-test Go files
- Commit:
ba0a9f958976c1d8d1baf3d2fc5a6aade16d01f2
Duplication details
Pattern: repeated parsing/classification of owner/repo[/path]@ref`` skill specs before either validating or pinning them.
Locations:
pkg/workflow/skills_frontmatter.go:58
pkg/workflow/skills_ref_resolution.go:47
Code sample:
trimmed := strings.TrimSpace(spec)
if trimmed == "" || strings.HasPrefix(trimmed, "${{") || isLocalSkillRef(trimmed) {
return spec
}
repoPath, ref, hasAt := strings.Cut(trimmed, "@")
if !hasAt {
return spec
}
if ref == "" { ... }
if gitutil.IsValidFullSHA(ref) { ... }
Impact analysis
- Maintainability: The accepted shape of skill refs is now encoded in multiple places, so future syntax changes must be kept in sync manually.
- Bug risk: Validation already owns checks for ambiguous SHA-like refs and unsafe characters, while resolution reimplements only part of the same decision tree. That split raises the chance of drift between “accepted” and “resolved” behavior.
- Code bloat: The commit added a second parser/classifier instead of a shared helper or parsed struct.
Refactoring recommendations
-
Extract a single skill-ref parser/classifier.
Extract common functionality to: pkg/workflow/skills_frontmatter.go or a new focused helper in pkg/workflow/
Estimated effort: 2-3 hours
Benefits: one source of truth for local-vs-remote classification, repo path extraction, ref normalization, and SHA detection.
-
Return structured metadata instead of reparsing strings.
Estimated effort: low to medium
Benefits: validation can enforce rules while resolution consumes the same parsed result without redoing branching logic.
Implementation checklist
Analysis metadata
- Detection method: Serena semantic code analysis
- Analysis date: 2026-08-08T21:59:53Z
- Commit:
ba0a9f958976c1d8d1baf3d2fc5a6aade16d01f2
Assignee: @copilot
Generated by 🔍 Duplicate Code Detector · gpt54 · 63.5 AIC · ⊞ 12.9K · ◷
Overview
The new skills-frontmatter feature now parses and classifies remote skill specs in two different code paths: validation and compile-time pinning. Both paths trim the raw spec, reject/skip expressions and local paths, split on
@, treat empty refs specially, and short-circuit full SHA refs.Key metrics/issues
ba0a9f958976c1d8d1baf3d2fc5a6aade16d01f2Duplication details
Pattern: repeated parsing/classification of
owner/repo[/path]@ref`` skill specs before either validating or pinning them.Locations:
pkg/workflow/skills_frontmatter.go:58pkg/workflow/skills_ref_resolution.go:47Code sample:
Impact analysis
Refactoring recommendations
Extract a single skill-ref parser/classifier.
Extract common functionality to:
pkg/workflow/skills_frontmatter.goor a new focused helper inpkg/workflow/Estimated effort: 2-3 hours
Benefits: one source of truth for local-vs-remote classification, repo path extraction, ref normalization, and SHA detection.
Return structured metadata instead of reparsing strings.
Estimated effort: low to medium
Benefits: validation can enforce rules while resolution consumes the same parsed result without redoing branching logic.
Implementation checklist
Analysis metadata
ba0a9f958976c1d8d1baf3d2fc5a6aade16d01f2Assignee:
@copilot