Codync
免费开源的 1:1 Grok Bot 与 Muse 替代方案。可在 iPhone、Mac 或 Linux 桌面上将 Claude 代码、Codex、Cursor 以及 40 多个编码代理作为持久机器人使用。支持群组聊天、线程、应用。
AI 翻译
A test generation skill framework for AI IDEs, following the test pyramid methodology with Evaluation-Driven Development (EDD) and Specification-Driven Development (SDD).
翻译准备中
开发工具TypeScript · PythonGitHub @agiledon自行安装运营者未确认
试用过了吗? 点一下就好,无需登录。
尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
安装型项目无需部署域名也可验证。个人仓库可通过 GitHub 登录验证,组织仓库可使用上方的仓库验证文件。
制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗English | 简体中文
A test generation skill framework for AI IDEs, following the test pyramid methodology with Evaluation-Driven Development (EDD) and Specification-Driven Development (SDD).
Khufu provides seven skills — /khufu-ut, /khufu-it, /khufu-api, /khufu-e2e, /khufu-harness, /khufu-to-prd, and /khufu-to-test-cases — that leverage AI agents to generate unit tests, integration tests, API tests, end-to-end tests, project constraint assets (Harness Engineering), MVP PRDs, and test cases traced to those PRDs.
Evaluate → Verify → Improve feedback loopspecs/<feature>/spec.v<N>.md). Supports forward generation (Spec → Tests) and reverse generation (Tests → Spec). Each test links back to its spec entry/khufu-ut @docs/spec.md)fragile), or requires refactoring (recorded to untestable-report.md)/khufu-to-prd grills a requirement description, splits it into MVPs, and writes Cockburn fully dressed use cases under docs/prd/ (prd-mvp1.md, prd-mvp2.md, … and prd-catalog.md)/khufu-to-test-cases writes one document per PRD under docs/test-cases/ (test-cases-prd-mvp1.md, …), with one case per main flow, alternate flow, and independently asserted business rule. A script classifies only the words after the command. With no PRD path, the skill asks in the reply and does not scan or write. After you choose to scan, it lists the files and asks again before generating. prd-catalog.md is an index, not an inputdocs/khufu/api/oracle-mismatch.md or docs/khufu/e2e/oracle-mismatch.md# Install globally
npm install -g khufu-kit
# Initialize in your project. The tool list has nothing pre-selected.
cd your-project
khufu init
# Check for a newer version on npm and update if available
khufu update
# Use the skills in your IDE (e.g. Claude Code)
/khufu-ut # Generate unit tests
/khufu-it # Generate integration tests
/khufu-api # Generate API tests
/khufu-e2e # Generate E2E tests
/khufu-harness # Build / update project constraint assets
/khufu-to-prd # Grill a requirement into MVP PRDs
/khufu-to-test-cases @docs/prd/prd-mvp1.md # Turn that PRD into test cases
Khufu installs its skills into each tool using that tool's own skill/command directory convention, so the same khufu init works everywhere:
| Tool | Skill/Command directory (project) | Global directory |
|---|---|---|
| Claude Code | .claude/skills/ | ~/.claude/skills |
| Cursor | .cursor/commands/ | ~/.cursor/commands |
| OpenCode | .opencode/commands/ | ~/.opencode/commands |
| Codex (OpenAI) | .codex/skills/ | ~/.codex/skills |
| Qoder | .qoder/skills/ | ~/.qoder/skills |
| Trae | .trae/skills/ | ~/.trae/skills |
khufu init asks which tools to install. None is pre-selected. --yes and a non-interactive run do not choose a tool; pass --ide:
khufu init --ide claude,qoder,trae # required with --yes, or when there is no terminal
khufu init --ide claude --scope global # same as --global; default scope is project
khufu init --ide claude --yes --force # skip the remaining prompts and overwrite .khufu/khufu.yaml
--yes accepts a detected language without asking, and falls back to Java when none is detected. It does not choose a tool.
Each selected tool receives all seven skills (khufu-ut, khufu-it, khufu-api, khufu-e2e, khufu-harness, khufu-to-prd, khufu-to-test-cases) in its own directory. Companion files ship with the skill, including khufu-to-test-cases/scripts/resolve_prd_args.py.
khufu update compares your installed version against the latest published khufu-kit on npm:
khufu update # interactive — prompts before updating
khufu update -y # update automatically without prompting
| Language | UT Frameworks | IT Frameworks | API Frameworks | E2E Frameworks |
|---|---|---|---|---|
| Java | JUnit 5/4, TestNG | Spring Boot Test, Testcontainers, H2 | REST Assured, MockMvc | Playwright, Selenium |
| Python | pytest, unittest | pytest + testcontainers | pytest + httpx | Playwright |
| TypeScript/JS | Jest, Vitest, Mocha | Jest + Supertest | Supertest | Playwright, Cypress |
| Go | testing + testify | testing + dockertest | testing + httptest | Playwright |
| C# | xUnit, NUnit, MSTest | xUnit + Testcontainers | RestSharp | Playwright |
| C++ | Google Test, Catch2, doctest | Google Test | pytest + httpx | Playwright, Qt Test |
Init detects Java, Python, TypeScript, JavaScript, Go, C#, C++, Rust, Ruby, and Elixir from project files. It writes framework, directory, and coverage defaults for the languages in the table. Rust, Ruby, and Elixir are recognized, and the interactive language list also offers Rust and Ruby, but those three do not receive framework defaults. C++ is detected from CMakeLists.txt or xmake.lua; it is not on the manual language list.
Khufu enforces a non-overlapping test pyramid. Each layer owns a distinct risk dimension:
| Layer | Owns | Does NOT Own |
|---|---|---|
| UT | Business logic, algorithms, validation, state transitions | DB queries, HTTP routing, UI |
| IT | Component wiring, transaction boundaries, ORM mappings, DB constraints | Business logic details, HTTP status codes |
| API | Status codes, response schemas, headers, auth/authz, content negotiation | Component internals, DB state |
| E2E | Critical user journeys, multi-page workflows, browser interactions | Edge-case validation, exhaustive error paths |
When generating tests at a layer, khufu scans lower-layer tests and skips scenarios that add no new risk — keeping your suite lean and fast.
Khufu treats test specifications as first-class artifacts. Each feature gets a versioned Markdown spec:
specs/
├── UserRegistration/
│ ├── spec.v1.md # Versioned specification
│ ├── spec.v2.md
│ └── CHANGELOG.md # Spec change history
Each spec file contains:
# Feature: UserRegistration
- Version: 1 | Created: 2026-06-25 | Source: spec-based | Criticality: High
## Evaluation Criteria ← EDD: defined BEFORE tests
### Correctness(正确性)
- [ ] Normal input returns User with ID
- [ ] Duplicate email throws DuplicateEmailException
## Unit Tests
### UT-USER-001: shouldCreateUser_whenValidInputGiven
- Category: happy-path | Status: implemented
- Test File: `__tests__/UserService.test.ts`
- Evaluates: Correctness — normal input returns User
**Scenario:** Given ... When ... Then ...
## Evaluation Summary ← EDD: filled AFTER test execution
| Criteria | Target | Actual | Status |
|----------|--------|--------|--------|
| Line coverage | ≥85% | 88% | ✅ |
| Branch coverage | ≥75% | 72% | ❌ |
Spec lifecycle: planned → implemented → evaluated → passed (failed criteria trigger re-evaluation).
For tightly-coupled code that resists standard mocking, khufu-ut offers:
@Tag("fragile") and excluded from CI by defaultuntestable-report.md with refactoring recommendationsAfter khufu init, configuration is .khufu/khufu.yaml. .khufu/installed-skills.json records what was installed. A TypeScript project looks like this:
ide:
- claude
- qoder
- trae
language: typescript
frameworks:
ut: jest
it: jest
api: supertest
e2e: playwright
directories:
ut: __tests__/
it: __tests__/integration/
api: __tests__/api/
e2e: e2e/
coverage:
ut:
tool: jest
thresholds:
line: 80
branch: 70
function: 80
formats: [lcov, html, text]
excludes: ['**/*.d.ts', '**/index.ts', '**/*.config.*']
it:
tool: jest
thresholds:
line: 60
branch: 50
formats: [lcov, html]
excludes: ['**/*.config.*']
scope: project
Java, Python, Go, C#, and C++ receive their own framework, directory, and coverage defaults. Init does not write spec, evaluation, categories, or dataFactories. Skills still apply those rules from skills/_shared/. You can add an optional spec block later; test-layer skills read spec.directory (default specs/) and spec.docsDirectory (default docs/khufu/) when it is present. --force replaces an existing .khufu/khufu.yaml.
skills/
├── _shared/
│ ├── mode-selection.md # Spec-based vs code-based mode
│ ├── language-detection.md # Language and khufu.yaml
│ ├── framework-selector.md # Framework routing by language × layer
│ ├── directory-resolver.md # Test directory resolution
│ ├── coverage-config.md # Coverage tool configuration
│ ├── compilation-verification.md # Compile the generated tests
│ ├── test-execution-verification.md # Run the generated tests
│ ├── evaluation-framework.md # EDD methodology
│ ├── test-pyramid-strategy.md # Layer deduplication rules
│ ├── spec-sync.md # Skip scenarios already generated
│ ├── spec-doc-scanner.md # Read docs/khufu execution records
│ ├── spec-doc-generator.md # Write docs/khufu execution records
│ ├── test-data-factories.md # Shared data factory patterns
│ ├── report-template.md # Unified report generation
│ ├── parallel-execution.md # Split generation across sub-agents
│ └── oracle-binding.md # Code binds the call; the test case locks the assertion
├── khufu-ut/SKILL.md # Unit test generator
├── khufu-it/SKILL.md # Integration test generator
├── khufu-api/SKILL.md # API test generator
├── khufu-e2e/SKILL.md # E2E test generator
├── khufu-harness/SKILL.md # Constraint asset builder
├── khufu-to-prd/SKILL.md # MVP PRDs as Cockburn use cases
└── khufu-to-test-cases/
├── SKILL.md # PRD to docs/test-cases
└── scripts/resolve_prd_args.py # Decide whether the invocation named a PRD
khufu-ut, khufu-it, khufu-api, and khufu-e2e read _shared/ through the Read tool. Shared logic is defined once. khufu-harness, khufu-to-prd, and khufu-to-test-cases follow their own workflows.
A single command symlinks the skills into place so Claude Code loads them directly from your working tree:
git clone https://github.com/agiledon/khufu.git
cd khufu
npm install
npm run build
npm run setup # creates symlinks for local development
What setup does:
skills/_shared/ → _shared/ at the project root (so Read _shared/... references in skill files resolve correctly)skills/khufu-*/ → .claude/skills/khufu-*/ (Claude Code loads skills from .claude/skills/)khufu initAfter setup, edit any file under skills/ and changes are live immediately — no rebuild, no copy step.
npm test # run khufu's own tests
npm run dev # watch mode (tsc --watch)
Use npm link to register the local khufu CLI globally, then initialize it in your target project:
# Step 1: Build khufu-kit from source
cd /path/to/khufu-kit
npm install
npm run build
npm link # registers 'khufu' command globally
# Step 2: Install into your project
cd /path/to/your-project
khufu init # writes .khufu/khufu.yaml and installs skills into the selected IDE(s)' skills/commands directory
To pick up changes after editing khufu-kit's source:
cd /path/to/khufu-kit
npm run build # recompile TypeScript
# The 'khufu' command now uses the updated build automatically (npm link)
To undo the global link when done:
cd /path/to/khufu-kit
npm unlink -g khufu-kit
Alternatively, use npm install with a local path (no global link):
cd /path/to/your-project
npm install /path/to/khufu-kit
npx khufu init
MIT