# The SDK

> The @sypnia/skills package for your own tools: read and check skills, search the registry, resolve and verify.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://skills.docs.sypnia.com/tools/sdk/

For agents: @sypnia/skills (MIT, Node 20+, ESM): import { readSkill, checkSkill, verifyInstalled } from '@sypnia/skills' (offline: parse SKILL.md + skill.yaml, run the automatic checks except AI and names, verify a project's installed skills against its lock) and import { createSkills } from '@sypnia/skills/registry' (createSkills({ registry?, token? }) → search({ q, kind, label, publisher, cursor }), get(id), version(id, v), resolve({ id: range }), download(id, v) → verified files (throws SignatureError/HashError), publish(dir, { visibility }), yank(id, v, reason)). Errors are SkillsError with code matching the API.

```bash
npm install @sypnia/skills
```

## Offline: reading and checking

```ts
import { readSkill, checkSkill, verifyInstalled } from '@sypnia/skills';

const skill = await readSkill('./espiga-pos-import');
// { name: 'espiga-pos-import', version: '1.0.0', description: '…', touches: { scripts: ['scripts/convert.py'], … }, labels: ['scripts'] }

const findings = await checkSkill('./espiga-pos-import');
// [] when it passes; otherwise [{ check: 'manifest', file: 'scripts/clean.sh', message: 'not declared in touches.scripts' }]

const report = await verifyInstalled('.');
// { ok: true, skills: [{ id: 'sypnia/sypnia-design-guide', version: '1.4.0', hash: 'ok', signature: 'ok', edited: [] }] }
```

`checkSkill` runs every automatic check that needs no server: format, manifest, versions against a given previous version, hidden text and secrets.

## The registry

```ts
import { createSkills } from '@sypnia/skills/registry';

const skills = createSkills({ token: process.env.SYPNIA_SKILLS_TOKEN });

const { items } = await skills.search({ q: 'design guide', label: 'instructions' });
const resolved = await skills.resolve({ 'sypnia/sypnia-design-guide': '^1.4.0' });
const files = await skills.download('sypnia/sypnia-design-guide', resolved['sypnia/sypnia-design-guide'].version);
```

| Method                                          | Does                                                                  |
| ----------------------------------------------- | --------------------------------------------------------------------- |
| `search({ q, kind, label, publisher, cursor })` | search; public skills without a token                                 |
| `get(id)`, `version(id, version)`               | a skill, or one version with its manifest, hash, signature and review |
| `resolve(ranges)`                               | the versions a set of ranges resolves to, with their needs            |
| `download(id, version)`                         | the package's files, after checking its hash and signature            |
| `publish(dir, { visibility, tag })`             | publish; returns the version and its state                            |
| `yank(id, version, reason)`                     | yank a version                                                        |

`download` throws `HashError` or `SignatureError` and never returns files that did not verify. Every other failure is a `SkillsError` whose `code` is the API's error code ([API reference](https://skills.docs.sypnia.com/api)).
