代码测试

运维部署 社区

技能解读

当前原文的自动摘译,尚未人工审校。

Kotlin 构建/测试/分析/docker

参数:$ARGUMENTS

项目路径和JDK

从~/.claude/project-repos.json解析项目路径。 Kotlin 项目是根目录包含 build.gradle 或 build.gradle.kts 的任何注册表项。 JDK 版本是每个项目的,应该在项目的projects/{shortname}.md 中声明。在调用 Gradle 之前设置:

建造

失败时,建议使用./gradlew --refresh-dependencies解决依赖性错误。对于编译错误,请引用文件/行和有问题的类型。

测试

如果项目使用 TestContainers,请确保 Docker 首先运行。报告:总计/通过/失败/跳过。对于失败,显示类、方法、断言错误和堆栈跟踪的前几行。

分析

Detekt(通用):ktlint(替代):报告问题:规则名称、文件:行、消息、严重性。

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
运维部署
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需手动接入
是否需要外部接口密钥
不需要
兼容的系统
Docker
运行环境要求
Docker
检测到的文件与系统行为
  • 只读
  • 命令执行
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

## Kotlin build / test / analyze / docker

**Arguments:** $ARGUMENTS

## Project paths & JDK

Resolve project paths from `~/.claude/project-repos.json`. A Kotlin project
is any registry entry whose root contains `build.gradle` or `build.gradle.kts`.

JDK version is per-project and should be declared in the project's
`projects/{shortname}.md`. Set it before invoking Gradle:

```bash
export JAVA_HOME=$(/usr/libexec/java_home -v {version})
```

## Actions

### `build`

```bash
cd {repo-path} && ./gradlew build -x test
# Multi-module projects:
cd {repo-path} && ./gradlew :{module}:build -x test
```

On failure, suggest `./gradlew --refresh-dependencies` for dependency
errors. For compilation errors, quote the file/line and the offending type.

### `test`

```bash
# All tests:
cd {repo-path} && ./gradlew test

# A specific module:
cd {repo-path} && ./gradlew :{module}:test

# A filter (uses JUnit's `--tests`):
cd {repo-path} && ./gradlew test --tests "{filter}"

# Module + filter:
cd {repo-path} && ./gradlew :{module}:test --tests "{filter}"
```

If the project uses TestContainers, ensure Docker is running first.

Report: total / passed / failed / skipped. For failures, show class,
method, assertion error, and the first few lines of stack trace.

### `analyze`

Detekt (common):
```bash
cd {repo-path} && ./gradlew detekt
cd {repo-path} && ./gradlew :{module}:detekt
cd {repo-path} && ./gradlew detekt --auto-correct
```

ktlint (alternative):
```bash
cd {repo-path} && ./gradlew ktlintCheck
cd {repo-path} && ./gradlew ktlintFormat
```

Report issues with: rule name, file:line, message, severity.

### `docker`

Starts the project's `docker-compose.yml` services (Postgres, Redis, any
stub/mock servers):

```bash
# All services:
cd {repo-path} && docker compose up -d

# Specific service:
cd {repo-path} && docker compose up -d {service}
```

After start, wait ~5s and check health:
```bash
docker compose -f {repo-path}/docker-compose.yml ps
```

If any container is unhealthy:
```bash
docker compose logs --tail=20 {service}
```

Common fixes:
- Port conflict: `docker ps` to find the claimant
- Stale volumes: `docker compose down -v && docker compose up -d`

## Process

1. Parse arguments: action, shortname, optional module/filter/flags
2. Set JDK (skip for `docker`)
3. `cd` to the resolved project path
4. Run the command
5. Report result

---
> Source: [ajvelo/claude-toolkit](https://github.com/ajvelo/claude-toolkit) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。