Skip to content
Agentmart
Submit a tool

codebase-conventions

Non-negotiable codebase conventions for the scai CLI — module boundaries, error contract, credential handling, agent contract, quality gates.

Skill by Sitecore-Studio-Labs

IndexedMIT★ 3
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/sitecore-studio-labs-codebase-conventions

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Non-negotiable codebase conventions for the scai CLI — module boundaries, error contract, credential handling, agent contract, quality gates. Trigger when writing or modifying code in scai.

Use cases: documents, writing, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/codebase-conventions

What's inside

Skill name
codebase-conventions
Description
Non-negotiable codebase conventions for the scai CLI — module boundaries, error contract, credential handling, agent contract, quality gates. Trigger when writing or modifying code in scai.
License
MIT
Instructions
220 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Codebase Conventions — scai

These rules apply to every change. The CLI is published to npm and used by
end users (humans and agents) — the bar is high.

## Package manager: pnpm for agent work

Agents working in scai use `pnpm` for everything: install, dev, test,
build. Never `npm`, `yarn`, `bun`, or `npx` in an agent session.

End users install scai via any of npm/pnpm/yarn/bun (per the README and
because scai is a public CLI). That's a documentation concern, not an
agent-workflow concern.

For one-off binaries, use `pnpm exec <bin>`.

## Module structure

`src/` is 22 **domain areas** plus three cross-cutting layers. A domain
area owns one product surface — its API client, task runners, and (where
it has one) an `index.ts` SDK barrel.

```
src/
├── cli.ts             ← entrypoint; src/program.ts builds the Commander tree
├── commands/          ← Commander command definitions; thin parsers
│   ├── deploy/, serialization/, recipe/, brand/, ...  ← per-area subcommands
│   └── shared.ts      ← shared option helpers
├── config/            ← sitecoreai.cli.json + module schemas, config resolution
├── shared/            ← cross-cutting: errors, logger, spinner, HTTP/GraphQL
│                        transport, redaction
└── <domain areas>/    ← deploy, serialization, setup, recipe, brand,
                          brief, campaigns, sites, publishing, content,
                          hygiene, webhooks, workflow, agents, policy, mcp,
                          scripting, sync, auth, authoring, doctor,
                          telemetry
```

A typical domain area (e.g. `serialization/`) holds `tasks/` (task
runners), an API-client subdir, and an `index.ts` barrel exporting the
SDK surface for that subpath.

**Direction of imports:**

- `commands/` may import any domain area, `config/`, and `shared/`.
- A domain area may import **peer domain areas**, `config/`, and
  `shared/` — never `commands/`.
- `config/` may import `shared/` only.
- **`src/shared/` is a leaf** — it imports no domain area and no
  `commands/` (type-only `@/config` imports are allowed). `allow-write`
  and `env` were moved into `policy/`; `content/` must not import
  `publishing/`. Those two boundaries killed the former `shared↔policy`
  and `content↔publishing` cycles.
- `tests/unit/architecture/module-boundaries.test.ts` enforces those
  two invariants. It is not a full cycle detector — peer domain areas
  may still cross-import; the hard rule is that `shared/` stays a leaf.

When adding a new command group (like `recipe`), follow the existing
pattern: a parser dir under `commands/<group>/`, and a peer domain area
`src/<group>/` if it owns runtime logic.

## Error handling: createCliError

Throw structured CLI errors so the top-level handler can render them with
hints and exit codes. Pattern (from `src/shared/errors.ts`):

```typescript
import { createCliError } from "@/shared/errors";

throw createCliError("Invalid module configuration at ${moduleFile}.", "CONFIG_INVALID", {
  hint: "Fix the module JSON to match the serialization module schema.",
  details,
});
```

- First arg: human-readable message
- Second arg: stable `CODE` for telemetry/log filtering
- Options: `hint` (always include — tells the user the next step), `details` (structured)

Don't `throw new Error("...")` from command paths. Reserve raw `Error` for
truly internal/programmer errors.

## Logging: consola via toLogger(options)

Commands receive `options` from commander; convert to a logger via
`toLogger(options)` in `serialization/tasks/shared.ts`. The logger honors
`--json`, `--quiet`, `--log-file`.

- `--json` → emit JSON lines, no decoration. **No banners, no colors, no
  spinner.** Spinner code paths must check `logger.isJson()` before
  starting an `ora` instance.
- `--quiet` → suppress info; warnings + errors still emit.
- `--log-file` → also write to file at the given path.

Don't `console.log`. Don't write color codes outside consola/ora.

## Credentials: keychain-only

- Tokens are stored via `keytar` in `src/setup/deploy-token.ts`
  (and similar for OAuth tokens) under the `sitecoreai-cli` service.
- Never write a token to `sitecoreai.cli.json` directly. The `accessToken`
  / `deployToken` fields in the example config are placeholders showing
  where keychain values are loaded into.
- Env-var overrides (`SITECOREAI_DEPLOY_TOKEN`, `SITECOREAI_ENV_<NAME>_DEPLOY_TOKEN`)
  are read at startup and held in memory only — never persisted.
- Telemetry: the schema explicitly forbids token-shaped payloads; don't
  add fields that could leak.

## Agent / CI contract

Every command must work non-interactively:

- Honor `--non-interactive` (don't prompt; fail fast on missing required input)
- Honor `SITECOREAI_AUTO_WIZARD=0` (skip auto-init/auto-login wizards)
- Default `allowWrite: false` on environments — destructive operations
  require explicit `--allow-write` or `allowWrite: true` in config
- Honor `--what-if` on push-style operations (preview without applying)
- `--json` output is structured + machine-parseable; never include
  decorative text in JSON-mode output. **Wrap your output in

From Sitecore-Studio-Labs/sitecoreai-cli, MIT.

More from Sitecore-Studio-Labs/sitecoreai-cli

Signals

Stars
3
Forks
0
Open issues
4
Last commit (this folder)
Aug 3, 2026 (2 months ago)
Last release
Aug 4, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Sitecore-Studio-Labs

Cite this page

codebase-conventions skill. Agent Mart. https://agentmart.dev/skills/sitecore-studio-labs-codebase-conventions (last updated 2026-10-24)