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.

referencesdatabases.md

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

CAP Database Configuration Reference

Source: https://cap.cloud.sap/docs/guides/databases

Supported Databases

Database Node.js Package Java Use Case
SQLite @cap-js/sqlite Yes Development, testing
SAP HANA @cap-js/hana Yes Production
PostgreSQL @cap-js/postgres Yes Production
H2 N/A Yes Java development

SQLite (Development)

Installation

npm add @cap-js/sqlite -D

Configuration

{
  "cds": {
    "requires": {
      "db": {
        "kind": "sqlite",
        "credentials": { "url": ":memory:" }
      }
    }
  }
}

File-based SQLite

{
  "cds": {
    "requires": {
      "db": {
        "kind": "sqlite",
        "credentials": { "url": "db.sqlite" }
      }
    }
  }
}

Deploy Schema

cds deploy --to sqlite:db.sqlite

SAP HANA (Production)

Installation

npm add @cap-js/hana
cds add hana

Configuration

{
  "cds": {
    "requires": {
      "db": {
        "[production]": {
          "kind": "hana",
          "deploy-format": "hdbtable"
        }
      }
    }
  }
}

Hybrid Development

# Add HANA for hybrid mode
cds add hana --for hybrid

# Deploy to HANA Cloud
cds deploy --to hana

# Run locally with remote HANA
cds watch --profile hybrid

Build for HANA

cds build --for hana

Generates in gen/db/:

  • .hdbtable files
  • .hdbview files
  • .hdbtabledata files (CSV data)
  • .hdiconfig and .hdinamespace

HANA-Specific Features

Vector Embeddings:

entity Documents {
  key ID : UUID;
  content : String;
  embedding : Vector(1536);  // For AI embeddings
}

Geospatial:

entity Locations {
  key ID : UUID;
  point : hana.ST_POINT;
  area : hana.ST_GEOMETRY;
}

Schema Evolution

CAP handles compatible changes automatically. For incompatible changes:

@cds.persistence.journal
entity LargeTable {
  key ID : UUID;
  data : String;
}

Generates .hdbmigrationtable for manual migration control.

Native SQL

@sql.append: 'PARTITION BY HASH (ID) PARTITIONS 4'
entity PartitionedData { ... }

@sql.prepend: 'COLUMN TABLE'
entity ColumnTable { ... }

PostgreSQL

Installation

npm add @cap-js/postgres
cds add postgres

Configuration

{
  "cds": {
    "requires": {
      "db": {
        "kind": "postgres",
        "credentials": {
          "host": "localhost",
          "port": 5432,
          "database": "mydb",
          "user": "postgres",
          "password": "password"
        }
      }
    }
  }
}

Docker Development

docker run -d --name postgres \
  -e POSTGRES_PASSWORD=postgres \
  -p 5432:5432 \
  postgres:15

Deploy Schema

cds deploy --to postgres

H2 (Java Development)

pom.xml

<dependency>
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <scope>runtime</scope>
</dependency>

Configuration

# application.yaml
spring:
  datasource:
    url: jdbc:h2:mem:testdb
    driver-class-name: org.h2.Driver

Database-Agnostic Queries

All databases support standard CQL operations:

// Works on all databases
await SELECT.from(Books).where({ stock: { '>': 0 } });
await INSERT.into(Books).entries({ title: 'New Book' });
await UPDATE(Books, id).set({ stock: 50 });
await DELETE.from(Books, id);

Standard Functions

Function Description
concat(x, y) String concatenation
contains(x, y) Substring check
startswith(x, y) Prefix check
endswith(x, y) Suffix check
tolower(x) Lowercase
toupper(x) Uppercase
trim(x) Remove whitespace
length(x) String length
substring(x, i, n) Extract substring

Session Variables

// Available across all databases
cds.context.user;      // Current user
cds.context.tenant;    // Current tenant
cds.context.locale;    // User locale
cds.context.timestamp; // Request timestamp

Initial Data (CSV)

File Location

db/
├── schema.cds
└── data/
    ├── my.bookshop-Books.csv
    ├── my.bookshop-Authors.csv
    └── sap.common-Countries.csv

Naming Convention

<namespace>-<EntityName>.csv or <namespace>.<EntityName>.csv

Format

ID;title;author_ID;stock;price
1;Wuthering Heights;101;100;12.99
2;Jane Eyre;102;50;10.99

Test Data

Place in test/data/ for development-only data:

test/
└── data/
    ├── my.bookshop-Books.csv
    └── my.bookshop-Reviews.csv

Connection Pooling

Node.js

{
  "cds": {
    "requires": {
      "db": {
        "pool": {
          "min": 0,
          "max": 10,
          "acquireTimeoutMillis": 10000,
          "idleTimeoutMillis": 30000
        }
      }
    }
  }
}

Java

spring:
  datasource:
    hikari:
      minimum-idle: 5
      maximum-pool-size: 20
      idle-timeout: 30000

Constraints

Not Null

entity Books {
  title : String(100) not null;
}

Unique

@assert.unique: { isbn: [isbn] }
entity Books {
  isbn : String(13);
}

Foreign Keys

{
  "cds": {
    "features": {
      "assert_integrity": "db"
    }
  }
}

Native Queries

Node.js

const result = await cds.db.run(
  `SELECT * FROM my_bookshop_Books WHERE stock > ?`,
  [10]
);

Java

@Autowired
JdbcTemplate jdbc;

List<Map<String, Object>> result = jdbc.queryForList(
  "SELECT * FROM my_bookshop_Books WHERE stock > ?",
  10
);

Profile-Based Configuration

{
  "cds": {
    "requires": {
      "db": {
        "[development]": {
          "kind": "sqlite",
          "credentials": { "url": ":memory:" }
        },
        "[hybrid]": {
          "kind": "hana"
        },
        "[production]": {
          "kind": "hana"
        }
      }
    }
  }
}

Activate Profile

# Development (default)
cds watch

# Hybrid
cds watch --profile hybrid

# Production
NODE_ENV=production cds serve

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