一键导入
write-tests
Add or expand unit/integration tests for existing code (when testing is configured). Use proactively when tests need to be added or expanded.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add or expand unit/integration tests for existing code (when testing is configured). Use proactively when tests need to be added or expanded.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create blog posts — from a topic (writes content) or with provided content (scaffolding). Use proactively when creating new blog posts or articles.
Pre-publication audit for blog posts — comprehensive final review of SEO, AEO, accessibility, images, content quality, i18n parity, and project conventions before publishing. Use proactively before publishing any blog post.
Pre-publication audit for blog series — validates series definition, post ordering, cross-post consistency, navigation, and runs individual post audits for all posts in the series. Use proactively before publishing any blog series.
Audit the blog tag taxonomy — frequency analysis, orphan detection, hierarchy validation, and proposals for new subtopic tags. Read-only — proposes, never modifies tags or posts. Use proactively before each release cycle or after a content drop of 5+ posts.
Optional DeepWorkPlan addon that connects an AI-first repo to the developer's Dailybot team — installing (with consent) the Dailybot agent skill (DailybotHQ/agent-skill) and/or the Dailybot CLI (DailybotHQ/cli), wiring the plan lifecycle into best-effort agent updates - kickoff when a plan starts, significant task completions, a blocked report when an unattended run halts, and a milestone on plan completion - with payloads derived from the plan's state layer, and optionally committing the Dailybot skill's deterministic hook enforcement (dailybot hook lifecycle hooks, CLI >= 1.12.0) so the agent harness itself reminds agents about unreported work. Opt-in, never required, never blocks the work, reconciles existing setups instead of clobbering them, and defers all auth to the Dailybot skill's own consent flow. Use when the developer or team already uses Dailybot and wants DWP progress visible to humans.
Optional DeepWorkPlan addon that safely upgrades a repo's dependencies — reasoning about the repo's ACTUAL package manager (npm/pnpm/yarn + ncu, pip/poetry/uv, cargo, go mod, bundler, composer, and more) rather than assuming npm — with a batched, validated, revertible workflow that detects the manager and manifests/lockfiles, classifies upgrades (patch/minor/major), upgrades in safe batches, runs the repo's real validation gate after each batch, reverts a failing batch, and summarizes. Opt-in, never required, reconciles with the repo's existing tooling. Use when the developer wants to bring dependencies up to date without breaking the build.
| name | write-tests |
| description | Add or expand unit/integration tests for existing code (when testing is configured). Use proactively when tests need to be added or expanded. |
| disable-model-invocation | false |
| allowed-tools | Read, Write, Edit, Glob, Grep, Bash |
| model | sonnet |
| tier | 2 |
| intent | tests |
| max-files | 10 |
| max-loc | 500 |
Add or expand tests for existing code. This skill creates or extends test files with meaningful cases, edge cases, and mocks.
src/lib/*.test.tsTier: 2 - Standard
Reasoning: Writing tests requires moderate reasoning (understanding behavior, edge cases, mocks). Scope typically 1-10 files, 100-500 LOC; standard development work.
$TARGET: File(s) or module to add tests for (e.g., src/components/blog/BlogCard.svelte)$SCOPE: What to cover (e.g., "unit for props", "interaction tests", "edge cases for null")$EXISTING: Path to existing test file to extendtests/fixtures/posts.ts)vitest.config.ts at project root@/ maps to src/ (matches tsconfig)@sveltejs/vite-plugin-svelte with hot: falseconditions: ['browser'] for Svelte 5 component teststests/mocks/astro-content.ts (aliased in vitest config)tests/
├── unit/
│ ├── lib/ # Utility function tests
│ │ ├── blog.test.ts
│ │ ├── i18n.test.ts
│ │ ├── search.test.ts
│ │ └── translations.test.ts
│ └── components/ # Svelte component tests
│ ├── BlogCard.test.ts
│ └── BlogPagination.test.ts
├── fixtures/
│ └── posts.ts # Mock blog post data
├── helpers/
│ └── setup.ts # Test setup (jest-dom matchers)
└── mocks/
└── astro-content.ts # Mock for astro:content virtual module
Utility function tests:
import { describe, expect, it } from 'vitest';
import { getPostSlug } from '@/lib/blog';
describe('getPostSlug', () => {
it('strips date prefix from post ID', () => {
expect(getPostSlug('en/2024-03-15_my-post')).toBe('my-post');
});
});
Svelte component tests:
import { render, screen } from '@testing-library/svelte';
import { describe, expect, it } from 'vitest';
import BlogCard from '@/components/blog/BlogCard.svelte';
import { publishedEnglishPost } from '../../fixtures/posts';
describe('BlogCard', () => {
it('renders post title', () => {
render(BlogCard, { props: { post: publishedEnglishPost as never } });
expect(screen.getByText('My Awesome Post')).toBeDefined();
});
});
Important notes:
as never cast for mock posts passed to functions expecting CollectionEntry<'blog'>resolve.conditions: ['browser'] in vitest configastro:content (e.g., getBlogPosts)tests/unit/tests/unit/tests/fixtures/ when applicablepnpm run test # Run tests
pnpm run biome:check # Lint check
## Tests Added/Updated
### Target
{What was tested}
### Files
- `tests/.../foo.test.ts`: {created|updated} — {brief description}
### Coverage
- {list of cases covered}
### Validation
- pnpm run test: pass
- pnpm run biome:check: pass
### Commit Message
test: add|expand tests for {target}
*.test.tsStop and escalate if:
astro:content beyond the existing stubpnpm run test)pnpm run biome:check passesEscalate to Tier 3 if: integration/E2E design needed, or test architecture decisions.