Skill: bytesagain-lab/chefpad (version 2.0.1)

--- version: "2.0.0" name: cooking-recipe description: "Manage recipes and grocery lists with ingredient tracking and meal plans. Use when adding recipes, searching by ingredient, or building shopping lists." author: BytesAgain homepage: https://bytesagain.com source: https://github.com/bytesagain/ai-skills --- # ChefPad — Recipe Manager A local-first recipe management tool. Add recipes with cuisine and cooking time, build ingredient lists and step-by-step instructions, rate your favorites, search by keyword or ingredient, and get random meal suggestions — all from the command line. ## Commands | Command | Description | |---------|-------------| | `chefpad add <name> [cuisine] [mins]` | Add a new recipe with optional cuisine type and cooking time (default: general, 30min) | | `chefpad ingredient <id> <text>` | Add an ingredient to an existing recipe by its ID | | `chefpad step <id> <text>` | Add a cooking step to an existing recipe by its ID | | `chefpad list` | List all saved recipes with ratings, ingredient and step counts | | `chefpad show <id>` | Show full recipe details — ingredients, steps, cuisine, time, rating | | `chefpad search <keyword>` | Search recipes by name, cuisine, or ingredient | | `chefpad rate <id> <1-5>` | Rate a recipe from 1 to 5 stars | | `chefpad random` | Get a random recipe suggestion from your collection | | `chefpad suggest <ingredients...>` | Find recipes that match the ingredients you have on hand | | `chefpad info` | Show version and branding info | | `chefpad help` | Show all available commands | ## Data Storage - **Location:** `~/.chefpad/` - `recipes.json` — Stores all recipes with their ingredients, steps, ratings, cuisine, and cooking time - `favorites.json` — Reserved for favorite recipe tracking - Both files are auto-created as empty JSON arrays on first run - All data is stored locally as JSON — no external APIs, no network calls, no accounts needed ## Requirements - bash (any modern version) - python3 (standard library only — uses `json`, `time`, `random`) - No external dependencies or API keys required ## When to Use 1. **Building a personal recipe collection** — Add recipes you discover or create, complete with ingredients and step-by-step instructions, all stored locally. 2. **Meal planning with what you have** — Use `suggest` with ingredients in your fridge to find matching recipes from your collection. 3. **Quick dinner decisions** — Use `random` when you can't decide what to cook and want a surprise pick from your saved recipes. 4. **Searching by cuisine or ingredient** — Quickly find all Italian recipes or everything that uses chicken with the `search` command. 5. **Rating and tracking favorites** — Rate recipes after cooking them to build a curated list of your best dishes over time. ## Examples ```bash # Add a new recipe chefpad add "Kung Pao Chicken" chinese 25 # Add ingredients to the recipe (use the ID shown after adding) chefpad ingredient 1710000000 "500g chicken breast, diced" chefpad ingredient 1710000000 "100g roasted peanuts" chefpad ingredient 1710000000 "3 dried chili peppers" chefpad ingredient 1710000000 "2 tbsp soy sauce" # Add cooking steps chefpad step 1710000000 "Marinate chicken with soy sauce for 15 minutes" chefpad step 1710000000 "Stir-fry chicken until golden, set aside" chefpad step 1710000000 "Fry chili peppers, add chicken and peanuts, toss" # List all your recipes chefpad list # Show full recipe details chefpad show 1710000000 # Rate a recipe chefpad rate 1710000000 5 # Search for chicken recipes chefpad search chicken # Find recipes matching ingredients you have chefpad suggest chicken peanuts # Get a random meal suggestion chefpad random ``` --- *Powered by BytesAgain | bytesagain.com | [REDACTED_SECRET]*

path: _meta.json
content: ownerId: kn7e60c0zbzfa33m5mqvwzbx1s82jnx1
slug: cooking-recipe
version: 1.0.0
publishedAt: 1773055614388

path: scripts/script.sh
content: #!/bin/bash
# ChefPad - 食谱管理器
# Powered by BytesAgain | bytesagain.com

DATA_DIR="$HOME/.chefpad"
RECIPES_FILE="$DATA_DIR/recipes.json"
FAVORITES_FILE="$DATA_DIR/favorites.json"
mkdir -p "$DATA_DIR"
[ ! -f "$RECIPES_FILE" ] && echo "[]" > "$RECIPES_FILE"
[ ! -f "$FAVORITES_FILE" ] && echo "[]" > "$FAVORITES_FILE"

cmd_add() {
    local name="$1"; shift
    local cuisine="${1:-general}"; shift
    local time_mins="${1:-30}"
    if [ -z "$name" ]; then
        echo "Usage: chefpad add <name> [cuisine] [time_minutes]"
        return 1
    fi
    python3 << PYEOF
import json, time as t
recipe = {"id": int(t.time()), "name": "$name", "cuisine": "$cuisine", "time": int("$time_mins"), "ingredients": [], "steps": [], "rating": 0, "created": t.strftime("%Y-%m-%d")}
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
data.append(recipe)
with open("$RECIPES_FILE", "w") as f: json.dump(data, f, indent=2)
print("Recipe added: {} ({}, {}min)".format("$name", "$cuisine", "$time_mins"))
PYEOF
}

cmd_ingredient() {
    local recipe_id="$1"; shift
    local ingredient="$*"
    if [ -z "$recipe_id" ] || [ -z "$ingredient" ]; then
        echo "Usage: chefpad ingredient <recipe_id> <ingredient>"
        return 1
    fi
    python3 << PYEOF
import json
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
for r in data:
    if str(r["id"]) == "$recipe_id":
        r.setdefault("ingredients",[]).append("$ingredient")
        print("Added ingredient: $ingredient")
        break
with open("$RECIPES_FILE", "w") as f: json.dump(data, f, indent=2)
PYEOF
}

cmd_step() {
    local recipe_id="$1"; shift
    local step="$*"
    if [ -z "$recipe_id" ] || [ -z "$step" ]; then
        echo "Usage: chefpad step <recipe_id> <step_description>"
        return 1
    fi
    python3 << PYEOF
import json
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
for r in data:
    if str(r["id"]) == "$recipe_id":
        r.setdefault("steps",[]).append("$step")
        print("Step {} added".format(len(r["steps"])))
        break
with open("$RECIPES_FILE", "w") as f: json.dump(data, f, indent=2)
PYEOF
}

cmd_list() {
    python3 << PYEOF
import json
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
if not data:
    print("No recipes yet. Add one: chefpad add <name>")
else:
    print("Your Recipes:")
    print("-" * 50)
    for r in data:
        stars = "⭐" * r.get("rating",0) if r.get("rating",0) > 0 else "(unrated)"
        print("  [{}] {} - {} ({}min) {}".format(r["id"], r["name"], r["cuisine"], r["time"], stars))
        print("      Ingredients: {} | Steps: {}".format(len(r.get("ingredients",[])), len(r.get("steps",[]))))
PYEOF
}

cmd_show() {
    local recipe_id="$1"
    if [ -z "$recipe_id" ]; then
        echo "Usage: chefpad show <recipe_id>"
        return 1
    fi
    python3 << PYEOF
import json
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
for r in data:
    if str(r["id"]) == "$recipe_id":
        print("=== {} ===".format(r["name"]))
        print("Cuisine: {} | Time: {}min".format(r["cuisine"], r["time"]))
        stars = "⭐" * r.get("rating",0) if r.get("rating",0) > 0 else "(unrated)"
        print("Rating: {}".format(stars))
        print("\nIngredients:")
        for i, ing in enumerate(r.get("ingredients",[]), 1):
            print("  {}. {}".format(i, ing))
        print("\nSteps:")
        for i, s in enumerate(r.get("steps",[]), 1):
            print("  {}. {}".format(i, s))
        break
else:
    print("Recipe not found: $recipe_id")
PYEOF
}

cmd_search() {
    local query="$*"
    if [ -z "$query" ]; then
        echo "Usage: chefpad search <keyword>"
        return 1
    fi
    python3 << PYEOF
import json
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
q = "$query".lower()
results = [r for r in data if q in r["name"].lower() or q in r["cuisine"].lower() or any(q in i.lower() for i in r.get("ingredients",[]))]
if not results:
    print("No recipes found for: $query")
else:
    print("Found {} recipe(s):".format(len(results)))
    for r in results:
        print("  [{}] {} ({}, {}min)".format(r["id"], r["name"], r["cuisine"], r["time"]))
PYEOF
}

cmd_rate() {
    local recipe_id="$1"
    local rating="$2"
    if [ -z "$recipe_id" ] || [ -z "$rating" ]; then
        echo "Usage: chefpad rate <recipe_id> <1-5>"
        return 1
    fi
    if ! [[ "$rating" =~ ^[1-5]$ ]]; then
        echo "Rating must be 1-5"
        return 1
    fi
    python3 << PYEOF
import json
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
for r in data:
    if str(r["id"]) == "$recipe_id":
        r["rating"] = int("$rating")
        print("Rated {} as {}".format(r["name"], "⭐" * int("$rating")))
        break
with open("$RECIPES_FILE", "w") as f: json.dump(data, f, indent=2)
PYEOF
}

cmd_random() {
    python3 << PYEOF
import json, random
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
if not data:
    print("No recipes yet!")
else:
    r = random.choice(data)
    print("How about: {} ({}, {}min)?".format(r["name"], r["cuisine"], r["time"]))
PYEOF
}

cmd_suggest() {
    local ingredients="$*"
    if [ -z "$ingredients" ]; then
        echo "Usage: chefpad suggest <ingredient1> <ingredient2> ..."
        return 1
    fi
    python3 << PYEOF
import json
try:
    with open("$RECIPES_FILE") as f: data = json.load(f)
except: data = []
query_ings = "$ingredients".lower().split()
results = []
for r in data:
    recipe_ings = " ".join(r.get("ingredients",[])).lower()
    matches = sum(1 for q in query_ings if q in recipe_ings)
    if matches > 0:
        results.append((matches, r))
results.sort(key=lambda x: -x[0])
if not results:
    print("No matching recipes. Try adding more recipes first!")
else:
    print("Recipes matching your ingredients:")
    for score, r in results[:5]:
        print("  [{}] {} ({} ingredient match)".format(r["id"], r["name"], score))
PYEOF
}

cmd_info() {
    echo "ChefPad v1.0.0"
    echo "Powered by BytesAgain | bytesagain.com"
}

cmd_help() {
    echo "ChefPad - Recipe Manager"
    echo "Usage: chefpad <command> [arguments]"
    echo ""
    echo "Commands:"
    echo "  add <name> [cuisine] [mins]   Add a recipe"
    echo "  ingredient <id> <text>        Add ingredient to recipe"
    echo "  step <id> <text>              Add cooking step"
    echo "  list                          List all recipes"
    echo "  show <id>                     Show recipe details"
    echo "  search <keyword>              Search recipes"
    echo "  rate <id> <1-5>               Rate a recipe"
    echo "  random                        Get random recipe suggestion"
    echo "  suggest <ingredients...>      Find recipes by ingredients"
    echo "  info                          Version info"
    echo "  help                          Show this help"
}

case "$1" in
    add) shift; cmd_add "$@";;
    ingredient) shift; cmd_ingredient "$@";;
    step) shift; cmd_step "$@";;
    list) cmd_list;;
    show) shift; cmd_show "$@";;
    search) shift; cmd_search "$@";;
    rate) shift; cmd_rate "$@";;
    random) cmd_random;;
    suggest) shift; cmd_suggest "$@";;
    info) cmd_info;;
    help|"") cmd_help;;
    *) echo "Unknown command: $1"; cmd_help; exit 1;;
esac


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)