selfhost-ai: Command for Claude Code

.claude/commands/add-new-service.md

add-new-service is a command for Claude Code from kossakovsky/selfhost-ai. It costs 0 tokens per session (5,657 once invoked), scanned A, original, Apache-2.0.

A command that adds a new optional service to the Selfhost AI project and updates its Docker Compose setup. It creates the required names, service settings, health check, and related configuration entries.

In plain words
What is it for?
Use it when adding a containerized service such as a database, worker, or AI tool to Selfhost AI. Pass the service name as the argument.
Why use it?
It removes the repetitive work of wiring a service into several project configuration files while keeping naming and ordering consistent.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

This is kossakovsky/selfhost-ai's own configuration. It tells Claude Code how to work on selfhost-ai itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything selfhost-ai configures →

Reuse

Borrowing it

Nothing to install: this file belongs to kossakovsky/selfhost-ai. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/kossakovsky/selfhost-ai/main/.claude/commands/add-new-service.md
Clone the repo
git clone --depth 1 https://github.com/kossakovsky/selfhost-ai

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-new-service

README.md
[![agentmods](https://agentmods.dev/badge/commands/kossakovsky/selfhost-ai/add-new-service/github.svg)](https://agentmods.dev/commands/kossakovsky/selfhost-ai/add-new-service)
Your own site
<a href="https://agentmods.dev/commands/kossakovsky/selfhost-ai/add-new-service"><img src="https://agentmods.dev/badge/commands/kossakovsky/selfhost-ai/add-new-service/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-new-service

Your own site · 80×15
<a href="https://agentmods.dev/commands/kossakovsky/selfhost-ai/add-new-service"><img src="https://agentmods.dev/badge/commands/kossakovsky/selfhost-ai/add-new-service.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,657 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.05657
Opus 5.5 $0.00000 $0.02263
Sonnet 5.5 $0.00000 $0.01131
Haiku 4.5 $0.00000 $0.00566

Measured 27d ago against content hash d0ae13deac8c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-new-service scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 27d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

test: ["CMD-SHELL", "wget -qO- http://localhost:<PORT>/health || exit 1"]
.claude/commands/add-new-service.md · 760 lines

How it starts

The opening of the file, as written. The whole thing — 760 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add New Service: $ARGUMENTS

Add a new optional service called $ARGUMENTS to the Selfhost AI project.

Naming Conventions

Derive these from $ARGUMENTS:

  • SERVICE_SLUG = lowercase with hyphens, e.g., my-service
  • SERVICE_SLUG_UNDERSCORE = lowercase with underscores, e.g., my_service
  • SERVICE_NAME_UPPER = UPPERCASE with underscores, e.g., MY_SERVICE
  • SERVICE_NAME_TITLE = Title Case, e.g., MyService

STEP 1: docker-compose.yml

File: docker-compose.yml

1.1 Basic Service Definition

Add service block in services: section (maintain alphabetical order):

  $ARGUMENTS:
    image: <org>/<image>:<tag>
    container_name: $ARGUMENTS
    profiles: ["$ARGUMENTS"]
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"
    environment:
      # Service-specific env vars
      SOME_VAR: "${SOME_VAR:-default}"
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://localhost:<PORT>/health || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 5
    # volumes:
    #   - ${SERVICE_SLUG_UNDERSCORE}_data:/data

1.2 Caddy Environment Passthrough

Add to caddy service environment: section (if externally accessible):

  caddy:
    environment:
      # ... existing vars ...
      ${SERVICE_NAME_UPPER}_HOSTNAME: "${${SERVICE_NAME_UPPER}_HOSTNAME}"
      # If using basic auth:
      ${SERVICE_NAME_UPPER}_USERNAME: "${${SERVICE_NAME_UPPER}_USERNAME}"
      ${SERVICE_NAME_UPPER}_PASSWORD_HASH: "${${SERVICE_NAME_UPPER}_PASSWORD_HASH}"

1.3 Named Volume (if persistent storage needed)

Add to top-level volumes: section:

volumes:
  # ... existing ...
  ${SERVICE_SLUG_UNDERSCORE}_data:

1.4 Service Dependencies

If service requires database/cache, add depends_on:

  $ARGUMENTS:
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy

Common dependencies:

  • postgres - PostgreSQL database
  • redis - Redis cache/queue
  • ollama - Local LLM inference
  • minio - S3-compatible object storage
  • clickhouse - Analytics database (for Langfuse)

Read the full file on GitHub · 760 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 27d ago Changed d0ae13deac8c
  2. 1mo ago Changed e6f244323551
  3. 1mo ago Changed · +5 lines 722cf0fdec57
  4. 2mo ago First seen · 755 lines · 0 tokens per session scan A e9d2df3feba2

Subscribe to this mod's changes

add-new-service is a command published in the GitHub repository kossakovsky/selfhost-ai (955 stars, last pushed 10d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 5,657 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

add-new-service compared with commands from other repositories

add-new-service next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
add-new-servicekossakovsky/selfhost-aiCommand95510d agoApache-2.0A0Claude Code
vios-architectureNVIDIA-AI-Blueprints/video-search-and-summarizationCommand2.0kyesterdayApache-2.0A42Claude Code
plann8n-io/n8nCommand210kyesterdaynoneA7Claude Code
triagen8n-io/n8nCommand210kyesterdaynoneA7Claude Code
vios-sqaNVIDIA-AI-Blueprints/video-search-and-summarizationCommand2.0kyesterdayApache-2.0A25Claude Code
testmdlmarkham/TailOpsMCPCommand1910mo agononeA11Claude Code
checklistgithub/spec-kitCommand148kyesterdayMITA13Claude Code