/cap-developer:cap-troubleshootingfrom cap-developer
Runs structured diagnostics on CAP Node.js projects to find startup failures, request errors, build/deploy issues, data problems, or config confusion. Collects version info, configuration, dependency health, and verbose logs, then suggests fixes.
Ships in cap-developer. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Run a structured diagnostic on a CAP Node.js project to find out why something is broken. Collect project state, walk through a checklist of common issues, and suggest concrete fixes.
Ask the user (or infer from context) which category the problem falls into:
| Category | Examples |
|---|---|
| Startup failure | cds watch crashes, server won't start |
| Request error | 404, 500, 401/403, query returns wrong data |
| Build/deploy error | cds build fails, HDI deploy fails |
| Data issue | Missing data, wrong results, draft problems |
| Config confusion | Service bindings, profiles, hybrid testing |
This determines which checks in Step 3 to prioritize.
This skill covers diagnosing failures. For how to start, discover and stop local servers in the first place, see
cap-inner-loop.
Run these commands from the project root. Capture all output — do not stop on errors.
cds version
Compare the global @sap/cds-dk version against the local @sap/cds in
node_modules. A major version mismatch (e.g. dk 9 vs cds 7) is a problem.
cds env requires
cds env requires --profile production
This shows the resolved service bindings and feature flags. Look for
unexpected kind values, missing credentials, or wrong database config.
npm ls --depth=0 2>&1
Look for UNMET PEER DEPENDENCY, MISSING, or invalid entries.
DEBUG=all cds watch 2>&1 | head -100
DEBUG=all turns on trace-level logging for every CAP module. Scan the
output for errors, warnings, or unexpected flow. You can also narrow it:
| DEBUG value | What it shows |
|---|---|
all | Everything |
sql | Generated SQL statements |
auth | Authentication resolution |
remote | Remote service calls |
app | Application-level logs |
cds | Core CDS runtime |
When you need to inspect the live model or test queries interactively, use a
heredoc to feed commands into the REPL. This is important: piping via
echo ... | closes stdin before the async server boot finishes, so the
entities are not yet in scope and commands fail. A heredoc keeps stdin open
long enough for the server to start and export all globals.
cds repl --run . <<'EOF'
await SELECT.from(Incidents).limit(3)
EOF
After --run . boots, the REPL automatically injects all entities and
services as globals, so you can use them directly:
cds repl --run . <<'EOF'
.inspect cds.model .depth=2
EOF
cds repl --run . <<'EOF'
.inspect cds.services .depth=1
EOF
cds repl --run . <<'EOF'
await SELECT.from(Incidents).where({ status_code: 'N' })
EOF
You can also put multiple statements in one heredoc:
cds repl --run . <<'EOF'
const result = await SELECT.from(Incidents).columns('ID','title','status_code')
console.log(result)
EOF
Read package.json — specifically cds.requires, dependencies, and
devDependencies. Check if these files/folders exist:
db/ or data/ — CDS domain modelsrv/ — service definitions and handlersapp/ — UI / Fiori annotations (optional).cdsrc.json or cds config in package.json.cdsrc-private.json — private config / hybrid bindingsdefault-env.json — legacy service bindings (deprecated, prefer cds bind)Walk through these checks. Skip items that don't match the symptom category from Step 1.
Symptom: Strange errors on cds watch, features not working as documented.
Check: Compare major versions from cds version output. The global
@sap/cds-dk and local @sap/cds must be on the same major version.
Fix:
npm install -g @sap/cds-dk@latest
npm update @sap/cds
Symptom: MODULE_NOT_FOUND errors, or behavior doesn't match code changes
to dependencies.
Check: Run npm ls --depth=0 and look for errors. Check if node_modules
exists at all.
Fix:
rm -rf node_modules package-lock.json
npm install
Symptom: "No service definition found", database errors, wrong database used in production.
Check: Run cds env requires and compare against what you expect. Common
mistakes:
db kind is sql but no database plugin installedauth not configured for production profileFix: Correct package.json cds section or .cdsrc.json. Use
cds env requires --profile <profile> to verify each profile.
Symptom: "No database service configured" or "Cannot find module" for database.
Check: Look at devDependencies / dependencies for one of:
| Plugin | Database |
|---|---|
@cap-js/sqlite | SQLite (dev) |
@cap-js/hana | SAP HANA (production) |
@cap-js/postgres | PostgreSQL |
Fix:
# For local development:
npm add -D @cap-js/sqlite
# For production with HANA:
npm add @cap-js/hana
Symptom: Model changes not reflected at runtime, deployed schema differs from CDS.
Check: If gen/ folder exists, check if it's outdated vs the source .cds
files.
Fix:
cds build
# or just use cds watch during development — it rebuilds automatically
Symptom: 401 Unauthorized, 403 Forbidden, or auth works locally but not in production.
Check:
.cdsrc.json for local dev?@requires / @restrict annotations?DEBUG=auth cds watch and inspect which user is resolved.@sap/xssec installed? Is XSUAA bound?Fix (local mock users): Add to .cdsrc.json:
{
"requires": {
"auth": {
"[development]": {
"kind": "mocked",
"users": {
"alice": { "roles": ["admin"] },
"bob": { "roles": ["viewer"] }
}
}
}
}
}
Symptom: Works locally with SQLite but fails when testing against remote HANA or other BTP services.
Check:
cds bind run to create bindings? Check .cdsrc-private.json.cds env requires.db --profile hybrid to see resolved config.Fix:
cds bind -2 <hana-service-instance>
cds watch --profile hybrid
Symptom: Draft operations fail, "DRAFT_ACTIVE" table errors, Fiori edit flow broken.
Check:
@odata.draft.enabled on the right entity (the service-level
projection, not the db entity)?Composition of many correctly for sub-items?Fix: Ensure the annotation is on the service entity:
service CatalogService {
@odata.draft.enabled
entity Books as projection on db.Books;
}
Symptom: EADDRINUSE error on startup.
Check: Another process is using port 4004 (default).
Fix:
cds watch --port 4005
# or kill the existing process:
lsof -ti:4004 | xargs kill
Symptom: cds watch starts but hangs, or connects to unexpected external
services.
Check: Run cds env requires and look for remote service bindings that
may be active in the current profile. Check for leftover default-env.json
or .cdsrc-private.json files injecting credentials.
Fix: Remove or rename stale config files. Use explicit profiles:
CDS_ENV=development cds watch
Symptom: Requests succeed but fields are missing, associations resolve to null, or expands return nothing.
Check: The cause is usually the CDS model, not the runtime — run a
cap-cds-review pass over the affected entities and service projections.
Present findings as:
cds watch + a test request)If no issue is found from the checklist, suggest the user run with full debug logging and share the output:
DEBUG=all cds watch 2>&1 | tee cds-debug.log
cds version first — many issues boil down to version mismatches.DEBUG=all is noisy but invaluable. Narrow to specific modules once the
problem area is identified.cds repl --run . starts a live server inside the REPL, letting you query
the model and database interactively — very useful for data issues. Feed
commands via heredoc (<<'EOF' ... EOF), not via pipe (echo ... |):
piping closes stdin before the async boot completes, causing commands to
fail with "not defined" errors. The heredoc keeps stdin open until the
server is ready and all entity/service globals are injected.cds env shows the effective merged config from all sources. It's the
single source of truth for "what config is actually active".What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub capire/skills --plugin cap-developer10 skills in this plugin
/cap-add-remote-serviceAdd a remote service integration to an existing CAP Node.js application using the Calesi pattern. Imports external APIs (from other CAP apps or OData/S4 sources), creates consumption views, wires up delegation and data federation handlers, and validates the result with cds watch. Use when a developer wants to consume an external service in their CAP app./cap-cds-reviewReview and assess CDS data models in CAP applications for correctness, best practices, and potential issues. Produces a structured report with severity-rated findings covering naming conventions, associations/compositions, annotations, reuse patterns, service projections, and performance considerations. Use this skill whenever a developer asks to review, audit, or improve their CDS model, or proactively when you notice potential modeling issues while working on a CAP project./cap-Other plugins' skills for the same job