CAPforge GitHub npm

Your AI already codes.
Make it get CAP right.
// CLEAN COMPILE ✓

General-purpose models hallucinate CDS: annotation terms that don't exist, OData v2 syntax mixed into v4, invented fields. CAPforge connects your agent (Claude Code, Cursor…) to the real compiler and SAP's official best practices — and doesn't let it stop until the code compiles.

claude — CAP project
> add a Books entity with draft and a value help ▸ cap_scaffold_entity — model + projection + annotations + CSV + i18n ▸ cap_write_files — 5 files written ▸ cap_validate — cds compile… ✗ [ERROR] annotations.cds:12 — 'UI.LineItm' is not a valid term agent reads the error and corrects… ▸ cap_validate — cds compile… ✓ CLEAN COMPILE — entity ready, draft enabled

The real loop: generate → compile → correct → green. No babysitting.

The problem

Every failed AI iteration is tokens and minutes down the drain

There's barely any public CAP code in training data. The result: your copilot nails React on the first try, but with CAP it enters the "doesn't compile → fix it → still broken" loop. You pay the API either way — and get scrap. And what does compile often doesn't fit your project: invented entities, ignored catalogs, your conventions nowhere to be seen.

The solution

Generate with the rules. Verify with the toolchain.

Generate
Your AI stops making up CAP syntax.
→ sourced best practices
  • Full scaffolding: model with aspects (cuid, managed), projection, Fiori annotations, CSV, i18n
  • Knowledge core distilled from official SAP docs (capire, OData vocabularies, reference samples), every rule with its source URL
  • Codebase-aware: reads your real CDS model — reuses your entities, never invents fields
  • Migration mode: inventories a legacy freestyle UI5 app as the starting point to modern CAP/Fiori
Works together with SAP's official @cap-js/mcp-server, not instead of it.
Verify
The agent does not stop until everything is green.
→ three validation layers per stack
  • CAP: real cds compile in the loop, then cds lint, then a test deploy to a throwaway sqlite that loads your mock CSVs
  • UI5 freestyle: well-formed XML + every declared handler must exist in the controller
  • SAP's official ui5lint for deprecations and UI5 2.x readiness
  • Errors go back to the agent, which corrects and revalidates — no copy-pasting
MIT licensed. BYOK. Runs 100% on your machine.

How it works

Three steps, zero friction

01Register it in your agent — 4 lines in Claude Code's or Cursor's .mcp.json, command npx -y capforge.
02Open your CAP project and ask for your entity in plain language.
03CAPforge guides, validates, and doesn't stop until the ✓ green.

Uncomfortable questions

Answered head-on

I already pay for Claude/Cursor/my API. What does this add?

Every failed iteration gets billed the same: you pay tokens for code that doesn't compile. CAPforge doesn't replace your AI — it makes the one you already pay for get it right and prove it, by running the real compiler in the loop. Fewer iterations, fewer tokens, less supervising.

Won't models just learn CAP on their own?

Generic syntax — yes, they'll improve. But two things are never in any training data: your project's model and conventions, and the result of running your toolchain on what the AI just wrote. Retrieval and generation get better; verification still needs the compiler in the loop.

What about Joule, SAP's copilot?

Joule lives inside SAP Build's closed ecosystem, with its licensing and its pace. CAPforge works in the tools your team already uses and loves — Claude Code, Cursor, VS Code — with whatever model you choose. It complements rather than competes: we're the small, open, sharp piece.

Does my code leave my machine?

No. CAPforge runs locally as an MCP server. It calls no LLM and sends nothing anywhere: your agent brings the model (your key, your data agreement) and CAPforge contributes knowledge and validation on your disk.

Get started

Give your AI the compiler and the rules.
Keep the credit for yourself.

$ npx -y capforge