- Run
yarn kbn bootstrapfor initial setup, after switching branches, or when encountering dependency errors
- Kibana is organized into modules, each defined by a
kibana.jsonc: core, packages, and plugin packages. Aside from tooling and testing, most code lives in these modules. - Packages are reusable units with explicit boundaries and a single public entry point (no subpath imports), usually with a focused purpose.
- Plugins are a package type (
type: "plugin") that include a plugin class with setup/start/stop lifecycles, utilized by the core platform to enable applications. - Plugins that depend on other plugins rely on the contracts returned by those lifecycles, so circular dependencies must be avoided.
- Module IDs (typically
@kbn/...) live inkibana.jsonc;package.jsonnames are derived where present. - Plugin IDs are additional camelCase IDs under
plugin.idinkibana.jsonc, used by core platform and other plugins. - Modules are grouped by domain (platform vs solutions) with visibility rules (
sharedvsprivate) that limit cross-group access. - Utility scripts live in
scripts/(e.g.,node scripts/generate.js). - If a user correction contradicts this doc or any skills you followed, or missing guidance caused avoidable work, submit DevEx feedback:
echo "..." | scripts/devex_feedback.sh(include the gap and suggested fix).
Always run node scripts/check_changes.ts to validate your changes
yarn test:jest [--config=<pathToConfigFile>] [TestPathPattern]
- Config is auto-discovered from the test file path (walks up to nearest
jest.config.js). Simplest usage:yarn test:jest src/core/packages/http/server-internal/src/http_server.test.ts - Only one
--configper run. To test multiple packages, run separate commands.
yarn test:jest_integration [--config=<pathToConfigFile>] [TestPathPattern]
- Auto-discovers
jest.integration.config.js(notjest.config.js). Same single-config constraint as above.
yarn test:ftr [--config <file1> [--config <file2> ...]]
- For new tests, prefer using Scout
node scripts/scout run-tests --arch stateful --domain classic --config <scoutConfigPath> (or --testFiles <specPath1,specPath2>)
Follow existing patterns in the target area first; below are common defaults.
yarn test:type_check [--project path/to/tsconfig.json]
- Without
--projectit checks all projects (very slow). Always scope to a single project:yarn test:type_check --project src/core/packages/http/server-internal/tsconfig.json - Only one
--projectper run. To check multiple packages, run separate commands.
- Use TypeScript for all new code; avoid
anyandunknown. - Prefer explicit return types for public APIs and exported functions.
- Use
import typefor type-only imports. - Avoid non-null assertions (
!) unless locally justified. - Prefer
readonlyandas constfor immutable structures. - Prefer const arrow functions
- Prefer explicit import/exports over "*"
- Prefer destructuring of variables, rather than property access
- Never suppress type errors with
@ts-ignore,@ts-expect-error; fix the root cause.
node scripts/eslint --fix $(git diff --name-only)
- Never suppress linting errors with
eslint-disable; fix the root cause.
- Follow existing formatting in the file; do not reformat unrelated code.
- Prefer single quotes in TS/JS unless the file uses double quotes.
PascalCasefor classes, types, and React components.camelCasefor functions, variables, and object keys.- New filenames must be
snake_case(lowercase with underscores) unless an existing convention requires otherwise. - Use descriptive names; avoid single-letter names outside tight loops.
- Prefer early returns and positive conditions.
- Handle errors explicitly; return typed errors from APIs when possible.
- Keep async logic linear; avoid nested
tryblocks when possible.
- Use functional components; type props explicitly.
- Keep hooks at the top level; avoid conditional hooks.
- Avoid inline styles unless consistent with the file’s conventions.
- Use
@elastic/euicomponents with Emotion (@emotion/react) for styling.
- Unsure: read more code; if still stuck, ask w/ short options. Never guess.
- Fix root cause (not band-aid).
- Make focused changes; avoid unrelated refactors.
- Update docs and tests when behavior or usage changes.
- Never remove, skip, or comment out tests to make them pass; fix the underlying code.