From backend-development-assistant
Backend authentication and authorization patterns. JWT, OAuth2, session management, RBAC, and secure token handling.
How this skill is triggered — by the user, by Claude, or both
Slash command
/backend-development-assistant:authenticationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Bonded to:** `api-development-agent` (Secondary)
Bonded to: api-development-agent (Secondary)
# Invoke authentication skill
"Implement JWT authentication for my API"
"Set up OAuth2 with Google login"
"Configure role-based access control"
| Method | Best For | Stateless | Complexity |
|---|---|---|---|
| JWT | APIs, microservices | Yes | Medium |
| OAuth2 | Third-party login | Yes | High |
| Session | Traditional web apps | No | Low |
| API Key | Simple integrations | Yes | Low |
from jose import jwt
from datetime import datetime, timedelta
SECRET_KEY = "your-secret-key"
ALGORITHM = "HS256"
def create_access_token(user_id: str, expires_delta: timedelta = timedelta(minutes=30)):
expire = datetime.utcnow() + expires_delta
return jwt.encode(
{"sub": user_id, "exp": expire},
SECRET_KEY,
algorithm=ALGORITHM
)
def verify_token(token: str) -> str:
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
return payload.get("sub")
from enum import Enum
from functools import wraps
class Role(Enum):
ADMIN = "admin"
USER = "user"
VIEWER = "viewer"
PERMISSIONS = {
Role.ADMIN: ["read", "write", "delete", "admin"],
Role.USER: ["read", "write"],
Role.VIEWER: ["read"]
}
def require_permission(permission: str):
def decorator(func):
@wraps(func)
async def wrapper(user, *args, **kwargs):
if permission not in PERMISSIONS.get(user.role, []):
raise HTTPException(status_code=403)
return await func(user, *args, **kwargs)
return wrapper
return decorator
| Issue | Cause | Solution |
|---|---|---|
| Token expired | Short TTL | Implement refresh tokens |
| Invalid signature | Wrong secret | Verify SECRET_KEY |
| 401 on valid token | Clock skew | Sync server time |
npx claudepluginhub pluginagentmarketplace/custom-plugin-backend --plugin backend-development-assistantGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.