infra

GitHub

指导基于Bun和Turbo的Monorepo基础设施管理,涵盖包管理、结构规范、命令执行及依赖维护。

.claude/skills/infra/SKILL.md trycompai/comp

Trigger Scenarios

配置Monorepo结构 管理项目依赖 执行构建或类型检查

Install

npx skills add trycompai/comp --skill infra -g -y
More Options

Non-standard path

npx skills add https://github.com/trycompai/comp/tree/main/.claude/skills/infra -g -y

Use without installing

npx skills use trycompai/comp@infra

指定 Agent (Claude Code)

npx skills add trycompai/comp --skill infra -a claude-code -g -y

安装 repo 全部 skill

npx skills add trycompai/comp --all -g -y

预览 repo 内 skill

npx skills add trycompai/comp --list

SKILL.md

Frontmatter
{
    "name": "infra",
    "description": "Use when working with packages, dependencies, monorepo structure, or build configuration"
}

Source Cursor rule: .cursor/rules/infra.mdc. Original Cursor alwaysApply: false.

Infrastructure

Package Manager

Use bun, never npm/yarn/pnpm.

bun install              # Install deps
bun add <pkg>            # Add package
bun add -D <pkg>         # Add dev dependency
bun run <script>         # Run script
bunx <cmd>               # Execute binary

Monorepo Structure

comp/
├── apps/
│   ├── api/             # NestJS backend
│   ├── app/             # Next.js main app
│   └── portal/          # Next.js portal
├── packages/
│   ├── db/              # Prisma (@trycompai/db)
│   ├── ui/              # Legacy UI (@trycompai/ui); prefer @trycompai/design-system
│   └── ...
├── turbo.json
└── package.json

Running Commands

# Multi-package (via turbo)
bun run build            # Build all
bun run lint             # Lint all
bun run typecheck        # Type check all
bun run dev              # Dev all

# Single package
bun run -F apps/app dev
bun run -F @trycompai/db prisma:generate
turbo build --filter=@trycompai/ui

Importing Between Packages

// ✅ Import from package name
import { Button } from '@trycompai/design-system';
import { prisma } from '@trycompai/db';

// ❌ Never relative paths across packages
import { Button } from '../../../packages/ui/src/button';

Adding Dependencies

# To specific package
bun add axios -F apps/app
bun add -D vitest -F @trycompai/ui

# To root (dev tools only)
bun add -D -w prettier typescript

After Code Changes

Always run checks:

bun run typecheck
bun run lint

Fix all errors before committing.

Common TypeScript Fixes

  • Property does not exist: Check interface definitions
  • Type mismatch: Verify expected vs actual type
  • Empty interface extends: Use type X = SomeType instead

Common ESLint Fixes

  • Unused variables: Remove or prefix with _
  • Any type: Add proper typing
  • Empty object type: Use type instead of interface

Creating a New Package

mkdir packages/my-package
// packages/my-package/package.json
{
  "name": "@trycompai/my-package",
  "version": "0.0.0",
  "private": true,
  "main": "./src/index.ts",
  "scripts": {
    "build": "tsup src/index.ts --format cjs,esm --dts",
    "typecheck": "tsc --noEmit"
  }
}
// packages/my-package/tsconfig.json
{
  "extends": "@trycompai/tsconfig/base.json",
  "include": ["src"]
}

Package Boundaries

✅ Create packages for:

  • Code used by 2+ apps
  • Self-contained, focused functionality

❌ Don't create packages for:

  • Code only used in one app (colocate instead)
  • App-specific business logic

Version History

  • 0ccfcc2 Current 2026-09-27 10:24

Same Skill Collection

.agents/skills/audit-design-system/SKILL.md
.agents/skills/audit-hooks/SKILL.md
.agents/skills/audit-rbac/SKILL.md
.agents/skills/audit-tests/SKILL.md
.agents/skills/better-auth-best-practices/SKILL.md
.agents/skills/billing/SKILL.md
.agents/skills/code/SKILL.md
.agents/skills/cursor-usage/SKILL.md
.agents/skills/data/SKILL.md
.agents/skills/diagnose-generation-failure/SKILL.md
.agents/skills/forms/SKILL.md
.agents/skills/generate-mcp-server/SKILL.md
.agents/skills/infra/SKILL.md
.agents/skills/manage-openapi-overlays/SKILL.md
.agents/skills/new-feature-setup/SKILL.md
.agents/skills/production-readiness/SKILL.md
.agents/skills/prompt-engineering/SKILL.md
.agents/skills/speakeasy-context/SKILL.md
.agents/skills/stale-worktree-cleanup/SKILL.md
.agents/skills/trigger-advanced-tasks/SKILL.md
.agents/skills/trigger-basic/SKILL.md
.agents/skills/trigger-config/SKILL.md
.agents/skills/trigger-realtime/SKILL.md
.agents/skills/ui/SKILL.md
.claude/skills/api-endpoint-contract/SKILL.md
.claude/skills/audit-design-system/SKILL.md
.claude/skills/audit-hooks/SKILL.md
.claude/skills/audit-rbac/SKILL.md
.claude/skills/audit-tests/SKILL.md
.claude/skills/check-results-service/SKILL.md
.claude/skills/cleanup/SKILL.md
.claude/skills/code/SKILL.md
.claude/skills/cursor-usage/SKILL.md
.claude/skills/data/SKILL.md
.claude/skills/forms/SKILL.md
.claude/skills/new-feature-setup/SKILL.md
.claude/skills/production-readiness/SKILL.md
.claude/skills/prompt-engineering/SKILL.md
.claude/skills/security-review/SKILL.md
.claude/skills/stale-worktree-cleanup/SKILL.md
.claude/skills/trigger-advanced-tasks/SKILL.md
.claude/skills/trigger-basic/SKILL.md
.claude/skills/trigger-config/SKILL.md
.claude/skills/trigger-realtime/SKILL.md
.claude/skills/ui/SKILL.md
.agents/skills/essentials/SKILL.md
.agents/skills/prisma/SKILL.md
.agents/skills/trigger-scheduled-tasks/SKILL.md
.claude/skills/essentials/SKILL.md

Metadata

Files
0
Version
0ccfcc2
Hash
c527c65e
Indexed
2026-09-27 10:24

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-28 06:30
浙ICP备14020137号-1