create-unit-test
建立可直接用於專案的單元測試
單元測試常常偏離專案慣例,並變得難以維護。此技能為 Claude、Codex 和 Claude Code 提供一套聚焦的工作流程,用於建立可靠且符合 Android 與 Kotlin 專案標準的測試。
使用我的智慧代理安裝
將此請求複製給你的智慧代理,其中包含權威 Skill 頁面和清單。
Review the Skillstore skill "create-unit-test" from https://skillstore.io/skills/anysoftkeyboard-create-unit-test.md and its manifest at https://skillstore.io/api/skills/anysoftkeyboard-create-unit-test/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智慧代理仍應顯示其計畫,並依安全政策請求必要確認。
Agent 可讀資源
當 AI Agent、爬蟲或腳本需要乾淨脈絡、而不是讀取完整頁面時,請使用這些連結。
測試它
正在使用「create-unit-test」。 為 database mapper 類別新增測試。
預期結果:
- 在相符的測試原始碼路徑中新增 mapper 測試檔案。
- 針對有效 mapping 行為的 happy path 測試。
- 在相關時,針對 null、empty 或 invalid values 的 edge case 測試。
- 用於驗證變更的 Gradle module test command。
正在使用「create-unit-test」。 為 Android activity helper 建立單元測試。
預期結果:
- 針對 Android framework 互動的 Robolectric-based 單元測試。
- 用於確定性設定的 fakes 或提供的 resources。
- 清楚的 Arrange-Act-Assert 測試方法。
- 關於任何需要 instrumentation 而非單元測試的行為備註。
正在使用「create-unit-test」。 實作後單元測試失敗。
預期結果:
- 需要檢查的相關 Gradle XML 報告路徑。
- 根據報告做出的精簡失敗診斷。
- 聚焦的修正,以及重新執行相關 test task。
安全審計
安全The static findings are false positives caused by Markdown backticks around filenames, paths, Gradle commands, and testing terminology. No prompt injection, data exfiltration, unsafe networking, credential access, or malicious intent was found in SKILL.md.
風險因素
分享與引用此報告
分享版本化評估報告、中性徽章、嵌入卡片與引用。Skillstore 只報告證據,不判斷該 Skill 是否安全。
複製報告連結
https://skillstore.io/skills/anysoftkeyboard-create-unit-test/audits/11?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/anysoftkeyboard-create-unit-test?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/anysoftkeyboard-create-unit-test?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/anysoftkeyboard-create-unit-test/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/anysoftkeyboard-create-unit-test.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>學術引用 (APA · BibTeX · CFF)
APA 引用
AnySoftKeyboard. (2026). create-unit-test security audit report (audit version 11) [Author version unspecified]. Skillstore. https://skillstore.io/skills/anysoftkeyboard-create-unit-test/audits/11BibTeX 引用
@techreport{anysoftkeyboard-anysoftkeyboard-create-unit-test-2026,
author = {AnySoftKeyboard},
title = {create-unit-test security audit report (audit version 11)},
institution = {Skillstore},
year = {2026},
number = {11},
url = {https://skillstore.io/skills/anysoftkeyboard-create-unit-test/audits/11},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "create-unit-test security audit report (audit version 11)"
version: "unspecified"
type: report
authors:
- name: "AnySoftKeyboard"
date-released: "2026-07-09"
url: "https://skillstore.io/skills/anysoftkeyboard-create-unit-test/audits/11"
identifiers:
- type: other
value: "skillstore:anysoftkeyboard-create-unit-test:audit:11"
description: "Skillstore immutable audit report identifier"
Skillstore 評分
評分依據 證據置信度: 高你可以打造什麼
為新的 Kotlin 類別新增測試
建立相符的測試檔案,選擇有用的 happy path 與 edge cases,並執行正確的 Gradle test task。
在貢獻者之間標準化測試工作
讓助手與團隊成員遵循相同的測試名稱、位置、fakes、Robolectric 與可靠性規則。
診斷失敗的單元測試
使用 Gradle 測試輸出與 XML 報告來定位失敗,並引導聚焦的修正。
試試這些提示
Use the create-unit-test skill to add unit tests for this class. Focus on observable behavior, use the correct test file location, and run the module test task.
Use the create-unit-test skill to identify happy path, edge case, and error case tests for this source file. Implement the most valuable cases and explain any skipped cases.
Use the create-unit-test skill to write a Robolectric unit test for this Android component. Provide resources or fakes as needed and keep the test deterministic.
Use the create-unit-test skill to run the relevant Gradle unit tests, inspect the failure report, fix the test or source issue, and rerun the test task until it passes.
最佳實務
- 在選擇實作細節之前,先了解行為與測試結果。
- 當 fakes 能讓測試更簡單且更貼近真實情境時,優先使用 fakes 而非 mocks。
- 先執行最小且相關的 Gradle test task,然後在 commit 前執行更廣泛的套件。
避免
- 除非任務明確是 instrumentation testing,否則不要將單元測試放在 androidTest 中。
- 不要撰寫依賴 timing、external services 或 nondeterministic state 的測試。
- 當請求只要求測試行為時,不要建議原始碼實作細節。
常見問題
此技能會自動撰寫測試嗎?
此技能最適合哪些專案?
什麼時候應該使用 Robolectric?
它偏好 mocks 還是 fakes?
它可以診斷失敗的測試嗎?
安裝此技能安全嗎?
開發者詳細資訊
授權
MIT
Skillstore 修訂
r1
版本提示
作者未聲明版本。
引用
7db9b9f06e0ab79c575b58bc48c4d8dc9849f424
維護新鮮度
2026/7/22
使用量
5 次下載 · 181 次瀏覽
檔案結構
📄 SKILL.md