mit einem Klick
tdd-workflow
当用户要求TDD、测试驱动开发、先写测试或提到红绿重构时使用。
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Menü
当用户要求TDD、测试驱动开发、先写测试或提到红绿重构时使用。
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Basierend auf der SOC-Berufsklassifikation
This skill should be used when the user requests merging work into main and then deleting all other local and remote branches, keeping only main.
当用户要求"DeepSeek API 集成"、"AI 服务"、"生成回复建议"、"调用 LLM"、"HTTP 请求"、"流式响应"、"连接池优化"、"重试策略",或者提到"DeepSeek"、"API 调用"、"reqwest"、"streaming"时使用此技能。用于 DeepSeek API 集成、HTTP 客户端配置、错误处理、流式响应、连接池优化和 API 密钥管理。
当用户要求"IPC 通信"、"进程通信"、"Agent 协议"、"stdin/stdout"、"JSON 消息"、"Orchestrator 通信"、"消息序列化",或者提到"进程间通信"、"Agent 集成"、"消息协议"时使用此技能。用于实现 Rust Orchestrator 和 Platform Agents 之间的 IPC 通信,包括消息格式定义、序列化、错误处理和性能优化。
macOS Agent 开发规范(Swift + Accessibility API),包括项目结构、Accessibility API 使用、UI Automation、IPC 通信集成、错误处理和测试。
Background knowledge about WeReply project architecture, features, and context. Automatically loaded for AI reference, not directly user-invocable.
Python Agent 开发规范(Windows wxauto v4),包括项目结构、模块化、wxauto 使用、IPC 集成、错误处理、测试和部署。
| name | tdd-workflow |
| description | 当用户要求TDD、测试驱动开发、先写测试或提到红绿重构时使用。 |
强制要求:所有新功能、Bug 修复、重构必须达到 80% 以上测试覆盖率。
先写测试,验证测试会失败(因为功能尚未实现)。
编写最小代码使测试通过。
优化代码,保持所有测试通过。
作为用户,我希望能够创建新的饲料配方。
验收标准:
- 配方名称必填,长度 2-50 个字符
- 品种代码必填,必须是有效的品种
- 创建成功后返回配方 ID
Rust 测试:
#[tokio::test]
async fn test_create_formula_success() { }
#[tokio::test]
async fn test_create_formula_empty_name() { }
#[tokio::test]
async fn test_create_formula_name_too_long() { }
#[tokio::test]
async fn test_create_formula_invalid_species() { }
TypeScript 测试:
describe('FormulaForm', () => {
it('should create formula successfully', async () => { });
it('should show error when name is empty', async () => { });
it('should show error when name is too long', async () => { });
});
cargo test # Rust
npm test # TypeScript
预期结果:测试失败。
pub async fn create_formula(&self, dto: CreateFormulaDto) -> Result<i64> {
if dto.name.is_empty() {
return Err(anyhow!("配方名称不能为空"));
}
let formula_id = sqlx::query!(
"INSERT INTO formulas (name, species_code) VALUES (?, ?)",
dto.name, dto.species_code
)
.execute(&self.pool)
.await?
.last_insert_rowid();
Ok(formula_id)
}
cargo test
npm test
预期结果:所有测试通过。
// 提取验证逻辑
fn validate_formula_name(name: &str) -> Result<()> {
if name.is_empty() {
return Err(anyhow!("配方名称不能为空"));
}
Ok(())
}
pub async fn create_formula(&self, dto: CreateFormulaDto) -> Result<i64> {
validate_formula_name(&dto.name)?;
// ...
}
cargo tarpaulin --out Html # Rust
npm run test:coverage # TypeScript
要求:覆盖率 >= 80%。
#[test]
fn test_validate_formula_name() {
assert!(validate_formula_name("测试配方").is_ok());
assert!(validate_formula_name("").is_err());
}
#[tokio::test]
async fn test_create_formula_integration() {
let pool = setup_test_db().await;
let repo = FormulaRepository::new(Arc::new(pool));
let dto = CreateFormulaDto {
name: "测试配方".to_string(),
species_code: "PIG".to_string(),
};
let result = repo.create(dto).await;
assert!(result.is_ok());
cleanup_test_db().await;
}
import { vi } from 'vitest';
vi.mock('../bindings', () => ({
commands: {
createFormula: vi.fn(),
},
}));
it('should create formula', async () => {
vi.mocked(commands.createFormula).mockResolvedValue({
success: true,
data: { id: 1 },
});
const result = await createFormula(dto);
expect(result.success).toBe(true);
});
use mockall::mock;
mock! {
pub FormulaRepository {
async fn create(&self, dto: CreateFormulaDto) -> Result<i64>;
}
}
#[tokio::test]
async fn test_with_mock() {
let mut mock_repo = MockFormulaRepository::new();
mock_repo.expect_create().returning(|_| Ok(1));
let service = FormulaService::new(Arc::new(mock_repo));
let result = service.create_formula(dto).await;
assert!(result.is_ok());
}
test_validate_formula_name_rejects_empty_string