一键导入
devtools-imports
Conventions for importing code in Devtools to avoid build errors. Covers cross-module imports, internal imports, and the "import * as" requirement.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Conventions for importing code in Devtools to avoid build errors. Covers cross-module imports, internal imports, and the "import * as" requirement.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when migrating Chromium layout tests to DevTools unit tests
Use when starting a new task, creating a branch, switching branches, managing branches, creating and uploading CLs, handling stacked changes, or checking release and roll status in the DevTools Gerrit-based workflow. ALWAYS use this instead of running standard git checkout/switch commands for branch creation.
Reproduce and investigate flakiness in a test.
Refactor user-facing UIStrings and localization comments in a DevTools module folder according to UX writing guidelines (child task of b/40799900). Use when simplifying wording, checking sentence case, or improving L10n comments in UIStrings for a specific folder or issue. Don’t use for general code changes or non-UIStrings files.
Migrates legacy imperative DOM construction to local declarative Lit-html templates rendered inside existing containers.
Consolidates manual DOM creation, updates, and constructors into private helper methods and structured state interfaces.
| name | devtools-imports |
| description | Conventions for importing code in Devtools to avoid build errors. Covers cross-module imports, internal imports, and the "import * as" requirement. |
This codebase follows a special convention for importing code that must be followed to avoid build errors.
In DevTools each folder of code is considered a module:
front_end/models/trace is the trace module.front_end/panels/timeline is the timeline module.Within each module there are multiple TypeScript files. The file that is named the same as the folder name is called the entrypoint.
front_end/models/trace/trace.ts is the trace module's entrypointfront_end/models/trace/ModelImpl.ts is part of the implementation of the trace module.When you want to reuse code from other modules, you must import that module via its entrypoint. Imagine we are in front_end/panels/timeline/TimelinePanel.ts. This import is GOOD:
import * as Trace from '../models/trace/trace.js'; // import the entrypoint
This import is BAD because we import a file that is NOT the entrypoint:
import * as ModelImpl from '../models/trace/ModelImpl.js' // NEVER ALLOWED
Additionally, you must import using the import * as syntax.
import {ModelImpl, X, Y} from '../models/trace/trace.js'; // BAD
import * as Trace from '../models/trace/trace.js'; // GOOD
If you are within the same module, it is OK to import from files directly rather than go via the entrypoint. You can also import specifically what you need.
For example, if you are editing front_end/models/trace/ModelImpl.ts this would be acceptable:
import {Foo} from './Foo.js'; // allowed because Foo.ts is in the same directory.