ha-test-strategy
Hope-native test strategy for features, fixes, and refactors: select test-first, regression-first, characterization, integration, E2E, or manual evidence according to risk and repository rules.
git clone --depth 1 https://github.com/shiwenwen/hope-agent /tmp/ha-test-strategy && cp -r /tmp/ha-test-strategy/skills/ha-test-strategy ~/.claude/skills/ha-test-strategySKILL.md
# Hope Test Strategy Choose tests that reduce uncertainty about the requested behavior. Test-first is a valuable technique, not an unconditional law. ## Precedence Follow the user's request and repository instructions. Do not run broad suites, install dependencies, or rewrite test infrastructure when the project forbids or does not require it. ## Select The Strategy ### Test-first Prefer a failing test before implementation when the new contract is clear, the test seam is stable, and observing the failure proves the test is meaningful. ### Regression-first For a bug, reproduce the original failure in the narrowest credible automated test before or alongside the fix. Confirm it fails for the right reason, then passes after the root-cause change. ### Characterization-first For legacy, poorly documented, or risky refactors, capture current intentional behavior before changing structure. Do not freeze a known bug as desired behavior. ### Implementation-first with immediate coverage Reasonable for exploratory seams, generated code, mechanical migrations, or UI work where the correct test boundary becomes clear only after a small reversible implementation. Add the relevant proof before claiming completion. ### No new automated test Reasonable for pure docs, trivial metadata, generated outputs, or low-risk mechanical changes when existing checks directly cover the risk. Explain the decision rather than adding a meaningless test. ## Choose The Layer - Unit: pure logic, state transition, parser, policy, or failure classification. - Integration: persistence, adapter, protocol, or cross-module contract. - E2E: a user-critical path that only becomes true across the full stack. - Manual smoke: visual layout, OS integration, credentials, or external state that cannot be honestly simulated. Use the lowest layer that proves the contract. Add a higher layer only for a boundary the lower layer cannot cover. ## Test Quality - Assert observable behavior, not incidental implementation details. - Keep fixtures deterministic and failures diagnostic. - Cover the demonstrated edge, including cancellation, retry, stale state, or partial failure when relevant. - Avoid mocks that erase the boundary being tested. - Do not weaken existing assertions merely to make a change pass. ## Execute Efficiently 1. Run the narrowest new or failing test. 2. Run the nearest affected suite when justified. 3. Use `ha-verify` to decide whether broader gates are needed at closeout. If a test is flaky or environment-blocked, investigate the cause. Do not rerun until green and call that proof. ## Smoke Prompts - "Choose and add the right regression test for this bug." - "Refactor this legacy parser without freezing the broken behavior." - "Decide whether this UI change needs unit, E2E, or manual evidence."
>
Use when the user asks to draft, polish, translate, or reply to an email. Produces a clean draft with subject line, greeting, body, and sign-off, plus a pre-send self-check.
Use when the user mentions 飞书 / Feishu / Lark workspace operations: docx (云文档) read/write, bitable (多维表格) records / views / dashboards, drive (云盘) upload/download, wiki (知识库) link resolution, approval (审批) instance create/cancel/query, calendar (日历) event create/list/update + attendees, contact (联系人) user/department lookup, hire (招聘) job/talent/application listing. Trigger on phrases like 'OKR 周报', '把这份文档发到飞书云盘', '给团队拉个评审会议', '查 [姓名] 的联系方式', '撤销那条审批', '/wiki 链接', or any request that mentions a feishu / lark URL / token (doxcn.../bascn.../wikcn.../boxcn.../om_...).
Hope Agent browser automation — the standard `status → tabs → snapshot → act` loop, stale-ref recovery rules, and what to do when login / 2FA / captcha / camera-prompt / dialog blocks progress. Load this skill whenever you reach for the `browser` tool. Trigger on: user asks the agent to open / control / click / scrape / log into / verify something in a web app ('open X and click Y', '打开 X 然后点击 Y', 'log into my Gmail', 'scrape this page', 'fill out the form on X'); user reports a flow that requires real browser context (cookies, JS-rendered content, OAuth).
Hope-native review of uncommitted, staged, commit, branch, or PR changes: discover concrete regressions, independently verify candidates, and report actionable findings first without speculative noise.
Hope-native baseline for implementing, fixing, refactoring, and maintaining code: inspect the repository first, protect user changes, keep scope narrow, and finish with direct evidence.
Hope-native implementation planning for non-trivial code changes: ground the plan in repository evidence, order dependencies, name critical files and risks, define verification, then continue execution when allowed.
Hope-native local-first data analysis and Artifact reporting. Use for CSV/XLSX analysis, KPI readouts, metric diagnosis, product/business analysis, data-quality review, dashboards, charts, analytical reports, 数据分析, 指标诊断, 数据质量, 分析报告, or when the user wants a shareable offline HTML/ZIP/Markdown/PDF result. Produces the versioned AnalysisArtifactV1 contract and registers it with the artifact tool; never guesses missing data or requires public web deployment.