一键导入
repository-engineering-guidelines
Use for repository-wide engineering standards, workspace commands, and final verification.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use for repository-wide engineering standards, workspace commands, and final verification.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when adding, changing, extracting, or reusing client components, including Storybook stories and controls.
Use when adding or changing forms in apps/client.
Use when changing GitHub OAuth, session cookies, SessionGuard, logout, or authenticated API request identity.
Use when adding or changing routes in apps/client.
Use when adding or changing client state, React Query data flow, immutable context values, or Zustand stores.
Use when styling apps/client with Tailwind CSS v4.
| name | repository-engineering-guidelines |
| description | Use for repository-wide engineering standards, workspace commands, and final verification. |
Generated from ai/registry.json. Do not edit manually.
Canonical skill: ../../../ai/skills/repository-engineering-guidelines.md.
Referenced context:
../../../ai/rules/repository-rules.md../../../ai/rules/testing-rules.md../../../ai/rules/ai-rules.md../../../ai/architecture/monorepo.md../../../ai/architecture/ai-knowledge-system.md../../../ai/glossary/domain-terms.mdThis file is compiled from canonical AI knowledge files. Edit canonical files under ai, then run npm run ai:sync.
ai/skills/repository-engineering-guidelines.mdUse this skill for repository-wide code changes, refactors, bug fixes, feature work, and final verification.
Make changes that preserve monorepo boundaries, project contracts, and the smallest-correct-change style used in this repository.
ai/rules/repository-rules.mdai/rules/testing-rules.mdai/rules/ai-rules.mdai/architecture/monorepo.mdai/architecture/ai-knowledge-system.mdai/glossary/domain-terms.mddocs/PRODUCT.md, docs/DATA_MODEL.md, docs/CONFIG_FORMAT.md, and docs/TECHNICAL_DECISIONS.md when behavior changes.packages/* only when there is a real cross-workspace consumer.npm run lint for repository-wide changes or broad refactors.ai/rules/repository-rules.mdGlobal rules for changes anywhere in this monorepo.
docs/PRODUCT.md, docs/DATA_MODEL.md, docs/CONFIG_FORMAT.md, docs/TECHNICAL_DECISIONS.md, and docs/ROADMAP.md.unknown with validation at boundaries.packages/*..env, raw secrets, OAuth tokens, raw session tokens, or raw SDK keys.ai, then run npm run ai:sync.npm run lint for repository-wide changes or broad refactors.ai/rules/testing-rules.mdTesting rules for this Vitest-based monorepo.
describe, it, expect, vi.fn, and vi.spyOn.__tests__/ folders next to the source area they cover, matching the Storybook stories/ grouping convention.apps/client/src/api request and hook tests in src/api/__tests__, using the existing fetch, React Query, and render helpers from src/test.apps/client/src/core tests under src/core/<category>/__tests__/<name>.test.ts.src/components/__tests__ and shared member component tests under src/components/members/__tests__.src/pages/<PageName>/__tests__ or src/pages/<PageName>/<section>/__tests__ for colocated page internals.src/__tests__ only for source files owned directly by apps/client/src, such as permissions.ts.apps/client code that calls the API, cover both successful responses and API error responses with mocked fetch/response behavior.apps/client coverage at 90% or higher for configured client coverage targets; aim for 100% on pure helpers and request functions.vi.fn() methods.jest.mock patterns..only in tests.apps/client tests beside source files as loose *.test.ts(x) files when a nearby __tests__/ folder is available.src/test/render.tsx, src/test/api.ts, or src/test/pageApi.ts already cover the setup.npm --workspace @capture-flag/api run test.npm --workspace @capture-flag/client run test.npm --workspace @capture-flag/client run test:coverage.npm --workspace @capture-flag/shared run test.npm --workspace @capture-flag/evaluator run test.npm --workspace @capture-flag/sdk-js run test.npm run test.ai/rules/ai-rules.mdRules for maintaining the AI knowledge base itself.
ai as the source of truth for AI guidance.rules, architecture, glossary, and examples reusable across skills.skills task-oriented: each skill should orchestrate references instead of duplicating them.ai/registry.json.references in registry.json for every rule, architecture, glossary, or example a skill depends on.## Read First list identical to its registry.json references list.Source: with SHA-256 hash and Why this is canonical: to every file under ai/examples.npm run ai:sync after changing canonical skills, registry entries, or referenced knowledge files.npm run ai:check before finishing AI knowledge changes..opencode/skills, .cursor/rules, or .github/instructions AI route files manually.architecture.rules.alwaysApply: true outside the explicitly global project-core skill.npm run ai:sync.ai/architecture/monorepo.mdCapture Flag is a TypeScript npm workspaces monorepo.
apps/api: NestJS API, Prisma access, authentication, tenant services, public SDK config endpoint.apps/client: Vite React app for platform UI.packages/shared: shared package boundary for reusable cross-workspace code.packages/evaluator: pure local evaluation engine.packages/sdk-js: JavaScript SDK that fetches public config and evaluates locally.packages/react: React provider and hook around the JavaScript SDK.npm run build.npm run test.npm run lint.npm run ai:sync.npm run ai:check.apps/api.apps/client.packages/* only when there is a real cross-workspace consumer.docs/* are part of the source of truth for behavior.ai/architecture/ai-knowledge-system.mdai is the canonical AI knowledge base for the repository.
rules: reusable constraints, conventions, and anti-patterns.architecture: how project systems work and where new code integrates.glossary: domain vocabulary and naming meaning.examples: small real project examples that demonstrate conventions.skills: task-oriented workflows that reference the other layers.ai/registry.json defines routed skills.
ai/registry.schema.json documents the registry shape and the sync script enforces the same structural constraints during npm run ai:check.
Each skill entry contains:
name: route name used by tool-specific files.description: when the skill should be used.canonicalPath: workflow file under ai/skills.references: reusable knowledge files compiled with the skill.routes: explicit generated destinations for each tool.toolConfig: Cursor and GitHub route metadata.project-core is the global baseline skill. Other skills should remain task-specific and opt-in.
scripts/ai/sync-routes.mjs compiles each canonical skill and its references into tool routes:
.opencode/skills/<skill-name>/SKILL.md..cursor/rules/<skill-name>.mdc..github/instructions/<skill-name>.instructions.md.Generated routes must not be edited manually.
npm run ai:check validates registry entries, reference files, generated route content, and orphan generated routes.Read First parity with registry references, example source paths and hashes, and compiled route size reporting.npm run ai:sync writes expected generated routes and removes orphan generated routes.npm run lint runs ai:check before Biome.ai/glossary/domain-terms.mdCore Capture Flag domain language.
Authenticated platform identity. Users are global and can belong to multiple organizations.
External provider account linked to a user, such as GitHub.
Opaque client session stored in an HTTP-only cookie. The database stores only the token hash.
Primary tenant. Organizations own projects and organization memberships.
User membership and role inside an organization.
Product, application, or system inside an organization. Projects group configs, environments, SDK keys, members, flags, and segments.
User membership and role scoped to one project.
Named set of flags/settings consumed by SDKs as public Config JSON.
Runtime environment such as development, staging, or production.
Reusable targeting group scoped to a config. SDKs evaluate segment membership locally from Evaluation Context data.
Immutable record of important domain changes used for investigation and compliance.