@clipboard-health/ai-rules

中文文档
2.50.28发布于 2026/10/09MIT零依赖近 30 天下载 2090

Pre-built AI agent rules for consistent coding standards.

此软件包已被标记为弃用

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

原始使用文档
文档目录14 节
  1. Table of contents
  2. Install
  3. Usage
  4. Quick Start
  5. Include/Exclude Rules
  6. Updating Rules
  7. Available Rules
  8. backend
  9. common
  10. datamodeling
  11. frontend
  12. Contributing Rules
  13. Migration from v1
  14. Local development commands

@clipboard-health/ai-rules

Pre-built AI agent rules for consistent coding standards. Uses a retrieval-based approach: generates a compressed index in AGENTS.md pointing to copied .rules/ files that agents read on demand.

Table of contents

Install

npm install --save-dev @clipboard-health/ai-rules

Usage

Quick Start

  1. If you have an existing AGENTS.md and/or CLAUDE.md file in your repository, rename it to OVERLAY.md. The sync script appends this file's contents to generated AGENTS.md so it's loaded into LLM agent contexts.

  2. Choose the profile that matches your project type:

    ProfileIncludesUse For
    commoncommonTypeScript libraries, generic projects
    frontendcommon + frontendReact apps, web apps
    backendcommon + backendNestJS services, APIs
    fullstackcommon + frontend + backendMonorepos, fullstack apps
    datamodelingdatamodelingDBT data modeling
  3. Add it to your package.json:

    {
      "scripts": {
        "sync-ai-rules": "node ./node_modules/@clipboard-health/ai-rules/scripts/sync.js [PROFILE_NAME]",
        "postinstall": "node --run sync-ai-rules"
      }
    }
    
  4. Run:

    npm install  # Runs postinstall automatically
    
  5. Commit the generated files:

    git add .rules/ AGENTS.md CLAUDE.md
    git commit -m "feat: add AI coding rules"
    

Include/Exclude Rules

Fine-tune which rules are synced using --include and --exclude:

# Backend profile without MongoDB rules
node sync.js backend --exclude backend/mongodb

# Common profile plus one backend rule
node sync.js common --include backend/architecture

# Multiple overrides
node sync.js backend --exclude backend/mongodb backend/postgres --include frontend/testing

Unknown rule ids are skipped with a warning so a stale --include/--exclude never breaks installs.

Update your package.json script accordingly:

{
  "scripts": {
    "sync-ai-rules": "node ./node_modules/@clipboard-health/ai-rules/scripts/sync.js backend --exclude backend/mongodb"
  }
}

Updating Rules

When we release new rules or improvements:

# Update the package
npm update @clipboard-health/ai-rules

# The postinstall script automatically syncs the latest files
npm install

# Review the changes
git diff .rules/ AGENTS.md

# Commit the updates
git add .rules/ AGENTS.md CLAUDE.md
git commit -m "chore: update AI coding rules"

Rules are occasionally split so each one carries a narrower retrieval trigger. If you pin individual rule ids with --include rather than taking a whole category, check the diff for new ids after upgrading: a stale --include keeps resolving, so you lose the split-out rules without a warning.

Available Rules

Each rule's "When to Read" text comes from the description field in the rule file's YAML frontmatter — the single source of truth used for the generated AGENTS.md index and the tables below.

backend

Rule IDWhen to Read
backend/architectureStructuring NestJS modules, services, repos: three-tier, microservices, ts-rest contracts
backend/asyncMessagingWorking with queues, async messaging, or background jobs; planning their rollout or rollback; adding event-dependent behavior
backend/infrastructureProvisioning infrastructure: Terraform, Docker, ECS, DNS
backend/mongodbWorking with MongoDB/Mongoose: schemas, indexes, queries, transactions, migrations
backend/notificationsImplementing notifications via Knock: push notifications, deep links, workflow design
backend/postgresWorking with Postgres: column types, schema changes, query patterns, Prisma TypedSQL
backend/restApiDesignDesigning REST APIs: JSON:API, auth, validation, pagination, ts-rest contracts, DTOs
backend/serviceTestsWriting service tests: test data, background jobs, bug handling, migrations

common

Rule IDWhen to Read
common/aiRulesEditing Clipboard agent instructions: shared rules, repository overlays, or generated .rules, AGENTS.md, and CLAUDE.md files
common/ciRunnersWriting or editing GitHub Actions workflows: choosing runs-on runners, runner OS and egress constraints
common/commentsAndCopyWriting code comments, docs, UI copy, or identifier names
common/configurationAdding config, secrets, or third-party dependencies: SSM, LaunchDarkly, DB, NPM packages
common/containerRegistryChoosing or pulling a container image: Dockerfile FROM, Compose services, CI workflow images
common/coreLibrariesAdding dependencies, implementing functionality, or debugging errors involving a @clipboard-health/* library
common/dateTimeWorking with dates, times, timezones, or date comparisons
common/errorHandlingReturning or throwing errors: ServiceResult, ServiceError, ERROR_CODES, toError
common/featureFlagsCreating or managing feature flags: naming, lifecycle, SDK usage, Zod schemas
common/gitWorkflowWriting commit messages, PR titles and descriptions, or reviewing pull requests
common/groundtruthMaking engineering decisions that depend on Clipboard-specific context
common/libraryAuthoringAuthoring shared library code: @clipboard-health/* packages or shared library modules within services (e.g., src/lib)
common/localChecksRunning type checks, lint, or tests locally to verify a change
common/loggingObservabilityAdding logging, metrics, monitoring, or observability: levels, context, PII, Datadog
common/rulesEngineWriting or modifying @clipboard-health/rules-engine rule functions
common/testingWriting unit tests: conventions, naming, structure
common/typeScriptWriting ANY TypeScript code

datamodeling

Rule IDWhen to Read
datamodeling/analyticsQuerying analytics data: dbt-mcp, Snowflake, source columns, output formatting
datamodeling/castingDbtStagingModelsCasting data types in dbt staging models
datamodeling/dbtModelDevelopmentDeveloping dbt models or diagnosing schema and ingestion failures
datamodeling/dbtYamlDocumentationWriting dbt YAML documentation and schema files

frontend

Rule IDWhen to Read
frontend/architectureFrontend architecture: feature-based file organization, where business logic lives
frontend/customHooksCreating React custom hooks: naming, shared state with constate
frontend/dataFetchingImplementing data fetching, API response fixtures, and error handling: React Query, MSW, Playwright, caching, parsedApi
frontend/designSystemImplementing UI from the design system or Figma: prefer shared components, theme lookup, optional Code Connect
frontend/e2eTestingChoosing and writing Playwright E2E tests for registered critical flows
frontend/reactComponentsBuilding UI components: structure, composition, modals, bottom sheets, interactive elements, a11y, Storybook
frontend/renderScopeAdding or restructuring React state, context, hook returns, wall-clock values, hidden queries/subscriptions, or list filtering
frontend/stylingStyling components with MUI sx prop: theme tokens, spacing, no CSS/SCSS
frontend/testingWriting frontend tests: React Testing Library, component tests

Contributing Rules

A rule earns its place only if a frontier model would do the wrong thing without it: Clipboard-specific decisions, library choices, naming, and hard-won gotchas. Do not add tutorials, generic best practices, or anything a linter already enforces.

To add or change a rule:

  1. Edit or create the rule file under rules/<category>/ with a frontmatter description (the "When to Read" text).
  2. Run npx tsx scripts/populateReadme.ts to regenerate the tables above (a test fails if they drift).
  3. New categories are directories under rules/; no registration needed.

Migration from v1

v2 replaces the monolithic AGENTS.md with a retrieval-based approach. Rule files are now committed to your repo under .rules/.

  1. Update the package:

    npm install --save-dev @clipboard-health/ai-rules@latest
    
  2. Run install to trigger sync:

    npm install
    
  3. Add .rules/ to git and commit:

    git add .rules/ AGENTS.md CLAUDE.md
    git commit -m "feat!: update ai-rules to v2 retrieval-based approach"
    

Local development commands

See package.json scripts for a list of commands.

版本与发布记录

@clipboard-health/ai-rules 共发布 500 个版本,首次发布于 2025/10/14;过去 12 个月发布了 475 个版本。

版本发布日期距今
2.50.28latest2026/10/091 个月前
2.50.272026/10/081 个月前
2.50.262026/10/081 个月前
2.50.252026/10/081 个月前
2.50.242026/10/061 个月前
2.50.232026/10/061 个月前

关于 @clipboard-health/ai-rules 的常见问题

@clipboard-health/ai-rules 是什么?

Pre-built AI agent rules for consistent coding standards.注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

如何安装 @clipboard-health/ai-rules?

在项目目录运行 npm install @clipboard-health/ai-rules,或使用 pnpm add / yarn add / bun add。

@clipboard-health/ai-rules 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/clipboard-health__ai-rules 是否存在。

@clipboard-health/ai-rules 可以商用吗?

@clipboard-health/ai-rules 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@clipboard-health/ai-rules 的下载量有多少?

根据 npm 官方下载统计,@clipboard-health/ai-rules 在 2026/10/10 – 2026/11/08 这 30 天内被下载 2,090 次,日均约 70 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@clipboard-health/ai-rules 还在维护吗?

最新版本 2.50.28 发布于 2026/10/09(1 个月前);至今共发布 500 个版本,其中过去 12 个月发布了 475 个;首次发布于 2025/10/14。作者已将其标记为弃用,新项目建议寻找替代方案。