# Claude Config API Manage Claude Code commands, skills, and agents via the rdev API. ## Architecture ``` /root/.claude/ # Shared PVC (all projects) ├── .credentials.json # Auth tokens (shared) └── settings.json # Global preferences /workspace/.claude/ # In git repo (per-project) ├── commands/ # Project slash commands │ └── deploy.md ├── skills/ # Project skills │ └── go-testing.md └── agents/ # Project agents └── code-reviewer.md ``` ## Authentication All endpoints require `Authorization: Bearer ` header. - `projects:read` scope for GET endpoints - `projects:execute` scope for POST/PUT/DELETE endpoints ## Endpoints ### Overview ``` GET /projects/{id}/claude-config ``` Returns counts and lists of available commands, skills, and agents. **Response:** ```json { "data": { "project": "pantheon", "path": "/workspace/.claude", "commands": ["deploy", "test"], "skills": ["go-testing"], "agents": ["code-reviewer"] } } ``` ### Commands ``` GET /projects/{id}/claude-config/commands # List all POST /projects/{id}/claude-config/commands # Create GET /projects/{id}/claude-config/commands/{name} # Get one PUT /projects/{id}/claude-config/commands/{name} # Update DELETE /projects/{id}/claude-config/commands/{name} # Delete ``` ### Skills ``` GET /projects/{id}/claude-config/skills # List all POST /projects/{id}/claude-config/skills # Create GET /projects/{id}/claude-config/skills/{name} # Get one PUT /projects/{id}/claude-config/skills/{name} # Update DELETE /projects/{id}/claude-config/skills/{name} # Delete ``` ### Agents ``` GET /projects/{id}/claude-config/agents # List all POST /projects/{id}/claude-config/agents # Create GET /projects/{id}/claude-config/agents/{name} # Get one PUT /projects/{id}/claude-config/agents/{name} # Update DELETE /projects/{id}/claude-config/agents/{name} # Delete ``` ## Examples ### Create a command ```bash curl -X POST http://localhost:8080/projects/pantheon/claude-config/commands \ -H "Authorization: Bearer $RDEV_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "deploy", "content": "---\ndescription: Deploy to production\n---\n\n1. Run tests\n2. Build image\n3. Deploy to k8s" }' ``` ### List commands ```bash curl http://localhost:8080/projects/pantheon/claude-config/commands \ -H "Authorization: Bearer $RDEV_API_KEY" ``` ### Get a specific command ```bash curl http://localhost:8080/projects/pantheon/claude-config/commands/deploy \ -H "Authorization: Bearer $RDEV_API_KEY" ``` ### Update a command ```bash curl -X PUT http://localhost:8080/projects/pantheon/claude-config/commands/deploy \ -H "Authorization: Bearer $RDEV_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "content": "---\ndescription: Deploy to production (updated)\n---\n\nNew steps..." }' ``` ### Delete a command ```bash curl -X DELETE http://localhost:8080/projects/pantheon/claude-config/commands/deploy \ -H "Authorization: Bearer $RDEV_API_KEY" ``` ## File Format Commands, skills, and agents are markdown files with optional YAML frontmatter: ```markdown --- description: Short description shown in /help --- # Full instructions Detailed instructions for Claude... ``` ## Git Integration Since files are stored in `/workspace/.claude/`, you can commit them to git: ```bash # Via API POST /projects/pantheon/git {"args": ["add", ".claude/"]} POST /projects/pantheon/git {"args": ["commit", "-m", "Add deploy command"]} POST /projects/pantheon/git {"args": ["push"]} ``` ## Shared Credentials Claude auth is stored on a shared PVC (`claudebox-shared-claude-config`). Authenticate once, all project pods can use it: ```bash ./scripts/claude-auth.sh pantheon # Auth in any pod # Now all pods share the credentials ```