Skip to content

Context Engineering for AI-Assisted Codebases: A Hands-On Tutorial

A step-by-step guide to @libar-dev/delivery-process — annotate your TypeScript, generate living docs, and give AI agents structured context instead of stale Markdown.


This tutorial was executed end-to-end on a clean machine. Every CLI output shown below is captured verbatim from the test run.

PropertyValue
Date2026-02-21
Node.jsv22.17.1
npm11.6.1
Package@libar-dev/delivery-process v1.0.0-pre.0
OSmacOS (Darwin 25.2.0)
Presetlibar-generic

You have 50 TypeScript files. An AI coding agent asks: “What depends on UserService?” Today, you point it at a stale README or a Confluence page from last quarter. The agent guesses at imports and hallucinates relationships that do not exist.

Context engineering solves this by making code the single source of truth for delivery state. Instead of maintaining separate documents that drift within days, you place structured annotations directly in your source files. A CLI then extracts those annotations, generates living documentation, and answers queries with typed JSON — all derived from code, all regenerated in seconds.

A small TypeScript project with three annotated implementation files, two Gherkin feature specs, and one design stub. By the end, the system will have:

  • Extracted 11 patterns, their relationships, and 5 business rules from your source files
  • Generated 26 documentation files including architecture diagrams, roadmaps, pattern registries, and business rule references
  • Answered structured CLI queries about dependency chains, blocking analysis, bounded contexts, and pattern metadata
PartTopicWhat You DoTime
1Project SetupInitialize a project with all dependencies3 min
2ConfigurationConfigure sources, output, and presets3 min
3First AnnotationAnnotate one file and see it detected5 min
4Adding RichnessLayer in architecture, enrichment, and shape tags7 min
5RelationshipsConnect multiple files into a dependency graph7 min
6Doc GenerationGenerate pattern registry and roadmap5 min
7Gherkin SpecsWrite plan-level specs with business rules8 min
8Design StubsDescribe future implementations4 min
9Full GenerationGenerate all 26 docs + reference docs + linting7 min
10Advanced QueriesQuery project state with advanced CLI commands5 min

Total: ~55 minutes | Prerequisites: Node.js >= 18, npm