Interactive workflow for creating new ToolKit gears and editing existing ones. Use when adding a new gear to the platform, adding features to an existing gear (REST endpoints, DB entities, OData filtering, plugins, lifecycle/background tasks, SSE events, error types), refactoring gear layer structure, or creating SDK crates. Covers the full DDD-light stack — SDK pattern, contract/API/domain/infra layers, OperationBuilder, SecureORM, ClientHub, error handling, and testing.
Interactive workflow for creating and editing ToolKit gears.
examples/toolkit/users-info/ is the reference implementation. When unsure about patterns, read the corresponding file in users-info first.
examples/toolkit/users-info/users-info-sdk/src/examples/toolkit/users-info/users-info/src/Read the minimum set of docs needed for the task. Start with the routing table below; do NOT load all docs at once.
| When you need to... | Read this |
|---|---|
| Understand ToolKit concepts, golden path | docs/toolkit_unified_system/01_overview.md |
| Create gear structure, SDK crate, naming, layers | docs/toolkit_unified_system/02_gear_layout_and_sdk_pattern.md |
| Wire ClientHub, inter-gear clients, plugins | docs/toolkit_unified_system/03_clienthub_and_plugins.md |
| Add REST endpoints, OperationBuilder, SSE, auth | docs/toolkit_unified_system/04_rest_operation_builder.md |
| Implement errors, RFC-9457 Problem, From impls | docs/toolkit_unified_system/05_errors_rfc9457.md |
| Add DB entities, SecureORM, AuthZ PEP | docs/toolkit_unified_system/06_authn_authz_secure_orm.md |
| Add repositories, migrations, transactions | docs/toolkit_unified_system/11_database_patterns.md |
| Add OData filtering, pagination, $select, $orderby | docs/toolkit_unified_system/07_odata_pagination_select_filter.md |
| Configure lifecycle, background tasks, cancellation | docs/toolkit_unified_system/08_lifecycle_stateful_tasks.md |
| Create out-of-process gear, gRPC, OoP SDK | docs/toolkit_unified_system/09_oop_grpc_sdk_pattern.md |
| Get checklists, code templates, test patterns | docs/toolkit_unified_system/10_checklists_and_templates.md |
| Write unit tests, test file layout, mocks, fixtures | docs/toolkit_unified_system/12_unit_testing.md |
| Write E2E tests, cross-gear integration tests | docs/toolkit_unified_system/13_e2e_testing.md |
Ask the user (one message, not a wall of questions) or infer from the task or design documents:
file-storage)db, rest, stateful?authz-resolver)Use the answers to determine which docs to load next.
docs/toolkit_unified_system/02_gear_layout_and_sdk_pattern.mddocs/toolkit_unified_system/10_checklists_and_templates.md — use the "Adding a New Gear" checklistrest — also read docs/toolkit_unified_system/04_rest_operation_builder.mddb — also read docs/toolkit_unified_system/06_authn_authz_secure_orm.md and docs/toolkit_unified_system/11_database_patterns.mdexamples/toolkit/users-info/ for the layers being createdPresent to the user:
Get approval before writing code.
Create files in this order (each layer builds on the previous):
<gear>-sdk/ with Cargo.toml, src/lib.rs, src/client.rs, src/models.rs, src/errors.rs<gear>/Cargo.toml, src/lib.rs, src/gear.rs, src/config.rssrc/contract/ — re-export from SDK or define inlinesrc/domain/error.rs, src/domain/service/, src/domain/repos/src/infra/storage/entity/, src/infra/storage/mapper.rs, src/infra/storage/migrations/src/api/rest/dto.rs, src/api/rest/handlers/, src/api/rest/routes/, src/api/rest/error.rssrc/domain/local_client/Cargo.tomlapps/cf-gears-example-server/src/main.rsinit() via ClientHubstatic-authn / static-authz pattern)cargo build -p <gear-crate> — must compilecargo clippy -p <gear-crate> — no warningscargo gears lint --dylint — architecture lints passcargo test -p <gear-crate> — tests passAsk the user what they want to change. Common tasks:
Use the document routing table above. Load only what's needed for the specific change.
Read the gear's current implementation. Compare with examples/toolkit/users-info/ for the same layer.
Follow the DDD-light layer rules:
Serialize, Deserialize, ToSchema; MUST be in api/rest/pub/pub(crate)/pub(super)) MUST have #[domain_model] (strictly module-private helpers are exempt)#[derive(Scopable)] with #[secure(tenant_col = "...")]/{service-name}/v{N}/{resource} patternProblem (RFC-9457), implement From<DomainError> for ProblemSame as Phase 5 of the create workflow.
These rules apply to ALL gear work. Violating them will fail CI:
<gear>-sdk crateSecureConn + AccessScope for all DB access — no raw connectionsOperationBuilder for all REST routes — with .authenticated() and .standard_errors()#[domain_model] on all non-module-private domain structs/enums (DE0309 lint; strictly private helpers exempt)unwrap() / expect() — use proper Result typesPolicyEnforcer PEP pattern — never construct AccessScope manually3f8ddf6
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.