@workingpayload/agent-skills 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/APIForge/skill.md +165 -0
- package/AccessPlus/skill.md +136 -0
- package/AlgoMaster/skill.md +125 -0
- package/Architekt AI/skill.md +140 -0
- package/AuthCraft/skill.md +144 -0
- package/AutoScriptor/skill.md +137 -0
- package/BoilerCore/skill.md +136 -0
- package/BugHunter Pro/skill.md +133 -0
- package/ChangeScribe/skill.md +113 -0
- package/CodeSage/skill.md +163 -0
- package/CommitCraft/skill.md +113 -0
- package/CoverageMax/skill.md +161 -0
- package/CronGenius/skill.md +157 -0
- package/DataPolish/skill.md +142 -0
- package/DataWeaver/skill.md +151 -0
- package/DockMaster/skill.md +158 -0
- package/DocuGenie/skill.md +138 -0
- package/EdgeGuard/skill.md +160 -0
- package/EnvWizard/skill.md +156 -0
- package/ErrorMedic/skill.md +152 -0
- package/FeatureSmith/skill.md +139 -0
- package/FlexiLayout/skill.md +144 -0
- package/FlowTester/skill.md +154 -0
- package/FunctionForge/skill.md +136 -0
- package/InputShield/skill.md +144 -0
- package/IssueForge/skill.md +148 -0
- package/KubeCrafter/skill.md +149 -0
- package/LogicLens/skill.md +132 -0
- package/MockSmith/skill.md +146 -0
- package/ModelSensei/skill.md +138 -0
- package/PRMentor/skill.md +103 -0
- package/PerfDetective/skill.md +90 -0
- package/PipelinePro/skill.md +146 -0
- package/PolyglotShift/skill.md +94 -0
- package/PromptForge/skill.md +118 -0
- package/QueryPulse/skill.md +123 -0
- package/README.md +416 -329
- package/ReadMeCraft/skill.md +127 -0
- package/RefactorX/skill.md +84 -0
- package/RenderBoost/skill.md +148 -0
- package/SEOMancer/skill.md +156 -0
- package/ScrapeMaster/skill.md +157 -0
- package/SecretSniffer/skill.md +123 -0
- package/SecureScan/skill.md +130 -0
- package/ServiceSplitter/skill.md +153 -0
- package/SpeedSmith/skill.md +155 -0
- package/StackWise/skill.md +155 -0
- package/TaskOrchestrator/skill.md +135 -0
- package/TestCrafter/skill.md +158 -0
- package/TraceMind/skill.md +143 -0
- package/UISmith/skill.md +131 -0
- package/bin/cli.js +377 -0
- package/extension-extender/SKILL.md +122 -0
- package/fastapi-furious/SKILL.md +148 -0
- package/package.json +41 -32
- package/python-master/SKILL.md +108 -0
- package/react-ranger/SKILL.md +93 -0
- package/scripts/build_index.py +282 -0
- package/scripts/doctor.py +541 -0
- package/scripts/install.py +397 -0
- package/scripts/route.py +348 -0
- package/scripts/score.py +355 -0
- package/scripts/test_skill.py +473 -0
- package/scripts/validate.py +254 -0
- package/skills-routing.json +1131 -0
- package/skills.json +3261 -0
- package/cli.js +0 -181
- package/skills/APIForge/skill.md +0 -32
- package/skills/AccessPlus/skill.md +0 -32
- package/skills/AlgoMaster/skill.md +0 -32
- package/skills/Architekt AI/skill.md +0 -32
- package/skills/AuthCraft/skill.md +0 -32
- package/skills/AutoScriptor/skill.md +0 -32
- package/skills/BoilerCore/skill.md +0 -32
- package/skills/BugHunter Pro/skill.md +0 -32
- package/skills/ChangeScribe/skill.md +0 -32
- package/skills/CodeSage/skill.md +0 -32
- package/skills/CommitCraft/skill.md +0 -32
- package/skills/CoverageMax/skill.md +0 -32
- package/skills/CronGenius/skill.md +0 -32
- package/skills/DataPolish/skill.md +0 -32
- package/skills/DataWeaver/skill.md +0 -32
- package/skills/DockMaster/skill.md +0 -32
- package/skills/DocuGenie/skill.md +0 -32
- package/skills/EdgeGuard/skill.md +0 -32
- package/skills/EnvWizard/skill.md +0 -32
- package/skills/ErrorMedic/skill.md +0 -32
- package/skills/Extension-Extender/SKILL.md +0 -41
- package/skills/Extension-Extender/references/ui-guidelines.md +0 -26
- package/skills/Fastapi-Furious/README.md +0 -16
- package/skills/Fastapi-Furious/SKILL.md +0 -37
- package/skills/FeatureSmith/skill.md +0 -32
- package/skills/FlexiLayout/skill.md +0 -32
- package/skills/FlowTester/skill.md +0 -32
- package/skills/FunctionForge/skill.md +0 -32
- package/skills/InputShield/skill.md +0 -32
- package/skills/IssueForge/skill.md +0 -32
- package/skills/KubeCrafter/skill.md +0 -32
- package/skills/LogicLens/skill.md +0 -32
- package/skills/MockSmith/skill.md +0 -32
- package/skills/ModelSensei/skill.md +0 -32
- package/skills/PRMentor/skill.md +0 -32
- package/skills/PerfDetective/skill.md +0 -32
- package/skills/PipelinePro/skill.md +0 -32
- package/skills/PolyglotShift/skill.md +0 -32
- package/skills/PromptForge/skill.md +0 -32
- package/skills/Python-Master/README.md +0 -11
- package/skills/Python-Master/SKILL.md +0 -37
- package/skills/QueryPulse/skill.md +0 -32
- package/skills/React-Ranger/README.md +0 -17
- package/skills/React-Ranger/SKILL.md +0 -37
- package/skills/ReadMeCraft/skill.md +0 -32
- package/skills/RefactorX/skill.md +0 -32
- package/skills/RenderBoost/skill.md +0 -32
- package/skills/SEOMancer/skill.md +0 -32
- package/skills/ScrapeMaster/skill.md +0 -32
- package/skills/SecretSniffer/skill.md +0 -32
- package/skills/SecureScan/skill.md +0 -32
- package/skills/ServiceSplitter/skill.md +0 -32
- package/skills/SpeedSmith/skill.md +0 -32
- package/skills/StackWise/skill.md +0 -32
- package/skills/TaskOrchestrator/skill.md +0 -32
- package/skills/TestCrafter/skill.md +0 -32
- package/skills/TraceMind/skill.md +0 -32
- package/skills/UISmith/skill.md +0 -32
- /package/{skills/Extension-Extender → extension-extender}/assets/manifest.json +0 -0
- /package/{skills/Extension-Extender → extension-extender}/assets/popup.css +0 -0
- /package/{skills/Extension-Extender → extension-extender}/assets/popup.html +0 -0
- /package/{skills/Extension-Extender → extension-extender}/assets/popup.js +0 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
doctor.py - Health check for installed Agent Skills.
|
|
4
|
+
|
|
5
|
+
Checks Claude (~/.claude/commands/) and/or Gemini (~/.gemini/commands/)
|
|
6
|
+
install directories for integrity, staleness, orphans, and format issues.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
python scripts/doctor.py # check both targets
|
|
10
|
+
python scripts/doctor.py --target claude # check Claude only
|
|
11
|
+
python scripts/doctor.py --target gemini # check Gemini only
|
|
12
|
+
|
|
13
|
+
Exit codes:
|
|
14
|
+
0 = all healthy
|
|
15
|
+
1 = warnings only
|
|
16
|
+
2 = errors found
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import hashlib
|
|
21
|
+
import json
|
|
22
|
+
import os
|
|
23
|
+
import re
|
|
24
|
+
import sys
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
# Constants
|
|
29
|
+
# ---------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
SKILL_FILENAMES = {"skill.md", "SKILL.md"}
|
|
32
|
+
META_FILENAME = ".skills-meta.json"
|
|
33
|
+
|
|
34
|
+
INSTALL_DIRS = {
|
|
35
|
+
"claude": Path.home() / ".claude" / "commands",
|
|
36
|
+
"gemini": Path.home() / ".gemini" / "commands",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# ---------------------------------------------------------------------------
|
|
41
|
+
# Severity levels
|
|
42
|
+
# ---------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
OK = "OK"
|
|
45
|
+
WARN = "WARN"
|
|
46
|
+
ERROR = "ERROR"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CheckResult:
|
|
50
|
+
def __init__(self, label: str, status: str, message: str, recommendation: str = ""):
|
|
51
|
+
self.label = label
|
|
52
|
+
self.status = status
|
|
53
|
+
self.message = message
|
|
54
|
+
self.recommendation = recommendation
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def icon(self) -> str:
|
|
58
|
+
return {"OK": "[OK]", "WARN": "[WARN]", "ERROR": "[ERROR]"}[self.status]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# ---------------------------------------------------------------------------
|
|
62
|
+
# Helpers
|
|
63
|
+
# ---------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
def file_hash(path: Path) -> str:
|
|
66
|
+
"""Return MD5 hex digest of a file's content."""
|
|
67
|
+
h = hashlib.md5()
|
|
68
|
+
h.update(path.read_bytes())
|
|
69
|
+
return h.hexdigest()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def content_hash(text: str) -> str:
|
|
73
|
+
"""Return MD5 hex digest of a UTF-8 string."""
|
|
74
|
+
return hashlib.md5(text.encode("utf-8")).hexdigest()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def parse_frontmatter(text: str) -> dict | None:
|
|
78
|
+
"""
|
|
79
|
+
Parse YAML frontmatter delimited by '---'.
|
|
80
|
+
Returns dict of fields or None if not present.
|
|
81
|
+
"""
|
|
82
|
+
lines = text.splitlines()
|
|
83
|
+
if not lines or lines[0].strip() != "---":
|
|
84
|
+
return None
|
|
85
|
+
end = None
|
|
86
|
+
for i, line in enumerate(lines[1:], start=1):
|
|
87
|
+
if line.strip() == "---":
|
|
88
|
+
end = i
|
|
89
|
+
break
|
|
90
|
+
if end is None:
|
|
91
|
+
return None
|
|
92
|
+
fields: dict[str, str] = {}
|
|
93
|
+
for line in lines[1:end]:
|
|
94
|
+
if ":" in line:
|
|
95
|
+
key, _, value = line.partition(":")
|
|
96
|
+
fields[key.strip()] = value.strip().strip('"').strip("'")
|
|
97
|
+
return fields
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def find_source_skill(repo_root: Path, skill_name: str) -> Path | None:
|
|
101
|
+
"""
|
|
102
|
+
Locate the source skill file in the repo by skill name (case-insensitive
|
|
103
|
+
match against directory names).
|
|
104
|
+
"""
|
|
105
|
+
for subdir in repo_root.iterdir():
|
|
106
|
+
if not subdir.is_dir():
|
|
107
|
+
continue
|
|
108
|
+
for fname in SKILL_FILENAMES:
|
|
109
|
+
candidate = subdir / fname
|
|
110
|
+
if candidate.is_file():
|
|
111
|
+
# Try matching by directory name or by frontmatter name
|
|
112
|
+
if subdir.name.lower() == skill_name.lower():
|
|
113
|
+
return candidate
|
|
114
|
+
# Also try reading frontmatter
|
|
115
|
+
try:
|
|
116
|
+
fields = parse_frontmatter(candidate.read_text(encoding="utf-8", errors="replace"))
|
|
117
|
+
if fields and fields.get("name", "").lower() == skill_name.lower():
|
|
118
|
+
return candidate
|
|
119
|
+
except OSError:
|
|
120
|
+
pass
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# ---------------------------------------------------------------------------
|
|
125
|
+
# Individual health checks
|
|
126
|
+
# ---------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
def check_install_dir(install_dir: Path) -> CheckResult:
|
|
129
|
+
"""Check a: install directory exists."""
|
|
130
|
+
if install_dir.is_dir():
|
|
131
|
+
return CheckResult(
|
|
132
|
+
"Install directory",
|
|
133
|
+
OK,
|
|
134
|
+
f"Found: {install_dir}",
|
|
135
|
+
)
|
|
136
|
+
return CheckResult(
|
|
137
|
+
"Install directory",
|
|
138
|
+
ERROR,
|
|
139
|
+
f"Missing: {install_dir}",
|
|
140
|
+
recommendation="Run `python scripts/install.py` to create the install directory and install skills.",
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def check_meta_file(install_dir: Path) -> tuple[CheckResult, dict | None]:
|
|
145
|
+
"""Check b: .skills-meta.json exists and is valid JSON."""
|
|
146
|
+
meta_path = install_dir / META_FILENAME
|
|
147
|
+
if not meta_path.is_file():
|
|
148
|
+
return (
|
|
149
|
+
CheckResult(
|
|
150
|
+
"Meta file",
|
|
151
|
+
ERROR,
|
|
152
|
+
f"Missing: {meta_path}",
|
|
153
|
+
recommendation="Run `python scripts/install.py` to install skills and generate the meta file.",
|
|
154
|
+
),
|
|
155
|
+
None,
|
|
156
|
+
)
|
|
157
|
+
try:
|
|
158
|
+
meta = json.loads(meta_path.read_text(encoding="utf-8"))
|
|
159
|
+
return (
|
|
160
|
+
CheckResult("Meta file", OK, f"Found: {meta_path}"),
|
|
161
|
+
meta,
|
|
162
|
+
)
|
|
163
|
+
except json.JSONDecodeError as exc:
|
|
164
|
+
return (
|
|
165
|
+
CheckResult(
|
|
166
|
+
"Meta file",
|
|
167
|
+
ERROR,
|
|
168
|
+
f"Invalid JSON in {meta_path}: {exc}",
|
|
169
|
+
recommendation=f"Delete {meta_path} and run `python scripts/install.py` to regenerate it.",
|
|
170
|
+
),
|
|
171
|
+
None,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def check_file_integrity(install_dir: Path, meta: dict) -> list[CheckResult]:
|
|
176
|
+
"""Check c: every skill recorded in meta still exists on disk."""
|
|
177
|
+
results: list[CheckResult] = []
|
|
178
|
+
# Support both formats: {"skills": {...}} (Python installer) and {name: {...}} (Node CLI)
|
|
179
|
+
skills = meta.get("skills", None)
|
|
180
|
+
if skills is None:
|
|
181
|
+
# Node CLI format: top-level keys are skill names
|
|
182
|
+
skills = {k: v for k, v in meta.items() if isinstance(v, dict)}
|
|
183
|
+
if not skills:
|
|
184
|
+
results.append(
|
|
185
|
+
CheckResult(
|
|
186
|
+
"File integrity",
|
|
187
|
+
WARN,
|
|
188
|
+
"Meta file contains no tracked skills.",
|
|
189
|
+
recommendation="Run `python scripts/install.py` to reinstall skills.",
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
return results
|
|
193
|
+
|
|
194
|
+
for skill_name, info in skills.items():
|
|
195
|
+
filename = info.get("filename", f"{skill_name}.md")
|
|
196
|
+
skill_path = install_dir / filename
|
|
197
|
+
if skill_path.is_file():
|
|
198
|
+
results.append(
|
|
199
|
+
CheckResult(
|
|
200
|
+
f"File integrity [{skill_name}]",
|
|
201
|
+
OK,
|
|
202
|
+
f"Present: {skill_path.name}",
|
|
203
|
+
)
|
|
204
|
+
)
|
|
205
|
+
else:
|
|
206
|
+
results.append(
|
|
207
|
+
CheckResult(
|
|
208
|
+
f"File integrity [{skill_name}]",
|
|
209
|
+
ERROR,
|
|
210
|
+
f"Missing file: {skill_path}",
|
|
211
|
+
recommendation=f"Run `python scripts/install.py --force` to reinstall missing skills.",
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
return results
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def check_stale(install_dir: Path, meta: dict, repo_root: Path) -> list[CheckResult]:
|
|
218
|
+
"""Check d: installed skill content matches source repo version."""
|
|
219
|
+
results: list[CheckResult] = []
|
|
220
|
+
# Support both formats
|
|
221
|
+
skills = meta.get("skills", None)
|
|
222
|
+
if skills is None:
|
|
223
|
+
skills = {k: v for k, v in meta.items() if isinstance(v, dict)}
|
|
224
|
+
|
|
225
|
+
for skill_name, info in skills.items():
|
|
226
|
+
filename = info.get("filename", f"{skill_name}.md")
|
|
227
|
+
skill_path = install_dir / filename
|
|
228
|
+
if not skill_path.is_file():
|
|
229
|
+
# Already flagged by file integrity check — skip
|
|
230
|
+
continue
|
|
231
|
+
|
|
232
|
+
# Use source path from meta if available (Node CLI stores it as "source")
|
|
233
|
+
source_path_str = info.get("source_path") or info.get("source")
|
|
234
|
+
source_path = Path(source_path_str) if source_path_str and Path(source_path_str).is_file() else find_source_skill(repo_root, skill_name)
|
|
235
|
+
if source_path is None:
|
|
236
|
+
results.append(
|
|
237
|
+
CheckResult(
|
|
238
|
+
f"Stale check [{skill_name}]",
|
|
239
|
+
WARN,
|
|
240
|
+
f"Source skill '{skill_name}' not found in repo — cannot compare.",
|
|
241
|
+
recommendation="Verify the skill exists in the source repo or remove it from the install directory.",
|
|
242
|
+
)
|
|
243
|
+
)
|
|
244
|
+
continue
|
|
245
|
+
|
|
246
|
+
installed_hash = file_hash(skill_path)
|
|
247
|
+
source_hash = file_hash(source_path)
|
|
248
|
+
|
|
249
|
+
# Also compare against hash stored in meta (if present)
|
|
250
|
+
meta_hash = info.get("hash", "")
|
|
251
|
+
|
|
252
|
+
if installed_hash == source_hash:
|
|
253
|
+
results.append(
|
|
254
|
+
CheckResult(
|
|
255
|
+
f"Stale check [{skill_name}]",
|
|
256
|
+
OK,
|
|
257
|
+
"Up to date with source repo.",
|
|
258
|
+
)
|
|
259
|
+
)
|
|
260
|
+
else:
|
|
261
|
+
results.append(
|
|
262
|
+
CheckResult(
|
|
263
|
+
f"Stale check [{skill_name}]",
|
|
264
|
+
WARN,
|
|
265
|
+
f"Installed version differs from source repo ({source_path.relative_to(repo_root)}).",
|
|
266
|
+
recommendation="Run `python scripts/install.py --force` to update stale skills.",
|
|
267
|
+
)
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
return results
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def check_orphans(install_dir: Path, meta: dict) -> list[CheckResult]:
|
|
274
|
+
"""Check e: files in install dir that aren't tracked in meta."""
|
|
275
|
+
results: list[CheckResult] = []
|
|
276
|
+
# Support both formats
|
|
277
|
+
skills = meta.get("skills", None)
|
|
278
|
+
if skills is None:
|
|
279
|
+
skills = {k: v for k, v in meta.items() if isinstance(v, dict)}
|
|
280
|
+
tracked_filenames = {
|
|
281
|
+
info.get("filename", f"{name}.md") for name, info in skills.items()
|
|
282
|
+
}
|
|
283
|
+
# Also always ignore the meta file itself
|
|
284
|
+
tracked_filenames.add(META_FILENAME)
|
|
285
|
+
|
|
286
|
+
try:
|
|
287
|
+
entries = list(install_dir.iterdir())
|
|
288
|
+
except OSError:
|
|
289
|
+
return results
|
|
290
|
+
|
|
291
|
+
orphans = [
|
|
292
|
+
e for e in entries
|
|
293
|
+
if e.is_file() and e.name not in tracked_filenames
|
|
294
|
+
]
|
|
295
|
+
|
|
296
|
+
if not orphans:
|
|
297
|
+
results.append(
|
|
298
|
+
CheckResult("Orphan detection", OK, "No untracked files found.")
|
|
299
|
+
)
|
|
300
|
+
else:
|
|
301
|
+
for orphan in sorted(orphans):
|
|
302
|
+
results.append(
|
|
303
|
+
CheckResult(
|
|
304
|
+
f"Orphan [{orphan.name}]",
|
|
305
|
+
WARN,
|
|
306
|
+
f"Untracked file in install directory: {orphan.name}",
|
|
307
|
+
recommendation=(
|
|
308
|
+
f"Remove manually (`del \"{orphan}\"` on Windows / `rm \"{orphan}\"` on Unix) "
|
|
309
|
+
"or run `python scripts/install.py` to regenerate a clean install."
|
|
310
|
+
),
|
|
311
|
+
)
|
|
312
|
+
)
|
|
313
|
+
return results
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def check_format(install_dir: Path, meta: dict) -> list[CheckResult]:
|
|
317
|
+
"""Check f: each installed skill has frontmatter with name and description."""
|
|
318
|
+
results: list[CheckResult] = []
|
|
319
|
+
# Support both formats
|
|
320
|
+
skills = meta.get("skills", None)
|
|
321
|
+
if skills is None:
|
|
322
|
+
skills = {k: v for k, v in meta.items() if isinstance(v, dict)}
|
|
323
|
+
|
|
324
|
+
for skill_name, info in skills.items():
|
|
325
|
+
filename = info.get("filename", f"{skill_name}.md")
|
|
326
|
+
skill_path = install_dir / filename
|
|
327
|
+
if not skill_path.is_file():
|
|
328
|
+
continue
|
|
329
|
+
|
|
330
|
+
try:
|
|
331
|
+
text = skill_path.read_text(encoding="utf-8", errors="replace")
|
|
332
|
+
except OSError as exc:
|
|
333
|
+
results.append(
|
|
334
|
+
CheckResult(
|
|
335
|
+
f"Format [{skill_name}]",
|
|
336
|
+
ERROR,
|
|
337
|
+
f"Cannot read file: {exc}",
|
|
338
|
+
)
|
|
339
|
+
)
|
|
340
|
+
continue
|
|
341
|
+
|
|
342
|
+
fields = parse_frontmatter(text)
|
|
343
|
+
issues: list[str] = []
|
|
344
|
+
if fields is None:
|
|
345
|
+
issues.append("missing frontmatter")
|
|
346
|
+
else:
|
|
347
|
+
if "name" not in fields:
|
|
348
|
+
issues.append("frontmatter missing 'name'")
|
|
349
|
+
if "description" not in fields:
|
|
350
|
+
issues.append("frontmatter missing 'description'")
|
|
351
|
+
elif len(fields["description"]) < 20:
|
|
352
|
+
issues.append("description is too short (< 20 chars)")
|
|
353
|
+
|
|
354
|
+
if issues:
|
|
355
|
+
results.append(
|
|
356
|
+
CheckResult(
|
|
357
|
+
f"Format [{skill_name}]",
|
|
358
|
+
WARN,
|
|
359
|
+
f"Format issues: {', '.join(issues)}",
|
|
360
|
+
recommendation=(
|
|
361
|
+
"Edit the installed skill file to add valid YAML frontmatter, "
|
|
362
|
+
"or run `python scripts/install.py --force` to reinstall from source."
|
|
363
|
+
),
|
|
364
|
+
)
|
|
365
|
+
)
|
|
366
|
+
else:
|
|
367
|
+
results.append(
|
|
368
|
+
CheckResult(f"Format [{skill_name}]", OK, "Frontmatter valid.")
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
return results
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def check_source_repo(repo_root: Path) -> CheckResult:
|
|
375
|
+
"""Check g: source repo is accessible from the current directory."""
|
|
376
|
+
marker_candidates = [
|
|
377
|
+
repo_root / "skills.json",
|
|
378
|
+
repo_root / "scripts" / "validate.py",
|
|
379
|
+
repo_root / "scripts" / "install.py",
|
|
380
|
+
]
|
|
381
|
+
# Count how many markers exist
|
|
382
|
+
found = [p for p in marker_candidates if p.exists()]
|
|
383
|
+
|
|
384
|
+
if len(found) >= 1:
|
|
385
|
+
skill_dirs = [
|
|
386
|
+
d for d in repo_root.iterdir()
|
|
387
|
+
if d.is_dir() and any((d / f).is_file() for f in SKILL_FILENAMES)
|
|
388
|
+
]
|
|
389
|
+
return CheckResult(
|
|
390
|
+
"Source repo",
|
|
391
|
+
OK,
|
|
392
|
+
f"Accessible at {repo_root} ({len(skill_dirs)} skill(s) found).",
|
|
393
|
+
)
|
|
394
|
+
return CheckResult(
|
|
395
|
+
"Source repo",
|
|
396
|
+
WARN,
|
|
397
|
+
f"Source repo markers not found under {repo_root}.",
|
|
398
|
+
recommendation=(
|
|
399
|
+
"Run doctor.py from inside the Agent-Skills repository root, "
|
|
400
|
+
"or verify the repo directory is correct."
|
|
401
|
+
),
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
# ---------------------------------------------------------------------------
|
|
406
|
+
# Per-target runner
|
|
407
|
+
# ---------------------------------------------------------------------------
|
|
408
|
+
|
|
409
|
+
def run_checks_for_target(target: str, install_dir: Path, repo_root: Path) -> list[CheckResult]:
|
|
410
|
+
"""Run all health checks for one target (claude or gemini)."""
|
|
411
|
+
results: list[CheckResult] = []
|
|
412
|
+
|
|
413
|
+
# (a) Install directory exists
|
|
414
|
+
dir_result = check_install_dir(install_dir)
|
|
415
|
+
results.append(dir_result)
|
|
416
|
+
if dir_result.status == ERROR:
|
|
417
|
+
# Nothing else to check if the directory is absent
|
|
418
|
+
return results
|
|
419
|
+
|
|
420
|
+
# (b) Meta file exists
|
|
421
|
+
meta_result, meta = check_meta_file(install_dir)
|
|
422
|
+
results.append(meta_result)
|
|
423
|
+
if meta is None:
|
|
424
|
+
# Cannot run remaining per-skill checks without meta
|
|
425
|
+
return results
|
|
426
|
+
|
|
427
|
+
# (c) File integrity
|
|
428
|
+
results.extend(check_file_integrity(install_dir, meta))
|
|
429
|
+
|
|
430
|
+
# (d) Stale check
|
|
431
|
+
results.extend(check_stale(install_dir, meta, repo_root))
|
|
432
|
+
|
|
433
|
+
# (e) Orphan detection
|
|
434
|
+
results.extend(check_orphans(install_dir, meta))
|
|
435
|
+
|
|
436
|
+
# (f) Format validation
|
|
437
|
+
results.extend(check_format(install_dir, meta))
|
|
438
|
+
|
|
439
|
+
return results
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
# ---------------------------------------------------------------------------
|
|
443
|
+
# Output / reporting
|
|
444
|
+
# ---------------------------------------------------------------------------
|
|
445
|
+
|
|
446
|
+
def print_section(title: str, results: list[CheckResult]) -> tuple[int, int, int]:
|
|
447
|
+
"""Print a section of results. Returns (ok, warnings, errors)."""
|
|
448
|
+
print(f"\n{'=' * 70}")
|
|
449
|
+
print(f" {title}")
|
|
450
|
+
print(f"{'=' * 70}")
|
|
451
|
+
|
|
452
|
+
ok = warn = err = 0
|
|
453
|
+
for r in results:
|
|
454
|
+
print(f" {r.icon:<9} {r.label}: {r.message}")
|
|
455
|
+
if r.recommendation:
|
|
456
|
+
print(f" -> {r.recommendation}")
|
|
457
|
+
if r.status == OK:
|
|
458
|
+
ok += 1
|
|
459
|
+
elif r.status == WARN:
|
|
460
|
+
warn += 1
|
|
461
|
+
else:
|
|
462
|
+
err += 1
|
|
463
|
+
|
|
464
|
+
return ok, warn, err
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
# ---------------------------------------------------------------------------
|
|
468
|
+
# Main
|
|
469
|
+
# ---------------------------------------------------------------------------
|
|
470
|
+
|
|
471
|
+
def main() -> int:
|
|
472
|
+
parser = argparse.ArgumentParser(
|
|
473
|
+
description="Health check for installed Agent Skills."
|
|
474
|
+
)
|
|
475
|
+
parser.add_argument(
|
|
476
|
+
"--target", "-t",
|
|
477
|
+
choices=["claude", "gemini"],
|
|
478
|
+
default=None,
|
|
479
|
+
help="Which install target to check (default: both).",
|
|
480
|
+
)
|
|
481
|
+
args = parser.parse_args()
|
|
482
|
+
|
|
483
|
+
targets = [args.target] if args.target else ["claude", "gemini"]
|
|
484
|
+
|
|
485
|
+
repo_root = Path(__file__).resolve().parent.parent
|
|
486
|
+
|
|
487
|
+
total_ok = total_warn = total_err = 0
|
|
488
|
+
|
|
489
|
+
# (g) Source repo check — done once, shown at top
|
|
490
|
+
print("\nAgent Skills Doctor")
|
|
491
|
+
print("=" * 70)
|
|
492
|
+
source_result = check_source_repo(repo_root)
|
|
493
|
+
print(f" {source_result.icon:<9} {source_result.label}: {source_result.message}")
|
|
494
|
+
if source_result.recommendation:
|
|
495
|
+
print(f" -> {source_result.recommendation}")
|
|
496
|
+
if source_result.status == OK:
|
|
497
|
+
total_ok += 1
|
|
498
|
+
elif source_result.status == WARN:
|
|
499
|
+
total_warn += 1
|
|
500
|
+
else:
|
|
501
|
+
total_err += 1
|
|
502
|
+
|
|
503
|
+
for target in targets:
|
|
504
|
+
install_dir = INSTALL_DIRS[target]
|
|
505
|
+
results = run_checks_for_target(target, install_dir, repo_root)
|
|
506
|
+
ok, warn, err = print_section(
|
|
507
|
+
f"Target: {target.upper()} ({install_dir})",
|
|
508
|
+
results,
|
|
509
|
+
)
|
|
510
|
+
total_ok += ok
|
|
511
|
+
total_warn += warn
|
|
512
|
+
total_err += err
|
|
513
|
+
|
|
514
|
+
# Summary
|
|
515
|
+
print(f"\n{'=' * 70}")
|
|
516
|
+
print(f" SUMMARY")
|
|
517
|
+
print(f"{'=' * 70}")
|
|
518
|
+
print(f" Checks run : {total_ok + total_warn + total_err}")
|
|
519
|
+
print(f" [OK] : {total_ok}")
|
|
520
|
+
print(f" [WARN] : {total_warn}")
|
|
521
|
+
print(f" [ERROR] : {total_err}")
|
|
522
|
+
print()
|
|
523
|
+
|
|
524
|
+
if total_err == 0 and total_warn == 0:
|
|
525
|
+
print(" All skills are healthy.")
|
|
526
|
+
elif total_err == 0:
|
|
527
|
+
print(" Skills have warnings — review recommendations above.")
|
|
528
|
+
else:
|
|
529
|
+
print(" Skills have errors — action required.")
|
|
530
|
+
|
|
531
|
+
print()
|
|
532
|
+
|
|
533
|
+
if total_err > 0:
|
|
534
|
+
return 2
|
|
535
|
+
if total_warn > 0:
|
|
536
|
+
return 1
|
|
537
|
+
return 0
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
if __name__ == "__main__":
|
|
541
|
+
sys.exit(main())
|