DBTable Skills Tutorial
Define tables in tskill.md, let the subsystem generate helpers, and run CRUD flows through your DB adapter.
Repository Layout
DBTable skills live under .AchillesSkills/<domain>/<table>/ with a mandatory descriptor and auto-generated code:
tests/dbTableSkills/.AchillesSkills/
└── customers/
├── tskill.md
└── tskill.generated.mjs # created by DBTableSkillsSubsystem
The subsystem rebuilds tskill.generated.mjs whenever tskill.md is newer, then imports the generated functions at runtime.
Descriptor: tskill.md
Describe the table, fields, and behaviours in Markdown:
# Customers
Manage customer contact details.
## Table Purpose
Store customer records for CRM workflows.
## Field: customer_id
### Description
Primary identifier.
### PrimaryKey
auto-increment
## Field: email
### Description
Customer email address.
### Required
Always required.
### Validator
Must be a valid email.
The parser normalises headings into metadata; sections like Presenter, Resolver, Enumerator, and Derivator become generated functions.
Execution Flow
RecursiveSkilledAgentdiscoverstskill.mdand prepares the skill viaDBTableSkillsSubsystem.- The subsystem generates helpers in
tskill.generated.mjs(prepare/validate/present/resolvers/derivators). - At runtime, the LLMAgent classifies the prompt into CREATE, UPDATE, SELECT, or DELETE (supplying descriptor instructions and field lists to the prompt), applies the generated helpers, and uses your
dbAdapter(query/insert/update/delete).
There is no interactive form layer; argument handling lives inside the generated functions. When callers omit args, the subsystem injects the task
description into the default prompt argument before execution.
DB Adapter Contract
Supply a dbAdapter when constructing RecursiveSkilledAgent. Implement at least:
query(tableName, filter)insert(tableName, record)update(tableName, id, data)delete(tableName, filter)
If present, addType or addModel will be called during preparation to register table metadata.
Testing
Run node --test tests/dbTableSkills/dbTableSkills.test.mjs to exercise parsing, generation, and CRUD flows against a mock adapter. Sample descriptors in tests/dbTableSkills/.AchillesSkills/ serve as templates.