Claude Code Skill
Create a Claude Code skill that generates anime images with AnimeAPI
What is a Claude Code Skill?
Claude Code skills are SKILL.md files that extend Claude's capabilities with specialized knowledge, workflows, and tool integrations. By creating an AnimeAPI skill, Claude can generate anime images directly during coding sessions.
- Skills live in
~/.claude/skills/directory - Each skill is a folder containing a
SKILL.mdfile - Claude automatically discovers and uses skills when relevant
Prerequisites
- Claude Code CLI installed (
claudecommand available) - An AnimeAPI key from your dashboard
Step 1: Create the Skill Directory
# macOS/Linux
mkdir -p ~/.claude/skills/animeapi
# Windows (PowerShell)
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude\skills\animeapi"Step 2: Create the SKILL.md File
Create ~/.claude/skills/animeapi/SKILL.md with the following content:
# AnimeAPI Image Generation Skill
Generate high-quality anime images using the AnimeAPI service. Use this skill when users want to create anime-style images, illustrations, character art, or visual assets for their projects.
## When to Use
- User asks to generate anime images, illustrations, or artwork
- User needs visual assets for a project (game, app, website)
- User wants to create character designs or concept art
- User mentions "anime", "manga", "illustration" with image generation intent
## Configuration
Before using this skill, ensure the ANIMEAPI_KEY environment variable is set:
```bash
export ANIMEAPI_KEY="ank_your_api_key_here"
```
Or add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
## API Reference
### Endpoint
`POST https://api.animeapi.com/api/generate`
### Headers
- `Authorization: Bearer <ANIMEAPI_KEY>`
- `Content-Type: application/json`
### Request Body
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| prompt | string | Yes | Description of the image to generate |
| orientation | string | No | "portrait" (832x1280), "square" (1024x1024), or "landscape" (1280x832). Default: "portrait" |
| allowNSFW | boolean | No | Whether to allow mature content. Default: true |
### Response
```json
{
"image_url": "https://cdn.runware.ai/...",
"balance_usd": 9.99,
"generation_time_ms": 4200
}
```
### Pricing
- Each image costs $0.009 (less than 1 cent)
- Balance is prepaid and never expires
## Usage Instructions
When generating images, follow these steps:
1. **Craft the prompt**: Enhance user requests with anime-specific keywords for better results:
- Add style terms: "anime style", "manga art", "high quality"
- Add lighting: "dramatic lighting", "soft lighting", "sunset"
- Add details: "detailed eyes", "flowing hair", "intricate costume"
2. **Make the API call**:
```bash
curl -X POST "https://api.animeapi.com/api/generate" \
-H "Authorization: Bearer $ANIMEAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "anime girl with blue hair, magical forest, soft lighting, detailed eyes",
"orientation": "portrait"
}'
```
3. **Save the image**: Download the image from the returned URL and save it to the project:
```bash
curl -o output.webp "<image_url_from_response>"
```
## Example Prompts
Good prompts for quality results:
- **Character portrait**: "anime girl with silver hair and red eyes, elegant black dress, moonlit night, detailed, high quality"
- **Action scene**: "anime samurai warrior mid-battle, dramatic lighting, motion blur, intense expression"
- **Landscape**: "anime style cyberpunk city at night, neon lights, rain, reflections, detailed background"
- **Cute/Kawaii**: "chibi anime cat girl, pink hair, maid outfit, holding a tray, pastel colors, adorable"
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| 401 Unauthorized | Invalid or missing API key | Check ANIMEAPI_KEY is set correctly |
| 402 Payment Required | Insufficient balance | Add funds at animeapi.ai/dashboard/billing |
| 429 Too Many Requests | Rate limit exceeded | Wait 1 minute, max 10 requests/minute |
## Tips
- Portrait orientation works best for character art
- Landscape orientation works best for scenes and environments
- Square orientation works well for icons and profile pictures
- More descriptive prompts generally produce better results
- Include art style keywords like "anime", "manga", "illustration" for consistent styleStep 3: Set Your API Key
Add your API key to your environment:
# Add to ~/.bashrc, ~/.zshrc, or ~/.profile
export ANIMEAPI_KEY="ank_your_api_key_here"
# Windows (PowerShell - add to $PROFILE)
$env:ANIMEAPI_KEY = "ank_your_api_key_here"Step 4: Use the Skill
Now you can ask Claude to generate images:
# In Claude Code, just ask naturally:
> Generate an anime hero image for my landing page
> Create a character portrait: silver-haired elf mage with a mystical staff
> I need an anime-style background for my game - a fantasy castle at sunsetClaude will automatically use the AnimeAPI skill to generate and save images to your project.
Advanced: Add a Helper Script
Optionally, add a helper script to your skill folder for easier use. Create ~/.claude/skills/animeapi/generate.sh:
#!/bin/bash
# AnimeAPI Image Generator
# Usage: ./generate.sh "prompt" [orientation] [output_file]
PROMPT="$1"
ORIENTATION="${2:-portrait}"
OUTPUT="${3:-anime_output.webp}"
if [ -z "$PROMPT" ]; then
echo "Usage: ./generate.sh \"prompt\" [orientation] [output_file]"
exit 1
fi
if [ -z "$ANIMEAPI_KEY" ]; then
echo "Error: ANIMEAPI_KEY environment variable not set"
exit 1
fi
echo "Generating: $PROMPT"
echo "Orientation: $ORIENTATION"
RESPONSE=$(curl -s -X POST "https://api.animeapi.com/api/generate" \
-H "Authorization: Bearer $ANIMEAPI_KEY" \
-H "Content-Type: application/json" \
-d "{
\"prompt\": \"$PROMPT\",
\"orientation\": \"$ORIENTATION\"
}")
IMAGE_URL=$(echo "$RESPONSE" | grep -o '"image_url":"[^"]*"' | cut -d'"' -f4)
BALANCE=$(echo "$RESPONSE" | grep -o '"balance_usd":[0-9.]*' | cut -d':' -f2)
if [ -z "$IMAGE_URL" ]; then
echo "Error: Failed to generate image"
echo "$RESPONSE"
exit 1
fi
curl -s -o "$OUTPUT" "$IMAGE_URL"
echo "Saved to: $OUTPUT"
echo "Remaining balance: \$$BALANCE"Tips
- Claude will automatically enhance prompts for better anime-style results
- Generated images are saved as WebP format for optimal quality/size
- Each generation costs less than 1 cent - great for iteration
- Skills work across all Claude Code sessions automatically
- You can combine this with other skills for complex workflows
Ready to enhance Claude?
Get your API key and start generating anime images with Claude Code.