agentsclimarketplace

Coding unit test

Skill morning-start/agent-skills/process/project-management/coding-unit-test

AI 编程助手的专业技能库,涵盖 30+ 技能,按 6 类组织

Install
npx -y skills add morning-start/agent-skills --skill coding-unit-test

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

编码与单元测试工具。指导前后端并行开发、代码编写规范、单元测试撰写。适用于研发执行阶段的核心生产环节。

SKILL.md

2.5 KB, as published. Nobody here has run it

编码与单元测试

最核心的"生产"环节。

核心流程

前端开发 → 后端开发 → 前后端联调 → 单元测试

1. 前端开发规范

代码规范

规范项说明
命名规范变量/函数:camelCase;组件:PascalCase
代码格式使用Prettier/ESLint统一格式
注释规范复杂逻辑必须添加注释
Git提交提交信息遵循conventional commits

组件开发 checklist

  • 组件职责单一
  • Props类型定义完整
  • 处理好边界条件(空数据、加载中、错误状态)
  • 避免硬编码

2. 后端开发规范

分层架构

Controller → Service → Repository
     ↓          ↓          ↓
  接收请求   业务逻辑   数据库操作

代码规范

规范项说明
命名规范类名:PascalCase;方法:camelCase
异常处理统一异常捕获,分类处理
日志记录关键操作记录日志
事务管理多表操作使用事务

安全checklist

  • 参数校验
  • SQL注入防护
  • 权限校验
  • 敏感数据脱敏

3. 单元测试

测试金字塔

        /\
       /  \     E2E测试 (少)
      /----\    集成测试 (中)
     /      \   单元测试 (多)
    /--------\

单元测试结构(AAA模式)

describe('计算总价', () => {
  it('应正确计算单个商品总价', () => {
    // Arrange - 准备测试数据
    const items = [{ price: 10, quantity: 2 }];

    // Act - 执行被测方法
    const total = calculateTotal(items);

    // Assert - 验证结果
    expect(total).toBe(20);
  });
});

测试覆盖要求

场景最低覆盖率
核心业务逻辑80%+
工具函数90%+
分支处理覆盖所有if/else

4. 每日站会

3问模板

昨天:完成了xxx任务
今天:计划做xxx任务
阻塞:遇到yyy问题,需要zzz支持

风险升级机制

风险识别 → 记录到风险清单 → 及时上报 → 制定应对方案

使用场景

  • 正式进入编码阶段
  • 代码审查(Code Review)
  • 每日站会同步进度

关键产出

  1. 源代码(符合规范)
  2. 单元测试报告
  3. 每日站会纪要

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.