claude-skills-cli 0.0.3 → 0.0.4

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,458 @@
1
+ # Anthropic Resources - Official Guidance
2
+
3
+ Key insights from Anthropic's official Agent Skills documentation.
4
+
5
+ **Sources**:
6
+
7
+ - [Agent Skills Overview](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview)
8
+ - [Engineering Blog](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
9
+ - [Product Announcement](https://www.anthropic.com/news/skills)
10
+
11
+ ---
12
+
13
+ ## The Progressive Disclosure System
14
+
15
+ **Core Design Principle**: Skills load information in stages as needed, rather than consuming context upfront.
16
+
17
+ ### The 3-Level Loading System
18
+
19
+ | Level | File | Context Window | Token Budget | When Loaded |
20
+ | ------ | ---------------------------------------------- | -------------------------- | ------------ | ------------- |
21
+ | **1** | SKILL.md Metadata (YAML) | Always loaded | ~100 tokens | At startup |
22
+ | **2** | SKILL.md Body (Markdown) | Loaded when skill triggers | <5k tokens | When relevant |
23
+ | **3+** | Bundled files (references/, scripts/, assets/) | Loaded as needed by Claude | Unlimited\* | On-demand |
24
+
25
+ \*No practical limit - files only load when accessed
26
+
27
+ ### Why This Matters
28
+
29
+ > "Like a well-organized manual that starts with a table of contents, then specific chapters, and finally a detailed appendix, skills let Claude load information only as needed."
30
+ >
31
+ > — Anthropic Engineering Blog
32
+
33
+ **Benefits**:
34
+
35
+ - You can install many skills without context penalty
36
+ - Claude only knows each skill exists and when to use it (Level 1)
37
+ - Detailed content doesn't consume tokens until needed
38
+ - Effectively unbounded context per skill (via Level 3)
39
+
40
+ ---
41
+
42
+ ## How Skills Work
43
+
44
+ ### Skill Discovery and Loading
45
+
46
+ 1. **Startup**: Claude pre-loads `name` and `description` of every installed skill into system prompt
47
+ 2. **User request**: User makes a request that might need a skill
48
+ 3. **Skill matching**: Claude scans available skills to find relevant matches
49
+ 4. **Skill loading**: If relevant, Claude reads SKILL.md from filesystem via bash
50
+ 5. **On-demand access**: Claude reads additional files (references/, scripts/) as needed
51
+
52
+ ### The Filesystem Architecture
53
+
54
+ Skills run in a code execution environment where Claude has:
55
+
56
+ - **Filesystem access**: Skills exist as directories on a virtual machine
57
+ - **Bash commands**: Claude uses bash to read files and execute scripts
58
+ - **Code execution**: Scripts run without loading code into context
59
+
60
+ **How Claude accesses content**:
61
+
62
+ ```bash
63
+ # Claude triggers skill by reading SKILL.md
64
+ bash: cat pdf-skill/SKILL.md
65
+
66
+ # Claude reads additional references if needed
67
+ bash: cat pdf-skill/references/forms.md
68
+
69
+ # Claude executes scripts (only output enters context)
70
+ bash: node pdf-skill/scripts/validate_form.js
71
+ ```
72
+
73
+ **Key insight**: Script code never enters the context window. Only the output does. This makes scripts far more token-efficient than generating equivalent code on the fly.
74
+
75
+ ---
76
+
77
+ ## Official Best Practices
78
+
79
+ From Anthropic's engineering team:
80
+
81
+ ### 1. Start with Evaluation
82
+
83
+ > "Identify specific gaps in your agents' capabilities by running them on representative tasks and observing where they struggle or require additional context. Then build skills incrementally to address these shortcomings."
84
+
85
+ **Process**:
86
+
87
+ - Use Claude on real tasks
88
+ - Notice where it struggles
89
+ - Create skills to fill gaps
90
+ - Test and iterate
91
+
92
+ ### 2. Structure for Scale
93
+
94
+ > "When the SKILL.md file becomes unwieldy, split its content into separate files and reference them."
95
+
96
+ **Guidelines**:
97
+
98
+ - Keep SKILL.md under ~5k words
99
+ - Split mutually exclusive contexts into separate files
100
+ - Use code for both execution and documentation
101
+ - Make it clear whether Claude should run or read scripts
102
+
103
+ ### 3. Think from Claude's Perspective
104
+
105
+ > "Monitor how Claude uses your skill in real scenarios and iterate based on observations: watch for unexpected trajectories or overreliance on certain contexts."
106
+
107
+ **Key areas**:
108
+
109
+ - `name` and `description` drive skill triggering
110
+ - Claude decides whether to use the skill based on metadata
111
+ - Observe actual usage patterns, not assumed ones
112
+
113
+ ### 4. Iterate with Claude
114
+
115
+ > "As you work on a task with Claude, ask Claude to capture its successful approaches and common mistakes into reusable context and code within a skill."
116
+
117
+ **Workflow**:
118
+
119
+ 1. Work on task with Claude
120
+ 2. Notice successful patterns
121
+ 3. Ask Claude to capture them in skill
122
+ 4. Test and refine
123
+
124
+ ---
125
+
126
+ ## Writing for Claude
127
+
128
+ ### Skills as "Onboarding Guides"
129
+
130
+ > "Building a skill for an agent is like putting together an onboarding guide for a new hire."
131
+ >
132
+ > — Anthropic Engineering Blog
133
+
134
+ **What this means**:
135
+
136
+ - Focus on procedural knowledge ("how to do X")
137
+ - Include workflows, not just facts
138
+ - Provide examples of actual usage
139
+ - Capture organizational context
140
+
141
+ ### Skills Transform General → Specialized Agents
142
+
143
+ > "Skills extend Claude's capabilities by packaging your expertise into composable resources for Claude, transforming general-purpose agents into specialized agents that fit your needs."
144
+
145
+ **Examples**:
146
+
147
+ - General Claude + Database skill = Database specialist
148
+ - General Claude + Auth skill = Security specialist
149
+ - General Claude + UI skill = Frontend specialist
150
+
151
+ ---
152
+
153
+ ## The Skill Anatomy
154
+
155
+ ### Required Structure
156
+
157
+ Every skill must have:
158
+
159
+ ```
160
+ skill-name/
161
+ └── SKILL.md # Required
162
+ ```
163
+
164
+ SKILL.md must have:
165
+
166
+ ```markdown
167
+ ---
168
+ name: skill-name
169
+ description: What it does and when to use it
170
+ ---
171
+
172
+ # Skill content...
173
+ ```
174
+
175
+ ### Frontmatter Limits
176
+
177
+ | Field | Limit | Required |
178
+ | ------------- | --------------- | -------- |
179
+ | `name` | 64 characters | Yes |
180
+ | `description` | 1024 characters | Yes |
181
+
182
+ Only `name` and `description` are supported. No other YAML fields.
183
+
184
+ ### Optional Bundled Content
185
+
186
+ ```
187
+ skill-name/
188
+ ├── SKILL.md # Level 2: Instructions
189
+ ├── references/ # Level 3: Documentation
190
+ │ ├── detailed-guide.md
191
+ │ └── api-reference.md
192
+ ├── scripts/ # Level 3: Executable code
193
+ │ ├── validate.js
194
+ │ └── generate.sh
195
+ └── assets/ # Level 3: Resources
196
+ ├── template.json
197
+ └── diagram.png
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Context Window Behavior
203
+
204
+ ### How the Context Window Changes
205
+
206
+ From Anthropic's documentation:
207
+
208
+ **Initial state**:
209
+
210
+ ```
211
+ [System Prompt]
212
+ [Skill 1 Metadata]
213
+ [Skill 2 Metadata]
214
+ [Skill N Metadata]
215
+ [User Message]
216
+ ```
217
+
218
+ **After skill triggers**:
219
+
220
+ ```
221
+ [System Prompt]
222
+ [Skill Metadata (all skills)]
223
+ [User Message]
224
+ [SKILL.md Body] ← Loaded via bash
225
+ [references/forms.md] ← Loaded as needed
226
+ ```
227
+
228
+ **Key point**: Metadata for ALL skills is always loaded. Only triggered skills load their SKILL.md body.
229
+
230
+ ---
231
+
232
+ ## Progressive Disclosure in Practice
233
+
234
+ ### Example: PDF Skill
235
+
236
+ **Level 1 (Always):**
237
+
238
+ ```yaml
239
+ name: pdf
240
+ description: Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files.
241
+ ```
242
+
243
+ ~100 tokens
244
+
245
+ **Level 2 (When triggered):**
246
+
247
+ ```markdown
248
+ # PDF Processing
249
+
250
+ ## Quick Start
251
+
252
+ Use pdfplumber to extract text...
253
+
254
+ For form filling, see [forms.md](forms.md)
255
+ ```
256
+
257
+ ~3k tokens
258
+
259
+ **Level 3 (As needed):**
260
+
261
+ - `references/forms.md` - Form-filling guide (only if filling forms)
262
+ - `scripts/extract_fields.js` - Executable script (runs, doesn't load)
263
+
264
+ **Total token cost if NOT filling forms**: ~3,100 tokens (Level 1 + Level 2)
265
+ **Total token cost if filling forms**: ~6,000 tokens (Level 1 + Level 2 + forms.md)
266
+
267
+ ---
268
+
269
+ ## Code Execution in Skills
270
+
271
+ ### Why Include Scripts
272
+
273
+ > "Large language models excel at many tasks, but certain operations are better suited for traditional code execution. For example, sorting a list via token generation is far more expensive than simply running a sorting algorithm."
274
+ >
275
+ > — Anthropic Engineering Blog
276
+
277
+ **When to use scripts**:
278
+
279
+ - **Efficiency**: Operations that are cheaper to execute than generate
280
+ - **Determinism**: Tasks requiring consistent, repeatable results
281
+ - **Complexity**: Algorithms better suited to code than token generation
282
+
283
+ ### Script Execution Model
284
+
285
+ ```bash
286
+ # Claude runs script
287
+ bash: node scripts/validate_form.js form.pdf
288
+
289
+ # Output (only this enters context)
290
+ ✅ All form fields valid
291
+ Found 12 fillable fields
292
+ ```
293
+
294
+ **Context consumed**: ~20 tokens (just the output)
295
+ **Alternative (Claude generates validation code)**: ~500 tokens
296
+
297
+ **50x more efficient**
298
+
299
+ ---
300
+
301
+ ## Security Considerations
302
+
303
+ From Anthropic's security guidelines:
304
+
305
+ ### Trusted Sources Only
306
+
307
+ > "We strongly recommend using Skills only from trusted sources: those you created yourself or obtained from Anthropic."
308
+
309
+ **Risk**: Malicious skills can:
310
+
311
+ - Direct Claude to invoke tools in harmful ways
312
+ - Execute code with unintended effects
313
+ - Exfiltrate data to external systems
314
+ - Compromise system security
315
+
316
+ ### Auditing Third-Party Skills
317
+
318
+ If you must use untrusted skills:
319
+
320
+ 1. **Review all files**: SKILL.md, scripts, images, bundled resources
321
+ 2. **Check for unusual patterns**:
322
+ - Unexpected network calls
323
+ - File access beyond skill scope
324
+ - Operations not matching stated purpose
325
+ 3. **Examine external sources**: Skills fetching from URLs are risky
326
+ 4. **Verify dependencies**: Check code dependencies and imports
327
+
328
+ ### Runtime Constraints
329
+
330
+ Skills run in the code execution container with:
331
+
332
+ - ❌ **No network access**: Cannot make external API calls
333
+ - ❌ **No runtime package installation**: Only pre-installed packages available
334
+ - ✅ **Sandboxed execution**: Isolated from host system
335
+
336
+ ---
337
+
338
+ ## Skills are Composable
339
+
340
+ > "Skills stack together. Claude automatically identifies which skills are needed and coordinates their use."
341
+ >
342
+ > — Anthropic Product Announcement
343
+
344
+ ### Example: Multi-Skill Task
345
+
346
+ **User request**: "Create a GitHub contact card with database-backed favorites"
347
+
348
+ **Skills activated**:
349
+
350
+ 1. `github-integration` - Fetch profile data
351
+ 2. `database-patterns` - Query favorites table
352
+ 3. `ui-components` - Build card component
353
+ 4. `styling-patterns` - Apply CSS/styles
354
+
355
+ **Result**: Skills work together naturally, each handling its domain.
356
+
357
+ ---
358
+
359
+ ## Where Skills Work
360
+
361
+ ### Claude.ai
362
+
363
+ - **Pre-built Skills**: PowerPoint, Excel, Word, PDF (automatic)
364
+ - **Custom Skills**: Upload as zip (Settings > Features)
365
+ - **Sharing**: Individual user only (not org-wide)
366
+
367
+ ### Claude API
368
+
369
+ - **Pre-built Skills**: Reference by `skill_id` (e.g., `pptx`, `xlsx`)
370
+ - **Custom Skills**: Upload via `/v1/skills` endpoints
371
+ - **Sharing**: Workspace-wide
372
+
373
+ ### Claude Code
374
+
375
+ - **Custom Skills only**: Filesystem-based (`.claude/skills/` or `~/.claude/skills/`)
376
+ - **Sharing**: Via git/version control
377
+
378
+ **Important**: Skills don't sync across surfaces. Upload separately for each platform.
379
+
380
+ ---
381
+
382
+ ## Future of Skills
383
+
384
+ From Anthropic:
385
+
386
+ > "Looking further ahead, we hope to enable agents to create, edit, and evaluate Skills on their own, letting them codify their own patterns of behavior into reusable capabilities."
387
+
388
+ **Coming soon**:
389
+
390
+ - Simplified skill creation workflows
391
+ - Enterprise-wide deployment
392
+ - Skills complement MCP for complex workflows
393
+ - Agents creating their own skills
394
+
395
+ ---
396
+
397
+ ## Key Quotes
398
+
399
+ ### On Progressive Disclosure
400
+
401
+ > "Progressive disclosure is the core design principle that makes Agent Skills flexible and scalable."
402
+
403
+ ### On Simplicity
404
+
405
+ > "Skills are a simple concept with a correspondingly simple format. This simplicity makes it easier for organizations, developers, and end users to build customized agents and give them new capabilities."
406
+
407
+ ### On Filesystem Architecture
408
+
409
+ > "Agents with a filesystem and code execution tools don't need to read the entirety of a skill into their context window when working on a particular task. This means that the amount of context that can be bundled into a skill is effectively unbounded."
410
+
411
+ ### On Purpose
412
+
413
+ > "Think of Skills as custom onboarding materials that let you package expertise, making Claude a specialist on what matters most to you."
414
+
415
+ ---
416
+
417
+ ## Official Resources
418
+
419
+ ### Documentation
420
+
421
+ - [Agent Skills Overview](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview)
422
+ - [Quickstart Tutorial](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/quickstart)
423
+ - [Best Practices](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices)
424
+ - [API Skills Guide](https://docs.claude.com/en/api/skills-guide)
425
+
426
+ ### Examples
427
+
428
+ - [Skills Repository](https://github.com/anthropics/skills)
429
+ - [Skills Cookbook](https://github.com/anthropics/claude-cookbooks/tree/main/skills)
430
+
431
+ ### Articles
432
+
433
+ - [Product Announcement](https://www.anthropic.com/news/skills)
434
+ - [Engineering Blog](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills)
435
+
436
+ ---
437
+
438
+ ## Summary: The Anthropic Philosophy
439
+
440
+ **Skills are**:
441
+
442
+ - Composable (stack together)
443
+ - Portable (same format everywhere)
444
+ - Efficient (only load what's needed)
445
+ - Powerful (include executable code)
446
+
447
+ **Build like**:
448
+
449
+ - Onboarding guides (procedural knowledge)
450
+ - Specialized tools (domain expertise)
451
+ - Reference manuals (progressive detail)
452
+
453
+ **Optimize for**:
454
+
455
+ - Token efficiency (3-level loading)
456
+ - Claude's perspective (discovery via metadata)
457
+ - Real usage (iterate based on observation)
458
+ - Scalability (split when too large)