Skip to content

Commit 1a9ad4b

Browse files
lhassa8claude
andcommitted
docs: Add example skill files
- code-reviewer: SKILL.md + tests.yml - git-commit: SKILL.md + tests.yml - api-documenter: SKILL.md + STYLE_GUIDE.md (composite skill) - data-analyst: SKILL.md with full metadata Update .gitignore to allow examples/skills/ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b41d55a commit 1a9ad4b

8 files changed

Lines changed: 645 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ Thumbs.db
5252
.env
5353
.env.local
5454
api_key.txt
55-
skills/
55+
/skills/
56+
!examples/skills/
5657
*.zip
5758

5859
# Claude Code settings (may contain sensitive data)
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
schema_version: "1.0"
3+
name: api-documenter
4+
description: Use when asked to generate API documentation. Creates comprehensive docs with endpoints, parameters, and examples.
5+
version: 1.0.0
6+
min_skillforge_version: 1.0.0
7+
tags:
8+
- documentation
9+
- api
10+
includes:
11+
- ./STYLE_GUIDE.md
12+
---
13+
14+
# API Documentation Generator
15+
16+
Generate comprehensive API documentation from code, specifications, or descriptions.
17+
18+
## Documentation Structure
19+
20+
Every API endpoint should include:
21+
22+
1. **Endpoint**: HTTP method and path
23+
2. **Description**: What the endpoint does
24+
3. **Authentication**: Required auth (if any)
25+
4. **Parameters**: Path, query, and body parameters
26+
5. **Response**: Success and error responses
27+
6. **Examples**: Request/response examples
28+
29+
## Output Format
30+
31+
```markdown
32+
## Endpoint Name
33+
34+
Brief description.
35+
36+
### Request
37+
38+
`METHOD /path/:param`
39+
40+
**Authentication**: Bearer token / API key / None
41+
42+
**Parameters**:
43+
| Name | Type | In | Required | Description |
44+
|------|------|-----|----------|-------------|
45+
| id | string | path | Yes | Resource ID |
46+
47+
**Body**:
48+
```json
49+
{
50+
"field": "value"
51+
}
52+
```
53+
54+
### Response
55+
56+
**Success (200)**:
57+
```json
58+
{
59+
"data": {}
60+
}
61+
```
62+
63+
**Error (4xx)**:
64+
```json
65+
{
66+
"error": "message"
67+
}
68+
```
69+
70+
### Example
71+
72+
```bash
73+
curl -X METHOD https://api.example.com/path \
74+
-H "Authorization: Bearer token" \
75+
-d '{"field": "value"}'
76+
```
77+
```
78+
79+
## Examples
80+
81+
### Example 1: REST Endpoint
82+
83+
**User**: Document this endpoint:
84+
```python
85+
@app.get("/users/{user_id}")
86+
def get_user(user_id: int, include_posts: bool = False):
87+
"""Get user by ID."""
88+
...
89+
```
90+
91+
**Response**:
92+
93+
## Get User
94+
95+
Retrieve a user by their unique identifier.
96+
97+
### Request
98+
99+
`GET /users/:user_id`
100+
101+
**Authentication**: Bearer token
102+
103+
**Parameters**:
104+
| Name | Type | In | Required | Description |
105+
|------|------|-----|----------|-------------|
106+
| user_id | integer | path | Yes | Unique user identifier |
107+
| include_posts | boolean | query | No | Include user's posts (default: false) |
108+
109+
### Response
110+
111+
**Success (200)**:
112+
```json
113+
{
114+
"id": 123,
115+
"name": "John Doe",
116+
"email": "john@example.com",
117+
"posts": []
118+
}
119+
```
120+
121+
**Error (404)**:
122+
```json
123+
{
124+
"error": "User not found"
125+
}
126+
```
127+
128+
### Example
129+
130+
```bash
131+
curl https://api.example.com/users/123?include_posts=true \
132+
-H "Authorization: Bearer your-token"
133+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Documentation Style Guide
2+
3+
This reference document defines the style conventions for API documentation.
4+
5+
## Writing Style
6+
7+
- Use **active voice**: "Returns the user" not "The user is returned"
8+
- Use **present tense**: "Creates a resource" not "Will create"
9+
- Be **concise**: Avoid unnecessary words
10+
- Use **consistent terminology**: Pick one term and stick with it
11+
12+
## Code Examples
13+
14+
- Always include working curl examples
15+
- Show both request and response
16+
- Use realistic but safe example data
17+
- Include error examples for common cases
18+
19+
## Parameter Descriptions
20+
21+
- Start with a verb or noun
22+
- Include valid values for enums
23+
- Note default values
24+
- Mention constraints (min/max, format)
25+
26+
## Response Documentation
27+
28+
- Document all possible status codes
29+
- Show full response structure
30+
- Include pagination details if applicable
31+
- Document rate limit headers
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
schema_version: "1.0"
3+
name: code-reviewer
4+
description: Use when asked to review code for bugs, security issues, performance problems, or style improvements. Provides structured feedback with severity levels.
5+
version: 1.0.0
6+
min_skillforge_version: 1.0.0
7+
tags:
8+
- code-quality
9+
- review
10+
- security
11+
---
12+
13+
# Code Reviewer
14+
15+
You are an expert code reviewer. Analyze code for bugs, security vulnerabilities, performance issues, and style improvements.
16+
17+
## Instructions
18+
19+
When reviewing code:
20+
21+
1. **Read the code** carefully and understand its purpose
22+
2. **Identify issues** categorized by severity:
23+
- **Critical**: Security vulnerabilities, data loss risks
24+
- **High**: Bugs that will cause failures
25+
- **Medium**: Performance issues, code smells
26+
- **Low**: Style issues, minor improvements
27+
3. **Provide fixes** with corrected code snippets
28+
4. **Suggest improvements** for maintainability
29+
30+
## Response Format
31+
32+
Structure your review as:
33+
34+
```
35+
## Summary
36+
One-line overview of the code quality.
37+
38+
## Issues Found
39+
40+
### [Severity] Issue Title
41+
- **Location**: file:line or function name
42+
- **Problem**: What's wrong
43+
- **Fix**: How to fix it with code example
44+
45+
## Recommendations
46+
Prioritized list of improvements.
47+
```
48+
49+
## Examples
50+
51+
### Example 1: SQL Injection
52+
53+
**User**: Review this code
54+
```python
55+
def get_user(user_id):
56+
query = f"SELECT * FROM users WHERE id = {user_id}"
57+
return db.execute(query)
58+
```
59+
60+
**Response**:
61+
## Summary
62+
Critical security vulnerability found - SQL injection risk.
63+
64+
## Issues Found
65+
66+
### [Critical] SQL Injection Vulnerability
67+
- **Location**: `get_user` function
68+
- **Problem**: User input is directly interpolated into SQL query, allowing attackers to execute arbitrary SQL.
69+
- **Fix**: Use parameterized queries:
70+
```python
71+
def get_user(user_id: int):
72+
query = "SELECT * FROM users WHERE id = %s"
73+
return db.execute(query, (user_id,))
74+
```
75+
76+
## Recommendations
77+
1. Use an ORM like SQLAlchemy for safer database operations
78+
2. Add input validation for user_id
79+
3. Add type hints for better code clarity
80+
81+
### Example 2: Clean Code
82+
83+
**User**: Review this function
84+
```python
85+
def calculate_total(items: list[dict]) -> float:
86+
return sum(item['price'] * item['quantity'] for item in items)
87+
```
88+
89+
**Response**:
90+
## Summary
91+
Clean, well-written code with minor improvement suggestions.
92+
93+
## Issues Found
94+
No critical or high-severity issues found.
95+
96+
## Recommendations
97+
1. Consider adding error handling for missing keys
98+
2. Add docstring explaining expected item format
99+
3. Consider using a dataclass for type safety:
100+
```python
101+
@dataclass
102+
class Item:
103+
price: float
104+
quantity: int
105+
106+
def calculate_total(items: list[Item]) -> float:
107+
"""Calculate total price for a list of items."""
108+
return sum(item.price * item.quantity for item in items)
109+
```
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
version: "1.0"
2+
3+
defaults:
4+
timeout: 30
5+
6+
tests:
7+
- name: "detects_sql_injection"
8+
description: "Should identify SQL injection vulnerabilities"
9+
input: |
10+
Review this code:
11+
```python
12+
def get_user(id):
13+
query = f"SELECT * FROM users WHERE id = {id}"
14+
return db.execute(query)
15+
```
16+
assertions:
17+
- type: contains
18+
value: "SQL injection"
19+
case_sensitive: false
20+
- type: contains
21+
value: "Critical"
22+
case_sensitive: false
23+
- type: regex
24+
pattern: "parameterized|prepared|placeholder"
25+
mock:
26+
response: |
27+
## Summary
28+
Critical security vulnerability found - SQL injection risk.
29+
30+
## Issues Found
31+
32+
### [Critical] SQL Injection Vulnerability
33+
- **Problem**: User input directly in query
34+
- **Fix**: Use parameterized queries
35+
tags: ["security", "critical"]
36+
37+
- name: "provides_structured_feedback"
38+
description: "Should use the defined response format"
39+
input: "Review this function: def add(a, b): return a + b"
40+
assertions:
41+
- type: contains
42+
value: "Summary"
43+
- type: regex
44+
pattern: "(Issues|Recommendations)"
45+
mock:
46+
response: |
47+
## Summary
48+
Simple, clean function.
49+
50+
## Issues Found
51+
None.
52+
53+
## Recommendations
54+
- Add type hints
55+
- Add docstring
56+
tags: ["format"]
57+
58+
- name: "handles_clean_code"
59+
description: "Should acknowledge good code"
60+
input: |
61+
Review this:
62+
```python
63+
def calculate_total(items: list[dict]) -> float:
64+
"""Calculate total price."""
65+
return sum(item['price'] * item['quantity'] for item in items)
66+
```
67+
assertions:
68+
- type: not_contains
69+
value: "Critical"
70+
- type: regex
71+
pattern: "(clean|good|well)"
72+
case_sensitive: false
73+
mock:
74+
response: |
75+
## Summary
76+
Clean, well-written code with good practices.
77+
78+
## Issues Found
79+
No critical issues.
80+
81+
## Recommendations
82+
Consider using dataclasses for type safety.
83+
tags: ["positive"]

0 commit comments

Comments
 (0)