con un clic
typescript-style
// Guides ccusage TypeScript and JavaScript reading, writing, and review. Use before opening or editing .ts, .tsx, .js, or .jsx files, including mocks, fixtures, satisfies, or suppressions.
// Guides ccusage TypeScript and JavaScript reading, writing, and review. Use before opening or editing .ts, .tsx, .js, or .jsx files, including mocks, fixtures, satisfies, or suppressions.
Guides ccusage Rust tests. Use when adding or fixing cargo tests, CLI snapshots, Claude model pricing, LiteLLM compatibility, or Rust fixture-backed parser and loader tests.
Guides ccusage TypeScript package and tooling work. Use when editing apps/ccusage .ts/.js files, Vitest tests, Bun scripts, package launchers, schema tooling, or benchmark scripts.
Guides ccusage Rust implementation work. Use when editing rust/crates, native packaging, parser/module layout, pricing embedding, or Rust/TypeScript parity.
Profiles Bun TypeScript and JavaScript package scripts. Use for launcher, benchmark, or packaging hot paths; use ccusage-rust-profile for native CLI performance.
Creates atomic Conventional Commits. Use when committing code changes, splitting hunks into revertable units, or writing detailed commit messages.
Runs the full PR lifecycle. Use when creating a branch, committing, pushing, opening a PR, requesting AI review, and driving CI and review to completion.
| name | typescript-style |
| description | Guides ccusage TypeScript and JavaScript reading, writing, and review. Use before opening or editing .ts, .tsx, .js, or .jsx files, including mocks, fixtures, satisfies, or suppressions. |
| paths | ["**/*.ts","**/*.tsx","**/*.js","**/*.jsx"] |
| globs | *.ts,*.tsx,*.js,*.jsx |
satisfies Over asAvoid as type assertions and especially as any. Use satisfies when checking object literals, mocks, config objects, fixture data, and expected rows.
Bad:
const config = { port: 3000, host: 'localhost' } as ServerConfig;
const ctx = { fetchDirent: vi.fn(), addReadHistory: vi.fn() } as any;
Good:
const config = { port: 3000, host: 'localhost' } satisfies ServerConfig;
const ctx = { fetchDirent: vi.fn(), addReadHistory: vi.fn() } satisfies MockContext;
as const satisfiesUse as const satisfies for static literal data when preserving exact literal values or readonly tuples helps TypeScript catch mistakes.
Good:
const ROUTES = {
home: '/',
about: '/about',
} as const satisfies Record<string, string>;
Good for table-driven cases:
const reportCases = [
{ type: 'daily', period: '2026-05-16' },
{ type: 'monthly', period: '2026-05' },
] as const satisfies readonly ReportCase[];
asUse as only when satisfies cannot express the operation, such as narrowing data returned from an external untyped boundary or adapting to an API that requires a nominal type. Keep it local and avoid as any.
@ts-expect-errorUse @ts-expect-error instead of @ts-ignore, and include a short explanation. @ts-expect-error fails when the underlying type error disappears, so stale suppressions are caught.
Bad:
// @ts-ignore
import privateApi from 'some-package/private-api';
Use satisfies never after switches over discriminated unions or literal unions so new variants fail typecheck until the branch is handled.
Good:
switch (agent) {
case 'claude':
return loadClaude();
case 'codex':
return loadCodex();
default:
// exhaustiveness check for new agents added to the union
agent satisfies never;
throw new Error(`Unsupported agent: ${agent}`);
}
Good:
// @ts-expect-error Private runtime API has no public type declaration.
import privateApi from 'some-package/private-api';