skills/creating-service-skills/SKILL.md
Generate operational service skill packages for any service in the project. Produces SKILL.md documentation, diagnostic scripts, and references through a mandatory two-phase workflow. Use when onboarding to a new service, adding a new skill, or when a skill is missing from the catalog.
npx skillsauth add jaggerxtrm/jaggers-agent-tools creating-service-skillsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are the Service Skills Architect. Your job is to produce complete, operational skill packages for project services — not stubs, not placeholders. The output must be immediately useful to any agent working on the service.
Use both phases every time. Phase 1 gives structure; Phase 2 grounds the skill in real service behavior.
Run the scaffolder to build a structural skeleton from static analysis of
docker-compose*.yml, Dockerfile, and dependency files. It also detects
technologies and auto-populates official documentation links.
# Create a skeleton for a service
python3 "$CLAUDE_PROJECT_DIR/.claude/skills/creating-service-skills/scripts/scaffolder.py" \
create <service-id> <territory-path> "<description>"
# Example
python3 "$CLAUDE_PROJECT_DIR/.claude/skills/creating-service-skills/scripts/scaffolder.py" \
create auth-service src/auth/ "JWT authentication and session management"
The skeleton creates at .claude/skills/<service-id>/:
SKILL.md with [PENDING RESEARCH] markersscripts/health_probe.py stubscripts/log_hunter.py stubscripts/data_explorer.py stubreferences/deep_dive.md research checklistThe skeleton is never sufficient. It has structural facts but no semantic knowledge.
Classify the service type to determine which specialist script to add:
python3 "$CLAUDE_PROJECT_DIR/.claude/skills/creating-service-skills/scripts/deep_dive.py" \
classify <territory-path>
Print the full Phase 2 research agenda:
python3 "$CLAUDE_PROJECT_DIR/.claude/skills/creating-service-skills/scripts/deep_dive.py" \
questions <service-type>
After the skeleton exists, answer every research question by reading the actual source code. Use Serena LSP tools exclusively — never read entire files.
| What you need to find | Serena tool to use |
|---|---|
| Module/class structure | get_symbols_overview(relative_path, depth=1) |
| Body of a specific function | find_symbol(name_path, include_body=True) |
| Log/error message strings | search_for_pattern("logger.error|raise|except") |
| All SQL queries | search_for_pattern("SELECT|INSERT|UPDATE|COPY") |
| Env var usage | search_for_pattern("os.getenv|os.environ|settings\\.") |
| Data flow (who calls what) | find_referencing_symbols(name_path, relative_path) |
| Entry point detection | search_for_pattern('if __name__|def main|async def main') |
| Docker port mapping | search_for_pattern("ports:|DB_PORT|POSTGRES_PORT") |
| Actual table names | execute_db_query("SELECT tablename FROM pg_tables WHERE schemaname='public'") |
| Actual column names | execute_db_query("SELECT column_name, data_type FROM information_schema.columns WHERE table_name='X'") |
Do NOT read entire files. Map first → read only the symbols you need.
Container & Runtime
command:)depends_on: conditionsData Layer — verify ALL of these against the live DB before writing any scripts:
SELECT tablename FROM pg_tables WHERE schemaname='public' → get exact table listSELECT column_name, data_type FROM information_schema.columns WHERE table_name='<table>' → get exact column namesCOUNT(*) freshness check for tables with no timestamp)Failure Modes — build this table with ≥5 rows from real exception handlers:
| Symptom | Likely Cause | Resolution | |---------|-------------|------------| | (log output) | (root cause) | (exact fix command) |
Log Patterns — source from actual codebase, not invented:
search_for_pattern("logger.info|logging.info") → info patternssearch_for_pattern("logger.error|logger.warning") → error/warningsearch_for_pattern("logger.critical|panic!") → criticalAfter research is complete, replace all [PENDING RESEARCH] stubs in scripts/.
Scripts should be ready to run end-to-end, without TODO markers or placeholder SQL.
from dotenv import load_dotenv
from pathlib import Path
import sys
project_root = Path(__file__).resolve().parent.parent.parent.parent.parent
env_file = project_root / ".env"
if env_file.exists():
load_dotenv(str(env_file))
sys.path.insert(0, str(project_root))
from shared.db_pool_manager import execute_db_query
Never use raw psycopg2 or hardcoded credentials. Always use execute_db_query from
shared.db_pool_manager. The .env load is mandatory — scripts without it will fail
when the environment is clean.
information_schema before writing any SQL. Never guess table or column names.try has an except — incomplete try/except blocks crash silently. Every DB call must be wrapped with a matching except that captures the error into the result.qwen -y for delegation — when delegating Phase 2 to Qwen, always pass the -y flag (YOLO/non-interactive mode) otherwise Qwen will research but never write files.ccs gemini — Gemini is invoked as gemini -p "..." directly; GLM is env -u CLAUDECODE ccs glm -p "..."; Qwen is qwen -y "...".venv/bin/python3 for testing — diagnostic scripts must be tested with the project venv, not system python, which may lack dotenv and other deps.scripts/health_probe.pyRequired features:
check_container(): docker inspect -f {{.State.Running}} <container>check_table_freshness(): SELECT MAX(<ts_col>) FROM <table> — compare vs stale thresholddocker compose restart <service> or SQL correction--json flag for machine-readable outputSTALE_CHECKS = [
{"table": "actual_table", "ts_col": "created_at", "stale_minutes": 10},
]
DB_PORT = 5433 # external mapped port — verify in docker-compose.yml
scripts/log_hunter.pyRequired features:
critical → error → warning → info--tail N, --since <time>, --errors-only, --json flags# RIGHT — from actual codebase
PATTERNS = [
("OAuth expired", r"invalid_grant|token.*expired", "critical"),
("PDF parse error", r"PdfReadError|pdf.*format.*changed", "error"),
("Report saved", r"report.*ingested|saved.*DB", "info"),
]
# WRONG — never use generic patterns
PATTERNS = [("Error", r"ERROR|Exception|ConnectionError", "error")]
scripts/data_explorer.pyRequired features:
WHERE symbol = %s (never f-strings in SQL)--limit, --json, --symbol flags| Service Type | Script | Core Logic |
|---|---|---|
| continuous_db_writer | data_explorer.py | DISTINCT ON latest-per-symbol |
| http_api_server | endpoint_tester.py | Probe real routes, check response codes |
| one_shot_migration | coverage_checker.py | Verify expected schema/table exists |
| file_watcher | state_inspector.py | Mount accessible + state file present |
| scheduled_poller | auth_checker.py | Token file present + not expired |
See references/script_quality_standards.md for complete templates.
scripts/Makefile (required)The scaffolder creates a stub Makefile in Phase 1. In Phase 2, verify it is
correct and complete because it is the primary entry point for diagnostics.
Standard template (copy verbatim, replace <service-id> comment only):
# Skill diagnostic scripts for <service-id>
# Usage: make <target> (from this directory)
# Override python: make health PYTHON=/path/to/python3
# Auto-detect: prefer project venv (4 levels up), fall back to system python3
_VENV := $(wildcard ../../../../venv/bin/python3)
PYTHON ?= $(if $(_VENV),../../../../venv/bin/python3,python3)
.PHONY: health health-json data data-json logs errors db help
help:
@echo "Available targets:"
@echo " health - Run health probe (human readable)"
@echo " health-json - Run health probe (JSON output)"
@echo " data - Show latest DB records"
@echo " data-json - Show latest DB records (JSON, limit 5)"
@echo " logs - Tail and analyze recent logs"
@echo " errors - Show errors/criticals only"
@echo " db - Run DB helper example queries"
@echo ""
@echo "Python: $(PYTHON)"
health:
$(PYTHON) health_probe.py
health-json:
$(PYTHON) health_probe.py --json
data:
$(PYTHON) data_explorer.py
data-json:
$(PYTHON) data_explorer.py --json --limit 5
logs:
$(PYTHON) log_hunter.py --tail 50
errors:
$(PYTHON) log_hunter.py --errors-only --tail 50
db:
$(PYTHON) db_helper.py
Rules for the delegated Phase 2 agent:
make auth, make schema, make backfill)._VENV auto-detect path (../../../../venv/bin/python3) unchanged — it resolves from scripts/ → service dir → skills/ → .claude/ → project root → venv/.make help after updates and confirm the Python path resolves to the project venv.The scaffolder detects technologies from:
docker-compose*.yml image tagsrequirements.txt / pyproject.toml package namesCargo.toml crate namespackage.json dependenciesAnd automatically adds relevant official documentation links to the ## References
section of the generated SKILL.md. Verify these links are correct during Phase 2.
Once the skill is complete, verify that the PreToolUse skill activator hook is
wired in the project's .claude/settings.json. It should already be there if
you ran install-service-skills.py — but confirm it, and explain it to the user.
The skill_activator.py hook fires before any Read, Write, Edit, Grep,
Glob, or Bash operation. It checks whether the operation touches a registered
service territory (from service-registry.json). If it does, it injects:
[Service Skill] You are about to work with the '<service-id>' service territory.
Load the expert skill before proceeding: Read .claude/skills/<service-id>/SKILL.md
The skill contains: operational knowledge, failure modes, diagnostic scripts,
and the correct methods for managing this service.
Do not use ad-hoc approaches (raw SQL, improvised docker commands) when the
skill defines the correct method.
This means: from the moment the skill is registered, Claude will automatically be reminded to load and apply it whenever working on relevant files or running commands that mention the service — without you having to ask.
Check .claude/settings.json contains a PreToolUse entry:
"PreToolUse": [{
"matcher": "Read|Write|Edit|Glob|Grep|Bash",
"hooks": [{"type": "command",
"command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/skills/using-service-skills/scripts/skill_activator.py\""}]
}]
If missing, run the installer again or add it manually.
python3 .claude/skills/using-service-skills/scripts/cataloger.py
The service should appear in the output catalog. If not, the territory may not
be registered in service-registry.json — re-run the scaffolder for Phase 1.
After completing Phase 3, confirm:
✅ Hook registered: '<service-id>' skill is now auto-activated.
Whenever you (or I) work with files in <territory> or run commands mentioning
'<service-id>', I will automatically load .claude/skills/<service-id>/SKILL.md
and apply its expert knowledge — including using the correct diagnostic scripts
instead of ad-hoc queries.
A skill is complete (not a draft) when ALL of these are true:
Schema verification (before writing any script):
SELECT tablename FROM pg_tables WHERE schemaname='public' run — real table names confirmedSELECT column_name, data_type FROM information_schema.columns WHERE table_name='X' run per output tableCOUNT(*) used for freshness check insteadScript completeness:
[PENDING RESEARCH] markers remain in SKILL.mddotenv + shared.db_pool_manager)health_probe.py: real container check + actual table freshness + fix commands; every try has exceptlog_hunter.py: patterns sourced from codebase, not invented; severity bucketeddata_explorer.py: real table + real column names + parameterized SQLdb_helper.py: example queries against real tables with correct column names--json flagscripts/Makefile generated with standard targets: health, health-json, data, data-json, logs, errors, dbvenv/bin/python3 (not system python3) — 0 import errorsRegistration:
references/deep_dive.md Phase 2 checklist completed.claude/skills/service-registry.jsonPreToolUse skill activator hook confirmed in .claude/settings.jsonAfter successful completion:
✅ Created expert skill: `<service-id>`
**Classification**: <service-type> (confidence: high/medium/low)
**Territory**: <file patterns>
**Specialist Script**: <script-name.py>
**Health Strategy**: <strategy>
**Skill Path**: `.claude/skills/<service-id>/SKILL.md`
**Official Docs**: <detected technologies>
**Phase 2 Status**: Complete
- [PENDING RESEARCH] markers: 0
- Scripts implemented: health_probe.py, log_hunter.py, data_explorer.py, <specialist>.py
**Phase 3 Status**: Hook registered
- PreToolUse activator: confirmed in settings.json
- Auto-activation: triggers on territory files + service name in commands
⚠️ If Phase 2 is incomplete, the skill is NOT ready for use.
⚠️ If Phase 3 is skipped, the skill exists but will not enforce itself.
Write to:
.claude/skills/<service-id>/ (new skill packages).claude/skills/service-registry.json (registration)Do not:
.claude/skills/scripts/scaffolder.py — Phase 1 skeleton generator with official docs detectionscripts/deep_dive.py — Service classifier + Phase 2 research agendascripts/bootstrap.py — Registry CRUD and path resolution utilities/using-service-skills — Discover and activate expert personas at session start/updating-service-skills — Sync skills when implementation driftsdevelopment
Operational service-knowledge system for a project's services. One skill that creates, discovers, activates, updates, and scopes per-service expert skill packages (SKILL.md + diagnostic scripts + references), kept in sync with the code via a GitNexus-aware drift engine. Use when onboarding to a service, routing a task to the right expert, scaffolding a missing skill, or syncing a skill after the implementation drifted. Triggers: /service-skills, /creating-service-skills, /using-service-skills, /updating-service-skills, /scope, or any task that touches a registered service territory.
development
Bootstrap a complete security pipeline (Dependabot + OSV + Semgrep + gitleaks + pre-commit hooks + Codex review) on any GitHub repo. Designed for free user-private repos where GitHub Advanced Security is unavailable. Reusable across Python/TypeScript/Go/Rust stacks.
testing
Merges queued PRs from xt worktree sessions in the correct order (FIFO), maintaining linear history by rebasing remaining PRs after each merge. Use this skill whenever the user has multiple open PRs from xt worktrees, asks to "merge my PRs", "process the PR queue", "drain the queue", "merge worktree branches", or says "what PRs do I have open". Also activate after any xt-end completion when other PRs are already open, or when the user asks "can I merge yet" or "is CI green". Handles the full sequence: list → sort → CI check → merge oldest → rebase cascade → repeat until queue is empty.
testing
Autonomous session close flow for xt worktree sessions. Use this skill whenever the user says "done", "finished", "wrap up", "close session", "ship it", "I'm done", "ready to merge", or similar. Also activate when all beads issues in the session are closed, or when the user explicitly runs /xt-end. This skill is designed for headless/specialist use: it must make deterministic decisions, auto-remediate common anomalies, and avoid clarification questions unless execution is truly blocked.