简介
多层级工程知识助手:为爱好者、学生、专业人员、研究者、教育者和技师提供从DIY到学术研究的全流程工程支持,严格区分安全等级与专业资质要求。
原始描述
Support engineering understanding from DIY projects to professional practice and research.
通过你的 Agent 添加
安装目录:engineering/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Engineering 技能采用层级自适应架构,根据用户身份(爱好者/学生/专业人员/研究者/教育者/技师)动态调整输出深度与规范严格性:
- 爱好者模式:侧重安全边界的明确标注,用生活化类比解释力学概念(如"200磅剪切力≈两个成年人站立"),强制标注需持证操作的系统(电气主干、承重结构、燃气管道等)
- 学生模式:完整展示解题方法论(已知量/未知量识别→图示→符号推导→数值代入),强制单位一致性校验,连接热机、桁架、运放等真实工程系统
- 专业人员模式:精确引用标准版本(如"ASME B31.3-2022 §304.1.2"),区分强制性("shall")与建议性("should")条款,标注安全系数假设与管辖区(AHJ)修正要求
- 研究者模式:强制执行实验设计原则(对照组、统计功效、不确定度量化),区分仿真验证层级,要求FAIR数据共享与可复现性
- 教育者模式:从第一性原理构建知识,强制单位分析(可捕获70%+计算错误),逐步增加现实复杂度(摩擦→瞬态→非线性)
- 技师模式:精确引用图纸编号/版本/日期,提供带决策树的故障排查流程,区分施工范围与需PE签章的设计变更边界
显著优点
- 安全分层严谨:六类用户边界清晰,自动触发"需持证操作"警告,工程失误致死风险前置拦截
- 规范可追溯性:强制标准版本号、条款号、修订日期,满足法律责任链要求
- 认知脚手架完整:从直觉类比到符号推导到代码合规,覆盖工程认知全谱系
- 跨学科接口管理:主动标记结构/电气/工艺交叉点,强制多专业协调
潜在局限
- 无实时规范数据库:依赖训练数据中的标准版本,可能滞后于最新修订(如NEC年度更新)
- 管辖区差异未内置:AHJ(管辖当局)修正提示为通用警告,不覆盖具体地区特殊条款
- 仿真工具链缺失:不直接调用FEM/CFD软件,仅提供建模保真度建议
- 材料数据库有限:材料替代建议基于通用知识,非实时供应商库存
适合人群
- DIY爱好者(木工、金属加工、家居改造)
- 工科本科生/研究生(机械、土木、电气、化工)
- 执业工程师(需配合现行规范手册使用)
- 实验室研究人员(实验设计与论文写作阶段)
- 工程教育工作者(课程设计与考题编制)
- 现场技师(安装、调试、维护作业)
常规风险
- 过度自信风险:爱好者可能忽略"需PE签章"警告自行实施
- 版本滞后风险:引用的ASME/IEEE等标准可能非最新版,关键项目必须人工复核
- 单位换算错误:虽强制单位一致性检查,但复杂跨制式计算仍需人工复核
- 责任边界模糊:技能输出中的分析结论不构成工程设计文件,最终安全责任在实施方案的专业审核方
- 无实时规范数据库:依赖训练数据中的标准版本,可能滞后于最新修订(如NEC年度更新)
- 管辖区差异未内置:AHJ(管辖当局)修正提示为通用警告,不覆盖具体地区特殊条款
- 仿真工具链缺失:不直接调用FEM/CFD软件,仅提供建模保真度建议
- 材料数据库有限:材料替代建议基于通用知识,非实时供应商库存
适合人群
- DIY爱好者(木工、金属加工、家居改造)
- 工科本科生/研究生(机械、土木、电气、化工)
- 执业工程师(需配合现行规范手册使用)
- 实验室研究人员(实验设计与论文写作阶段)
- 工程教育工作者(课程设计与考题编制)
- 现场技师(安装、调试、维护作业)
常规风险
- 过度自信风险:爱好者可能忽略"需PE签章"警告自行实施
- 版本滞后风险:引用的ASME/IEEE等标准可能非最新版,关键项目必须人工复核
- 单位换算错误:虽强制单位一致性检查,但复杂跨制式计算仍需人工复核
- 责任边界模糊:技能输出中的分析结论不构成工程设计文件,最终安全责任在实施方案的专业审核方
- 过度自信风险:爱好者可能忽略"需PE签章"警告自行实施
- 版本滞后风险:引用的ASME/IEEE等标准可能非最新版,关键项目必须人工复核
- 单位换算错误:虽强制单位一致性检查,但复杂跨制式计算仍需人工复核
- 责任边界模糊:技能输出中的分析结论不构成工程设计文件,最终安全责任在实施方案的专业审核方
技能正文
name: engineering
description: Authoritative engineering reference covering code conventions, performance, comments, TypeScript type rules, testing, and commit messages. Use before writing or changing any source file, and when suggesting a commit message.
user-invocable: true
metadata:
author: Weslley Araújo
version: '1.4.0'
source: https://github.com/wellwelwel/skills
Engineering
This skill is the specialized, authoritative description of how code is written: the code conventions, performance, the comment discipline, the type rules, testing, and commit messages. Consult it before writing or changing source, and whenever you apply the code conventions.
Where the project already has an established convention that contradicts one below, follow the project. These rules decide whatever the project leaves open.
Code conventions
Security
- Whenever you build or change code, use the
/laguneskill (lagune.ai), named/lagune:lagunewhen installed as a plugin, to improve safety by default.
General
- Arrow functions over
function. Declare with const. Use a function only when the this context strictly requires it.
- Named exports only. Never use
default export.
- No abbreviations. Names are clear and explicit (for example
left/right, not a/b, and index, not i).
- Avoid nested
if-else-else-if. Favor clean, well-decoupled approaches when branching grows.
- No duplicated logic or types. Reuse existing logic and types whenever it is viable.
- No side effects inside loops or iterations. Keep iteration pure.
- Make errors actionable. An error states what went wrong, where, and what was expected, so whoever reads it knows what to fix.
- Prefer native capabilities over external dependencies whenever possible.
- On Node.js, always prefix native imports with
node: (for example node:path, node:fs).
- Prefer the async native APIs when viable (for example
node:fs/promises).
Layout
- Shared declarations live at the top of the file or scope. Anything used by more than one block is declared before the first block that uses it, never between blocks. Order them by kind: types first, then values and fixtures, then functions.
- Group statements by kind, and separate the groups with one blank line. Consecutive declarations stay together, consecutive calls stay together, and the switch from one kind to the other gets a blank line, even when a group holds a single statement. The same rule applies inside callbacks and between top-level declarations.
Performance
- Maintainability comes first. Pursue performance in balance with readable code, never at its expense.
- Keep the default path lean. An optional or uncommon feature stays behind the condition that enables it, so the default path never runs, allocates, or loads anything for it. A rare branch lives in a function of its own, so the hot function stays small enough for the engine to inline.
- Practice early return. Handle edge cases up front, and leave a path with
return, break, or continue the moment it is decided. Within a function, declare each value after the guards that can leave early, in the narrowest block that uses it, so nothing is computed or allocated for a path that never reaches it.
- Allocate nothing a hot path can avoid. Write each value once, in place, instead of building a temporary to copy from, and allocate a collection at its final size when that size is known. A large collection lives in parallel arrays instead of one object per item, with its numbers in typed arrays.
- Compute once. A value that cannot change between calls or iterations, such as a lookup table or a compiled pattern, is computed once, outside the function or the loop that uses it.
- Keep shapes stable. An object a hot path touches is created with every property it will ever have, always in the same order, and never gains or loses one afterwards. Keys that change at runtime can belong in a
Map.
- Release what leaves. A structure that outlives its items drops every reference it holds to an item as soon as the item is removed, so the memory is reclaimed while the structure lives on.
- Look up in constant time, and once. Find items through a
Map or a Set instead of scanning a list inside a loop. When no stored value can be undefined, read once and test the result instead of checking for the key first.
- Prove every optimization. A change made for performance alone is kept only when a benchmark of realistic use shows the gain over the previous version, on every runtime the project supports.
Comments
- Never add obvious comments. Assume that if code needs a comment to be understood, the implementation is poor, dirty/messy, or even rotten.
- The length of the comment reflects how bad the implementation is: the more explanation it needs, the worse the code.
- Don't explain the implementation in the comments: improve the implementation (clear names, decoupled functions with clearly defined scopes, proper abstractions, etc.) over explaining it with comments.
- Connectives betray an explanation. A comment that reads as reasoning ("so", "then", "because", "which means", "in order to", "this way", "otherwise", etc.) is walking the reader through the code, which is the violation above in disguise. Make the code carry the reasoning instead. The comment that survives states a fact the code cannot show on its own (an external constraint, a quirk, a team decision), plainly and without narrating the code around it.
- Inline comments are inline for a reason. Never stack them into improvised multi-line comments. When one line is not enough, use a comment block, and keep it as short and direct as it can be.
- A public API may carry documentation. What is exposed directly to the end user can have objective documentation comments stating what it does, never how it does it.
Types (TypeScript)
any and as unknown as are forbidden. No exceptions.
- Prefer
type. Use interface only when a class is meant to implement it.
- No pass-through aliases. A
type whose whole definition is another named type is a duplicated type under a second name.
- Reach for
as last. Prefer a direct type annotation or satisfies. A plain as cast is allowed, but only when neither of those fits.
- Keep type declarations together. When the project dedicates a place to them (a
types directory, for example), declare them there instead of scattering type and interface across the codebase.
Testing
- When the
testing skill is installed, use it to decide what deserves a test and what each test must assert.
- Use the runner and the scripts the project already has, and cover every runtime it supports.
- When the project has no runner yet, prefer Poku, and give each supported runtime its own script (for example
npm test, bun run test:bun, deno task test:deno).
- One blank line between tests, and between a block's setup and its first test.
- Arrange, then assert. Every call and declaration comes first, then a blank line, then every assertion. Never interleave them. A test made only of assertions keeps them together with no blank line.
Git
- Never infer commits. Do not create a commit based on context or assumption. Only commit when I explicitly ask for it.
- When suggesting a commit message, treat it like a Pull Request title: a short line naming the behavior the change gives whoever uses the software, never the motivation behind it (a review, a deadline, a third party's requirement) nor its mechanics (the files, fields, or values touched). For a change that keeps the behavior, such as a refactor, name what a maintainer would notice instead. Follow Conventional Commits (e.g.,
type: summary, type(scope): summary):
- ❌
fix(login): pass the accessibility audit names the motivation.
- ❌
fix(login): remove the paste handler names the mechanics.
- ✅
fix(login): accept pasted passwords names the behavior.
function. Declare with const. Use a function only when the this context strictly requires it.default export.left/right, not a/b, and index, not i).if-else-else-if. Favor clean, well-decoupled approaches when branching grows.node: (for example node:path, node:fs).node:fs/promises).- Shared declarations live at the top of the file or scope. Anything used by more than one block is declared before the first block that uses it, never between blocks. Order them by kind: types first, then values and fixtures, then functions.
- Group statements by kind, and separate the groups with one blank line. Consecutive declarations stay together, consecutive calls stay together, and the switch from one kind to the other gets a blank line, even when a group holds a single statement. The same rule applies inside callbacks and between top-level declarations.
Performance
- Maintainability comes first. Pursue performance in balance with readable code, never at its expense.
- Keep the default path lean. An optional or uncommon feature stays behind the condition that enables it, so the default path never runs, allocates, or loads anything for it. A rare branch lives in a function of its own, so the hot function stays small enough for the engine to inline.
- Practice early return. Handle edge cases up front, and leave a path with
return, break, or continue the moment it is decided. Within a function, declare each value after the guards that can leave early, in the narrowest block that uses it, so nothing is computed or allocated for a path that never reaches it.
- Allocate nothing a hot path can avoid. Write each value once, in place, instead of building a temporary to copy from, and allocate a collection at its final size when that size is known. A large collection lives in parallel arrays instead of one object per item, with its numbers in typed arrays.
- Compute once. A value that cannot change between calls or iterations, such as a lookup table or a compiled pattern, is computed once, outside the function or the loop that uses it.
- Keep shapes stable. An object a hot path touches is created with every property it will ever have, always in the same order, and never gains or loses one afterwards. Keys that change at runtime can belong in a
Map.
- Release what leaves. A structure that outlives its items drops every reference it holds to an item as soon as the item is removed, so the memory is reclaimed while the structure lives on.
- Look up in constant time, and once. Find items through a
Map or a Set instead of scanning a list inside a loop. When no stored value can be undefined, read once and test the result instead of checking for the key first.
- Prove every optimization. A change made for performance alone is kept only when a benchmark of realistic use shows the gain over the previous version, on every runtime the project supports.
Comments
- Never add obvious comments. Assume that if code needs a comment to be understood, the implementation is poor, dirty/messy, or even rotten.
- The length of the comment reflects how bad the implementation is: the more explanation it needs, the worse the code.
- Don't explain the implementation in the comments: improve the implementation (clear names, decoupled functions with clearly defined scopes, proper abstractions, etc.) over explaining it with comments.
- Connectives betray an explanation. A comment that reads as reasoning ("so", "then", "because", "which means", "in order to", "this way", "otherwise", etc.) is walking the reader through the code, which is the violation above in disguise. Make the code carry the reasoning instead. The comment that survives states a fact the code cannot show on its own (an external constraint, a quirk, a team decision), plainly and without narrating the code around it.
- Inline comments are inline for a reason. Never stack them into improvised multi-line comments. When one line is not enough, use a comment block, and keep it as short and direct as it can be.
- A public API may carry documentation. What is exposed directly to the end user can have objective documentation comments stating what it does, never how it does it.
Types (TypeScript)
any and as unknown as are forbidden. No exceptions.
- Prefer
type. Use interface only when a class is meant to implement it.
- No pass-through aliases. A
type whose whole definition is another named type is a duplicated type under a second name.
- Reach for
as last. Prefer a direct type annotation or satisfies. A plain as cast is allowed, but only when neither of those fits.
- Keep type declarations together. When the project dedicates a place to them (a
types directory, for example), declare them there instead of scattering type and interface across the codebase.
Testing
- When the
testing skill is installed, use it to decide what deserves a test and what each test must assert.
- Use the runner and the scripts the project already has, and cover every runtime it supports.
- When the project has no runner yet, prefer Poku, and give each supported runtime its own script (for example
npm test, bun run test:bun, deno task test:deno).
- One blank line between tests, and between a block's setup and its first test.
- Arrange, then assert. Every call and declaration comes first, then a blank line, then every assertion. Never interleave them. A test made only of assertions keeps them together with no blank line.
Git
- Never infer commits. Do not create a commit based on context or assumption. Only commit when I explicitly ask for it.
- When suggesting a commit message, treat it like a Pull Request title: a short line naming the behavior the change gives whoever uses the software, never the motivation behind it (a review, a deadline, a third party's requirement) nor its mechanics (the files, fields, or values touched). For a change that keeps the behavior, such as a refactor, name what a maintainer would notice instead. Follow Conventional Commits (e.g.,
type: summary, type(scope): summary):
- ❌
fix(login): pass the accessibility audit names the motivation.
- ❌
fix(login): remove the paste handler names the mechanics.
- ✅
fix(login): accept pasted passwords names the behavior.
return, break, or continue the moment it is decided. Within a function, declare each value after the guards that can leave early, in the narrowest block that uses it, so nothing is computed or allocated for a path that never reaches it.Map.Map or a Set instead of scanning a list inside a loop. When no stored value can be undefined, read once and test the result instead of checking for the key first.- Never add obvious comments. Assume that if code needs a comment to be understood, the implementation is poor, dirty/messy, or even rotten.
- The length of the comment reflects how bad the implementation is: the more explanation it needs, the worse the code.
- Don't explain the implementation in the comments: improve the implementation (clear names, decoupled functions with clearly defined scopes, proper abstractions, etc.) over explaining it with comments.
- Connectives betray an explanation. A comment that reads as reasoning ("so", "then", "because", "which means", "in order to", "this way", "otherwise", etc.) is walking the reader through the code, which is the violation above in disguise. Make the code carry the reasoning instead. The comment that survives states a fact the code cannot show on its own (an external constraint, a quirk, a team decision), plainly and without narrating the code around it.
- Inline comments are inline for a reason. Never stack them into improvised multi-line comments. When one line is not enough, use a comment block, and keep it as short and direct as it can be.
- A public API may carry documentation. What is exposed directly to the end user can have objective documentation comments stating what it does, never how it does it.
Types (TypeScript)
any and as unknown as are forbidden. No exceptions.
- Prefer
type. Use interface only when a class is meant to implement it.
- No pass-through aliases. A
type whose whole definition is another named type is a duplicated type under a second name.
- Reach for
as last. Prefer a direct type annotation or satisfies. A plain as cast is allowed, but only when neither of those fits.
- Keep type declarations together. When the project dedicates a place to them (a
types directory, for example), declare them there instead of scattering type and interface across the codebase.
Testing
- When the
testing skill is installed, use it to decide what deserves a test and what each test must assert.
- Use the runner and the scripts the project already has, and cover every runtime it supports.
- When the project has no runner yet, prefer Poku, and give each supported runtime its own script (for example
npm test, bun run test:bun, deno task test:deno).
- One blank line between tests, and between a block's setup and its first test.
- Arrange, then assert. Every call and declaration comes first, then a blank line, then every assertion. Never interleave them. A test made only of assertions keeps them together with no blank line.
Git
- Never infer commits. Do not create a commit based on context or assumption. Only commit when I explicitly ask for it.
- When suggesting a commit message, treat it like a Pull Request title: a short line naming the behavior the change gives whoever uses the software, never the motivation behind it (a review, a deadline, a third party's requirement) nor its mechanics (the files, fields, or values touched). For a change that keeps the behavior, such as a refactor, name what a maintainer would notice instead. Follow Conventional Commits (e.g.,
type: summary, type(scope): summary):
- ❌
fix(login): pass the accessibility audit names the motivation.
- ❌
fix(login): remove the paste handler names the mechanics.
- ✅
fix(login): accept pasted passwords names the behavior.
any and as unknown as are forbidden. No exceptions.type. Use interface only when a class is meant to implement it.type whose whole definition is another named type is a duplicated type under a second name.as last. Prefer a direct type annotation or satisfies. A plain as cast is allowed, but only when neither of those fits.types directory, for example), declare them there instead of scattering type and interface across the codebase.- When the
testingskill is installed, use it to decide what deserves a test and what each test must assert. - Use the runner and the scripts the project already has, and cover every runtime it supports.
- When the project has no runner yet, prefer Poku, and give each supported runtime its own script (for example
npm test,bun run test:bun,deno task test:deno). - One blank line between tests, and between a block's setup and its first test.
- Arrange, then assert. Every call and declaration comes first, then a blank line, then every assertion. Never interleave them. A test made only of assertions keeps them together with no blank line.
Git
- Never infer commits. Do not create a commit based on context or assumption. Only commit when I explicitly ask for it.
- When suggesting a commit message, treat it like a Pull Request title: a short line naming the behavior the change gives whoever uses the software, never the motivation behind it (a review, a deadline, a third party's requirement) nor its mechanics (the files, fields, or values touched). For a change that keeps the behavior, such as a refactor, name what a maintainer would notice instead. Follow Conventional Commits (e.g.,
type: summary, type(scope): summary):
- ❌
fix(login): pass the accessibility audit names the motivation.
- ❌
fix(login): remove the paste handler names the mechanics.
- ✅
fix(login): accept pasted passwords names the behavior.
type: summary, type(scope): summary):
- ❌
fix(login): pass the accessibility auditnames the motivation. - ❌
fix(login): remove the paste handlernames the mechanics. - ✅
fix(login): accept pasted passwordsnames the behavior.