ワンクリックで
subtrack-rules
When working on the subtrack project, editing source code, running tests, or managing dependencies
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
When working on the subtrack project, editing source code, running tests, or managing dependencies
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | subtrack-rules |
| description | When working on the subtrack project, editing source code, running tests, or managing dependencies |
subtrack is a Node.js CLI tool for managing subscription services from the terminal. Written in TypeScript, it stores data in SQLite and provides interactive prompts for CRUD operations.
pnpm add <package> instead of npm install <package> or bun add <package>pnpm remove <package> instead of npm uninstall <package> or bun remove <package>pnpm update instead of npm update or bun updatepnpm run <script> or pnpm <script> instead of npm run or bun runpnpmx <package> instead of npx or bunxapps/subtrack/ directory (monorepo root has no deps)tsx src/index.tstsdown (configured as pnpm build)pnpm lint:types (tsc --noEmit)bun or node --loader for running TypeScript directlyapps/subtrack/dist/index.mjsvitest (pnpm test or vitest run)*.test.tspnpm test:watch for watch mode__setDb() from db.ts to inject an in-memory SQLite database for testsconsola via consola.mockTypes() for output assertions (see display.test.ts)globalThis.fetch for exchange rate API testssql.js (WASM-based SQLite) — not better-sqlite3, sqlite3, or bun:sqliteimport initSqlJs from "sql.js" and import type { Database, SqlValue, BindParams } from "sql.js"$SUBSC_CLI_DB_DIR env var or ~/.config/subtrack/subtrack.db_db) and persisted to disk via saveDb() on writessubscriptions, tags, subscription_tags (many-to-many)BEGIN TRANSACTION / COMMIT / ROLLBACK)PRAGMA foreign_keys = ON at connection timeThe source code (subtrack/src/) follows a 4-layer separation:
| Layer | File | Responsibility |
|---|---|---|
| Entry | index.ts | CLI definition (commander), command routing |
| Commands | commands.ts | Command handlers, workflow logic, user interaction |
| Database | db.ts | SQLite CRUD, schema, persistence, __setDb() for testing |
| Display | display.ts | Table rendering with cli-table3, FX rate conversion |
| Prompts | prompts.ts | Input validation, interactive prompts, shared choices |
Keep concerns separated. Don't put DB queries in display logic or prompt logic in command handlers.
node: prefix for Node.js built-ins: import { readFileSync } from "node:fs", import path from "node:path", import { homedir } from "node:os".ts extension in local imports: import { handleList } from "./commands.ts"fetch for HTTP requestsWebSocket for WebSocket connections (if needed)type prefix for type-only imports: import type { SharedArgs } from "./db.ts"tsconfig.json)*.test.ts) excluded from tsconfig.json — type-checked separately by vitest"type": "module" in package.json)verbatimModuleSyntax: enforce correct import/value separationnoUncheckedIndexedAccess: disabled (codebase not compatible)Key packages and their purpose:
| Package | Usage |
|---|---|---|
| gunshi | CLI argument parsing (cli(), define(), .args, .run()) |
| @inquirer/prompts | Interactive prompts (input, confirm, checkbox, select) |
| consola | Logging (consola.info, consola.success, consola.error, consola.warn, consola.fail) |
| cli-table3 | Table rendering (customizable chars, styles, column widths) |
| picocolors | Terminal colors |
| sql.js | SQLite via WASM (new SQL.Database(), .run(), .exec()) |
| @types/node | Node.js type definitions (dev) |
typos (pnpm lint:typos or typos)nix fmt (nixfmt-rfc-style)SUBSC_CLI_DB_DIR: override database directory (default: ~/.config/subtrack/)subtrack.db (SQLite).env file or secrets management in this projectopen.er-api.com (USD base)