Skip to content

richfrem/agent-plugins-skills / plugins/dev-utils/.apm/skills/managing-huggingface-assets

managing-huggingface-assets

Verified

Sets up, downloads from and uploads to HuggingFace repositories with credential hygiene and exponential backoff. Use to validate HuggingFace credentials and dataset structure, download files, snapshots or model weights, or upload files, folders, learning snapshots and JSONL traces. Not for searching the Hub or other storage providers.

FileKindSize
SKILL.mdskill md2.7 KB
evals/evals.jsonconfig2.1 KB
references/acceptance-criteria.mdmarkdown2.2 KB
references/download.mdmarkdown1.7 KB
references/fallback-tree.mdmarkdown3.4 KB
references/init.mdmarkdown1.4 KB
references/upload.mdmarkdown2.1 KB
scripts/hf_config.pyscript6.2 KB
scripts/hf_download.pyexecutablescript6.5 KB
scripts/hf_init.pyscript2.7 KB
scripts/hf_upload.pyscript13.2 KB

scripts/hf_init.py

View on GitHub
"""
hf_init.py
=====================================

Purpose:
    Validates environment, tests API connectivity, and ensures dataset structure on HF.

Layer: Execution / Initialization

Usage Examples:
    pythonhf_init.py
    pythonhf_init.py --validate-only

Supported Object Types:
    None

CLI Arguments:
    --validate-only: Validate without making changes.

Input Files:
    - .env file for credentials

Output:
    - JSON string printed containing initialization status report.

Key Functions:
    full_init(): Run full HF initialization sequence.

Script Dependencies:
    sys, json, asyncio, argparse, pathlib, hf_config

Consumed by:
    - managing-huggingface-assets skill (init mode)
"""
import sys
import json
import asyncio
import argparse
from pathlib import Path

# Resolve imports (locally symlinked)
sys.path.insert(0, str(Path(__file__).parent))
try:
    from hf_config import get_hf_config, validate_config
except ImportError as e:
    print(f"Failed to import local hf_config: {e}")
    sys.exit(1)


async def full_init(validate_only: bool = False) -> dict:
    """Run full HF initialization sequence."""

    # Step 1: Validate config
    result = validate_config()
    if result["status"] != "valid":
        return result

    if validate_only:
        result["mode"] = "validate_only"
        return result

    # Step 2: Ensure dataset structure
    try:
        sys.path.insert(0, str(Path(__file__).parent))
        from hf_upload import ensure_dataset_structure, ensure_dataset_card

        config = get_hf_config()

        structure_ok = await ensure_dataset_structure(config)
        result["dataset_structure"] = "created" if structure_ok else "failed"

        card_ok = await ensure_dataset_card(config)
        result["dataset_card"] = "created" if card_ok else "failed"

        result["next_steps"] = [
            f"Visit: https://huggingface.co/datasets/{config.dataset_repo_id}",
            "Verify lineage/, data/, metadata/ folders exist",
            "Configure your project's persistence plugin to use the managing-huggingface-assets upload primitives"
        ]
    except ImportError as e:
        result["warning"] = f"Could not import upload module: {e}. Install: pip install huggingface_hub"

    return result


def main() -> None:
    """Validate HuggingFace environment and initialize dataset structure."""
    parser = argparse.ArgumentParser(description="HuggingFace Init")
    parser.add_argument("--validate-only", action="store_true", help="Validate without making changes")
    args = parser.parse_args()

    result = asyncio.run(full_init(args.validate_only))
    print(json.dumps(result, indent=2))

    if result.get("status") != "valid":
        sys.exit(1)


if __name__ == "__main__":
    main()
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall