Agent Skills › langwatch/langwatch › repo-tree

repo-tree

GitHub

解析 LangWatch 仓库目录结构,指导代码、模块及服务的正确放置位置,解决包与应用的归属疑问。

.claude/skills/repo-tree/SKILL.md langwatch/langwatch

Trigger Scenarios

询问代码或功能应放在哪个文件夹 判断新创建的是模块还是应用 区分 apps、modules、packages 和 services 的用途

Install

npx skills add langwatch/langwatch --skill repo-tree -g -y
More Options

Non-standard path

npx skills add https://github.com/langwatch/langwatch/tree/main/.claude/skills/repo-tree -g -y

Use without installing

npx skills use langwatch/langwatch@repo-tree

指定 Agent (Claude Code)

npx skills add langwatch/langwatch --skill repo-tree -a claude-code -g -y

安装 repo 全部 skill

npx skills add langwatch/langwatch --all -g -y

预览 repo 内 skill

npx skills add langwatch/langwatch --list

SKILL.md

Frontmatter
{
    "name": "repo-tree",
    "description": "Where a thing lives in the LangWatch tree and what each top-level folder is for. Use when someone says 'where does this go', 'which package', 'new package', 'is this a module or a package', 'apps vs modules vs packages vs services vs tools', 'what is a generated module list', 'catalogue.json', 'generate:modules', 'which app runs this', or opens a folder and cannot tell what it owns. Teaches the map and the placement test; the record is dev\/docs\/ARCHITECTURE.md sections 1 to 3.",
    "user-invocable": true
}

The repository tree

One pnpm workspace (TypeScript), Go services and Python services beside it. The rule that names every package: where the code runs, or what it declares (ARCHITECTURE.md §2). The tree is the contract; when this skill and the linter disagree, the linter wins (§17).

The map

Folder Holds Rule
apps/ api, worker, tasks, backend (api and worker in one process), ui, server (npx CLI), scenario-child, plus the *-web internal consoles An app is src/main.ts and src/config.ts; scenario-child is the isolated runner (§4). No product code (§1).
modules/<name>/ One feature: contract/ process/ browser/ client/, plus specs/ and adrs/ A module is an isolated microservice (§3).
enterprise/modules/<name>/ The same shape, licence-gated at runtime Always installed; refuses per organisation (§3, §11).
packages/ Framework only A package earns its place by being framework, not feature (§2).
services/ Go (aigateway, nlpgo, langyagent, the *sims), Python (langevals) Not in the Node module system.
tools/ Dev tooling: thuishaven (haven), dev-runtime, workerrun Not shipped.
specs/ Cross-cutting Gherkin feature files Module specs live in modules/<name>/specs/.
sdks/, mcp/, docs/ Published SDKs, the MCP server, the public docs site Not the product.
dev/ Architecture record, ADRs, best practices, dev scripts dev/docs/ARCHITECTURE.md is the one record.

Rules that matter

  1. Apps hold no product code. apps/api/src/main.ts boots a server and serves the installed modules. If you are writing behaviour in an app, it belongs in a module.
  2. Feature code in packages/ is a defect. If the code names a product subject (trace, monitor, invite), it is a module.
  3. One subject, one owning module. modules/catalogue.json maps every subject to exactly one module. Another module reaches the subject through the owner's *Api and contract only (§3). modules/README.md prints that map with each module's tables and peers, and every module has its own README.md (ownership skill).
  4. The prefix tells you the graph. Nothing browser-* in a server graph; no process* package in a web graph (§2). A contract imports the light @langwatch/module core, plus only the portable surfaces §2 names (config and secret handles, errors, the span vocabulary, @langwatch/eventing/tables); never a runtime.
  5. Generated lists are never edited. The module list each app carries (process halves in apps/{api,worker,tasks}/src/process-modules.generated.ts; browser halves in apps/ui/src/browser-modules.generated.ts) is written by pnpm generate:modules from the catalogue. Add a module by editing modules/catalogue.json, then run the generator.
  6. Shared browser code has three homes, no kits. Component: the design system. Pure domain logic: the owner's contract. Data: the owner's <name>-client (§3.4). A *-browser-kit package is a deleted spelling.
  7. A package named by a module has four suffixes: @langwatch/<f>-contract, -process, -browser, -client. Enterprise ones carry enterprise- in the name (@langwatch/enterprise-billing-process).
  8. A portable library both halves import sits inside the owning module (modules/analytics/filters exists; the record also names modules/trace/query-language, not in the tree yet), never in packages/ (§2). It is the one sanctioned folder beside the four halves, specs/ and adrs/.

Placement test

Ask in order. Stop at the first yes.

Question Goes to
Does it name a product subject? The module the catalogue gives that subject.
Does a screen render it? modules/<f>/browser/ (layers in the browser-module skill).
Is it a component several modules share? packages/design-system (§2).
Is it data several browsers read? The owner's modules/<f>/client/.
Is it a schema, error or *Api another module calls? The owner's contract/.
Does it start a process, parse config or open stores? A framework package (process, process-stores, config).
Is it a backfill or data move for a release? A defineMigrationStep in the module's .withMigrations (ledger, run by the worker's upgrade).
Is it a job an operator starts by name? The module's process/src/tasks/, run by apps/tasks, outside the ledger.
Is it Go or Python? services/<name>.
Is it dev-only tooling? tools/<name>.

If no row fits, that is a design question. Do not invent a folder: ask.

Worked example: modules/monitor

The smallest full module. Read it before inventing a layout.

modules/monitor/
├── adrs/  specs/
├── contract/src/    monitor.api.ts  monitor.errors.ts  monitor.trpc.ts  index.ts
├── process/src/     monitor.module.ts  index.ts  app/  services/  repositories/
│                    rules/  transport/
└── browser/src/     monitor.web.ts  model/  behavior/  ui/{elements,blocks,sections}

Its catalogue entry is one line of data: id: "monitor", root: "modules/monitor", classification: "core", subjects: ["monitor"]. modules/organization owns seven subjects (group, invite, membership, organization, team, ...), so one module may own several subjects. modules/automation adds eventing/, channels/ and migrations/ to process/src/; add a folder only when the module has that kind of thing.

Traps

  • Reading dist/ or *.generated.ts as source. Both are outputs. Fix the catalogue or the source, regenerate.
  • A new folder under a module root. The root holds the four halves, a module-owned portable library, specs/ and adrs/ only. The folder grammar is packages/oxlint-rules/grammar/feature-layout-policy.mjs; the linter refuses a stray folder (see the linting skill).
  • A folder that keeps growing. Past the source-folder-shape budget it is grouped into features/<concern>/, one level only (§3.4). The number is the policy's (FOLDER_BUDGET in its source), not this skill's.
  • A second config.ts or a dev-only branch in an app. The same main.ts runs on a laptop, in CI and in production; only the parsed environment differs.
  • Putting a table or a query in a module that does not own the subject. Owning a table means owning every query against it; another module reads it only through a declared share (ownership skill).
  • A utils/, lib/, helpers/, domain/ folder. Deleted spellings. Pure decisions go in rules/; behaviour in services/.
  • Naming a package *-web. Today that means an internal console under apps/*-web; module browser halves are *-browser.

Links

  • dev/docs/ARCHITECTURE.md §1 (the product), §2 (package family), §3 (a module), §3.4 (browser half, no kits), §16 (names in flight), §18 (Nx runs the tasks).
  • The generated pages: modules/README.md, packages/README.md, apps/README.md, the enterprise/ indexes and one per module; ownership reads them, readmes maintains them.
  • The module skills: module for anatomy, module-client for clients, browser-module for the browser half.
  • Process composition and what a module may demand (peers, config, stores, entitlements): the module-dependencies and process-composition skills. Not taught here.

Version History

  • c0c14dc Current 2026-10-19 19:34

Same Skill Collection

.claude/skills/analyticssim/SKILL.md
.claude/skills/browser-pair/SKILL.md
.claude/skills/browser-test/SKILL.md
.claude/skills/chakra-ui-builder/SKILL.md
.claude/skills/chakra-ui-refactor/SKILL.md
.claude/skills/code-review/SKILL.md
.claude/skills/code-search/SKILL.md
.claude/skills/feature-map/SKILL.md
.claude/skills/githubsim/SKILL.md
.claude/skills/haven-auth/SKILL.md
.claude/skills/haven-db/SKILL.md
.claude/skills/haven-orb/SKILL.md
.claude/skills/haven-play/SKILL.md
.claude/skills/haven-seed/SKILL.md
.claude/skills/haven-setup/SKILL.md
.claude/skills/idpsim/SKILL.md
.claude/skills/lambdasim/SKILL.md
.claude/skills/langwatch-kanban/SKILL.md
.claude/skills/llmsim/SKILL.md
.claude/skills/mailsim/SKILL.md
.claude/skills/module/SKILL.md
.claude/skills/outboundsim/SKILL.md
.claude/skills/ownership/SKILL.md
.claude/skills/storagesim/SKILL.md
.claude/skills/voicesim/SKILL.md
plugins/langwatch/skills/langwatch/SKILL.md
services/langy-agent/skills/github/SKILL.md
skills/_compiled/native/agent-best-practices/SKILL.md
skills/_compiled/native/agent-performance/SKILL.md
skills/_compiled/native/automations/SKILL.md
skills/_compiled/native/code-changes/SKILL.md
skills/_compiled/native/context-sweet-spot/SKILL.md
skills/_compiled/native/daily-insights/SKILL.md
skills/_compiled/native/dashboard-widgets/SKILL.md
skills/_compiled/native/datasets/SKILL.md
skills/_compiled/native/debug-instrumentation/SKILL.md
skills/_compiled/native/debug-with-langwatch/SKILL.md
skills/_compiled/native/drive-the-ui/SKILL.md
skills/_compiled/native/eval-triage/SKILL.md
skills/_compiled/native/evaluate-multimodal/SKILL.md
skills/_compiled/native/evaluations/SKILL.md
skills/_compiled/native/experiments/SKILL.md
skills/_compiled/native/find-traces/SKILL.md
skills/_compiled/native/generate-rag-dataset/SKILL.md
skills/_compiled/native/github/SKILL.md
skills/_compiled/native/guided-onboarding/SKILL.md
skills/_compiled/native/level-up/SKILL.md
skills/_compiled/native/lwql-charts/SKILL.md
skills/_compiled/native/online-evaluations/SKILL.md

Metadata

Files
0
Version
c0c14dc
Hash
457d092c
Indexed
2026-10-19 19:34

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-19 23:16
浙ICP备14020137号-1