skill-checker 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -4,62 +4,179 @@ Security checker for Claude Code skills — detect injection, malicious code, an
4
4
 
5
5
  ## Features
6
6
 
7
- - **51 security rules** across 6 categories: structural validity, content quality, injection detection, code safety, supply chain, and resource abuse
7
+ - **53 security rules** across 6 categories: structural validity, content quality, injection detection, code safety, supply chain, and resource abuse
8
8
  - **Scoring system**: Grade A–F with 0–100 score
9
9
  - **Dual entry**: CLI tool + PreToolUse hook for automatic interception
10
10
  - **Configurable policies**: strict / balanced / permissive approval strategies
11
+ - **Context-aware detection**: severity reduction in code blocks and documentation sections, with zero reduction for injection rules
12
+ - **IOC threat intelligence**: built-in seed data for known malicious hashes, C2 IPs, and typosquat names
11
13
  - **Multiple output formats**: terminal (color), JSON, hook response
12
14
 
13
15
  ## Security Standard & Benchmark
14
16
 
15
- Skill Checker's 51 rules are aligned with established security frameworks
16
- including OWASP Top 10 for LLM Applications (2025), MITRE CWE, and MITRE
17
- ATT&CK. The tool ships with a reproducible benchmark dataset of six fixture
18
- skills covering all rule categories. This alignment is an internal mapping
19
- exercise — Skill Checker does not claim third-party certification or
20
- external audit status.
17
+ Skill Checker's 53 rules are aligned with established security frameworks including OWASP Top 10 for LLM Applications (2025), MITRE CWE, and MITRE ATT&CK. The tool ships with a reproducible benchmark dataset of six fixture skills covering all rule categories. This alignment is an internal mapping exercise — Skill Checker does not claim third-party certification or external audit status.
21
18
 
22
- See [docs/SECURITY_BENCHMARK.md](docs/SECURITY_BENCHMARK.md) for the full
23
- rule mapping matrix, benchmark methodology, scoring model, and known
24
- limitations.
19
+ See [docs/SECURITY_BENCHMARK.md](docs/SECURITY_BENCHMARK.md) for the full rule mapping matrix, benchmark methodology, scoring model, and known limitations.
25
20
 
26
21
  ## Quick Start
27
22
 
28
23
  ```bash
24
+ # Install globally
25
+ npm install -g skill-checker
26
+
29
27
  # Scan a skill directory
28
+ skill-checker scan ./path/to/skill/
29
+
30
+ # Or run without installing
30
31
  npx skill-checker scan ./path/to/skill/
32
+ ```
31
33
 
32
- # Scan with JSON output
33
- npx skill-checker scan ./path/to/skill/ --format json
34
+ ## Usage
34
35
 
35
- # Scan with strict policy
36
- npx skill-checker scan ./path/to/skill/ --policy strict
36
+ ```bash
37
+ skill-checker scan <path> [options]
37
38
  ```
38
39
 
39
- ## Installation
40
+ | Option | Description |
41
+ |--------|-------------|
42
+ | `-f, --format <format>` | Output format: `terminal` (default), `json`, `hook` |
43
+ | `-p, --policy <policy>` | Approval policy: `strict`, `balanced` (default), `permissive` |
44
+ | `-c, --config <path>` | Path to config file |
40
45
 
41
46
  ```bash
42
- npm install -g skill-checker
47
+ # Colored terminal report
48
+ skill-checker scan ./my-skill
49
+
50
+ # JSON output for CI/programmatic use
51
+ skill-checker scan ./my-skill --format json
52
+
53
+ # Hook response format (for PreToolUse integration)
54
+ skill-checker scan ./my-skill --format hook
55
+
56
+ # Strict policy — deny on HIGH and above
57
+ skill-checker scan ./my-skill --policy strict
43
58
  ```
44
59
 
60
+ Exit code `0` = no critical issues, `1` = critical issues detected.
61
+
62
+ ## Hook Integration
63
+
64
+ Skill Checker can run automatically as a Claude Code [PreToolUse hook](https://docs.anthropic.com/en/docs/claude-code/hooks), intercepting skill file writes before they happen.
65
+
66
+ ### Setup
67
+
68
+ ```bash
69
+ npx tsx hook/install.ts
70
+ ```
71
+
72
+ This adds a hook entry to `~/.claude/settings.json`:
73
+
74
+ ```json
75
+ {
76
+ "hooks": {
77
+ "PreToolUse": [
78
+ {
79
+ "matcher": "Write|Edit",
80
+ "hook": "/path/to/skill-gate.sh"
81
+ }
82
+ ]
83
+ }
84
+ }
85
+ ```
86
+
87
+ ### How It Works
88
+
89
+ 1. Claude Code intercepts Write/Edit operations targeting SKILL.md files
90
+ 2. `skill-gate.sh` receives the file content via stdin (JSON)
91
+ 3. Runs `skill-checker scan --format hook` on the content
92
+ 4. Returns a permission decision: `allow`, `ask`, or `deny`
93
+
94
+ The hook is fail-closed — if the scanner is unavailable, JSON parsing fails, or any unexpected error occurs, it returns `ask` (never silently allows).
95
+
96
+ ### Requirements
97
+
98
+ - `jq` must be installed for JSON parsing
99
+ - `skill-checker` must be globally installed or available via `npx`
100
+
101
+ ## Scoring
102
+
103
+ Base score starts at **100**. Each finding deducts points by severity:
104
+
105
+ | Severity | Deduction |
106
+ |----------|-----------|
107
+ | CRITICAL | -25 |
108
+ | HIGH | -10 |
109
+ | MEDIUM | -3 |
110
+ | LOW | -1 |
111
+
112
+ | Grade | Score | Meaning |
113
+ |-------|-------|---------|
114
+ | A | 90–100 | Safe to install |
115
+ | B | 75–89 | Minor issues |
116
+ | C | 60–74 | Review advised |
117
+ | D | 40–59 | Significant risk |
118
+ | F | 0–39 | Not recommended |
119
+
45
120
  ## Configuration
46
121
 
47
- Create a `.skillcheckerrc.yaml` in your project root or home directory:
122
+ Create `.skillcheckerrc.yaml` in your project root or home directory:
48
123
 
49
124
  ```yaml
50
- policy: balanced
125
+ # Approval policy
126
+ policy: balanced # strict / balanced / permissive
51
127
 
128
+ # Override severity for specific rules
52
129
  overrides:
53
- CODE-006: LOW
130
+ CODE-006: LOW # env var access is expected in my skills
131
+ SUPPLY-002: LOW # I trust npx -y in my workflow
54
132
 
133
+ # Ignore rules entirely
55
134
  ignore:
56
- - CONT-006
135
+ - CONT-006 # reference-heavy skills are fine
136
+ ```
137
+
138
+ Config is resolved in order: CLI `--config` flag → project directory (walks up) → home directory → defaults.
139
+
140
+ ### Policy Matrix
141
+
142
+ | Severity | strict | balanced | permissive |
143
+ |----------|--------|----------|------------|
144
+ | CRITICAL | deny | deny | ask |
145
+ | HIGH | deny | ask | report |
146
+ | MEDIUM | ask | report | report |
147
+ | LOW | report | report | report |
148
+
149
+ ## Rule Categories
150
+
151
+ | Category | Rules | Examples |
152
+ |----------|-------|---------|
153
+ | Structural (STRUCT) | 8 | Missing SKILL.md, invalid frontmatter, binary files |
154
+ | Content (CONT) | 7 | Placeholder text, lorem ipsum, promotional content |
155
+ | Injection (INJ) | 9 | Zero-width chars, prompt override, tag injection, encoded payloads |
156
+ | Code Safety (CODE) | 13 | eval/exec, shell execution, API key leakage, rm -rf, obfuscation |
157
+ | Supply Chain (SUPPLY) | 10 | Unknown MCP servers, suspicious domains, malicious hashes, typosquat |
158
+ | Resource Abuse (RES) | 6 | Unrestricted tool access, disable safety checks, ignore project rules |
159
+
160
+ See [docs/SECURITY_BENCHMARK.md](docs/SECURITY_BENCHMARK.md) for the complete rule mapping with OWASP/CWE/ATT&CK references.
161
+
162
+ ## Programmatic API
163
+
164
+ ```typescript
165
+ import { scanSkillDirectory } from 'skill-checker';
166
+
167
+ const report = scanSkillDirectory('./my-skill', {
168
+ policy: 'strict',
169
+ overrides: { 'CODE-006': 'LOW' },
170
+ ignore: ['CONT-001'],
171
+ });
172
+
173
+ console.log(report.grade, report.score, report.results.length);
57
174
  ```
58
175
 
59
176
  ## License
60
177
 
61
- This project is licensed under the **GNU Affero General Public License v3.0 (AGPLv3)** - see the [LICENSE](LICENSE) file for details.
178
+ This project is licensed under the **GNU Affero General Public License v3.0 (AGPLv3)** see the [LICENSE](LICENSE) file for details.
62
179
 
63
- **商业授权 (Commercial License)**
180
+ **Commercial License (商业授权)**
64
181
 
65
- 如果您希望将本工具集成到闭源的商业产品、SaaS 服务中,或者由于公司合规原因无法遵守 AGPLv3 协议,请通过 Alexander.kinging@gmail.com 联系作者购买商业授权。
182
+ If you want to integrate this tool into a closed-source commercial product or SaaS, or cannot comply with AGPLv3 due to company policy, contact Alexander.kinging@gmail.com for a commercial license.
File without changes