通过实际操作产品验证交付内容,记录用户可查看的证据,并发布验收报告。可检查已有验证计划或创建检查项,选择合适的操作界面,并使用 `lh` CLI 发布结果。
- 实际检查更改后的产品行为
- 收集截图或其他验证证据
- 编写验证计划和报告
本指南说明代码和测试文件的命名、目录位置与导出约定,介绍单模块测试、集成测试的放置规则,以及如何按功能边界拆分超过 1200 行的文件并保留导入路径和行为。
Use for where a file lives, how it is named, where its tests go, and how to split a source or test file over 1200 lines (拆分大文件, 目录结构, 文件命名).
实测评分 未实测
查看安装方法本指南整理代码库中的文件命名、目录位置、导出和测试放置规则,涵盖 React 组件、钩子、普通模块及软件包的命名方式,也说明何时使用具名导出。单个模块的测试放在模块旁边;涉及多个模块或真实基础设施的测试放在 __tests__/。对于超过 1200 行的文件,指南建议按状态、功能或处理阶段等实际边界拆成多个模块,同时保留公开导入路径和原有行为。
添加新文件、判断测试应放在哪里,或规划大型文件的拆分结构时可以参考。它帮助新文件和拆分出的模块遵循代码库现有习惯,不要求为了统一而批量重命名旧文件。
顶层目录的职责由 AGENTS.md 和 project-overview 规定。本指南处理这些目录之下的放置和命名。
本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。
AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。
不计入评分。 由 AI(OpenAI Codex)于 2026年10月26日 评估。仅供参考,安装前请同时查看原文。
安装前可以查看交给 AI 代理的指令内容。
Top-level ownership (src/features, src/routes, apps/server/src, packages, …) is in AGENTS.md and project-overview. This skill owns placement and naming inside those roots, test placement, and how a large file becomes a directory. The rules record the conventions the codebase already follows; where it was split between two forms, the rule names the one to use for new files. Do not rename existing files only to match.
| What | Form | Example |
|---|---|---|
| React component file / component directory | PascalCase | PlanCard.tsx, ChatInput/ControlBar/ |
| Hook | useXxx.ts(x) | ChatInputNotice/useChatInputNotice.ts |
| Other module | camelCase or one word | originLink.ts, recentDirs.ts |
| Server class module | the class name | services/agentRuntime/StaleOperationReaper.ts |
| Service, router, store, and other non-component dirs | camelCase | services/aiAgent/, store/chat/slices/ |
| Package directory | kebab-case | packages/agent-runtime/ |
| Files inside a package | camelCase | packages/database/src/models/ |
A package whose files are already kebab-case (alint, openapi, builtin-skills) keeps kebab-case internally. Shared per-directory modules are constants.ts, types.ts, style.ts, and utils.ts, not const.ts, type.ts, styles.ts, or helpers.ts. Create one only when two or more modules in that directory use it; a constant or type used by one module stays in that module.
New files use named exports (export const PlanCard = …), even when the neighboring files default-export; do not copy the older default-export habit. The exceptions are modules a framework, tool, or loader imports by their default export: route segments under src/routes (see spa-routes), Next.js special files (page.tsx, layout.tsx, not-found.tsx), *.config.ts files, desktop controllers and services (*Ctr.ts, *Srv.ts, globbed by apps/desktop/src/main/core/App.ts), and locale resource files. Lint does not enforce this: this repository's eslint.config.mjs overrides no-restricted-syntax, which drops the shared @lobehub/lint warning on export default. When moving an existing file, keep its exports unchanged so its callers do not change.
One rule for every app and package:
Foo.ts → Foo.test.ts; a directory entry's test is index.test.ts.__tests__/ holds only tests that do not belong to one module: integration tests that run several modules together or real infrastructure (database, Redis, the tRPC or Hono request stack), such as routers/lambda/__tests__/integration/ and the database model and repository tests in testing, plus their shared setup, fixtures, and fakes.__tests__/. Move an existing unit test beside its module when you split or rewrite that test file; do not migrate tests as a side task.Foo.<scenario>.test.ts(x), keeping the original extension (index.<scenario>.test.ts(x) for a directory entry). Put shared mock factories and fixtures in a testUtils.ts beside them; each test file keeps its own vi.mock calls, because Vitest hoists them per file..test.ts (testing).Source and test files stay at or below 1200 lines. Generated code (*.gen.ts, generated/ directories) and the locales/default/ tables are exempt:
bun run check, the pre-commit hook, and the PR's File Size Gate job fail on both.Foo.ts becomes Foo/index.ts, §4), not into a neighboring file or another slice. Put a new test in a scenario test file under the limit (§2), splitting the old test file first when the test belongs to one of its scenarios. Because hundreds of legacy files are over the limit, these checks report their growth as an advisory (a warning annotation in CI) instead of failing; it is still a required fix.The limit says when to split, not where. Split on a real boundary (state, reuse, render update, sub-domain, pipeline stage), as react requires; never cut a file at an arbitrary line count. When a heavy feature is mounted by several hosts, use compose-atoms instead.
A split keeps the public import path: Foo.tsx becomes Foo/index.tsx, so import Foo from './Foo' keeps working and callers do not change. Commit the move (mkdir -p Foo && git mv Foo.tsx Foo/index.tsx) alone before extracting, so reviewers can read the extraction diff separately and Git keeps the rename while those commits stay intact (a squash merge folds them together). split-large-file has the full procedure.
| Kind | index keeps | Siblings | Precedent |
|---|---|---|---|
| React component | Public API, shared top-level state, composition | Child components (PascalCase), useXxx.ts for state transitions and side effects, pure logic modules with their own tests | Conversation/Messages/GoalTaskCard/ |
| Server service | The class and its orchestration methods | Stage functions taking an explicit deps object (pipeline/<stage>.ts), sub-domain folders | services/aiAgent/, services/comfyui/ |
| tRPC router | The merged router | One sub-router per sub-domain (market/agent.ts exports agentRouter) | routers/lambda/market/ |
| Zustand store | The action class and its public method signatures | Logic modules exporting a function that takes one params object plus get; the class method delegates to it | agentRun/actions/entries/conversationLifecycle/ |
ChatInput/ControlBar/).components/, hooks/, utils/) follow who uses the code:
PlanGrid/usePlanActions.ts).utils.ts for pure functions.Dashboard/utils/, ChatInput/hooks/, ResourceManager/components/).src/utils, src/hooks, src/components, or a packages/* package.helpers/; name the module by its content or use utils.bun run check with the test files passed explicitly: related-test discovery finds only <name>.test.* and <name>.<scenario>.test.* of each changed file, so the entry's tests do not run for an extracted sibling such as usePlanActions.ts.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
通过实际操作产品验证交付内容,记录用户可查看的证据,并发布验收报告。可检查已有验证计划或创建检查项,选择合适的操作界面,并使用 `lh` CLI 发布结果。
本技能指导在 LobeHub 中接入 AI 模型提供商,涵盖运行时、模型信息、设置、品牌展示、文档和验收,并帮助判断新增模型是否需要新的提供商集成。
本技能指导如何用服务器端环境变量设置用户偏好默认值,涵盖变量校验、服务器配置、写入用户状态,以及更新 `.env.example` 和自托管文档。
说明如何在智能体执行步骤、工具调用、人工审批、上下文压缩和子智能体调用时注册钩子。钩子可观察事件、模拟本地工具结果,也可通过 Webhook 按配置策略允许或拒绝工具调用。
此技能用于为智能体设计事件驱动的后台工作流,划分来源、信号、动作和策略的职责,并处理异步交接、去重、执行范围、完成记录与运行观测。
本技能在 macOS 桌面聊天应用中测试机器人频道:打开应用、进入频道或联系人、发送消息、等待回复并截图。支持 Discord、Slack、Telegram、微信、飞书和 QQ;iMessage 使用 BlueBubbles 桥接。