بنقرة واحدة
auth-manager
Use for authentication management, token validation, and credential troubleshooting.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use for authentication management, token validation, and credential troubleshooting.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Enhance session checkpoints with git context and diff summaries. Use after completing significant work to enrich checkpoint.md files with repository state, recent commits, and code change summaries. Triggers include "enhance checkpoint", "update checkpoint with git", "add git context to checkpoint", or when finishing a multi-file change session.
Use for model training, hyperparameter tuning, and Modal GPU training.
Use when invoking training, evaluation, and dataset preparation via CLI. Provides all standard commands for this project.
Multi-perspective code analysis using three AI personas (RYAN, FLASH, SOCRATES) for comprehensive decision-making. Use when complex code decisions need analysis from multiple viewpoints, or when avoiding single-perspective blind spots is critical.
Use for secrets management, credentials handling, and security best practices.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
| name | auth-manager |
| description | Use for authentication management, token validation, and credential troubleshooting. |
| triggers | ["authentication","token","credentials","HF_TOKEN","MODAL_TOKEN","HuggingFace auth","Modal auth","secret validation","auth error","401","unauthorized"] |
This skill provides authentication management capabilities for HuggingFace and Modal tokens, including validation, troubleshooting, and error handling.
# Validate HF_TOKEN
python -c "from auth_utils import AuthValidator; print(AuthValidator().validate_hf_token())"
# Validate MODAL_TOKEN
python -c "from auth_utils import AuthValidator; print(AuthValidator().validate_modal_token())"
# Validate all tokens
python -c "from auth_utils import AuthValidator; v = AuthValidator(); print(v.validate_all_tokens())"
# Set HF_TOKEN (local)
export HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Set HF_TOKEN (GitHub Secrets)
gh secret set HF_TOKEN --body "hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Set Modal token (Modal 1.0+ uses 'token new')
modal token new
# Verify Modal token
modal token info
modal token list
# Check token format
echo $HF_TOKEN | grep -E "^hf_"
# List GitHub secrets
gh secret list
# Check auth logs
cat logs/auth.log
# Test upload with validation
python src/upload_to_huggingface.py --help
Use this skill when:
Symptoms:
ValueError: HF_TOKEN environment variable not set
Diagnosis:
echo $HF_TOKEN # Should show token
Solution:
# Local
export HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# GitHub Secrets
gh secret set HF_TOKEN --body "hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Symptoms:
TokenValidationResult(status=TokenStatus.INVALID, message="HF_TOKEN has invalid format")
Diagnosis:
echo $HF_TOKEN | head -c 10 # Should start with "hf_"
Solution:
hf_)Symptoms:
TokenValidationResult(status=TokenStatus.INVALID, message="Modal token invalid")
Diagnosis:
modal token info # Should show valid token
Solution:
modal token new # Re-authenticate (Modal 1.0+)
modal token info # Verify
Symptoms:
huggingface_hub.utils._errors.HFValidationError: 401 Client Error
Diagnosis:
# Check if secret exists
gh secret list | grep HF_TOKEN
# Check workflow logs
gh run view <run-id> --log
Solution:
# Update secret
gh secret set HF_TOKEN --body "hf_new_token_here"
# Re-run workflow
gh workflow run upload-hub.yml
Symptoms:
WARNING: Retry 3/3 after 30.0s
ERROR: All attempts failed: Connection timeout
Diagnosis:
# Check network
curl -I https://huggingface.co
# Check token validity
python -c "from auth_utils import AuthValidator; print(AuthValidator().validate_hf_token())"
Solution:
Before long-running operations (training, upload):
from auth_utils import AuthValidator, TokenStatus, setup_auth_logging
logger = setup_auth_logging()
validator = AuthValidator(logger)
# Validate HF_TOKEN
hf_result = validator.validate_hf_token()
if hf_result.status != TokenStatus.VALID:
logger.error(f"HF_TOKEN validation failed: {hf_result.message}")
sys.exit(1)
# Validate MODAL_TOKEN (for training)
modal_result = validator.validate_modal_token()
if modal_result.status != TokenStatus.VALID:
logger.error(f"MODAL_TOKEN validation failed: {modal_result.message}")
sys.exit(1)
logger.info("All tokens validated successfully")
In GitHub Actions workflow:
- name: Validate HF_TOKEN
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
python -c "
import os
from huggingface_hub import HfApi
token = os.environ.get('HF_TOKEN')
if not token:
print('❌ HF_TOKEN not set')
exit(1)
if not token.startswith('hf_'):
print('❌ HF_TOKEN has invalid format')
exit(1)
try:
api = HfApi()
user = api.whoami(token=token)
print(f'✅ HF_TOKEN valid for user: {user[\"name\"]}')
except Exception as e:
print(f'❌ HF_TOKEN validation failed: {e}')
exit(1)
"
For operations that may fail transiently:
from retry_utils import RetryConfig, RetryManager
config = RetryConfig(
max_attempts=3,
base_delay=2.0,
max_delay=30.0,
retryable_exceptions=(ConnectionError, TimeoutError)
)
manager = RetryManager(config)
def upload_operation():
# ... upload logic ...
pass
try:
manager.execute(upload_operation)
except Exception as e:
logger.error(f"Upload failed after all retries: {e}")
sys.exit(1)
| File | Purpose |
|---|---|
src/auth_utils.py | Token validation utilities |
src/retry_utils.py | Retry with exponential backoff |
src/upload_to_huggingface.py | Upload script with auth validation |
src/train_dit.py | Training script with auth validation |
.github/workflows/upload-hub.yml | CI/CD workflow with auth check |
logs/auth.log | Authentication event logs |
# Check HF_TOKEN
python -c "from auth_utils import AuthValidator; print(AuthValidator().validate_hf_token())"
# Output: TokenValidationResult(token_type='HF_TOKEN', status=TokenStatus.VALID, ...)
# Check MODAL_TOKEN (Modal 1.0+)
modal token info
# Output: ✅ Token valid
# Start training
modal run src/train_dit.py data/cats --steps 300000
# Check workflow failure
gh run view 12345 --log | grep -i auth
# Check secret
gh secret list
# Update secret
gh secret set HF_TOKEN --body "hf_new_token"
# Re-run workflow
gh workflow run upload-hub.yml
gh run watch
# Check auth logs
cat logs/auth.log | tail -50
# Validate token
python -c "from auth_utils import AuthValidator; print(AuthValidator().validate_hf_token())"
# Test upload with verbose logging
python src/upload_to_huggingface.py --generator checkpoints/model.pt --repo-id test/repo 2>&1 | tee upload.log
# Check for retry events
grep -i retry upload.log