# BuilderSkill

> BuilderSkill: the skills NoClick's workflow builder loads before it builds, apart from the Agent Skills an agent attaches (`noclick.Skill`).

## BuilderSkill

```typescript
class BuilderSkill
```

A skill NoClick's builder loads: a description the builder reads to decide whether it needs it, plus text and,
optionally, a workflow to follow. `scope` says whose: `owned` (your account's, or a workspace it's in) or `shared`
(shared with it to read). It loads while it's `enabled` and not `muted` for your account. They're what Settings →
Skills in the NoClick app shows. Any of your account's own keys reads and changes them; one held to one of your users
rejects with `PermissionDenied`.

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `name` | `string` |  |
| `description` | `string` |  |
| `scope` | `"owned" | "shared"` |  |
| `ownerId` | `string | null` |  |
| `enabled` | `boolean` |  |
| `muted` | `boolean` | Muted for your account alone: the way to stop one shared with it loading. |
| `hasText` | `boolean` |  |
| `hasWorkflow` | `boolean` |  |
| `bodyText` | `string | null` | Its text and workflow, on one read whole (`get`, and what a change answers); null on a list's. |
| `bodyWorkflow` | `JsonObject | null` |  |
| `createdAt` | `Date | null` |  |
| `updatedAt` | `Date | null` |  |
| `raw` | `JsonObject` | The response JSON exactly as the API sent it. |

Types:

```typescript
type JsonObject = { [key: string]: unknown };
```

### BuilderSkill.list

```typescript
static list(options?: { client?: NoClick }): Promise<BuilderSkill[]>
```

Your account's builder skills (`owned`), newest first, then those shared with it (`shared`).

    for (const skill of await BuilderSkill.list()) console.log(skill.name, skill.enabled && !skill.muted);

Parameters:

- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: Each skill, without its text and workflow (`get` reads one whole).

### BuilderSkill.create

```typescript
static create(
  fields: BuilderSkillFields & { name: string },
  options?: { client?: NoClick },
): Promise<BuilderSkill>
```

Make a builder skill in your account's active workspace.

    await BuilderSkill.create({ name: "Brand voice", description: "How we write.", bodyText: "Short sentences." });

Parameters:

- `fields` (`BuilderSkillFields & { name: string }`, required)
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The skill, whole.

Types:

```typescript
/** What a builder skill says, set when it's made or changed. */
interface BuilderSkillFields {
  name?: string;
  /** When the builder should use it: what it reads to decide. */
  description?: string;
  /** What it tells the builder; an empty string clears it. */
  bodyText?: string;
  /** A workflow it may follow (nodes and edges). */
  bodyWorkflow?: JsonObject;
  /** Whether the builder loads it. */
  enabled?: boolean;
}

type JsonObject = { [key: string]: unknown };
```

### BuilderSkill.get

```typescript
static get(id: string, options?: { client?: NoClick }): Promise<BuilderSkill>
```

One builder skill, with its text and workflow.

Parameters:

- `id` (`string`, required)
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The skill, whole.

### BuilderSkill.update

```typescript
update(
  fields: BuilderSkillFields & { muted?: boolean },
  options?: { client?: NoClick },
): Promise<BuilderSkill>
```

Change it: what it says or whether it's enabled (its owner, or a share that may edit it; others reject with
`PermissionDenied`), and whether it's `muted` for your account (anyone it reaches). Fields left out stay as they
are. Resolves to it as it stands after.

    await skill.update({ muted: true });

Parameters:

- `fields` (`BuilderSkillFields & { muted?: boolean }`, required)
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: It, as it stands after the change.

Types:

```typescript
/** What a builder skill says, set when it's made or changed. */
interface BuilderSkillFields {
  name?: string;
  /** When the builder should use it: what it reads to decide. */
  description?: string;
  /** What it tells the builder; an empty string clears it. */
  bodyText?: string;
  /** A workflow it may follow (nodes and edges). */
  bodyWorkflow?: JsonObject;
  /** Whether the builder loads it. */
  enabled?: boolean;
}

type JsonObject = { [key: string]: unknown };
```

### BuilderSkill.delete

```typescript
delete(options?: { client?: NoClick }): Promise<void>
```

Delete it for good: only the account that made it may.

Parameters:

- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.
