sap-cap-capire by secondsky/sap-skills
npx skills add https://github.com/secondsky/sap-skills --skill sap-cap-capire# Install CAP development kit
npm i -g @sap/cds-dk @sap/cds-lsp
# Create new project
cds init <project-name>
cds init <project-name> --add sample,hana
# Start development server with live reload
cds watch
# Add capabilities
cds add hana # SAP HANA database
cds add sqlite # SQLite for development
cds add xsuaa # Authentication
cds add mta # Cloud Foundry deployment
cds add multitenancy # SaaS multitenancy
cds add typescript # TypeScript support
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
using { cuid, managed } from '@sap/cds/common';
namespace my.bookshop;
entity Books : cuid, managed {
title : String(111) not null;
author : Association to Authors;
stock : Integer;
price : Decimal(9,2);
}
entity Authors : cuid, managed {
name : String(111);
books : Association to many Books on books.author = $self;
}
using { my.bookshop as my } from '../db/schema';
service CatalogService @(path: '/browse') {
@readonly entity Books as projection on my.Books;
@readonly entity Authors as projection on my.Authors;
@requires: 'authenticated-user'
action submitOrder(book: Books:ID, quantity: Integer) returns String;
}
此技能集成了官方的 CAP MCP(模型上下文协议)服务器,为 AI 代理提供对您项目已编译的 CDS 模型和 CAP 文档的实时访问。
可用的 MCP 工具 :
search_model - 在您已编译的 CSN 模型中模糊搜索 CDS 实体、服务、操作和关系search_docs - 通过语义搜索在 CAP 文档中查找语法、模式和最佳实践主要优势 :
设置 : 有关与 Claude Code、opencode 或 GitHub Copilot 的配置,请参阅 MCP 集成指南。
使用案例 : 有关实际示例及量化的投资回报率(约每年每名开发者节省 13.1 万美元),请参阅 MCP 使用案例。
代理集成 : 专门的代理(cap-cds-modeler、cap-service-developer、cap-project-architect、cap-performance-debugger)在其工作流程中会自动使用这些 MCP 工具。
project/
├── app/ # UI content (Fiori, UI5)
├── srv/ # Service definitions (.cds, .js/.ts)
├── db/ # Data models and schema
│ ├── schema.cds # Entity definitions
│ └── data/ # CSV seed data
├── package.json # Dependencies and CDS config
└── .cdsrc.json # CDS configuration (optional)
| CDS 类型 | SQL 映射 | 常见用途 |
|---|---|---|
UUID | NVARCHAR(36) | 主键 |
String(n) | NVARCHAR(n) | 文本字段 |
Integer | INTEGER | 整数 |
Decimal(p,s) | DECIMAL(p,s) | 货币值 |
Boolean | BOOLEAN | 真/假 |
Date | DATE | 日历日期 |
Timestamp | TIMESTAMP | 日期/时间 |
using { cuid, managed, temporal } from '@sap/cds/common';
// cuid = UUID key
// managed = createdAt, createdBy, modifiedAt, modifiedBy
// temporal = validFrom, validTo
// srv/cat-service.js
module.exports = class CatalogService extends cds.ApplicationService {
init() {
const { Books } = this.entities;
// Before handlers - validation
this.before('CREATE', Books, req => {
if (!req.data.title) req.error(400, 'Title required');
});
// On handlers - custom logic
this.on('submitOrder', async req => {
const { book, quantity } = req.data;
// Custom business logic
return { success: true };
});
return super.init();
}
}
const { Books } = cds.entities;
// SELECT with conditions
const books = await SELECT.from(Books)
.where({ stock: { '>': 0 } })
.orderBy('title');
// INSERT
await INSERT.into(Books)
.entries({ title: 'New Book', stock: 10 });
// UPDATE
await UPDATE(Books, bookId)
.set({ stock: { '-=': 1 } });
// package.json
{
"cds": {
"requires": {
"db": {
"[development]": {
"kind": "sqlite",
"credentials": { "url": ":memory:" }
},
"[production]": { "kind": "hana" }
}
}
}
}
cds add hana
cds deploy --to hana
db/data/my.bookshop-Books.csv<命名空间>-<实体名称>.csv# Add CF deployment support
cds add hana,xsuaa,mta,approuter
# Build and deploy
npm install --package-lock-only
mbt build
cf deploy mta_archives/<project>_<version>.mtar
cds add multitenancy
配置:
{
"cds": {
"requires": {
"multitenancy": true
}
}
}
// Service-level
@requires: 'authenticated-user'
service CatalogService { ... }
// Entity-level
@restrict: [
{ grant: 'READ' },
{ grant: 'WRITE', to: 'admin' }
]
entity Books { ... }
cds init [name] # Create project
cds add <feature> # Add capability
cds watch # Dev server with live reload
cds serve # Start server
cds compile <model> # Compile CDS to CSN/SQL/EDMX
cds deploy --to hana # Deploy to HANA
cds build # Build for deployment
cds env # Show configuration
cds repl # Interactive REPL
cds version # Show version info
@sap/cds/common 的 cuid 和 managed 方面db/ 中,服务放在 srv/ 中,UI 放在 app/ 中每周安装量
103
仓库
GitHub 星标数
164
首次出现
2026年1月23日
安全审计
安装于
opencode96
codex96
gemini-cli96
github-copilot94
kimi-cli89
amp89
# Install CAP development kit
npm i -g @sap/cds-dk @sap/cds-lsp
# Create new project
cds init <project-name>
cds init <project-name> --add sample,hana
# Start development server with live reload
cds watch
# Add capabilities
cds add hana # SAP HANA database
cds add sqlite # SQLite for development
cds add xsuaa # Authentication
cds add mta # Cloud Foundry deployment
cds add multitenancy # SaaS multitenancy
cds add typescript # TypeScript support
using { cuid, managed } from '@sap/cds/common';
namespace my.bookshop;
entity Books : cuid, managed {
title : String(111) not null;
author : Association to Authors;
stock : Integer;
price : Decimal(9,2);
}
entity Authors : cuid, managed {
name : String(111);
books : Association to many Books on books.author = $self;
}
using { my.bookshop as my } from '../db/schema';
service CatalogService @(path: '/browse') {
@readonly entity Books as projection on my.Books;
@readonly entity Authors as projection on my.Authors;
@requires: 'authenticated-user'
action submitOrder(book: Books:ID, quantity: Integer) returns String;
}
This skill integrates with the official CAP MCP (Model Context Protocol) server, providing AI agents with live access to your project's compiled CDS model and CAP documentation.
Available MCP Tools :
search_model - Fuzzy search for CDS entities, services, actions, and relationships in your compiled CSN modelsearch_docs - Semantic search through CAP documentation for syntax, patterns, and best practicesKey Benefits :
Setup : See MCP Integration Guide for configuration with Claude Code, opencode, or GitHub Copilot.
Use Cases : See MCP Use Cases for real-world examples with quantified ROI (~$131K/developer/year time savings).
Agent Integration : The specialized agents (cap-cds-modeler, cap-service-developer, cap-project-architect, cap-performance-debugger) automatically use these MCP tools as part of their workflows.
project/
├── app/ # UI content (Fiori, UI5)
├── srv/ # Service definitions (.cds, .js/.ts)
├── db/ # Data models and schema
│ ├── schema.cds # Entity definitions
│ └── data/ # CSV seed data
├── package.json # Dependencies and CDS config
└── .cdsrc.json # CDS configuration (optional)
| CDS Type | SQL Mapping | Common Use |
|---|---|---|
UUID | NVARCHAR(36) | Primary keys |
String(n) | NVARCHAR(n) | Text fields |
Integer | INTEGER | Whole numbers |
Decimal(p,s) | DECIMAL(p,s) | Monetary values |
Boolean | BOOLEAN | True/false |
using { cuid, managed, temporal } from '@sap/cds/common';
// cuid = UUID key
// managed = createdAt, createdBy, modifiedAt, modifiedBy
// temporal = validFrom, validTo
// srv/cat-service.js
module.exports = class CatalogService extends cds.ApplicationService {
init() {
const { Books } = this.entities;
// Before handlers - validation
this.before('CREATE', Books, req => {
if (!req.data.title) req.error(400, 'Title required');
});
// On handlers - custom logic
this.on('submitOrder', async req => {
const { book, quantity } = req.data;
// Custom business logic
return { success: true };
});
return super.init();
}
}
const { Books } = cds.entities;
// SELECT with conditions
const books = await SELECT.from(Books)
.where({ stock: { '>': 0 } })
.orderBy('title');
// INSERT
await INSERT.into(Books)
.entries({ title: 'New Book', stock: 10 });
// UPDATE
await UPDATE(Books, bookId)
.set({ stock: { '-=': 1 } });
// package.json
{
"cds": {
"requires": {
"db": {
"[development]": {
"kind": "sqlite",
"credentials": { "url": ":memory:" }
},
"[production]": { "kind": "hana" }
}
}
}
}
cds add hana
cds deploy --to hana
db/data/my.bookshop-Books.csv<namespace>-<EntityName>.csv# Add CF deployment support
cds add hana,xsuaa,mta,approuter
# Build and deploy
npm install --package-lock-only
mbt build
cf deploy mta_archives/<project>_<version>.mtar
cds add multitenancy
Configuration:
{
"cds": {
"requires": {
"multitenancy": true
}
}
}
// Service-level
@requires: 'authenticated-user'
service CatalogService { ... }
// Entity-level
@restrict: [
{ grant: 'READ' },
{ grant: 'WRITE', to: 'admin' }
]
entity Books { ... }
cds init [name] # Create project
cds add <feature> # Add capability
cds watch # Dev server with live reload
cds serve # Start server
cds compile <model> # Compile CDS to CSN/SQL/EDMX
cds deploy --to hana # Deploy to HANA
cds build # Build for deployment
cds env # Show configuration
cds repl # Interactive REPL
cds version # Show version info
cuid and managed aspects from @sap/cds/commondb/, services in srv/, UI in app/Weekly Installs
103
Repository
GitHub Stars
164
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode96
codex96
gemini-cli96
github-copilot94
kimi-cli89
amp89
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
130,600 周安装
Date | DATE | Calendar dates |
Timestamp | TIMESTAMP | Date/time |