Add an Invokta Capability
Resolve the project root as three directories above this SKILL.md. Perform
all relative reads and commands from that root; do not assume the caller's
current working directory is the project.
Establish the contract
- Read
AGENTS.md,CUSTOMIZE.md,src/engine.ts,src/capabilities/template.ts, andtest/engine.test.tscompletely. - Define the stable capability ID, title, description, input, output, access, timeout, annotations, dependency failures, and observable errors.
- Ask for an explicit decision before changing an existing ID, schema, access rule, or output contract.
Follow RED, GREEN, REFACTOR
- Add an engine-level test that invokes the literal capability ID through
engine.invokeand fails for the missing behavior. - Cover unauthenticated access and invalid input. Cover ownership, not-found, cancellation, or dependency failure when the capability can encounter it.
- Implement the smallest capability and dependency boundary that passes.
- Refactor only after the contract is executable.
Keep one engine boundary
- Define the action with
defineCapabilityand Zod input/output schemas. - Use
access: "authenticated"for user or tenant data unless the user explicitly approves a public contract. - Treat
context.principal.idas the ownership boundary for per-user data. - Inject repositories, providers, clocks, and tools through engine-owned factories or closures.
- Register the literal ID in
src/engine.tsandinvokta.mcp.json. - Keep business logic out of
src/direct.ts,src/cli.ts,src/mcp-stdio.ts, andsrc/mcp-http.ts. - Never call a capability's
runmethod directly.
Add persistence safely
- Start domain migrations after
migrations/001_oauth.sql. - Use
002_domain.sqlfor the first domain migration; inspect the existing migration list before choosing every later number. - Make migrations transactional and safe to rerun.
- Add each migration filename to
src/database/migrate.ts. - Keep every per-user query constrained by the authenticated principal.
- Do not couple domain tables to
oauth_artifacts; OAuth persistence is an authorization-server implementation detail. - Extend the structure that exists in the project. Do not invent repository, domain, schema, or test files before confirming they are present or needed.
Deliver
- Update
README.md,CUSTOMIZE.md, or domain documentation when public behavior or configuration changes. - Run
npm run check. - Validate both Compose files when configuration changes.
- Report the capability ID, access contract, tests, and any migration or deployment requirement.