@anysiteio/agent-skills 1.0.1 → 1.3.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.
@@ -0,0 +1,274 @@
1
+ # LLM Analysis Reference
2
+
3
+ ## Setup
4
+
5
+ ```bash
6
+ anysite llm setup
7
+ ```
8
+
9
+ Interactive configuration: selects provider (`openai` or `anthropic`), API key environment variable, default model, and optionally tests the connection. Writes to `~/.anysite/config.yaml` under the `llm:` key.
10
+
11
+ ### Configuration Format
12
+
13
+ ```yaml
14
+ llm:
15
+ default_provider: openai
16
+ providers:
17
+ openai:
18
+ provider: openai
19
+ api_key_env: OPENAI_API_KEY
20
+ default_model: gpt-4.1-mini
21
+ anthropic:
22
+ provider: anthropic
23
+ api_key_env: ANTHROPIC_API_KEY
24
+ default_model: claude-sonnet-4-5-20250514
25
+ cache_enabled: true
26
+ default_temperature: 0.0
27
+ default_max_tokens: 4096
28
+ rate_limit: "50/m"
29
+ ```
30
+
31
+ ### Provider Support
32
+
33
+ | Provider | SDK | Structured Output | Default Model |
34
+ |----------|-----|-------------------|---------------|
35
+ | OpenAI | `openai` (AsyncOpenAI) | JSON Schema via `response_format` | `gpt-4.1-mini` |
36
+ | Anthropic | `anthropic` (AsyncAnthropic) | System-prompt with JSON schema instruction | `claude-sonnet-4-5-20250514` |
37
+
38
+ ## Commands
39
+
40
+ ### `anysite llm summarize`
41
+
42
+ Summarize each record in a dataset source.
43
+
44
+ ```bash
45
+ anysite llm summarize <dataset.yaml> --source <source_id> [OPTIONS]
46
+ ```
47
+
48
+ | Option | Description |
49
+ |--------|-------------|
50
+ | `--source, -s` | Source to summarize (required) |
51
+ | `--max-length` | Max words in summary (default: 100) |
52
+ | `--output-column` | Column name for summary (default: `summary`) |
53
+ | `--prompt` | Custom prompt override |
54
+ | `--prompt-file` | Read prompt from file |
55
+ | `--dry-run` | Show prompt without calling LLM |
56
+
57
+ ### `anysite llm classify`
58
+
59
+ Classify records into categories.
60
+
61
+ ```bash
62
+ anysite llm classify <dataset.yaml> --source <source_id> [OPTIONS]
63
+ ```
64
+
65
+ | Option | Description |
66
+ |--------|-------------|
67
+ | `--source, -s` | Source to classify (required) |
68
+ | `--categories, -c` | Comma-separated categories (auto-detects if omitted) |
69
+ | `--multi` | Allow multiple categories per record |
70
+ | `--output-column` | Column name for category (default: `category`) |
71
+ | `--prompt` | Custom prompt override |
72
+ | `--prompt-file` | Read prompt from file |
73
+ | `--dry-run` | Show prompt without calling LLM |
74
+
75
+ When `--categories` is omitted, the classifier auto-detects 3-7 categories from the first 20 records.
76
+
77
+ ### `anysite llm enrich`
78
+
79
+ Enrich records with LLM-extracted attributes.
80
+
81
+ ```bash
82
+ anysite llm enrich <dataset.yaml> --source <source_id> --add <spec> [OPTIONS]
83
+ ```
84
+
85
+ | Option | Description |
86
+ |--------|-------------|
87
+ | `--source, -s` | Source to enrich (required) |
88
+ | `--add` | Field spec: `name:type_or_values` (repeatable, at least one required) |
89
+ | `--prompt` | Custom prompt override |
90
+ | `--prompt-file` | Read prompt from file |
91
+ | `--dry-run` | Show prompt without calling LLM |
92
+
93
+ **Field spec formats:**
94
+
95
+ | Format | Example | Description |
96
+ |--------|---------|-------------|
97
+ | Enum | `sentiment:positive/negative/neutral` | Constrained to listed values |
98
+ | Type | `language:string` | Free-form string |
99
+ | Range | `quality_score:1-10` | Integer value |
100
+ | Boolean | `is_technical:boolean` | True/false |
101
+ | Number | `relevance:number` | Floating point |
102
+
103
+ ### `anysite llm generate`
104
+
105
+ Generate text for each record using a custom prompt.
106
+
107
+ ```bash
108
+ anysite llm generate <dataset.yaml> --source <source_id> --prompt <template> [OPTIONS]
109
+ ```
110
+
111
+ | Option | Description |
112
+ |--------|-------------|
113
+ | `--source, -s` | Source to process (required) |
114
+ | `--prompt` | Prompt with `{field}` placeholders (required unless `--prompt-file`) |
115
+ | `--prompt-file` | Read prompt from file |
116
+ | `--output-column` | Column name for generated text (default: `text`) |
117
+ | `--dry-run` | Show prompt without calling LLM |
118
+
119
+ The prompt template supports `{field_name}` placeholders that are replaced with record values. Example: `"Write a bio for {name} who works as {headline}"`.
120
+
121
+ Default temperature is 0.7 (higher than other commands).
122
+
123
+ ### `anysite llm match`
124
+
125
+ Match records between two dataset sources.
126
+
127
+ ```bash
128
+ anysite llm match <dataset.yaml> --source-a <id> --source-b <id> [OPTIONS]
129
+ ```
130
+
131
+ | Option | Description |
132
+ |--------|-------------|
133
+ | `--source-a` | First source (required) |
134
+ | `--source-b` | Second source (required) |
135
+ | `--fields-a` | Fields from source A to include |
136
+ | `--fields-b` | Fields from source B to include |
137
+ | `--top-k` | Max matches per source-a record (default: 3) |
138
+ | `--threshold` | Min match score 0.0-1.0 (default: 0.5) |
139
+ | `--prompt` | Custom prompt override |
140
+ | `--prompt-file` | Read prompt from file |
141
+ | `--dry-run` | Show prompt without calling LLM |
142
+
143
+ Processes each source-a record against batches of 10 source-b records. Returns matches with score and reason.
144
+
145
+ ### `anysite llm deduplicate`
146
+
147
+ Find semantic duplicates in a dataset source.
148
+
149
+ ```bash
150
+ anysite llm deduplicate <dataset.yaml> --source <source_id> [OPTIONS]
151
+ ```
152
+
153
+ | Option | Description |
154
+ |--------|-------------|
155
+ | `--source, -s` | Source to deduplicate (required) |
156
+ | `--key, -k` | Field for blocking (grouping similar records) (default: `name`) |
157
+ | `--threshold` | Min confidence for duplicate (default: 0.8) |
158
+ | `--prompt` | Custom prompt override |
159
+ | `--prompt-file` | Read prompt from file |
160
+ | `--dry-run` | Show prompt without calling LLM |
161
+
162
+ Uses a blocking pass (first 3 chars of key field) to group candidate duplicates before LLM evaluation.
163
+
164
+ ### `anysite llm cache-stats`
165
+
166
+ Show LLM cache statistics (entry count, total input/output tokens).
167
+
168
+ ```bash
169
+ anysite llm cache-stats
170
+ anysite llm cache-stats --json # Machine-readable JSON output
171
+ ```
172
+
173
+ ### `anysite llm cache-clear`
174
+
175
+ Clear all cached LLM responses.
176
+
177
+ ```bash
178
+ anysite llm cache-clear
179
+ anysite llm cache-clear --json # Machine-readable JSON output
180
+ ```
181
+
182
+ ## Common Options
183
+
184
+ These options are shared across `summarize`, `classify`, `enrich`, `generate`, `match`, and `deduplicate`:
185
+
186
+ | Option | Description | Default |
187
+ |--------|-------------|---------|
188
+ | `--provider` | LLM provider name | From config |
189
+ | `--model` | Model ID override | From config |
190
+ | `--parallel, -j` | Concurrent LLM calls | 5 |
191
+ | `--rate-limit` | Rate limit (e.g., `"50/m"`, `"10/s"`) | From config |
192
+ | `--temperature` | LLM temperature | 0.0 (0.7 for generate) |
193
+ | `--max-tokens` | Max response tokens | 4096 |
194
+ | `--no-cache` | Skip cache lookup | false |
195
+ | `--format, -f` | Output format: json/jsonl/csv/table | json |
196
+ | `--output, -o` | Write results to file | stdout |
197
+ | `--fields` | Record fields to include in LLM prompt | All fields |
198
+ | `--quiet, -q` | Suppress progress/stats output | false |
199
+ | `--dry-run` | Show prompt without calling LLM | false |
200
+ | `--prompt` | Custom prompt template | Built-in |
201
+ | `--prompt-file` | Read prompt from file | - |
202
+
203
+ ## Prompt System
204
+
205
+ ### Built-in Prompts
206
+
207
+ | Key | Used by | Description |
208
+ |-----|---------|-------------|
209
+ | `summarize` | `summarize` | Summarize record in N words |
210
+ | `classify` | `classify` | Classify records into categories |
211
+ | `classify_auto_detect` | `classify` (no categories) | Auto-detect categories from sample |
212
+ | `match` | `match` | Rank candidates by relevance |
213
+ | `deduplicate` | `deduplicate` | Identify semantic duplicates |
214
+ | `enrich` | `enrich` | Extract specified attributes |
215
+
216
+ ### Custom Prompts
217
+
218
+ Use `--prompt` for inline templates or `--prompt-file` to read from a file.
219
+
220
+ Template variables:
221
+ - `{record}` — formatted record (all non-underscore fields)
222
+ - `{records}` — formatted batch of records with indices
223
+ - `{field_name}` — individual record field value
224
+ - Command-specific variables: `{max_length}`, `{categories}`, `{field_descriptions}`, `{source_a_name}`, `{source_b_name}`, etc.
225
+
226
+ ### Field Filtering
227
+
228
+ `--fields "name,headline,location"` restricts which record fields are sent to the LLM. Supports dot-notation for nested fields (e.g., `urn.value`).
229
+
230
+ ## Cache System
231
+
232
+ SQLite database at `~/.anysite/llm_cache.db` with WAL mode. Cache keys are SHA256 hashes of `{provider}:{system_prompt+user_prompt}:{input_data}`.
233
+
234
+ Disable per-command with `--no-cache`. Disable globally by setting `cache_enabled: false` in config.
235
+
236
+ ## Examples
237
+
238
+ ```bash
239
+ # Classify LinkedIn posts by sentiment
240
+ anysite llm classify dataset.yaml --source posts \
241
+ --categories "positive,negative,neutral" \
242
+ --fields "text,title" --format table --output sentiment.csv
243
+
244
+ # Summarize company profiles
245
+ anysite llm summarize dataset.yaml --source companies \
246
+ --fields "name,description,industry" --max-length 50 --format table
247
+
248
+ # Enrich profiles with multiple attributes
249
+ anysite llm enrich dataset.yaml --source profiles \
250
+ --add "seniority:junior/mid/senior/executive" \
251
+ --add "department:string" \
252
+ --add "is_technical:boolean" \
253
+ --format csv --output enriched.csv
254
+
255
+ # Generate personalized messages
256
+ anysite llm generate dataset.yaml --source profiles \
257
+ --prompt "Write a cold outreach message for {name}, {headline} at {company}" \
258
+ --temperature 0.7 --model gpt-4.1
259
+
260
+ # Match people to companies
261
+ anysite llm match dataset.yaml --source-a profiles --source-b companies \
262
+ --fields-a "name,headline,skills" --fields-b "name,industry,description" \
263
+ --top-k 3 --threshold 0.6
264
+
265
+ # Find duplicate profiles
266
+ anysite llm deduplicate dataset.yaml --source profiles \
267
+ --key name --threshold 0.8 --fields "name,headline,location"
268
+
269
+ # Preview prompt without calling LLM
270
+ anysite llm classify dataset.yaml --source posts --dry-run
271
+
272
+ # Use a custom prompt from file
273
+ anysite llm generate dataset.yaml --source profiles --prompt-file my_prompt.txt
274
+ ```
@@ -0,0 +1,287 @@
1
+ # Skill Audit
2
+
3
+ Static security auditor for Claude Code skills, commands, and plugins. Detects dangerous patterns — excessive permissions, hooks, prompt injection, credential access, privilege escalation — before you enable a skill.
4
+
5
+ **Developer:** Anysite Skills Contributors
6
+
7
+ ## Overview
8
+
9
+ The Skill Audit skill performs read-only static security analysis of Claude Code skills, commands, and plugins. It analyzes SKILL.md files, supporting scripts, and hooks to identify security risks before installation.
10
+
11
+ Works with both local files and remote GitHub repositories.
12
+
13
+ ## Installation
14
+
15
+ ### Prerequisites
16
+
17
+ - **Claude Code** - Version with skill support enabled
18
+ - **Anysite Skills Marketplace** - Already added if you're viewing this
19
+
20
+ ### Install from Marketplace
21
+
22
+ ```bash
23
+ # Add the marketplace (if not already added)
24
+ /plugin marketplace add https://github.com/anysiteio/agent-skills
25
+
26
+ # Install the skill
27
+ /plugin install skill-audit@anysite-skills
28
+ ```
29
+
30
+ ### Permissions
31
+
32
+ The skill requires these permissions (automatically granted during installation):
33
+
34
+ ```json
35
+ {
36
+ "permissions": {
37
+ "allow": [
38
+ "Skill(skill-audit)",
39
+ "Skill(skill-audit:*)"
40
+ ]
41
+ }
42
+ }
43
+ ```
44
+
45
+ For stricter WebFetch domain enforcement (recommended):
46
+
47
+ ```json
48
+ {
49
+ "permissions": {
50
+ "allow": [
51
+ "Skill(skill-audit)",
52
+ "Skill(skill-audit:*)",
53
+ "WebFetch(domain:api.github.com)",
54
+ "WebFetch(domain:raw.githubusercontent.com)"
55
+ ]
56
+ }
57
+ }
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ ### Quick Start
63
+
64
+ Once installed, invoke the skill to audit targets:
65
+
66
+ ```bash
67
+ # Audit a specific skill directory
68
+ /skill-audit .claude/skills/my-skill
69
+
70
+ # Audit a specific command file
71
+ /skill-audit .claude/commands/deploy.md
72
+
73
+ # Audit a skill by name (searches .claude/skills/ and .claude/commands/)
74
+ /skill-audit my-skill
75
+
76
+ # Audit ALL skills and commands in the current project
77
+ /skill-audit
78
+ ```
79
+
80
+ ### Remote Audit (GitHub)
81
+
82
+ Audit skills from GitHub before installing them:
83
+
84
+ ```bash
85
+ # Audit a GitHub repository
86
+ /skill-audit https://github.com/user/repo
87
+
88
+ # Audit a specific directory on GitHub
89
+ /skill-audit https://github.com/user/repo/tree/main/.claude/skills/my-skill
90
+
91
+ # Audit a single file from GitHub
92
+ /skill-audit https://github.com/user/repo/blob/main/.claude/commands/deploy.md
93
+ ```
94
+
95
+ ## What It Checks
96
+
97
+ The auditor performs a comprehensive 5-phase static analysis:
98
+
99
+ ### Analysis Phases
100
+
101
+ | Phase | What It Analyzes |
102
+ |-------|------------------|
103
+ | **Discovery** | Inventories all files in the skill/plugin directory, detects plugin structure |
104
+ | **Frontmatter** | Checks `allowed-tools`, hooks, permissions, invocation settings |
105
+ | **Body Content** | Scans for dangerous tool references, settings manipulation, injection patterns, sensitive file access |
106
+ | **Supporting Files** | Examines scripts for network egress, credential access, code execution, persistence |
107
+ | **Hooks** | Detects hook definitions or installations, classifies by risk level |
108
+
109
+ ### Detection Rules
110
+
111
+ | Rule ID | Severity | Description |
112
+ |---------|----------|-------------|
113
+ | **SKL-001a** | Medium | Hooks present in skill (require manual review) |
114
+ | **SKL-001b** | Critical | Hooks with dangerous patterns (network, credentials, persistence) |
115
+ | **SKL-002** | Critical/High | Prompt injection or dynamic injection patterns (`!` + backticks, `$(...)`) |
116
+ | **SKL-003** | High | Bash/WebFetch/broad wildcards in `allowed-tools` |
117
+ | **SKL-004** | Medium/High | Missing `disable-model-invocation` on side-effect skills |
118
+ | **SKL-005** | High | Dangerous patterns in supporting scripts |
119
+ | **SKL-006** | High | Instructions to change permissions, settings, or hooks |
120
+
121
+ ### Risk Scoring
122
+
123
+ | Score Range | Risk Level | Recommendation |
124
+ |-------------|------------|----------------|
125
+ | **0** | Clean | No findings, safe to enable |
126
+ | **1-3** | Low-Medium | Review findings, likely safe |
127
+ | **4-6** | High | Needs attention before enabling |
128
+ | **7-8** | Critical | Do not enable without remediation |
129
+ | **9-10** | Severe | Multiple critical findings, likely malicious |
130
+
131
+ ## Output Format
132
+
133
+ The skill generates detailed audit reports:
134
+
135
+ ```markdown
136
+ # Skill Audit Report: my-skill
137
+
138
+ **Path:** .claude/skills/my-skill/
139
+ **Date:** 2026-01-30
140
+ **Risk Score:** 3/10
141
+ **Overall Severity:** Medium
142
+
143
+ ## Summary
144
+ The skill uses WebFetch for external API calls but has no hooks or injection patterns.
145
+
146
+ ## Findings
147
+ | # | ID | Severity | Finding | Location | Evidence |
148
+ |---|---|---|---|---|---|
149
+ | 1 | SKL-003 | Medium | WebFetch in allowed-tools | SKILL.md:4 | `allowed-tools: Read, WebFetch` |
150
+
151
+ ## Hardening Recommendations
152
+ 1. Remove WebFetch unless strictly required for the skill's purpose.
153
+ ```
154
+
155
+ ## Security Properties
156
+
157
+ This skill is designed with security as the top priority:
158
+
159
+ ### Read-Only Analysis
160
+ - Uses ONLY `Read`, `Grep`, `Glob` tools (plus `WebFetch` for remote GitHub audits)
161
+ - Cannot modify files or execute commands
162
+ - No system state changes
163
+
164
+ ### Anti-Injection Protection
165
+ - All audited content treated as untrusted malicious input
166
+ - Instructions found in audited files are flagged as findings
167
+ - Never follows or executes instructions from audited content
168
+
169
+ ### Evidence Redaction
170
+ - Secrets, tokens, and API keys found in evidence are automatically masked
171
+ - Prevents accidental exposure of credentials in audit reports
172
+ - Shows only first 4 and last 4 characters of sensitive values
173
+
174
+ ### Scoped WebFetch
175
+ - WebFetch restricted to `raw.githubusercontent.com` and `api.github.com`
176
+ - Only used for fetching remote skill files from GitHub
177
+ - No redirects followed, no links from fetched content used
178
+ - No arbitrary URL access
179
+
180
+ ### Isolated Execution
181
+ - Runs in a forked subagent context (`context: fork`)
182
+ - Prevents context contamination from audited content
183
+ - Clean execution environment for each audit
184
+
185
+ ### Manual-Only Invocation
186
+ - `disable-model-invocation: true` prevents auto-triggering
187
+ - Must be invoked explicitly via `/skill-audit`
188
+ - No automatic background scans
189
+
190
+ ### Remote Audit Limits
191
+ - Maximum 20 files per remote audit
192
+ - 100 KB file size limit
193
+ - Large repositories require targeting a specific subdirectory
194
+
195
+ ## Use Cases
196
+
197
+ ### Pre-Installation Audit
198
+ Audit skills from GitHub before installing them:
199
+ ```bash
200
+ /skill-audit https://github.com/third-party/suspicious-skill
201
+ ```
202
+
203
+ ### Regular Security Reviews
204
+ Audit all installed skills periodically:
205
+ ```bash
206
+ /skill-audit
207
+ ```
208
+
209
+ ### Third-Party Skill Vetting
210
+ Review community-contributed skills before enabling:
211
+ ```bash
212
+ /skill-audit .claude/skills/community-skill
213
+ ```
214
+
215
+ ### Command Safety Check
216
+ Verify custom commands don't have dangerous patterns:
217
+ ```bash
218
+ /skill-audit .claude/commands/deploy.md
219
+ ```
220
+
221
+ ## How It Works
222
+
223
+ ```
224
+ User Request
225
+
226
+ skill-audit Skill
227
+
228
+ Static Analysis Engine
229
+
230
+ Security Report (Read-only, no modifications)
231
+ ```
232
+
233
+ The skill performs purely static analysis without executing any code from the audited target. All analysis is based on pattern matching, AST analysis, and heuristic detection.
234
+
235
+ ## Key Features
236
+
237
+ **Comprehensive Detection**
238
+ - Hooks and auto-execution patterns
239
+ - Prompt injection attempts
240
+ - Excessive permissions
241
+ - Credential access patterns
242
+ - Privilege escalation attempts
243
+
244
+ **Multi-Target Support**
245
+ - Local skill directories
246
+ - Individual command files
247
+ - Remote GitHub repositories
248
+ - Bulk project audits
249
+
250
+ **Zero Side Effects**
251
+ - Read-only operation
252
+ - No file modifications
253
+ - No command execution
254
+ - Safe to run on any skill
255
+
256
+ **Detailed Reporting**
257
+ - Risk scoring (0-10 scale)
258
+ - Severity classification
259
+ - Specific evidence locations
260
+ - Hardening recommendations
261
+
262
+ ## Structure
263
+
264
+ ```
265
+ skill-audit/
266
+ ├── SKILL.md # Skill definition + audit logic (single file)
267
+ └── README.md # This file
268
+ ```
269
+
270
+ ## Contributing
271
+
272
+ Found a security pattern that should be detected? Submit an issue or pull request at:
273
+ https://github.com/anysiteio/agent-skills/issues
274
+
275
+ ## Support
276
+
277
+ - **GitHub Issues**: [github.com/anysiteio/agent-skills/issues](https://github.com/anysiteio/agent-skills/issues)
278
+ - **Documentation**: [SKILL.md](SKILL.md)
279
+ - **Anysite MCP**: [docs.anysite.io](https://docs.anysite.io)
280
+
281
+ ## License
282
+
283
+ MIT License - see [LICENSE](../../LICENSE) file for details
284
+
285
+ ---
286
+
287
+ **Note**: This is a security/defensive tool and operates independently from the anysite MCP server. It does not require anysite MCP server to function.