@mclawnet/agent 0.5.9 → 0.6.2
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/cli.js +168 -61
- package/dist/__tests__/cli.test.d.ts +2 -0
- package/dist/__tests__/cli.test.d.ts.map +1 -0
- package/dist/__tests__/service-config.test.d.ts +2 -0
- package/dist/__tests__/service-config.test.d.ts.map +1 -0
- package/dist/__tests__/service-linux.test.d.ts +2 -0
- package/dist/__tests__/service-linux.test.d.ts.map +1 -0
- package/dist/__tests__/service-macos.test.d.ts +2 -0
- package/dist/__tests__/service-macos.test.d.ts.map +1 -0
- package/dist/__tests__/service-windows.test.d.ts +2 -0
- package/dist/__tests__/service-windows.test.d.ts.map +1 -0
- package/dist/backend-adapter.d.ts +2 -0
- package/dist/backend-adapter.d.ts.map +1 -1
- package/dist/chunk-CBZIH6FY.js +93 -0
- package/dist/chunk-CBZIH6FY.js.map +1 -0
- package/dist/{chunk-KHPEQTWF.js → chunk-GLO5OZAY.js} +203 -213
- package/dist/chunk-GLO5OZAY.js.map +1 -0
- package/dist/chunk-RO47ET27.js +88 -0
- package/dist/chunk-RO47ET27.js.map +1 -0
- package/dist/hub-connection.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/linux-6AR7SXHW.js +176 -0
- package/dist/linux-6AR7SXHW.js.map +1 -0
- package/dist/macos-XVPWIH4C.js +174 -0
- package/dist/macos-XVPWIH4C.js.map +1 -0
- package/dist/service/config.d.ts +19 -0
- package/dist/service/config.d.ts.map +1 -0
- package/dist/service/index.d.ts +6 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/service/index.js +47 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/linux.d.ts +18 -0
- package/dist/service/linux.d.ts.map +1 -0
- package/dist/service/macos.d.ts +18 -0
- package/dist/service/macos.d.ts.map +1 -0
- package/dist/service/types.d.ts +19 -0
- package/dist/service/types.d.ts.map +1 -0
- package/dist/service/windows.d.ts +18 -0
- package/dist/service/windows.d.ts.map +1 -0
- package/dist/session-manager.d.ts +4 -7
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/skill-loader.d.ts +8 -0
- package/dist/skill-loader.d.ts.map +1 -0
- package/dist/start.d.ts.map +1 -1
- package/dist/start.js +2 -1
- package/dist/windows-NLONSCDA.js +165 -0
- package/dist/windows-NLONSCDA.js.map +1 -0
- package/package.json +7 -5
- package/skills/academic-search/SKILL.md +147 -0
- package/skills/architecture/SKILL.md +294 -0
- package/skills/changelog-generator/SKILL.md +112 -0
- package/skills/chart-visualization/SKILL.md +183 -0
- package/skills/code-review/SKILL.md +304 -0
- package/skills/codebase-health/SKILL.md +281 -0
- package/skills/consulting-analysis/SKILL.md +584 -0
- package/skills/content-research-writer/SKILL.md +546 -0
- package/skills/data-analysis/SKILL.md +194 -0
- package/skills/deep-research/SKILL.md +198 -0
- package/skills/docx/SKILL.md +211 -0
- package/skills/github-deep-research/SKILL.md +207 -0
- package/skills/image-generation/SKILL.md +209 -0
- package/skills/lead-research-assistant/SKILL.md +207 -0
- package/skills/mcp-builder/SKILL.md +304 -0
- package/skills/meeting-insights-analyzer/SKILL.md +335 -0
- package/skills/pair-programming/SKILL.md +196 -0
- package/skills/pdf/SKILL.md +309 -0
- package/skills/performance-analysis/SKILL.md +261 -0
- package/skills/podcast-generation/SKILL.md +224 -0
- package/skills/pptx/SKILL.md +497 -0
- package/skills/project-learnings/SKILL.md +280 -0
- package/skills/security-audit/SKILL.md +211 -0
- package/skills/skill-creator/SKILL.md +200 -0
- package/skills/technical-writing/SKILL.md +286 -0
- package/skills/testing/SKILL.md +363 -0
- package/skills/video-generation/SKILL.md +247 -0
- package/skills/web-design-guidelines/SKILL.md +203 -0
- package/skills/webapp-testing/SKILL.md +162 -0
- package/skills/workflow-automation/SKILL.md +299 -0
- package/skills/xlsx/SKILL.md +305 -0
- package/dist/chunk-KHPEQTWF.js.map +0 -1
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-health
|
|
3
|
+
description: Evaluate codebase quality across multiple dimensions including type safety, lint cleanliness, test coverage, dead code, and dependency hygiene. Use when performing health checks, quality audits, tracking code quality trends, or assessing technical debt.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codebase Health
|
|
8
|
+
|
|
9
|
+
Comprehensive codebase quality assessment across eight dimensions, producing a composite health score with actionable improvement recommendations.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Code quality is not one metric — it is a composite of type safety, lint cleanliness, test coverage, dead code, dependency health, documentation, complexity, and security posture. This skill runs available project tools, scores each dimension, and produces a clear dashboard so teams can track quality over time and prioritize improvements.
|
|
14
|
+
|
|
15
|
+
**Core principle**: Wrap, don't replace. Run the project's own tools and score their output. Never substitute analysis for what the tool reports.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- Periodic health checks (weekly, before releases)
|
|
20
|
+
- Evaluating technical debt before a refactoring effort
|
|
21
|
+
- Assessing code quality on a new project or repo
|
|
22
|
+
- Tracking quality trends over multiple sprints
|
|
23
|
+
- Comparing quality across modules or packages in a monorepo
|
|
24
|
+
- Pre-merge quality gates
|
|
25
|
+
|
|
26
|
+
## When NOT to Use
|
|
27
|
+
|
|
28
|
+
- **Fixing issues** — this skill diagnoses only; use implementation skills to fix
|
|
29
|
+
- **Code review of a specific PR** — use the `code-review` skill
|
|
30
|
+
- **Performance profiling** — use the `performance-analysis` skill
|
|
31
|
+
|
|
32
|
+
## Health Dimensions
|
|
33
|
+
|
|
34
|
+
### 1. Type Safety (Weight: 20%)
|
|
35
|
+
|
|
36
|
+
Does the code leverage the type system to prevent bugs at compile time?
|
|
37
|
+
|
|
38
|
+
**What to check:**
|
|
39
|
+
- Type checker passes cleanly (e.g., `tsc --noEmit`, `mypy`, `go vet`)
|
|
40
|
+
- Strict mode enabled where available (`strict: true` in tsconfig)
|
|
41
|
+
- No `any` escape hatches in TypeScript, no `# type: ignore` in Python
|
|
42
|
+
- Generic types used instead of casting
|
|
43
|
+
|
|
44
|
+
**Scoring:**
|
|
45
|
+
| Score | Criteria |
|
|
46
|
+
|-------|----------|
|
|
47
|
+
| 10 | Clean (zero errors), strict mode on |
|
|
48
|
+
| 7 | < 10 errors or non-strict mode |
|
|
49
|
+
| 4 | < 50 errors |
|
|
50
|
+
| 0 | >= 50 errors or no type checking |
|
|
51
|
+
|
|
52
|
+
### 2. Lint Cleanliness (Weight: 15%)
|
|
53
|
+
|
|
54
|
+
Is the code consistent and free of common mistakes?
|
|
55
|
+
|
|
56
|
+
**What to check:**
|
|
57
|
+
- Linter passes cleanly (ESLint, Biome, Ruff, clippy)
|
|
58
|
+
- Formatter applied consistently (Prettier, Black, gofmt)
|
|
59
|
+
- No lint rule suppressions without comments explaining why
|
|
60
|
+
|
|
61
|
+
**Scoring:**
|
|
62
|
+
| Score | Criteria |
|
|
63
|
+
|-------|----------|
|
|
64
|
+
| 10 | Clean (zero warnings) |
|
|
65
|
+
| 7 | < 5 warnings |
|
|
66
|
+
| 4 | < 20 warnings |
|
|
67
|
+
| 0 | >= 20 warnings |
|
|
68
|
+
|
|
69
|
+
### 3. Test Coverage (Weight: 25%)
|
|
70
|
+
|
|
71
|
+
Are the important code paths protected by tests?
|
|
72
|
+
|
|
73
|
+
**What to check:**
|
|
74
|
+
- Test runner passes (`npm test`, `pytest`, `cargo test`)
|
|
75
|
+
- Line coverage percentage
|
|
76
|
+
- Branch coverage percentage
|
|
77
|
+
- All new code has corresponding tests
|
|
78
|
+
|
|
79
|
+
**Scoring:**
|
|
80
|
+
| Score | Criteria |
|
|
81
|
+
|-------|----------|
|
|
82
|
+
| 10 | All pass, line coverage > 80% |
|
|
83
|
+
| 7 | All pass, line coverage > 60% |
|
|
84
|
+
| 4 | Some failures, or coverage < 60% |
|
|
85
|
+
| 0 | Test suite broken or coverage < 30% |
|
|
86
|
+
|
|
87
|
+
### 4. Dead Code (Weight: 10%)
|
|
88
|
+
|
|
89
|
+
Is there unused code cluttering the codebase?
|
|
90
|
+
|
|
91
|
+
**What to check:**
|
|
92
|
+
- Unused exports, functions, types (knip, ts-prune)
|
|
93
|
+
- Unreachable code branches
|
|
94
|
+
- Commented-out code blocks
|
|
95
|
+
- Unused dependencies in package.json / requirements.txt
|
|
96
|
+
|
|
97
|
+
**Scoring:**
|
|
98
|
+
| Score | Criteria |
|
|
99
|
+
|-------|----------|
|
|
100
|
+
| 10 | Clean (no unused exports or dependencies) |
|
|
101
|
+
| 7 | < 5 unused exports |
|
|
102
|
+
| 4 | < 20 unused exports |
|
|
103
|
+
| 0 | >= 20 unused or many unused dependencies |
|
|
104
|
+
|
|
105
|
+
### 5. Dependency Health (Weight: 10%)
|
|
106
|
+
|
|
107
|
+
Are dependencies up to date and free of known vulnerabilities?
|
|
108
|
+
|
|
109
|
+
**What to check:**
|
|
110
|
+
- `npm audit` / `pip-audit` / `cargo audit` for security advisories
|
|
111
|
+
- Outdated dependencies (`npm outdated`)
|
|
112
|
+
- Pinned versions vs floating ranges
|
|
113
|
+
- License compatibility
|
|
114
|
+
|
|
115
|
+
**Scoring:**
|
|
116
|
+
| Score | Criteria |
|
|
117
|
+
|-------|----------|
|
|
118
|
+
| 10 | No vulnerabilities, all deps current |
|
|
119
|
+
| 7 | No critical vulns, < 5 outdated |
|
|
120
|
+
| 4 | Critical vulns present but patchable |
|
|
121
|
+
| 0 | Unpatched critical vulns or abandoned deps |
|
|
122
|
+
|
|
123
|
+
### 6. Documentation (Weight: 5%)
|
|
124
|
+
|
|
125
|
+
Is the project understandable to newcomers?
|
|
126
|
+
|
|
127
|
+
**What to check:**
|
|
128
|
+
- README exists and is current
|
|
129
|
+
- API documentation or JSDoc/docstrings on public interfaces
|
|
130
|
+
- Architecture decision records (ADRs) for key decisions
|
|
131
|
+
- Setup instructions that actually work
|
|
132
|
+
|
|
133
|
+
**Scoring:**
|
|
134
|
+
| Score | Criteria |
|
|
135
|
+
|-------|----------|
|
|
136
|
+
| 10 | Comprehensive docs, setup works first try |
|
|
137
|
+
| 7 | README + basic docs, most things documented |
|
|
138
|
+
| 4 | README only, some gaps |
|
|
139
|
+
| 0 | No docs or docs are outdated/wrong |
|
|
140
|
+
|
|
141
|
+
### 7. Complexity (Weight: 10%)
|
|
142
|
+
|
|
143
|
+
Is the code maintainable or tangled?
|
|
144
|
+
|
|
145
|
+
**What to check:**
|
|
146
|
+
- Cyclomatic complexity per function (target: < 10)
|
|
147
|
+
- File size (target: < 300 lines per file)
|
|
148
|
+
- Function length (target: < 50 lines per function)
|
|
149
|
+
- Nesting depth (target: < 4 levels)
|
|
150
|
+
- Module coupling (how many dependencies each module has)
|
|
151
|
+
|
|
152
|
+
**Scoring:**
|
|
153
|
+
| Score | Criteria |
|
|
154
|
+
|-------|----------|
|
|
155
|
+
| 10 | All functions < 10 complexity, clean structure |
|
|
156
|
+
| 7 | Few functions > 10 complexity |
|
|
157
|
+
| 4 | Many complex functions, deep nesting |
|
|
158
|
+
| 0 | God classes, 1000+ line files, spaghetti |
|
|
159
|
+
|
|
160
|
+
### 8. Security Posture (Weight: 5%)
|
|
161
|
+
|
|
162
|
+
Is the code following security best practices?
|
|
163
|
+
|
|
164
|
+
**What to check:**
|
|
165
|
+
- No hardcoded secrets (use git-secrets, gitleaks, or trufflehog)
|
|
166
|
+
- Input validation on user-facing endpoints
|
|
167
|
+
- Authentication/authorization checks in place
|
|
168
|
+
- HTTPS enforced, CORS configured properly
|
|
169
|
+
- Dependencies scanned for CVEs
|
|
170
|
+
|
|
171
|
+
**Scoring:**
|
|
172
|
+
| Score | Criteria |
|
|
173
|
+
|-------|----------|
|
|
174
|
+
| 10 | No findings, security tools configured |
|
|
175
|
+
| 7 | Minor findings, no credential leaks |
|
|
176
|
+
| 4 | Significant findings, some credential exposure risk |
|
|
177
|
+
| 0 | Hardcoded secrets or critical security gaps |
|
|
178
|
+
|
|
179
|
+
## Health Check Process
|
|
180
|
+
|
|
181
|
+
### Step 1: Detect Available Tools
|
|
182
|
+
|
|
183
|
+
Auto-detect what's available in the project:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Type checker
|
|
187
|
+
[ -f tsconfig.json ] && echo "typecheck: tsc --noEmit"
|
|
188
|
+
[ -f mypy.ini ] || [ -f pyproject.toml ] && echo "typecheck: mypy ."
|
|
189
|
+
|
|
190
|
+
# Linter
|
|
191
|
+
[ -f biome.json ] && echo "lint: biome check ."
|
|
192
|
+
ls eslint.config.* .eslintrc.* 2>/dev/null && echo "lint: eslint ."
|
|
193
|
+
[ -f pyproject.toml ] && grep -q "ruff" pyproject.toml && echo "lint: ruff check ."
|
|
194
|
+
|
|
195
|
+
# Tests
|
|
196
|
+
[ -f package.json ] && grep -q '"test"' package.json && echo "test: npm test"
|
|
197
|
+
[ -f pyproject.toml ] && grep -q "pytest" pyproject.toml && echo "test: pytest"
|
|
198
|
+
|
|
199
|
+
# Dead code
|
|
200
|
+
command -v knip >/dev/null && echo "deadcode: knip"
|
|
201
|
+
|
|
202
|
+
# Security
|
|
203
|
+
command -v gitleaks >/dev/null && echo "security: gitleaks detect"
|
|
204
|
+
[ -f package.json ] && echo "audit: npm audit"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Step 2: Run Each Tool
|
|
208
|
+
|
|
209
|
+
Run each detected tool, capturing:
|
|
210
|
+
- Exit code (pass/fail)
|
|
211
|
+
- Output summary (error/warning counts)
|
|
212
|
+
- Duration
|
|
213
|
+
|
|
214
|
+
### Step 3: Score and Present
|
|
215
|
+
|
|
216
|
+
Calculate weighted composite score:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
composite = Σ (dimension_score × weight)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
If a dimension is not measurable (tool unavailable), redistribute its weight proportionally.
|
|
223
|
+
|
|
224
|
+
### Step 4: Present Dashboard
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
CODEBASE HEALTH DASHBOARD
|
|
228
|
+
===========================
|
|
229
|
+
Project: my-project
|
|
230
|
+
Branch: main
|
|
231
|
+
Date: 2026-04-01
|
|
232
|
+
|
|
233
|
+
Dimension Score Status Details
|
|
234
|
+
--------------- ----- --------- -------------------------
|
|
235
|
+
Type Safety 10/10 CLEAN 0 errors, strict mode
|
|
236
|
+
Lint 8/10 WARNING 3 warnings
|
|
237
|
+
Test Coverage 9/10 GOOD 92% line coverage
|
|
238
|
+
Dead Code 7/10 WARNING 4 unused exports
|
|
239
|
+
Dependencies 10/10 CLEAN No vulnerabilities
|
|
240
|
+
Documentation 7/10 WARNING Missing API docs
|
|
241
|
+
Complexity 8/10 GOOD 2 functions > 10 complexity
|
|
242
|
+
Security 10/10 CLEAN No findings
|
|
243
|
+
|
|
244
|
+
COMPOSITE SCORE: 8.7 / 10
|
|
245
|
+
|
|
246
|
+
Status labels: CLEAN (10) | GOOD (8-9) | WARNING (6-7) | NEEDS WORK (4-5) | CRITICAL (0-3)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Step 5: Recommendations
|
|
250
|
+
|
|
251
|
+
Prioritize by `weight × (10 - score)`:
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
RECOMMENDATIONS (by impact)
|
|
255
|
+
============================
|
|
256
|
+
1. [HIGH] Address 3 lint warnings (Lint: 8/10, weight 15%)
|
|
257
|
+
2. [MED] Remove 4 unused exports (Dead Code: 7/10, weight 10%)
|
|
258
|
+
3. [MED] Add API documentation (Docs: 7/10, weight 5%)
|
|
259
|
+
4. [LOW] Reduce complexity in 2 functions (Complexity: 8/10, weight 10%)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Trend Tracking
|
|
263
|
+
|
|
264
|
+
Run health checks regularly and track changes:
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
HEALTH TREND (last 5 runs)
|
|
268
|
+
===========================
|
|
269
|
+
Date Score Change Highlight
|
|
270
|
+
---------- ----- ------ -------------------------
|
|
271
|
+
2026-03-15 7.2 — Baseline
|
|
272
|
+
2026-03-22 7.8 +0.6 Fixed type errors
|
|
273
|
+
2026-03-29 8.3 +0.5 Added test coverage
|
|
274
|
+
2026-04-01 8.7 +0.4 Removed dead code
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Interpreting trends:**
|
|
278
|
+
- Steady improvement → team is addressing debt
|
|
279
|
+
- Plateau → time to tackle the next dimension
|
|
280
|
+
- Decline → new code is outpacing quality standards
|
|
281
|
+
- Volatile → inconsistent practices, need better CI gates
|