devtools-imports

GitHub

定义DevTools代码库的导入规范,通过模块入口点引用和强制使用import * as语法避免构建错误。

.agents/skills/devtools-imports/SKILL.md ChromeDevTools/devtools-frontend

触发场景

跨模块代码复用 遵循项目编码规范

安装

npx skills add ChromeDevTools/devtools-frontend --skill devtools-imports -g -y
更多选项

非标准路径

npx skills add https://github.com/ChromeDevTools/devtools-frontend/tree/main/.agents/skills/devtools-imports -g -y

不安装直接使用

npx skills use ChromeDevTools/devtools-frontend@devtools-imports

指定 Agent (Claude Code)

npx skills add ChromeDevTools/devtools-frontend --skill devtools-imports -a claude-code -g -y

安装 repo 全部 skill

npx skills add ChromeDevTools/devtools-frontend --all -g -y

预览 repo 内 skill

npx skills add ChromeDevTools/devtools-frontend --list

SKILL.md

Frontmatter
{
    "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."
}

Imports

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 entrypoint
  • front_end/models/trace/ModelImpl.ts is part of the implementation of the trace module.

Importing from another 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

Importing from within the same module

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.

版本历史

  • 678d19c 当前 2026-08-20 15:20

同 Skill 集合

.agents/skills/devtools-ci/SKILL.md
.agents/skills/devtools-model-management/SKILL.md
.agents/skills/devtools-setting-migration/SKILL.md
.agents/skills/devtools-source-maps/SKILL.md
.agents/skills/devtools-testing-guidance/SKILL.md
.agents/skills/devtools-unicode-escaping/SKILL.md
.agents/skills/devtools-ux-writing-refactor/SKILL.md
.agents/skills/devtools-verification/SKILL.md
.agents/skills/evaluate-ai-css-completion/SKILL.md
.agents/skills/fixing-skipped-tests/SKILL.md
.agents/skills/foundation-test-migration/SKILL.md
.agents/skills/gerrit-cli/SKILL.md
.agents/skills/merging-devtools-module/SKILL.md
.agents/skills/migrate-chromium-test/SKILL.md
.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md
.agents/skills/ui-eng-vision-logic-consolidator/SKILL.md
.agents/skills/ui-eng-vision-orchestrator/SKILL.md
.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md
.agents/skills/ui-eng-vision-widget-promoter/SKILL.md
.agents/skills/ui-widgets/SKILL.md
.agents/skills/version-control/SKILL.md
.agents/skills/repro-flaky-tests/SKILL.md

元信息

文件数
0
版本
57c368e
Hash
4f2ead12
收录时间
2026-08-20 15:20

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-17 00:15
浙ICP备14020137号-1