adamantite
v0.47.0
Published
An strict and opinionated set of presets for modern TypeScript applications
Maintainers
Readme
Adamantite provides one CLI and a set of presets for linting, formatting, type checking, dependency analysis, and monorepo checks. It configures Oxlint, Oxfmt, TypeScript, Knip, and Sherif so humans and coding agents can use the same project workflow.
Features
- Fast checks: Run Oxlint and Oxfmt on the Oxc toolchain.
- Strict defaults: Use opinionated lint and TypeScript presets without assembling a configuration from scratch.
- Optional presets: Add rules for different needs — frameworks like React, Next.js, and Vue, test runners like Jest and Vitest, Node.js, and stricter opt-in rule sets.
- Project setup: Create package scripts, configuration files, editor settings, and CI through an interactive or non-interactive initializer.
- Setup maintenance: Assess managed integrations with
doctor, update managed dependencies, and give humans or agents repair instructions. - Custom rules: Write project-specific Oxlint rules in
.adamantite/lint/, one rule for each file, and enable all of them with one line. - Hardening: Have a coding agent turn the coding standards that your code already follows into custom rules, and into instructions for the ones that no rule can check.
- Workspace checks: Find unused code with Knip and dependency inconsistencies with Sherif.
- Agent guidance: Add a managed Adamantite section to
AGENTS.md, and add the Adamantite skill for your coding agents.
Quick start
Run the initializer from the root of a TypeScript project:
npx adamantite initThe interactive setup lets you choose package scripts, presets, TypeScript, editors, CI,
and coding agent setup with the Adamantite skill. After setup, use the scripts written to package.json:
bun run check
bun run fix
bun run analyzeUse the equivalent adamantite commands directly when the project does not have managed
scripts:
adamantite check
adamantite fix
adamantite analyzeNon-interactive setup
Use --non-interactive to configure a project entirely from flags. Specify at least one
--script or --typescript. Repeat --script, --preset, and --editor to select multiple values.
npx adamantite init \
--non-interactive \
--script check \
--script fix \
--script analyze \
--preset react \
--editor vscode \
--typescript typescript \
--install-extensions \
--github-actions \
--agentsAvailable setup values:
- Scripts:
check,fix, andanalyze. In a detected monorepo,analyzealso installs Sherif. - Presets:
react,react-strict,tanstack,nextjs,vue,effect,jest,vitest,node,architecture,strict, andtailwind.react-strictrequiresreact. - Editors:
vscodeandzed. - TypeScript presets:
typescriptandtsconfig. See the TypeScript presets.
Presets require the check or fix script. Editor extension installation
requires an editor. GitHub Actions requires a compatible script and a supported package
manager. Omitted boolean flags are disabled.
The GitHub Actions workflow runs the check and analyze scripts that you select.
Its job sits between # ADAMANTITE:START and # ADAMANTITE:END comments. Adamantite owns
the jobs between these comments, and you own the rest of the workflow. You can rename the
file in .github/workflows and add your own jobs outside the comments. Doctor checks only the
jobs between the comments, and init updates them when you did not change them.
Agents verify custom rules with temporary cases while they work. CI runs the rules through
check by default. Users can add an explicit adamantite rule test step for optional saved tests.
Init preserves a workflow with an explicit rule-test command, including its setup and other settings.
Existing package scripts whose commands differ from Adamantite's are kept and reported
instead of being replaced. The interactive initializer asks before overwriting them; in
non-interactive mode, pass --overwrite-scripts to replace them. To keep custom flags,
forward them to the Adamantite command after --, e.g.
adamantite analyze -- --directory packages/app.
In a detected monorepo, TypeScript setup does not write a root tsconfig.json, because a
catch-all root config makes TypeScript treat all packages as one project. Adamantite
prints guidance instead: add "extends": "adamantite/typescript", or "extends": "adamantite/tsconfig"
in a library, to each package's tsconfig.json or to a shared base config.
Commands
Run adamantite --help or adamantite <command> --help for the complete CLI reference.
adamantite check
Find formatting, lint, and type errors without changing files:
adamantite check
adamantite check srccheck fails when Oxlint reports a warning, because a warning that passes is a pattern that
agents copy. Use --allow-warnings to pass with warnings. A forwarded --max-warnings or
--deny-warnings, such as adamantite check -- --max-warnings 10, replaces this default. To keep existing violations of a
rule while new code follows it, turn the rule off for those files in an Oxlint override.
Use --only to run one stage. Arguments after -- go to that stage, and to Oxlint when
both run:
adamantite check --only lint
adamantite check --only formatadamantite fix
Apply safe Oxlint fixes, then format the files with Oxfmt. Suggested and dangerous fixes require explicit flags:
adamantite fix
adamantite fix --suggested
adamantite fix --dangerous
adamantite fix --allUse --only to run one stage. Arguments after -- go to that stage, and to Oxlint when
both run:
adamantite fix --only lint
adamantite fix --only formatadamantite analyze
Find unused dependencies, exports, and files with Knip. In a detected monorepo, analyze
first finds dependency consistency problems with Sherif. The --fix option can remove
unused files, so review its effect before use.
adamantite analyze
adamantite analyze --strict
adamantite analyze --fix
adamantite analyze --only unused
adamantite analyze --only monorepo --fix -- --select highest- The
monorepostage (Sherif) runs first, and only in a detected monorepo. Theunusedstage (Knip) always runs. - Without
--fix, both stages run and the exit code comes from the first failure. With--fix, a Sherif failure skips Knip, because Knip must not remove code against a dependency graph that Sherif did not repair. --fixapplies to each stage that runs.--strictapplies to Knip only.--only monorepoor--only unusedruns one stage.--only monorepofails outside a monorepo and with--strict.- Arguments after
--go to Knip, or to the stage that--onlyselects. analyzeruns Sherif without flags. Put project exceptions in thesheriffield of the rootpackage.json, which Sherif reads. The keys are the Sherif CLI options in camelCase:ignoreDependency,ignoreRule,ignorePackage,select,noInstall, andfailOnWarnings. For example:"sherif": { "ignoreDependency": ["tailwindcss"] }.- A Sherif fix that must choose between versions prompts in a terminal. Without a terminal,
set
"sherif": { "select": "highest" }in the rootpackage.json, or runadamantite analyze --only monorepo --fix -- --select highest. - Use
--fixlocally, not in CI. Sherif refuses to fix in a CI environment (for example whenCIis set), soanalyze --fixfails there in a monorepo. CI runsadamantite analyzewithout--fix.
adamantite doctor
Assess every Adamantite-managed integration. Doctor is read-only. Each finding describes
the current state, the goal state, and how to verify the repair. Doctor also checks that the
installed packages can run Oxlint: each declared package is installed, and @effect/tsgo has
a build for the installed Oxlint, tsrs, and platform. It starts no tool for this check.
adamantite doctorIn an interactive terminal, Doctor presents each finding as formatted text and offers to
hand off to an installed coding agent, or to copy one combined Markdown repair prompt. A
handoff starts the selected agent CLI in the terminal seeded with that same Markdown
repair prompt; the agent edits the project under its own permission and trust flow. When
the agent session ends, Doctor reassesses and exits 0 only when no findings remain.
Doctor detects installed agents by probing each supported CLI — Claude Code (claude),
Codex (codex), Cursor (cursor-agent), Gemini CLI (gemini), Grok Build (grok),
and OpenCode (opencode) — and lists only the ones found on PATH. OpenCode pre-fills
its input with the seed prompt, so that handoff needs one Enter press to start.
A coding agent can also run adamantite doctor in the target project to receive Markdown
directly. In a non-interactive run, Doctor prints the combined repair prompt and exits 1
when findings remain. If only assessment warnings remain, Doctor prints a Markdown
warning report and exits 0.
adamantite harden
Ask a coding agent to find the coding standards that the project already follows, and to put
each one at the highest level of enforcement that works: a custom rule when a rule can check
it, and a line in CODING_STANDARDS.md when no rule can.
adamantite harden
adamantite harden --path packages/web
adamantite harden --commits 500The prompt lists the Oxlint config of the root and of each workspace package, the rules folders
that their custom() calls load, and the AGENTS.md of the root and of each package. Agents start
from AGENTS.md, so it must point to the other documentation. The prompt also lists each Markdown
file that git ls-files gives, except the changesets and the changelogs, and the agent reads each
one.
--path limits the session to one package or folder. The prompt then lists the configs of the
packages in that folder, or of the package that contains it, the rules folders that those configs
load, the AGENTS.md of the root and of those packages, and the Markdown files of those packages
and of the root. The prompt also lists the Markdown files that no chain of links or code-span paths
from an AGENTS.md reaches, and each link to a missing file. The agent also reads the fix commits of the last 200 commits, or of the number
that --commits gives, and a mistake that the fixes repeat becomes a candidate. With --path, it
reads only the commits that change that folder.
The agent shows the candidates and writes nothing until you approve them. When no human can
approve, the agent stops at the candidates.
In an interactive terminal, harden offers the same menu as Doctor: hand off to an installed
coding agent seeded with the prompt, copy the prompt, or do nothing. After a handoff, harden
runs check, then the Doctor assessment, and exits 1 when either fails.
During the session, the agent verifies each new or changed custom rule with temporary
RuleTester cases and removes the cases before handback.
Harden also exits 1 when the session added a link to a Markdown file that does not exist. A copy or "do nothing"
exits 0 without verification. Without a terminal, it prints the prompt and exits 0. harden never produces Doctor findings. See
ADR 0012.
adamantite update
Update Adamantite-managed dependencies, then report any setup findings:
adamantite update
adamantite doctorupdate exits 0 when dependency updates succeed, even if doctor findings remain. Use
adamantite doctor as the CI gate. It also refreshes each copy of the
Adamantite skill that differs from the skill of the installed Adamantite version.
adamantite rule
Write, try, and inspect custom rules and other Oxlint rules:
adamantite rule add no-process-env
adamantite rule add no-window --dir tooling/lint/rules
adamantite rule test add
adamantite rule test add no-process-env
adamantite rule test add no-process-env --path tests/no-process-env.test.ts
adamantite rule test
adamantite rule test --path tests/no-process-env.test.ts
adamantite rule try no-console --report src/debug.ts --accept src/index.ts
adamantite rule try no-restricted-imports --options '[{"paths":["node:fs"]}]' --report src/new.ts=draft.ts
adamantite rule try project/no-process-env --current --report src/env.ts
adamantite rule ast src/index.tsrule add writes only a rule stub to .adamantite/lint/, or to the folder that --dir names.
Agents verify it with temporary RuleTester cases by default. rule test add lists existing
rules for selection. Pass a rule name to skip the list; the command fails if the rule does not
exist. It writes an optional <name>.test.ts beside the rule, or at the file path that --path
names. --dir selects another rules folder. It preserves existing files. Adapt the generated
valid and invalid cases to the rule before running them.
rule test runs saved .test.* files beside the rules that custom() loads. Use
rule test --path <file> for a test saved elsewhere. CI and harden do not run saved tests
automatically. Agents remove their temporary verification cases before they finish.
During harden, agents can use rule test add to prepare those temporary cases and
rule test --path <file> to run them. They preserve user-owned saved tests.
rule try runs a trial. It lints cases with one rule and shows whether the rule reports or
accepts each case. Give the full rule name, such as no-console, typescript/no-explicit-any,
or project/no-process-env. Each --report adds a case that the rule must report, and each
--accept adds a case that the rule must accept. A trial needs at least one --report case.
Repeat either flag to add more cases.
Run rule try from the project root. A case is a file path relative to the project root. Use
<path>=<file> to lint the content of <file> as if it were at <path>. This form lets you try
code that is not in the project yet, and code in files that git ignores.
By default, the trial sets the rule to error with no options. --options gives the options
that come after the severity, as a JSON array. --current uses the rule setting from the
project config instead. You cannot use --options and --current together.
The trial lints a copy of the project in a temporary folder, so it does not change the project. It exits 0 when every case gives the expected result, 1 when a case does not, and 2 when the trial cannot check the cases, such as for a rule that does not exist.
rule ast prints the ESTree-shaped AST that Oxlint rules visit, so you can read node names off
real code.
Pass arguments to underlying tools
Commands that invoke Knip, Oxlint, Oxfmt, or Sherif forward arguments after --:
adamantite analyze --strict -- --directory packages/app
adamantite check src -- --format github
adamantite analyze --only monorepo -- --ignore-package package-aPackage managers consume one separator, so package scripts need a second one:
bun run analyze -- -- --directory packages/app
npm run analyze -- -- --directory packages/appinit, doctor, harden, and update do not forward arguments because they do not invoke one
underlying CLI.
Presets
Adamantite publishes configuration that can also be consumed directly. The package exports only the imports in this table, and Node.js rejects any other path in the package:
| Export | Purpose |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| adamantite/lint | Core Oxlint rules. |
| adamantite/lint/react | React, JSX accessibility, and performance. |
| adamantite/lint/react-strict | React feature-code restrictions and curated React Doctor checks for state, effects, cleanup, and render lifetimes. See the react-strict preset. |
| adamantite/lint/tanstack | Opinions for TanStack Query with route loaders: queries defined once with queryOptions(), and no query data copied into state. See the tanstack preset. |
| adamantite/lint/nextjs | Next.js rules. |
| adamantite/lint/vue | Vue rules. |
| adamantite/lint/effect | Curated @effect/tsgo rules for Effect misuse, such as effects that never run and unhandled errors, and vendored anti-slop rules for tagged values. See the effect preset. |
| adamantite/lint/node | Node.js rules. |
| adamantite/lint/jest | Jest rules for test files. See the jest and vitest presets. |
| adamantite/lint/vitest | Vitest rules for test files. See the jest and vitest presets. |
| adamantite/lint/architecture | Load first-party rules for project-defined layer maps and import owners. No rules are enabled by default. |
| adamantite/lint/strict | Framework-neutral opinions: no type assertions outside tests, no unknown in signatures, no module mocks, no deep or wide destructuring, a reason on each suppression, no console calls, and no task comments. See the strict preset. |
| adamantite/lint/tailwind | @shadcn/lint rules for Tailwind v4 design systems: no restyled components, raw colors, arbitrary values, inline styles, unknown classes, or unreadable class expressions. shadcn/ui is not required. See the tailwind preset. |
| adamantite/rules | A function, custom(), that loads the project's own rules from .adamantite/lint/. See custom rules. |
| adamantite/rules/plugin | definePlugin, defineRule, eslintCompatPlugin, and all Oxlint authoring types. |
| adamantite/rules/testing | RuleTester and its types for temporary agent verification and optional saved tests. |
| adamantite/format | Oxfmt configuration. |
| adamantite/analyze | Knip configuration. The ignoreDependencies named export groups suggested ignore lists; init sets ignoreDependencies.monorepo in a monorepo and ignoreDependencies.effect with the effect preset. |
| adamantite/typescript | Strict TypeScript configuration for TS 7+, with ts-reset types: JSON.parse() and response.json() return unknown. Allows only erasable syntax. Not for libraries. See the TypeScript presets. |
| adamantite/tsconfig | The strict options of adamantite/typescript without the ts-reset types, for libraries. See the TypeScript presets. |
When consuming the lint presets directly, hoist the core preset's ignore patterns onto the
root config. Oxlint does not merge ignorePatterns from extended configs, so without the
hoist, dependencies, build output, and generated code are only skipped when your
.gitignore happens to cover them:
import core from "adamantite/lint"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core],
ignorePatterns: core.ignorePatterns,
})Configs generated by adamantite init include this automatically.
The TypeScript presets
adamantite/tsconfig sets strict compiler options for TypeScript 7 and later. It allows only
erasable syntax, so enum, a namespace with values, and parameter properties fail type checking.
adamantite/typescript adds type resets to the same options, so built-in APIs return safer
types. For example, JSON.parse(), response.json(), and property reads on localStorage return
unknown instead of any, and includes() on a literal array accepts a wider value. The project
needs no reset.d.ts file and no dependency, because the preset loads the resets from the
Adamantite package. The resets started from
ts-reset by Matt Pocock. See credits.
The resets also cover built-in APIs that ts-reset leaves as any. Object.values() and
Object.entries() on a type without an index signature, Object.assign() with more than three
sources, Object.getPrototypeOf(), Reflect.apply(), Reflect.construct(), eval(), and the
values of a JSON.parse() reviver return or take unknown. TypeScript cannot change a property type or a
default type parameter by declaration merging, so PromiseRejectedResult.reason and
MessageEvent data stay any.
{ "extends": "adamantite/typescript" }Use adamantite/tsconfig in a library that publishes declaration files. A declaration file that
TypeScript emits with the type resets can name the global AdamantiteTypeScript helper types,
which a consumer without the resets does not have. Doctor reports a package whose
tsconfig.json loads the type resets, directly or through a base config, when the package is not
private and declares exports or types. Doctor asks the project's TypeScript with
tsc --showConfig.
The preset adds the type resets through files, and includes every file below your
tsconfig.json through include. List your files in include, which keeps the resets. A files
list in your tsconfig.json replaces the preset's list, so it drops the resets, and the config
still inherits the preset's include. A config that must check only its files, such as a
solution config with "files": [] and references, sets "include": [] too, or extends
adamantite/tsconfig. To use the strict options without the type resets, extend
adamantite/tsconfig.
The jest and vitest presets
The jest and vitest presets apply their rules only to test files, so rules such as
vitest/require-hook do not report scripts and library code. Each preset exports testFiles, the
files that its test runner runs as tests by default. vitest testFiles match *.test.* and
*.spec.* files. jest testFiles also match files in __tests__ folders.
Extend the preset to use these files:
import core from "adamantite/lint"
import vitest from "adamantite/lint/vitest"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core, vitest],
ignorePatterns: core.ignorePatterns,
})If your test runner finds tests in other files, use the preset in an override of your own
instead of extends. vitest.plugins and vitest.rules hold the preset's plugins and rules:
import core from "adamantite/lint"
import vitest, { testFiles } from "adamantite/lint/vitest"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core],
ignorePatterns: core.ignorePatterns,
overrides: [
{
files: [...testFiles, "e2e/**/*.ts"],
plugins: vitest.plugins,
rules: { ...vitest.rules, "vitest/max-expects": "off" },
},
],
})Change a test rule in an override, not in the top-level rules: the preset's rules for test files
replace top-level settings. Keep plugins: vitest.plugins in that override too, because Oxlint
ignores the vitest/* rules of an override that does not enable the vitest plugin.
The react-strict preset
adamantite/lint/react-strict keeps state and side effects out of React feature code. Use
it together with adamantite/lint/react. It loads Adamantite's first-party plugin and the
managed oxlint-plugin-react-doctor package. Init installs the pinned package when you
select react-strict. Doctor and update maintain its version.
adamantite/no-react-state-hooks reports calls to useState, useReducer, useEffect,
useLayoutEffect, useSyncExternalStore, useMemo, and useCallback imported from
react, including aliased imports and React.useState(...). Each message tells what to do
instead: derive state from loader data or URL params, move side effects to loaders, actions,
or event handlers, and let the React Compiler memoize. For the opinions that do not depend
on React, add the strict preset.
Hooks stay allowed in hook modules: files that match **/use[A-Z]*.{ts,tsx}, **/use-*.{ts,tsx}, or **/hooks/**, such as useCart.ts
or use-cart.ts. A file such as userProfile.tsx is feature code.
Globs match paths relative to the working directory. Set allow to use another layout, and
hooks to change the list of reported hooks:
import core from "adamantite/lint"
import react from "adamantite/lint/react"
import reactStrict from "adamantite/lint/react-strict"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core, react, reactStrict],
ignorePatterns: core.ignorePatterns,
rules: {
"adamantite/no-react-state-hooks": [
"error",
{ allow: ["src/state/**", "**/use[A-Z]*.{ts,tsx}"], hooks: ["useState", "useEffect"] },
],
},
})Each option replaces its default list.
The React Doctor package exports more than 900 rules. The preset enables only rules that run on one file
and that the native react, react-hooks, jsx-a11y, and unicorn rules do not already
report. Examples are an effect that does the work of an event handler (no-effect-event-handler), data fetched in an effect
(no-fetch-in-effect), and state changed in place (no-direct-state-mutation). It also
checks cleanup, stale timer references, discarded effect cleanup callbacks, loading flags
that stay set after a failed request, and contexts or object URLs created during render. The
TanStack Query and TanStack Start rules are not in this preset. See
ADR 0005 for the criteria.
React Doctor checks also run in hook modules where state and effect hooks are allowed.
Some React Doctor rules
skip test files and fixtures by path, such as __tests__/ and *.test.tsx.
oxlint-plugin-react-doctor has a modified MIT license. It needs written permission from
the copyright holder to use the software as machine learning training data, or to sell it
as a hosted product. Read the
license before
you select the preset.
If you add react-strict by hand, install oxlint-plugin-react-doctor as a devDependency.
Run adamantite doctor for an existing react-doctor configuration. Its repair prompt
moves the preset to react-strict and preserves project settings and rule overrides.
The tanstack preset
adamantite/lint/tanstack holds opinions for TanStack Query (@tanstack/react-query) in
apps that preload queries in route loaders, such as TanStack Router and TanStack Start apps.
It needs no extra package.
adamantite/query-from-loaderreportsuseQuery,useSuspenseQuery,useInfiniteQuery, anduseSuspenseInfiniteQuerycalls in route files that take a plain options object or aqueryOptions()call made inside a function. Define each query once withqueryOptions()at module scope or in an exported factory such asuserQuery(id), preload it in the route loader withqueryClient.ensureQueryData(), and pass the same options to the hook. For the infinite hooks, useinfiniteQueryOptions()andqueryClient.ensureInfiniteQueryData(). The rule looks through type-only wrappers such asas constandsatisfies. Then a route withpreload="intent"renders from the cache without a request waterfall. An object that spreads shared options, such as{ ...userQuery(id), select }, stays allowed.adamantite/no-query-data-in-statereportsuseStatecalls whose initial value comes from the data of a query in the same component, such asuseState(query.data)oruseState(() => data.user). The copy stops updating when the query refetches. Read the value from the query result, and keep only the user's edits in state.
A route file is a file that calls a route factory from @tanstack/react-router, such as
createFileRoute, createRootRoute, or createRoute. Only a route has a loader to preload
the query, so components outside route files can define their queries inline.
query-from-loader checks one file at a time. It cannot prove that a loader preloads the
options, so it moves queries toward shared definitions but does not guarantee the preload.
Query refetches from effects and mutation invalidation are not checked by these presets.
See ADR 0008.
The effect preset
adamantite/lint/effect reports misuse of Effect, such as an
effect that is neither yielded nor assigned (floating-effect), an unhandled error or
requirement (missing-effect-error, missing-effect-context), and a combinator with a
simpler replacement (catch-all-to-map-error). The rules come from
@effect/tsgo, the Effect Language Service for
TypeScript-Go, and need Oxlint's type-aware mode.
The preset also turns on the rules of the anti-slop-effect plugin from
anti-slop. Adamantite ships a build of it, so nothing
extra needs to be installed. The rules report tagged values that code handles by hand:
no-manual-tagged-constructionreports an object literal with a_tag. Use a tagged class, such asData.TaggedClassorData.TaggedError, or themakeof a tagged Schema.no-manual-tag-comparisonreports a comparison or aswitchon_tag. UseMatch.tag,Predicate.isTagged, or a helper such asOption.isNone.no-manual-effect-error-tagreports a broadEffect.catchhandler that branches on_tag. UseEffect.catchTagorEffect.catchReason.prefer-effect-matchreports a chain of ternaries that compare one value with literals. UseMatchor a lookup table.no-service-constructor-importsreports amake*import from a project file outside tests. Import the Layer of the service instead.
The preset turns off two core rules, unicorn/no-array-callback-reference and
unicorn/no-array-method-this-argument. They match an array method by its name only, so they
report Effect calls such as Option.some(value) and Array.findLast(values, predicate).
The @effect/tsgo rules are not a JavaScript plugin. They exist only in the Effect builds of the Oxlint
binding and tsrs, which @effect/tsgo ships. When the project installs
@effect/tsgo, Adamantite runs Oxlint with those builds. Nothing changes in
installed package files, so linting needs no install script. These run Oxlint with the builds:
adamantite check,adamantite fix, andadamantite harden.- VS Code and Zed, through the settings that
adamantite initwrites. They startnode_modules/adamantite/dist/oxlint.jsin place ofoxlint.
A plain oxlint call, such as in a lint-staged config, stops with
Unknown plugin: 'effecttsgo'. Run adamantite check --only lint instead, which also takes
file arguments.
When you select the preset, adamantite init does these steps:
- Installs the pinned
@effect/tsgo. - Adds
{ "name": "@effect/language-service", "diagnostics": true }tocompilerOptions.pluginsintsconfig.json. The rules read their options from this entry. The Effect language server needs diagnostics enabled to offer semantic quick fixes. - Configures the selected editors to use the installed Effect language server. Their Oxlint settings hide duplicate Effect rule reports. CLI Oxlint keeps the effect preset.
- Sets
ignoreDependencies.effectinknip.config.ts, because no package has the name@effect/language-service.
adamantite doctor reports each missing part, and adamantite update keeps
@effect/tsgo on its pinned version. Each @effect/tsgo release has Effect builds only for
some Oxlint and tsrs versions, so Adamantite moves the pins together. With an
Oxlint or tsrs version that the pinned @effect/tsgo has no build of, Oxlint
does not start, and the message names the versions that it supports. @effect/tsgo has no
builds for Linux with musl.
VS Code uses a copy of the Effect compiler and its standard libraries in
node_modules/.cache/adamantite/effect/. Init creates this cache without changing installed
package files. Zed starts the project's installed effect-tsgo CLI with tsc --lsp --stdio.
Both use a native TypeScript version that the installed @effect/tsgo supports.
To upgrade an existing editor setup, run:
adamantite update
adamantite init --non-interactive --script check --preset effect --editor vscode --editor zed --install-extensionsInit installs the TypeScript 7 extension for VS Code when --install-extensions is set.
In VS Code, run TypeScript: Select TypeScript Version..., then select Use Workspace Version
to use the Effect SDK. Install Zed's TypeScript language server extension (zed://extension/tsgo);
the managed server ID is typescript-ls.
After a fresh dependency install or an update, run
adamantite init --non-interactive --script check --editor vscode to prepare or refresh the SDK cache.
Doctor reports missing editor settings and a missing, incomplete, or stale SDK. It does not
write files. Install scripts can stay disabled.
The rules read their options from the tsconfig entry. For example, unstable-api-usage
reports each use of an API marked @stability unstable. To allow a module on purpose, list
it in allowedUnstableApis:
{
"compilerOptions": {
"plugins": [
{
"name": "@effect/language-service",
"diagnostics": true,
"allowedUnstableApis": ["effect/cli"],
},
],
},
}Effect 4.0.2 and later tag each module as stable or unstable. Unstable modules can have
breaking changes in minor releases. The unstable modules include the platform modules, such
as effect/FileSystem, effect/Path, and effect/Terminal, and all modules in
@effect/platform-node and @effect/vitest. A project that uses them must list them. An
entry can be a module, such as effect/Path, or a full package, such as @effect/vitest.
The preset enables only rules that report Effect code. It does not ban platform APIs, such
as Date.now() or process.env, in code that is not Effect code. Inside Effect code, it
reports them, because Clock, Random, and Config let tests control them. See
ADR 0007 for the criteria.
The architecture preset
adamantite/lint/architecture loads the first-party plugin without enabling any rules.
Use it to configure adamantite/layers and adamantite/import-owners without the other
rules of strict. It needs no extra package. The strict preset still loads the same plugin.
import core from "adamantite/lint"
import architecture from "adamantite/lint/architecture"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core, architecture],
ignorePatterns: core.ignorePatterns,
rules: {
"adamantite/layers": [
"error",
{
root: "src/lib",
layers: {
shared: { imports: [] },
services: { imports: ["shared"] },
},
},
],
"adamantite/import-owners": [
"error",
{ import: "giget", owners: ["src/lib/services/download.ts"] },
],
},
})Each option after the severity is one layer map or one import and its owners. Set these options for your project. The preset enables neither rule by default.
Each layer's imports list names siblings, and permissions are transitive. Put a child map
in that layer's layers property. Its root derives from the containing folder, and its
settings remain local. Every containing map checks the file independently.
You can also select it during setup with
adamantite init --non-interactive --script check --preset architecture.
The strict preset
adamantite/lint/strict holds framework-neutral opinions. Use it with any other preset.
It needs no extra package. Most of its type rules come from
anti-slop, which Adamantite ships as a vendored build.
adamantite/no-overzealous-destructuringreports destructuring patterns nested more thanmaxDepthlevels deep (default 2), such asconst { data: { user: { name } } } = query, and object patterns that take more thanmaxPropertiesproperties (default 5). A rest element does not count. Keep the object and read its members, or split the pattern.typescript/consistent-type-assertionsbans type assertions.as conststays allowed, and test files (*.test.*,*.spec.*, and__tests__/) keep the core preset's setting.no-consolereports a console call other thanconsole.info.adamantite/require-suppression-reasonreports anoxlint-disableoreslint-disablecomment, including the-lineand-next-lineforms, that gives no reason after--, such as// oxlint-disable-next-line no-console -- the CLI writes its report to stdout. A comment that names no rule is reported by the core preset'sunicorn/no-abusive-eslint-disable.no-warning-commentsreports a comment that starts withTODO,FIXME,XXX, orHACK. Fix the code now, or track the work in your issue tracker. Do not only rename the marker.- The anti-slop rules ask the code to decode input at its boundary into types that it owns.
They report
unknownin function signatures and type aliases, loose dictionary types, atypeofcheck outside a type predicate,Reflect.getandReflect.apply, and Vitest or Jest module mocks. They also report adjacentfilterandmappasses, areducethat copies its accumulator,shapein symbol names, and a missing blank line between statement groups. - In test files, where type assertions are allowed,
anti-slop/require-safety-comment-for-type-assertionrequires aSAFETY:comment on each assertion, andanti-slop/no-chained-type-assertionsandanti-slop/no-widen-then-assertreport assertions that hide the source type. Outside tests,typescript/consistent-type-assertionsis the only rule that reports an assertion. To change one of these three rules, set it in anoverridesentry for the same test files, because the preset's override takes priority over top-levelrules. - The preset turns off the core preset's
typescript/consistent-indexed-object-styleandunicorn/no-immediate-mutation, which conflict withanti-slop/no-known-value-widening.
Set maxDepth and maxProperties to change the destructuring limits:
import core from "adamantite/lint"
import strict from "adamantite/lint/strict"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core, strict],
ignorePatterns: core.ignorePatterns,
rules: {
"adamantite/no-overzealous-destructuring": ["error", { maxDepth: 1, maxProperties: 3 }],
},
})The Tailwind preset
The preset uses upstream shadcn/* rule names and settings.shadcn keys.
adamantite/lint/tailwind needs Tailwind v4 and the @shadcn/lint package. adamantite init
installs the pinned version when you select the preset, and adamantite doctor and
adamantite update keep it on that version. If you add the preset by hand, install
@shadcn/lint as a devDependency too. The plugin finds your components and theme
through components.json. Without that file it looks for components in components/ui
or src/components/ui and discovers the stylesheet that imports Tailwind. When your
components live elsewhere, set settings.shadcn.ui:
import core from "adamantite/lint"
import tailwind from "adamantite/lint/tailwind"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core, tailwind],
ignorePatterns: core.ignorePatterns,
settings: { shadcn: { ui: "@/ds" } },
})The preset allows layout classes such as mt-4 and w-[320px] on components, and turns
off no-restyle, no-arbitrary-values, and require-static-classes under
**/components/ui/**, where components own their appearance. Add the same override for
another component directory. See the
@shadcn/lint documentation for settings,
contracts, and custom messages.
Custom rules
Custom rules are Oxlint rules that your project writes and owns. Each rule file in
.adamantite/lint/ is one rule. custom() from adamantite/rules loads the folder
and enables each rule as error under the project plugin, so no-process-env.ts becomes
project/no-process-env. Add a file to add a rule, and delete the file to remove it. A file
that starts with _, such as _helpers.ts, is a helper. Declaration files and optional
.test.* files are also excluded from plugin loading.
.adamantite/lint/
no-process-env.ts # enabled as project/no-process-env
no-process-env.test.ts # optional test, skipped by the plugin
_helpers.ts # skipped// .adamantite/lint/no-process-env.ts
import { defineRule } from "adamantite/rules/plugin"
export default defineRule({
meta: {
messages: { unexpected: "Read configuration through the config module." },
type: "problem",
},
createOnce(context) {
return {
MemberExpression(node) {
if (node.object.type === "Identifier" && node.object.name === "process") {
context.report({ messageId: "unexpected", node })
}
},
}
},
})// oxlint.config.ts
import core from "adamantite/lint"
import custom from "adamantite/rules"
import { defineConfig } from "oxlint"
export default defineConfig({
extends: [core, custom()],
ignorePatterns: core.ignorePatterns,
})custom() returns an empty config when the folder does not exist, so adamantite init adds
it to every generated config. It takes these options:
dir: the rules folder. A relative path resolves from the file that callscustom(), not from the working directory. Default:.adamantite/lint.name: the plugin name that prefixes each rule. Default:project.rules: severity or options for a rule, by rule name without the prefix, such as{ "no-process-env": "warn" }.
adamantite/rules/plugin re-exports the helpers and types from Adamantite's pinned
@oxlint/plugins dependency. Use definePlugin from that module if you write a plugin
that you register in jsPlugins yourself. You do not need to add @oxlint/plugins to your project.
Optional saved RuleTester tests use node:test. Exclude them from Vitest or Jest discovery
so those runners do not also try to run them. Keep the runner's default and existing
exclusions. For Vitest:
// vitest.config.ts
import { configDefaults, defineConfig } from "vitest/config"
export default defineConfig({
test: {
exclude: [...configDefaults.exclude, ".adamantite/lint/**/*.test.*"],
},
})For Jest:
// jest.config.mjs
export default {
testPathIgnorePatterns: ["/node_modules/", "<rootDir>/.adamantite/lint/"],
}For another rules folder or a custom test --path, use its path in the exclusion. To
type-check tests that import .ts rule files, enable compilerOptions.allowImportingTsExtensions
in tsconfig.json. To check the hidden rules folder too, add .adamantite/lint to include.
To keep an existing .adamantite/rules folder, set custom({ dir: ".adamantite/rules" })
and use rule add --dir .adamantite/rules. You can instead move the folder to
.adamantite/lint. The previous adamantite/lint/custom import and named authoring imports
from adamantite/rules are removed. Import custom from adamantite/rules and the
authoring helpers and types from adamantite/rules/plugin. Run adamantite doctor for
migration instructions. Doctor reports the old imports and default folder without changing files.
Rule files run with Node.js type stripping, so use erasable TypeScript only: no enum,
namespace with values, or parameter properties. Rules get no type information. A rule
that throws prints an error for each file, and the lint run still exits 0. Adamantite owns
the wiring and the authoring guidance; your project owns the correctness of its rules.
Agents use RuleTester from adamantite/rules/testing to verify new and changed rules.
They run valid and invalid cases from stdin or a temporary file with Node.js, also in Bun
projects, and remove their temporary verification cases and fixtures before handback. The rules and their
runtime helpers stay in the target project. The "Custom rules" section of the
Adamantite skill has the command and the full authoring guidance.
adamantite doctor reports a rule file that cannot load, with the reason, a rules folder
that no custom() call loads, and two rules folders that use the same plugin name. It also
provides migration guidance for old API imports and the previous default rules folder.
User-owned saved tests and optional CI steps remain supported.
Custom rules in a monorepo
Oxlint rejects two plugins with the same name in one run, so give each rules folder its own name. A nested Oxlint config replaces the root config, so a workspace package that needs the root rules extends the root config:
// packages/web/oxlint.config.ts
import custom from "adamantite/rules"
import { defineConfig } from "oxlint"
import root from "../../oxlint.config.ts"
export default defineConfig({ extends: [root, custom({ name: "web" })] })To share one rules folder across the workspace, keep it in a tooling package and call
custom() there. The relative dir resolves from the tooling package, so every config that
extends it loads the same rules:
// tooling/lint/index.ts
import custom from "adamantite/rules"
export default custom({ dir: "rules", name: "acme" })Run adamantite rule add <name> --dir tooling/lint/rules to add a rule to that folder.
Doctor starts from the Oxlint config of the root and of each workspace package, and follows
relative imports, # imports, and imports of workspace packages to find the custom() calls. It
resolves them as Node.js does, so run it after you install the dependencies. It resolves
dir and name when they are string literals.
Requirements and boundaries
- Adamantite requires Bun 1.0 or later when run with Bun, or Node.js 22.19 or later when run with Node.js.
- Adamantite requires TypeScript 7 or later. List
typescriptas a dependency in your ownpackage.json. Do not rely on the copy that a package manager installs for Adamantite's peer dependency: npm cannot add or update a managed plugin such as@shadcn/lintin a project that has notypescriptentry of its own. - This repository uses pnpm and Node.js for development, but the CLI can configure projects that use Bun, Deno, npm, pnpm, or Yarn where the selected integration supports them.
- Adamantite manages recognized package scripts and supported configuration shapes. It reports custom configurations that require manual work instead of overwriting them.
fix,analyze --fix,init, andupdatecan change project files. Doctor is read-only.
Agent skill
The Adamantite skill teaches coding agents how to initialize, assess, repair, and update a project, and how to write custom rules. The Adamantite package ships it.
adamantite init asks whether to set up coding agents. When you answer yes, or pass
--agents in non-interactive mode, init adds the Adamantite section to AGENTS.md and writes
the skill to these folders:
| Skill folder | Agents | When |
| ---------------- | --------------------------------------- | --------------------------- |
| .agents/skills | Codex, Cursor, Gemini CLI, and OpenCode | Always |
| .claude/skills | Claude Code | The project has .claude/. |
| .grok/skills | Grok Build | The project has .grok/. |
The Adamantite CLI bundles the skill, so the copy matches the Adamantite version that wrote
it. After you update Adamantite, adamantite update writes the skill again to each folder
whose copy changed. It also removes the adamantite entry from skills-lock.json, so the
skills CLI does not write the same folders. Commit the skill folders, so every clone has
the skill.
To install the skill from GitHub instead, with the
skills CLI:
npx skills add adelrodriguez/adamantite --list
npx skills add adelrodriguez/adamantite --skill adamantiteadamantite update replaces a copy from GitHub with the skill of the installed Adamantite
version.
With pnpm 12.11 or later, pnpm install can also link the skill that the package ships
into the agent skill directories that exist in the project, such as .claude/skills,
after you approve it. pnpm creates the directory only when the agent that runs pnpm sets an
environment variable that identifies it, such as CLAUDECODE for .claude/skills.
Otherwise, if no skill directory exists, the install fails, so create one before you
approve the skill:
mkdir -p .claude/skills
pnpm approveThe linked skill then matches the installed Adamantite version. To choose the directories,
set skills.dirs.
Contributing
See CONTRIBUTING.md for the repository workflow. Contributors should also read the domain glossary and architecture reference.
Credits
Adamantite builds on the work of these people and projects.
Adamantite ships code from these projects, each with its MIT license:
- ts-reset by
Matt Pocock of
Total TypeScript. The type resets of
adamantite/typescriptand their tests started from it. - anti-slop by
Dillon Mulroy, in
adamantite/lint/strictandadamantite/lint/effect.
Adamantite configures and runs these tools:
- Oxlint, Oxfmt, and tsrs by Boshen and the Oxc contributors.
- Knip by Lars Kappert.
- Sherif by Tom Lienard.
- @effect/tsgo by Mattia Manzati and the Effect team.
- React Doctor by Aiden Bai of Million.
- @shadcn/lint by shadcn.
- TypeScript by Microsoft.
The terminal interface uses Clack by Nate Moore.
License
Adamantite uses the MIT License.
Made with 🥐 pastry
