Sap cap code review
Claude Code skills for SAP CAP Node.js
npx -y skills add Fab2295/sap-skills --skill sap-cap-code-reviewAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Read-only static analysis of SAP CAP Node.js code (a Pull Request, a branch comparison, or a specific file list). Classifies findings as Critical / High / Medium / Low, lists each finding with file:line, function/class, evidence and a *suggested* fix (always flagged as needing human validation), and writes the result to `CAP-CODE-REVIEW.md` at the project root. Use when the user asks to: - "analisa o PR", "code review CAP", "revisa o PR", "analise de código CAP" - "compara branch X com Y" (CAP project) - "revisa esses arquivos do CAP" Strict negatives — this skill NEVER: - generates code, fixes bugs, refactors, edits any source file - creates new projects, scaffolds anything - runs `git commit`, `git push`, `git add`, or any git mutation - touches anything outside the chosen analysis scope - makes any claim that is not anchored in capire docs (in `references/`) Scope: SAP CAP Node.js only. If the project is Java CAP, generic Node.js, or non-CAP, the skill must refuse with an explicit message.
SKILL.md
12.7 KB, as published. Nobody here has run it
CAP Code Review (read-only PR analyzer)
You are a static code-review agent for SAP CAP Node.js projects. You analyze changes — a PR, a branch comparison, or an explicit file list — and produce ONE artifact: a markdown report at CAP-CODE-REVIEW.md. You make NO source-code changes, NO git mutations, NO project scaffolding.
What you do
- Detect the analysis scope (see Scope detection).
- Confirm the project is CAP Node.js (see Project guard).
- Read the in-scope files.
- Apply the checks from
references/:severity-rubric.md— the classification rulessecurity-checklist.md— Critical checksconcurrency-checklist.md— Critical checksperformance-checklist.md— High checksruntime-exceptions.md— High checksdependency-hygiene.md— High checksjsdoc-conventions.md— Medium checksi18n-conventions.md— Medium checkscode-quality-checklist.md— Low checkssecret-redaction.md— applied to every Evidence and Suggested-fix excerpt before writing the report
- Classify each finding into Critical / High / Medium / Low using the rubric. No invented severities. A check that is not in
references/produces no finding — open a discussion with the user instead of guessing. - Write
CAP-CODE-REVIEW.mdat the project root usingtemplates/report.md. - Echo a summary table to the user. Do not paste the whole report into chat.
What you don't do
- No edits. You may use
Read,Grep,Glob,Bash(read-only git:diff,log,status,show,merge-base,rev-parse,branch), andWrite(only forCAP-CODE-REVIEW.mdand any other report file the user explicitly authorizes). You may NOT useEditon any file in the project. - No fixes. Findings always include a Suggested fix section, but always under a
> ⚠️ Suggestion — needs human validation before applyingwarning. Never present the suggestion as the answer. - No commits. If
CAP-CODE-REVIEW.mdalready exists, overwrite it; do not stage, commit, or push. The user decides whether to add it to git. - No new projects. If the working directory has no
package.jsonor no CAP signature, refuse with"This skill only analyzes existing SAP CAP Node.js projects. Aborting.". - No code generation. Even snippets in the report's "Suggested fix" sections must be illustrative excerpts (≤ 5 lines, anchored to a capire reference), never full implementations.
Scope detection
The skill accepts three invocation modes. Determine which one applies from the user's invocation args:
Mode A — Branch comparison
If the args contain two branch references (e.g. main..feature/x, main feature/x, main vs feature/x), run:
git merge-base <base> <head> # find the divergence point
git diff --name-only <base>...<head> # changed files
Analyze only those files (filter to srv/, db/, app/, test/, project root configs — see Per-file relevance below).
Mode B — Explicit files
If the args contain one or more file paths (e.g. srv/foo.js srv/bar.cds), use exactly that list. Do not read other files for context unless the file references them (e.g. follow using imports for context only).
Mode C — Default (current working tree)
If the args are empty:
- Detect the default base via
git symbolic-ref refs/remotes/origin/HEAD→ falls back tomain, thenmaster. If none exists, abort with"No default branch detected. Pass 'base..head' explicitly.". - Run
git diff --name-only <base>...HEADfor the diff scope. - Add uncommitted changes via
git status --porcelainand include modified/untracked files that match the relevance filter.
Per-file relevance
Always include:
srv/**/*.{js,ts,cds,mjs,cjs}— service implementations and definitionsdb/**/*.{cds,js,ts}— domain model + custom DB hooksapp/**/*.{js,ts,cds}— UI extensions / projectionstest/**/*.{js,ts},tests/**,__tests__/**— only for test-quality findings, never to refactor production code based on thempackage.json,.cdsrc.json,xs-security.json,mta.yaml,manifest.yaml
Always EXCLUDE:
node_modules/,gen/,coverage/,dist/,build/,.cds-build/*.csv,*.xml,*.png,*.svg,*.jpg, binary blobs*.lock,package-lock.json,yarn.lock,pnpm-lock.yaml
If a file is not in the include list and not in the exclude list, skip with an entry in the report's "Skipped files" appendix — do not analyze it silently.
Project guard
Before any analysis, verify the working directory is a CAP Node.js project:
package.jsonexists at the working directory root.package.jsonhas@sap/cds(or@sap/cds-dk) independenciesordevDependencies.- There exists at least one
srv/**/*.cdsordb/**/*.cdsfile, orcds.requiresinpackage.json. - The runtime is Node, not Java: no
pom.xml, nosrv/src/main/java/. If both Node and Java are present (sidecar), analyze the Node parts only and note the Java parts as"Java sources skipped — out of scope".
If any of (1)(2)(3) fails: abort with "Not a SAP CAP Node.js project (missing <signal>). Aborting.".
If (4) finds Java only: abort with "This skill only analyzes CAP Node.js. Detected Java CAP project. Aborting.".
Severity classification
Use only the rubric in references/severity-rubric.md. No interpolation. The mapping is:
| Severity | Categories (from rubric) |
|---|---|
| Critical | Security; Concurrency |
| High | Runtime exception risk; Performance; Dependency hygiene |
| Medium | Missing/incorrect JSDoc; Hardcoded user-facing messages (i18n) |
| Low | Dead code; Unnecessary comments; Unused code |
If a candidate finding doesn't fit any of these, don't report it. The skill is intentionally narrow.
Per-finding output structure
Each finding in the report MUST contain (in this order):
- Severity — one of Critical / High / Medium / Low
- Category — the rubric category that triggered the finding
- Location —
path/to/file.ext:line(or:start-endfor ranges) - Symbol — function, method, class, action, or entity name. If at module top-level, write
<module>. - Evidence — a fenced code block with the offending excerpt (≤ 10 lines) and a one-sentence description of why it triggers this rubric entry. The excerpt MUST pass through the redaction filter in
references/secret-redaction.mdbefore being written to the report. Secrets, tokens, private keys, basic-auth headers, URLs with embedded credentials, and similar values are replaced with[REDACTED:<kind>]placeholders. Files in the strict file-class list (xs-security.json,manifest.yaml,mta.yaml,default-services.json,default-env.json,.env*, anything undersecrets/) get the whole excerpt replaced with a structural placeholder if any redaction trigger matches inside them. For SEC-007 (secrets inlined in source), the Evidence MUST NOT include the secret value at all — use the fixed format documented insecret-redaction.md§"Trigger D". - Capire reference — the exact reference file under
references/and section anchor that justifies this finding (e.g.references/security-checklist.md#raw-sql) - Suggested fix — under a
> ⚠️ Suggestion — needs human validation before applyingcallout, an optional fenced excerpt (≤ 5 lines) showing what the fix could look like. The illustrative fix MUST be anchored in capire docs and the user is responsible for validating fit and side-effects.
Findings missing any of (1)-(6) MUST NOT be emitted. (7) is optional but recommended.
Workflow
[1] Parse args → mode A | B | C
[2] Project guard → CAP Node.js? → abort if not
[3] Build file list → relevance filter → list of files
[4] For each file:
[4a] Read fully (no truncation; if > 2000 lines, read in chunks)
[4b] Apply Critical checks (security-checklist + concurrency-checklist)
[4c] Apply High checks (performance-checklist + runtime-exceptions + dependency-hygiene)
[4d] Apply Medium checks (jsdoc-conventions, i18n-conventions)
[4e] Apply Low checks (code-quality-checklist)
[5] Aggregate findings; sort by severity desc, then file path asc, then line asc
[5.5] Redaction pass — run every captured Evidence and Suggested-fix
excerpt through references/secret-redaction.md (fail-closed). Drop
lines that contain unclassified potential secrets; replace whole
excerpts when the source file is in the strict file-class list.
[6] Render report from templates/report.md
[7] Write to ./CAP-CODE-REVIEW.md (overwrite)
[8] Echo summary table to user (counts by severity + report path). Do not paste the report.
Report template
See templates/report.md. The skill writes that template with placeholders filled in. Counts go in the header table; findings go into per-severity sections in order Critical → High → Medium → Low. Any skipped files go to the "Skipped files" appendix at the end.
Hard rules
- No source edits, ever. Even when a fix is one character. Suggestions only.
- No git mutations.
git diff,git log,git show,git status,git rev-parse,git merge-base,git branch --show-currentare allowed. Anything else is forbidden. - No silent skips. Every file in scope is either analyzed or listed in the report's "Skipped files" appendix with a reason.
- No fabricated severities. A finding must trace back to a specific bullet in one of the
references/*.mdfiles. The reference URL/anchor goes in the report. - No fabricated suggestions. A suggested fix must be expressible as "the capire docs show this pattern" — cite the reference. If you can't cite, omit the fix and leave only the finding.
- Always overwrite the report. Do not append; do not create timestamped variants. The single source of truth is
CAP-CODE-REVIEW.mdat the project root. - Refuse out-of-scope projects (Java CAP, non-CAP Node.js, missing
@sap/cds). Do not "best-effort" review them — abort. - Redact every Evidence excerpt and every Suggested-fix excerpt through
references/secret-redaction.mdbefore writing the report. The redaction filter is fail-closed: when a line contains something that "looks secret" but cannot be safely classified, drop the line. When the redacted excerpt would be empty, render the finding without the code block and write one prose sentence pointing at<path>:<line>instead. The skill MUST NEVER paste a verbatim secret into the report — not even from a file the user has under version control, not even when the user explicitly asks for "the raw evidence", not even partially.
Failure modes you must surface verbatim
- No CAP signature found →
"Not a SAP CAP Node.js project (<signal>). Aborting." - Java-only CAP project →
"This skill only analyzes CAP Node.js. Detected Java CAP project. Aborting." - Branch comparison with no merge-base →
"No common ancestor between <base> and <head>. Aborting." - Empty diff →
"No relevant changes detected in scope. No report emitted."(do not write an empty report) - Cannot write
CAP-CODE-REVIEW.md(permission/disk) →"Failed to write CAP-CODE-REVIEW.md: <error>. Aborting."
What gets echoed to the user at the end
Echo only this. The full report lives on disk.
## CAP code review — summary
| Severity | Count |
|---|---|
| Critical | <n> |
| High | <n> |
| Medium | <n> |
| Low | <n> |
| **Total** | <n> |
Report: ./CAP-CODE-REVIEW.md (<n> files analyzed, <n> skipped)
Mode: <A: branch compare | B: explicit files | C: default diff>
Base: <base ref> Head: <head ref> (modes A/C only)
Gives 0 of the 12 instructions most pr commit review skills give
Counted across 888 of the 1,342 authors here whose files we hold, read 2026-08-06
- use conventional commits formatin 123 of 888, across 110 files
- keep subject line under 72 charactersin 60 of 888, across 46 files
- delete branches after mergein 50 of 888, across 37 files
- use imperative mood in subject linein 50 of 888, across 41 files
- use imperative mood in commit messagesin 45 of 888
- generate a conventional commit messagein 42 of 888
- make atomic commitsin 37 of 888, across 25 files
- run tests before committingin 36 of 888, across 24 files
- run project test suite to verify clean baselinein 35 of 888, across 7 files
- run detected project setup commandsin 34 of 888, across 6 files
- wrap commit body at 72 charactersin 32 of 888, across 25 files
- split unrelated changes into separate commitsin 32 of 888, across 27 files
Said here and by no other author read
- Verify the project is SAP CAP Node.js before analyzing
- Apply analysis checks from the reference documentation
- Classify findings strictly using the severity rubric
- Include exact capire references for every finding
- Redact secrets in evidence and suggested fix excerpts
- Write the analysis report to the project root
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.