@lvlup-sw/axiom 0.2.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/.claude-plugin/plugin.json +16 -0
- package/CLAUDE.md +26 -0
- package/LICENSE +21 -0
- package/package.json +37 -0
- package/skills/audit/SKILL.md +126 -0
- package/skills/audit/references/composition-guide.md +105 -0
- package/skills/backend-quality/SKILL.md +40 -0
- package/skills/backend-quality/references/deterministic-checks.md +151 -0
- package/skills/backend-quality/references/dimensions.md +206 -0
- package/skills/backend-quality/references/findings-format.md +61 -0
- package/skills/backend-quality/references/scoring-model.md +86 -0
- package/skills/critique/SKILL.md +132 -0
- package/skills/critique/references/dependency-patterns.md +319 -0
- package/skills/critique/references/solid-principles.md +359 -0
- package/skills/distill/SKILL.md +83 -0
- package/skills/distill/references/dead-code-patterns.md +152 -0
- package/skills/distill/references/simplification-guide.md +128 -0
- package/skills/harden/SKILL.md +161 -0
- package/skills/harden/references/error-patterns.md +180 -0
- package/skills/harden/references/resilience-checklist.md +82 -0
- package/skills/scan/SKILL.md +102 -0
- package/skills/scan/references/check-catalog.md +68 -0
- package/skills/verify/SKILL.md +102 -0
- package/skills/verify/references/contract-testing.md +185 -0
- package/skills/verify/references/test-antipatterns.md +161 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "axiom",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Backend code quality skills for Claude Code. Six skills that audit, critique, harden, and simplify your architecture — the backend half of impeccable.",
|
|
5
|
+
"author": "lvlup-sw",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/lvlup-sw/axiom",
|
|
8
|
+
"skills": [
|
|
9
|
+
"skills/audit",
|
|
10
|
+
"skills/critique",
|
|
11
|
+
"skills/harden",
|
|
12
|
+
"skills/distill",
|
|
13
|
+
"skills/verify",
|
|
14
|
+
"skills/scan"
|
|
15
|
+
]
|
|
16
|
+
}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Axiom
|
|
2
|
+
|
|
3
|
+
Backend code quality skills. The other half of impeccable — same composable pattern, pointed at architecture instead of UI.
|
|
4
|
+
|
|
5
|
+
## Skills
|
|
6
|
+
|
|
7
|
+
| Skill | Purpose | Dimensions |
|
|
8
|
+
|-------|---------|-----------|
|
|
9
|
+
| `axiom:audit` | Comprehensive backend audit (orchestrator) | All |
|
|
10
|
+
| `axiom:critique` | Architecture review: SOLID, coupling, dependencies | Architecture, Topology |
|
|
11
|
+
| `axiom:harden` | Error handling, resilience, observability | Observability, Resilience |
|
|
12
|
+
| `axiom:distill` | Dead code, vestigial patterns, simplification | Hygiene, Topology |
|
|
13
|
+
| `axiom:verify` | Test quality, mock fidelity, contract drift | Test Fidelity, Contracts |
|
|
14
|
+
| `axiom:scan` | Deterministic pattern detection (grep/structural) | Pluggable (any) |
|
|
15
|
+
|
|
16
|
+
## Quality Dimensions
|
|
17
|
+
|
|
18
|
+
Seven canonical dimensions (DIM-1 through DIM-7) defined in `skills/backend-quality/references/dimensions.md`.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Run individual skills for targeted assessment, or `axiom:audit` for comprehensive analysis. All skills accept a `scope` argument (file, directory, or codebase).
|
|
23
|
+
|
|
24
|
+
## Integration
|
|
25
|
+
|
|
26
|
+
This plugin is standalone — no workflow dependencies. Workflow tools can consume findings via the standard finding format documented in `skills/backend-quality/references/findings-format.md`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 levelup software
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lvlup-sw/axiom",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Backend code quality skills for Claude Code",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "vitest",
|
|
8
|
+
"test:run": "vitest run"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
".claude-plugin",
|
|
12
|
+
"skills",
|
|
13
|
+
"CLAUDE.md"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"claude-code-plugin",
|
|
17
|
+
"backend-quality",
|
|
18
|
+
"code-review",
|
|
19
|
+
"architecture",
|
|
20
|
+
"design-patterns"
|
|
21
|
+
],
|
|
22
|
+
"author": {
|
|
23
|
+
"name": "LevelUp Software",
|
|
24
|
+
"email": "oss@lvlup.software"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"homepage": "https://github.com/lvlup-sw/axiom",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/lvlup-sw/axiom.git"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"vitest": "^3.0.0",
|
|
34
|
+
"typescript": "^5.7.0",
|
|
35
|
+
"yaml": "^2.7.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audit
|
|
3
|
+
description: "Run a comprehensive backend quality audit across all seven dimensions. Orchestrates scan, critique, harden, distill, and verify skills, deduplicates findings, and produces a unified report with verdict. Use when assessing overall codebase health. Triggers: 'audit backend', 'full quality check', 'run audit', or /axiom:audit. Do NOT use for targeted checks — use individual skills instead."
|
|
4
|
+
user-invokable: true
|
|
5
|
+
metadata:
|
|
6
|
+
author: lvlup-sw
|
|
7
|
+
version: 0.1.0
|
|
8
|
+
category: assessment
|
|
9
|
+
dimensions:
|
|
10
|
+
- all
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Audit — Comprehensive Backend Quality Assessment
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
The anchor skill that orchestrates all other axiom skills to produce a comprehensive backend quality report. Runs deterministic checks and qualitative assessments across all 7 dimensions, deduplicates findings, computes per-dimension metrics, and delivers a unified verdict.
|
|
18
|
+
|
|
19
|
+
## Triggers
|
|
20
|
+
|
|
21
|
+
**Use when:**
|
|
22
|
+
- Assessing overall codebase or module health
|
|
23
|
+
- Preparing for a release or major refactor
|
|
24
|
+
- Onboarding to understand existing technical debt
|
|
25
|
+
- User says "audit", "full quality check", "assess quality"
|
|
26
|
+
|
|
27
|
+
**Do NOT use when:**
|
|
28
|
+
- Targeting a specific concern (use `axiom:critique`, `axiom:harden`, `axiom:distill`, or `axiom:verify` directly)
|
|
29
|
+
- Running only deterministic checks (use `axiom:scan`)
|
|
30
|
+
- Performing workflow-specific review (workflow tools orchestrate axiom, not the reverse)
|
|
31
|
+
|
|
32
|
+
## Process
|
|
33
|
+
|
|
34
|
+
### Step 1: Scope Resolution
|
|
35
|
+
|
|
36
|
+
Determine the assessment scope from the `scope` argument:
|
|
37
|
+
- **File:** Assess a single file
|
|
38
|
+
- **Directory:** Assess all files in a directory (recursive)
|
|
39
|
+
- **Codebase:** Assess the entire project (default: current working directory)
|
|
40
|
+
|
|
41
|
+
Exclude by default: `node_modules/`, `dist/`, `.git/`, binary files, generated files.
|
|
42
|
+
|
|
43
|
+
### Step 2: Deterministic Scan
|
|
44
|
+
|
|
45
|
+
Run `axiom:scan` with `dimensions: all` for the resolved scope. This produces the mechanical findings that ground the qualitative assessment.
|
|
46
|
+
|
|
47
|
+
### Step 3: Qualitative Assessment
|
|
48
|
+
|
|
49
|
+
Run each specialized skill in sequence, passing the scope:
|
|
50
|
+
|
|
51
|
+
1. **`axiom:critique`** — Architecture (DIM-6) + Topology (DIM-1)
|
|
52
|
+
2. **`axiom:harden`** — Observability (DIM-2) + Resilience (DIM-7)
|
|
53
|
+
3. **`axiom:distill`** — Hygiene (DIM-5) + Topology (DIM-1)
|
|
54
|
+
4. **`axiom:verify`** — Test Fidelity (DIM-4) + Contracts (DIM-3)
|
|
55
|
+
|
|
56
|
+
Each skill produces findings in the standard format: `@skills/backend-quality/references/findings-format.md`
|
|
57
|
+
|
|
58
|
+
### Step 4: Deduplicate and Aggregate
|
|
59
|
+
|
|
60
|
+
Merge findings from all skills using these rules:
|
|
61
|
+
- **Same evidence + same dimension:** Merge into single finding (keep most detailed explanation)
|
|
62
|
+
- **Same evidence + different dimensions:** Keep both (finding genuinely spans two concerns)
|
|
63
|
+
- **Same pattern + different files:** Keep as separate findings
|
|
64
|
+
- **Deterministic + qualitative for same issue:** Merge, mark as `deterministic: true`
|
|
65
|
+
|
|
66
|
+
### Step 5: Coverage Check
|
|
67
|
+
|
|
68
|
+
Verify all 7 dimensions were assessed. If any dimension has zero findings and zero checks:
|
|
69
|
+
- **Warning:** "DIM-N ({name}) was not assessed — no checks or findings produced"
|
|
70
|
+
- This may indicate the scope doesn't contain code relevant to that dimension
|
|
71
|
+
|
|
72
|
+
### Step 6: Compute Verdict
|
|
73
|
+
|
|
74
|
+
Apply the verdict exactly as defined in `@skills/backend-quality/references/scoring-model.md` (single source of truth). Do not redefine thresholds here; compute and report the inputs required by the model (HIGH/MEDIUM/LOW counts).
|
|
75
|
+
|
|
76
|
+
Compute per-dimension metrics:
|
|
77
|
+
- Pass rate (deterministic checks only)
|
|
78
|
+
- Finding count (all findings)
|
|
79
|
+
- Severity distribution (HIGH / MEDIUM / LOW)
|
|
80
|
+
|
|
81
|
+
### Step 7: Produce Report
|
|
82
|
+
|
|
83
|
+
Output the structured report per the template in `@skills/backend-quality/references/scoring-model.md`:
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
# Backend Quality Report
|
|
87
|
+
|
|
88
|
+
**Scope:** [assessed scope]
|
|
89
|
+
**Verdict:** [CLEAN | NEEDS_ATTENTION]
|
|
90
|
+
**Date:** [current date]
|
|
91
|
+
|
|
92
|
+
## Summary
|
|
93
|
+
[Per-dimension table with findings, severity counts, pass rates]
|
|
94
|
+
|
|
95
|
+
## HIGH-Priority Findings
|
|
96
|
+
[Findings requiring immediate attention]
|
|
97
|
+
|
|
98
|
+
## MEDIUM-Priority Findings
|
|
99
|
+
[Findings to address soon]
|
|
100
|
+
|
|
101
|
+
## LOW-Priority Findings
|
|
102
|
+
[Polish and minor items]
|
|
103
|
+
|
|
104
|
+
## Dimensional Coverage
|
|
105
|
+
[Which dimensions assessed, any gaps]
|
|
106
|
+
|
|
107
|
+
## Recommendations
|
|
108
|
+
[Top 3-5 prioritized action items]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Error Handling
|
|
112
|
+
|
|
113
|
+
- **Empty scope (no files to assess):** Return "Nothing to assess — no files found in scope" with verdict CLEAN
|
|
114
|
+
- **Partial skill failure:** If one skill errors, continue with the remaining skills. Report the error in the output: "axiom:{skill} encountered an error: {message}. Results from other skills are still valid."
|
|
115
|
+
- **Scope validation:** Verify file/directory exists before starting. If not found: "Scope not found: {path}"
|
|
116
|
+
|
|
117
|
+
## Composition Guide
|
|
118
|
+
|
|
119
|
+
For details on how audit discovers skills, handles deduplication, and formats reports, see `@skills/audit/references/composition-guide.md`.
|
|
120
|
+
|
|
121
|
+
## References
|
|
122
|
+
|
|
123
|
+
- Dimension taxonomy: `@skills/backend-quality/references/dimensions.md`
|
|
124
|
+
- Finding format: `@skills/backend-quality/references/findings-format.md`
|
|
125
|
+
- Scoring model: `@skills/backend-quality/references/scoring-model.md`
|
|
126
|
+
- Composition details: `@skills/audit/references/composition-guide.md`
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Audit Composition Guide
|
|
2
|
+
|
|
3
|
+
How the `audit` skill orchestrates other axiom skills to produce a unified report.
|
|
4
|
+
|
|
5
|
+
## Skill Discovery
|
|
6
|
+
|
|
7
|
+
The audit skill invokes a fixed set of specialized skills:
|
|
8
|
+
|
|
9
|
+
| Order | Skill | Dimensions Covered |
|
|
10
|
+
|-------|-------|--------------------|
|
|
11
|
+
| 1 | `axiom:scan` | All (deterministic) |
|
|
12
|
+
| 2 | `axiom:critique` | Architecture, Topology |
|
|
13
|
+
| 3 | `axiom:harden` | Observability, Resilience |
|
|
14
|
+
| 4 | `axiom:distill` | Hygiene, Topology |
|
|
15
|
+
| 5 | `axiom:verify` | Test Fidelity, Contracts |
|
|
16
|
+
|
|
17
|
+
**Execution order matters:** `scan` runs first so specialized skills can reference its deterministic findings when layering qualitative assessment.
|
|
18
|
+
|
|
19
|
+
## Finding Deduplication
|
|
20
|
+
|
|
21
|
+
When aggregating findings from multiple skills, apply these rules in order:
|
|
22
|
+
|
|
23
|
+
### Rule 1: Same Evidence + Same Dimension → Merge
|
|
24
|
+
|
|
25
|
+
Two findings with identical `evidence` arrays and the same `dimension` are duplicates. Keep the one with the longer `explanation`. If lengths are equal, prefer the deterministic finding.
|
|
26
|
+
|
|
27
|
+
### Rule 2: Same Evidence + Different Dimensions → Keep Both
|
|
28
|
+
|
|
29
|
+
A single code location can violate multiple dimensions. For example, a lazy fallback constructor (DIM-1: Topology) may also be a silent error (DIM-2: Observability). Keep both findings — they represent genuinely different concerns.
|
|
30
|
+
|
|
31
|
+
### Rule 3: Same Pattern + Different Files → Keep Separate
|
|
32
|
+
|
|
33
|
+
The same anti-pattern in two different files is two separate findings. Each location needs independent attention.
|
|
34
|
+
|
|
35
|
+
### Rule 4: Deterministic + Qualitative → Merge as Deterministic
|
|
36
|
+
|
|
37
|
+
When `scan` and a qualitative skill both flag the same issue, merge them. The deterministic finding grounds the qualitative assessment. Set `deterministic: true` on the merged finding.
|
|
38
|
+
|
|
39
|
+
## Coverage Matrix
|
|
40
|
+
|
|
41
|
+
After deduplication, compute the coverage matrix:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
For each dimension (DIM-1 through DIM-7):
|
|
45
|
+
- deterministic_checks: count of scan checks run for this dimension
|
|
46
|
+
- qualitative_assessed: was a specialized skill invoked for this dimension?
|
|
47
|
+
- finding_count: total findings (post-dedup)
|
|
48
|
+
- severity_distribution: { HIGH: N, MEDIUM: N, LOW: N }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Flag dimensions with `deterministic_checks == 0 && finding_count == 0` as potentially unassessed.
|
|
52
|
+
|
|
53
|
+
## Partial Failure Handling
|
|
54
|
+
|
|
55
|
+
If a skill encounters an error during execution:
|
|
56
|
+
|
|
57
|
+
1. **Catch the error** — do not abort the entire audit
|
|
58
|
+
2. **Record the failure** — note which skill failed and why
|
|
59
|
+
3. **Continue with remaining skills** — partial results are better than no results
|
|
60
|
+
4. **Report the failure** — include a "Skill Failures" section in the report
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
## Skill Failures
|
|
64
|
+
|
|
65
|
+
- **axiom:critique** — Error: [error message]. Architecture and Topology dimensions may have incomplete coverage.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
5. **Adjust coverage matrix** — mark the failed skill's dimensions as partially assessed
|
|
69
|
+
|
|
70
|
+
## Report Assembly
|
|
71
|
+
|
|
72
|
+
### Verdict Computation
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
const HIGH_count = findings.filter(f => f.severity === 'HIGH').length;
|
|
76
|
+
const MEDIUM_count = findings.filter(f => f.severity === 'MEDIUM').length;
|
|
77
|
+
|
|
78
|
+
const verdict = (HIGH_count > 0 || MEDIUM_count > 5)
|
|
79
|
+
? 'NEEDS_ATTENTION'
|
|
80
|
+
: 'CLEAN';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Finding Ordering
|
|
84
|
+
|
|
85
|
+
Within each severity tier, order findings by:
|
|
86
|
+
1. Dimension (DIM-1 first, DIM-7 last)
|
|
87
|
+
2. Evidence file path (alphabetical)
|
|
88
|
+
3. Evidence line number (ascending)
|
|
89
|
+
|
|
90
|
+
### Recommendations
|
|
91
|
+
|
|
92
|
+
Generate 3-5 prioritized recommendations based on findings:
|
|
93
|
+
1. Address all HIGH findings first
|
|
94
|
+
2. Group related MEDIUM findings into themes
|
|
95
|
+
3. Suggest targeted skill runs for dimensions with many findings
|
|
96
|
+
4. If coverage gaps exist, recommend running specific skills
|
|
97
|
+
|
|
98
|
+
## Consumer Integration
|
|
99
|
+
|
|
100
|
+
Workflow tools that consume audit results should:
|
|
101
|
+
|
|
102
|
+
1. Parse the verdict (CLEAN / NEEDS_ATTENTION)
|
|
103
|
+
2. Map to their own status values (see scoring-model.md Consumer Mapping)
|
|
104
|
+
3. Optionally extract individual findings for issue creation
|
|
105
|
+
4. Use the coverage matrix to identify assessment gaps
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: backend-quality
|
|
3
|
+
description: "Core reference skill defining the backend quality dimension taxonomy, finding format, scoring model, and deterministic check catalog. Not user-invokable — referenced by all axiom skills as the shared foundation."
|
|
4
|
+
metadata:
|
|
5
|
+
author: lvlup-sw
|
|
6
|
+
version: 0.1.0
|
|
7
|
+
category: reference
|
|
8
|
+
dimensions:
|
|
9
|
+
- all
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Backend Quality — Foundation Reference
|
|
13
|
+
|
|
14
|
+
This skill defines the shared foundation for all axiom backend quality skills. It is NOT user-invokable — it exists to be referenced by the specialized skills.
|
|
15
|
+
|
|
16
|
+
## Dimension Taxonomy
|
|
17
|
+
|
|
18
|
+
Seven canonical quality dimensions: `@skills/backend-quality/references/dimensions.md`
|
|
19
|
+
|
|
20
|
+
| ID | Name | What it assesses |
|
|
21
|
+
|----|------|-----------------|
|
|
22
|
+
| DIM-1 | Topology | Dependency graphs, wiring, ambient state |
|
|
23
|
+
| DIM-2 | Observability | Error visibility, logging, failure transparency |
|
|
24
|
+
| DIM-3 | Contracts | Schema integrity, API consistency, type safety |
|
|
25
|
+
| DIM-4 | Test Fidelity | Test-production divergence, mock quality |
|
|
26
|
+
| DIM-5 | Hygiene | Dead code, vestigial patterns, evolutionary leftovers |
|
|
27
|
+
| DIM-6 | Architecture | SOLID, coupling, cohesion, dependency direction |
|
|
28
|
+
| DIM-7 | Resilience | Resource management, timeouts, failure handling |
|
|
29
|
+
|
|
30
|
+
## Finding Format
|
|
31
|
+
|
|
32
|
+
Standard schema for all skill output: `@skills/backend-quality/references/findings-format.md`
|
|
33
|
+
|
|
34
|
+
## Scoring Model
|
|
35
|
+
|
|
36
|
+
Verdict computation and health thresholds: `@skills/backend-quality/references/scoring-model.md`
|
|
37
|
+
|
|
38
|
+
## Deterministic Checks
|
|
39
|
+
|
|
40
|
+
Grep patterns and structural checks per dimension: `@skills/backend-quality/references/deterministic-checks.md`
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Deterministic Check Catalog
|
|
2
|
+
|
|
3
|
+
Grep patterns and structural checks organized by dimension. The `scan` skill executes these checks mechanically. Other skills invoke `scan` for their dimensions, then layer qualitative assessment.
|
|
4
|
+
|
|
5
|
+
Each check has: ID, pattern, what it detects, severity, and false-positive guidance.
|
|
6
|
+
|
|
7
|
+
## DIM-1: Topology
|
|
8
|
+
|
|
9
|
+
### T-1.1: Module-global mutable state
|
|
10
|
+
- **Pattern:** `^(let|var)\s+\w+\s*[:=]` at file scope (not inside function/class body)
|
|
11
|
+
- **Severity:** MEDIUM
|
|
12
|
+
- **Detects:** Ambient state that can diverge across module boundaries
|
|
13
|
+
- **False positives:** Intentional singletons with documented rationale; module-scoped constants that happen to use `let`
|
|
14
|
+
|
|
15
|
+
### T-1.2: Lazy fallback constructors
|
|
16
|
+
- **Pattern:** `if\s*\(\s*!\w+\s*\)\s*\{?\s*\w+\s*=\s*new\s`
|
|
17
|
+
- **Severity:** HIGH
|
|
18
|
+
- **Detects:** Degraded-mode instances created silently when wiring is missing
|
|
19
|
+
- **False positives:** Intentional lazy initialization with logging/telemetry
|
|
20
|
+
|
|
21
|
+
### T-1.3: Manual wiring functions
|
|
22
|
+
- **Pattern:** `^export\s+(async\s+)?function\s+(configure|register|setup|init)\w+\s*\(`
|
|
23
|
+
- **Severity:** MEDIUM
|
|
24
|
+
- **Detects:** Manual dependency wiring that requires correct call order
|
|
25
|
+
- **False positives:** Framework-required setup functions (e.g., Express middleware registration)
|
|
26
|
+
|
|
27
|
+
## DIM-2: Observability
|
|
28
|
+
|
|
29
|
+
### T-2.1: Empty catch blocks
|
|
30
|
+
- **Pattern:** `catch\s*(\(\w*\))?\s*\{\s*\}`
|
|
31
|
+
- **Severity:** HIGH
|
|
32
|
+
- **Detects:** Errors swallowed silently with no handling
|
|
33
|
+
- **False positives:** Intentional swallow with comment explaining rationale (rare, should be flagged for review)
|
|
34
|
+
|
|
35
|
+
### T-2.2: Catch with only console.log
|
|
36
|
+
- **Pattern:** `catch\s*\(\w+\)\s*\{\s*console\.(log|warn)\(`
|
|
37
|
+
- **Severity:** MEDIUM
|
|
38
|
+
- **Detects:** Error "handling" that only logs without context or recovery
|
|
39
|
+
- **False positives:** Development-only logging in test helpers
|
|
40
|
+
|
|
41
|
+
### T-2.3: Swallowed promise rejections
|
|
42
|
+
- **Pattern:** `\.catch\(\s*\(\)\s*=>\s*\{?\s*\}?\s*\)`
|
|
43
|
+
- **Severity:** HIGH
|
|
44
|
+
- **Detects:** Promise rejections silently ignored
|
|
45
|
+
- **False positives:** Intentional fire-and-forget with documented rationale
|
|
46
|
+
|
|
47
|
+
## DIM-3: Contracts
|
|
48
|
+
|
|
49
|
+
### T-3.1: Unsafe type assertions
|
|
50
|
+
- **Pattern:** `\bas\s+(?!const\b)\w+`
|
|
51
|
+
- **Severity:** MEDIUM
|
|
52
|
+
- **Detects:** Type assertions that bypass TypeScript's type checking
|
|
53
|
+
- **False positives:** Assertions after validated guards (e.g., `as Foo` after `instanceof Foo` check)
|
|
54
|
+
|
|
55
|
+
### T-3.2: Non-null assertions
|
|
56
|
+
- **Pattern:** `\w+!\.` or `\w+!\[`
|
|
57
|
+
- **Severity:** MEDIUM
|
|
58
|
+
- **Detects:** Non-null assertions that assume a value exists without checking
|
|
59
|
+
- **False positives:** Assertions after explicit null checks in the same scope
|
|
60
|
+
|
|
61
|
+
### T-3.3: Schema-type divergence (manual check)
|
|
62
|
+
- **Execution:** manual (excluded from deterministic scan)
|
|
63
|
+
- **Pattern:** Compare Zod schemas against TypeScript interfaces for missing/extra fields
|
|
64
|
+
- **Severity:** HIGH
|
|
65
|
+
- **Detects:** Runtime schema doesn't match compile-time types
|
|
66
|
+
- **False positives:** Intentional partial schemas (e.g., input validation that accepts a subset)
|
|
67
|
+
|
|
68
|
+
## DIM-4: Test Fidelity
|
|
69
|
+
|
|
70
|
+
### T-4.1: Skipped tests
|
|
71
|
+
- **Pattern:** `(describe|it|test)\.(skip|todo)\(`
|
|
72
|
+
- **Severity:** MEDIUM
|
|
73
|
+
- **Detects:** Tests that are disabled without tracked resolution
|
|
74
|
+
- **False positives:** Tests with linked issue references (`// TODO(#123)`)
|
|
75
|
+
|
|
76
|
+
### T-4.2: Mock-heavy tests
|
|
77
|
+
- **Pattern:** Count `vi\.mock|jest\.mock|sinon\.stub` per test file; flag if >3
|
|
78
|
+
- **Severity:** MEDIUM
|
|
79
|
+
- **Detects:** Over-isolation that hides integration behavior
|
|
80
|
+
- **False positives:** Tests for modules with many infrastructure boundaries
|
|
81
|
+
|
|
82
|
+
### T-4.3: Test setup divergence (manual check)
|
|
83
|
+
- **Execution:** manual (excluded from deterministic scan)
|
|
84
|
+
- **Pattern:** Compare test factory/setup functions against production initialization code
|
|
85
|
+
- **Severity:** HIGH
|
|
86
|
+
- **Detects:** Test wiring that doesn't match production wiring
|
|
87
|
+
- **False positives:** Intentional test-only configuration (e.g., in-memory DB for speed)
|
|
88
|
+
|
|
89
|
+
## DIM-5: Hygiene
|
|
90
|
+
|
|
91
|
+
### T-5.1: Commented-out code blocks
|
|
92
|
+
- **Pattern:** `^\s*\/\/\s*(function|class|const|let|var|if|for|while|return|export)\s` (3+ consecutive lines)
|
|
93
|
+
- **Severity:** MEDIUM
|
|
94
|
+
- **Detects:** Code preserved in comments instead of version control
|
|
95
|
+
- **False positives:** Documentation examples that happen to look like commented code
|
|
96
|
+
|
|
97
|
+
### T-5.2: Unused exports
|
|
98
|
+
- **Pattern:** Cross-reference `export` declarations against `import` statements project-wide
|
|
99
|
+
- **Severity:** LOW
|
|
100
|
+
- **Detects:** Exported symbols with no consumers
|
|
101
|
+
- **False positives:** Public API surface intentionally exported for external consumers
|
|
102
|
+
|
|
103
|
+
### T-5.3: Unreachable code
|
|
104
|
+
- **Pattern:** Code after unconditional `return`, `throw`, `break`, or `continue`
|
|
105
|
+
- **Severity:** MEDIUM
|
|
106
|
+
- **Detects:** Dead code that can never execute
|
|
107
|
+
- **False positives:** Generated code with defensive returns
|
|
108
|
+
|
|
109
|
+
## DIM-6: Architecture
|
|
110
|
+
|
|
111
|
+
### T-6.1: Circular imports
|
|
112
|
+
- **Pattern:** Build import graph; detect cycles
|
|
113
|
+
- **Severity:** HIGH
|
|
114
|
+
- **Detects:** Circular dependencies between modules
|
|
115
|
+
- **False positives:** Type-only imports that don't create runtime cycles
|
|
116
|
+
|
|
117
|
+
### T-6.2: God objects
|
|
118
|
+
- **Pattern:** Files with >500 lines or classes/objects with >10 exported members
|
|
119
|
+
- **Severity:** MEDIUM
|
|
120
|
+
- **Detects:** Modules with too many responsibilities
|
|
121
|
+
- **False positives:** Intentional facades or barrel files
|
|
122
|
+
|
|
123
|
+
### T-6.3: Dependency direction violations
|
|
124
|
+
- **Pattern:** Core/domain modules importing from infrastructure/CLI/UI modules
|
|
125
|
+
- **Severity:** MEDIUM
|
|
126
|
+
- **Detects:** Inverted dependency direction (core depends on periphery)
|
|
127
|
+
- **False positives:** Requires project-specific layer definitions to assess accurately
|
|
128
|
+
|
|
129
|
+
## DIM-7: Resilience
|
|
130
|
+
|
|
131
|
+
### T-7.1: Unbounded collections
|
|
132
|
+
- **Pattern:** `new\s+(Map|Set|Array)\s*\(` without nearby `.delete`, `.clear`, or size check
|
|
133
|
+
- **Severity:** HIGH
|
|
134
|
+
- **Detects:** Collections that grow without bound
|
|
135
|
+
- **False positives:** Collections with short, bounded lifetimes (e.g., within a request handler)
|
|
136
|
+
|
|
137
|
+
### T-7.2: Missing timeouts
|
|
138
|
+
- **Pattern:** `fetch\(` or `http\.(get|post|put)` without `signal`, `timeout`, or `AbortController`
|
|
139
|
+
- **Severity:** MEDIUM
|
|
140
|
+
- **Detects:** External calls that could hang indefinitely
|
|
141
|
+
- **False positives:** Calls to localhost services with guaranteed fast response
|
|
142
|
+
|
|
143
|
+
### T-7.3: Unbounded retry loops
|
|
144
|
+
- **Pattern:** `while\s*\(.*retry` or `for\s*\(.*attempt` without max limit
|
|
145
|
+
- **Severity:** HIGH
|
|
146
|
+
- **Detects:** Retry logic that could loop forever
|
|
147
|
+
- **False positives:** Loops with break conditions that aren't pattern-matched
|
|
148
|
+
|
|
149
|
+
## Extensibility
|
|
150
|
+
|
|
151
|
+
Projects can add custom checks via `.axiom/checks.md` at the repo root. Format matches this file — one section per dimension, each check with pattern, severity, description, and false-positive guidance. Custom checks are loaded alongside the built-in catalog by the `scan` skill.
|