All skills
secondsky avatar

/sap-cap-capire

@620a19a
by Eddiesecondsky/sap-skills456 stars
120

SAP Cloud Application Programming Model (CAP) development skill using Capire documentation. Use when: building CAP applications, defining CDS models, implementing services, working with SAP HANA/SQLite/PostgreSQL databases, deploying to SAP BTP Cloud Foundry or Kyma, implementing Fiori UIs, handling authorization, multitenancy, or messaging. Covers CDL/CQL/CSN syntax, Node.js and Java runtimes, event handlers, OData services, and CAP plugins.

Use this Skill: https://skilld.dev/gh/secondsky/sap-skills/sap-cap-capire

This session only. Nothing lands on disk.

referencescli-complete.md

≈2.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

CAP CLI - Complete Command Reference

Source: <https://cap.cloud.sap/docs/cli/>

Table of Contents

Project Commands

cds init

Create a new CAP project

# Basic project
cds init [project-name]

# With sample data and HANA support
cds init my-bookshop --add sample,hana

# With TypeScript
cds init my-project --add typescript

# With multiple features
cds init my-app --add sample,hana,xsuaa,mta,multitenancy

Features Available:

  • sample - Add sample bookshop model
  • hana - Add SAP HANA database support
  • sqlite - Add SQLite for development
  • xsuaa - Add authentication service
  • mta - Add Multi-Target Application support
  • approuter - Add approuter for HTML5 apps
  • multitenancy - Add SaaS multitenancy support
  • typescript - Add TypeScript support
  • Fiori - Add Fiori templates

cds add

Add capabilities to existing project

# Add features to existing project
cds add hana
cds add xsuaa
cds add typescript
cds add multitenancy
cds add mta
cds add approuter

# Add multiple features
cds add hana,xsuaa,mta

Build & Deploy Commands

cds build

Build project for deployment

# Build all targets
cds build

# Build specific target
cds build --for hana
cds build --for production

# Clean build
cds build --clean

cds deploy

Deploy database schema

# Deploy to configured database
cds deploy

# Deploy to HANA
cds deploy --to hana

# Deploy with auto-migration
cds deploy --to hana --auto-migrate

# Dry run (show SQL without executing)
cds deploy --to hana --dry

cds compile

Compile CDS models

# Compile to CSN
cds compile db/schema.cds

# Compile to SQL
cds compile db/schema.cds --to sql

# Compile to EDMX (OData)
cds compile srv/cat-service.cds --to edmx

# Compile to YAML
cds compile db/schema.cds --to yaml

# Compile with flavor
cds compile srv/cat-service.cds --to edmx --flavor v4

Development Commands

cds watch

Start development server with live reload

# Start with default port
cds watch

# Start on specific port
cds watch --port 4004

# Start with HANA
cds watch --profile development,hana

# Start with in-memory database
cds watch --in-memory

# Start with custom profile
cds watch --profile my-profile

cds serve

Start production server

# Start server
cds serve

# Serve specific service
cds serve all
cds serve CatalogService

# Serve with custom port
cds serve --port 4004

cds run

Run custom scripts

# Run with custom entry point
cds run my-script.js

# Run with environment variables
cds run --env NODE_ENV=production

Database Commands

cds migrate

Run database migrations

# Run all pending migrations
cds migrate

# Migrate to HANA
cds migrate --to hana

# Dry run migration
cds migrate --to hana --dry

cds load

Load initial data

# Load all CSV data
cds load

# Load specific CSV
cds load db/data/my.bookshop-Books.csv

# Load with CSV import options
cds load --delim ";" --quote '"'

cds diff

Compare database schemas

# Compare model with database
cds diff

# Diff specific entity
cds diff Books

# Diff in SQL format
cds diff --to sql

Service Commands

cds bind

Bind external services

# Bind to external OData service
cds bind ExternalService --to https://api.example.com

# Bind with credentials
cds bind ExternalService --to-cred '{"url":"https://api.example.com"}'

cds tunnel

Create tunnel to remote services

# Create tunnel
cds tunnel

# Tunnel to specific service
cds tunnel --to my-service

Utility Commands

cds env

Show configuration

# Show all environment
cds env

# Show specific setting
cds env get requires.db.kind

# Set environment variable
cds env set requires.db.kind hana

# Show effective configuration
cds env get --effective

cds version

Show version information

# Show version
cds version

# Show detailed version info
cds version --full

cds help

Show help information

# General help
cds help

# Help for specific command
cds help watch
cds help deploy

cds repl

Interactive CAP shell

# Start REPL
cds repl

# REPL with preloaded entities
cds repl srv/cat-service

cds plugins

Manage CLI plugins

# List installed plugins
cds plugins

# Install plugin
npm install -g @cap-js-community/odata-v2-adapter

# Show plugin help
cds help odata-v2

Configuration

Profiles

# Use specific profile
cds watch --profile production

# Use multiple profiles
cds watch --profile development,hana

# Set default profile in package.json
{
  "cds": {
    "profiles": {
      "development": {
        "requires": {
          "db": { "kind": "sqlite" }
        }
      },
      "production": {
        "requires": {
          "db": { "kind": "hana" }
        }
      }
    }
  }
}

Environment Variables

# Set database URL
export CDS_requires_db_credentials_url=postgresql://user:pass@host:5432/db

# Set service bindings
export CDS_requires_myService_credentials='{"url":"https://api.example.com"}'

# Set profile
export NODE_ENV=production
export CDS_ENV=production

# Set custom properties
export CDS_custom_prop=value

Configuration Files

// .cdsrc.json
{
  "requires": {
    "db": {
      "kind": "sqlite",
      "credentials": {
        "url": ":memory:"
      }
    },
    "[production]": {
      "db": {
        "kind": "hana",
        "credentials": {
          "url": "hana-url"
        }
      }
    }
  },
  "build": {
    "target": "gen",
    "tasks": [{
      "for": "hana",
      "src": "db"
    }]
  }
}

Advanced Options

Watch Options

# Watch specific folders
cds watch --watch db srv

# Exclude files from watching
cds watch --exclude node_modules

# Live reload on changes
cds watch --livereload

# Open browser on start
cds watch --open

Deploy Options

# Deploy with custom model
cds deploy db/schema.cds --to hana

# Deploy with auto-healing
cds deploy --to hana --auto-heal

# Deploy with cascading deletes
cds deploy --to hana --cascading

# Deploy in verbose mode
cds deploy --to hana --verbose

Compile Options

# Compile with specific output format
cds compile db/schema.cds --to json --output model.json

# Compile with imports
cds compile db/schema.cds --to sql --with-imports

# Compile for specific flavor
cds compile srv/cat-service.cds --to edmx --flavor v4

Build Options

# Build for production
cds build --production

# Build without minification
cds build --no-minify

# Build with inline sourcemaps
cds build --sourceMap

# Build for custom target
cds build --target ./dist

Plugin Commands

OData V2 Adapter

# Install V2 adapter
npm install -g @cap-js-community/odata-v2-adapter

# Run V2 adapter
cds odata-v2

# Run with custom port
cds odata-v2 --port 4005

GraphQL Adapter

# Install GraphQL adapter
npm install @cap-js/graphql

# Run GraphQL server
cds watch --graphql

# GraphQL endpoint: http://localhost:4004/graphql

Fiori Tools

# Install Fiori tools
npm install -g @sap/ux-ui5-tooling

# Generate Fiori app
cds watch --fiori

# Launch Fiori Preview
cds launch --open /preview

Development Workflow Examples

Initial Project Setup

# Create new project
cds init my-bookshop --add sample,hana

# Install dependencies
npm install

# Start development
cds watch

Adding New Features

# Add authentication
cds add xsuaa

# Add multitenancy
cds add multitenancy

# Add TypeScript
cds add typescript

# Rebuild
npm run build

Database Management

# Load initial data
cds load

# Deploy to HANA
cds deploy --to hana

# Check for differences
cds diff --to sql

Deployment Preparation

# Build for production
cds build --production

# Create MTA archive
mbt build

# Deploy to Cloud Foundry
cf deploy mta_archives/my-app_1.0.0.mtar

Troubleshooting

Common Issues

# Clear build cache
rm -rf node_modules/.cache
cds build --clean

# Check configuration
cds env get --effective

# Test database connection
cds deploy --to hana --dry

# Check model compilation
cds compile db/schema.cds

Debug Mode

# Enable debug logs
DEBUG=cds* cds watch

# Verbose output
cds deploy --to hana --verbose

# Show effective config
cds env get --effective

Best Practices

Development

  • Use cds watch for development with live reload
  • Use SQLite for local development
  • Use profiles for different environments
  • Keep models in db/ and services in srv/

Deployment

  • Always run cds build before deployment
  • Use cds deploy --dry to check SQL before execution
  • Use MTA for Cloud Foundry deployment
  • Include cds build in CI/CD pipeline

Performance

  • Use cds compile --to sql to review generated SQL
  • Use --no-minify for debugging production builds
  • Use --cascading carefully in production
  • Monitor build times for large models

Last Updated: 2025-11-27 CAP Version: 9.4.x Documentation: <https://cap.cloud.sap/docs/cli/>

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The analyzed skill is a reference and template package providing guidance for SAP Cloud Application Programming Model (CAP) development, configuration, data privacy, and testing. It contains no executable scripts, hardcoded credentials, or malicious behavior.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    12/34 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 620a19a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 months ago
Other metadata
metadata
{
  "maintainer": "Eduard Jiglau",
  "maintainer_email": "hello@sap-ai-skills.com",
  "website": "https://sap-ai-skills.com",
  "version": "2.4.1",
  "last_verified": "2026-02-22",
  "cap_version": "@sap/cds 9.7.x",
  "mcp_version": "@cap-js/mcp-server 0.0.5",
  "lsp_version": "@sap/cds-lsp 9.7.x"
}

README badge

README badge for secondsky/sap-skills/sap-cap-capire