工程开发工作流与质量规范
superpowers
核心工程工作流,在每一项任务中都会激活。强制执行系统化的“先计划后编码”方法论、多文件重构安全、依赖感知的变更、预检验证以及零占位符质量标准。在所有编码任务中主动(PROACTIVELY)使用。
- License 许可
- MIT
- 最近更新
- 2026-09-14
- Stars
- ★ 68
- Forks
- 15
01 前言 Front Matter
- name
- superpowers
- description
- Core engineering workflow that activates on EVERY task. Enforces systematic plan-before-code methodology, multi-file refactoring safety, dependency-aware changes, pre-flight verification, and zero-placeholder quality standards. Use PROACTIVELY on all coding tasks.
03 SKILL.md 正文
Engineering Superpowers
Workflow (ALWAYS follow this order)
1. ANALYZE — Understand before you touch
read_file → grep → glob → understand patterns → identify dependencies
- Read every file you plan to modify BEFORE writing anything
- Check
package.json/requirements.txtfor existing dependencies - Map the dependency graph: what imports what
- Identify established patterns (naming, structure, error handling)
- Check for existing tests related to the code you'll change
2. PLAN — Think before you code
- Break task into ordered steps with
write_todos - Identify files to create vs modify vs delete
- Map the blast radius: what breaks if you change X?
- Plan the order of changes (dependencies first, dependents after)
- Consider edge cases BEFORE implementing
3. IMPLEMENT — Write production code
- Complete, working code — never TODOs, placeholders, or stubs
- Handle ALL edge cases: empty input, null, undefined, network errors, timeouts
- Use proper TypeScript types —
unknownoverany, explicit return types - Follow patterns already in the codebase
- Install dependencies BEFORE importing them
4. VERIFY — Prove it works
- Search for
TODO,FIXME,PLACEHOLDER,HACKin your output - Verify all imports resolve to real files/packages
- Run build command to catch type errors
- Run tests if they exist
- Check for unused imports and dead code
Multi-File Refactoring Safety
Pre-Flight Checklist
1. List ALL files that will be affected
2. Check git status — are there uncommitted changes?
3. Identify the dependency order for changes
4. Plan rollback: what to revert if something breaks
Change Order Protocol
1. Create new files first (no existing code depends on them)
2. Update shared modules (types, utils, constants)
3. Update consumers (components, routes, handlers)
4. Update entry points (index files, main files)
5. Remove deprecated code LAST
Rename/Move Safety
1. Find ALL references: grep for imports, usages, config references
2. Update ALL import paths in dependent files
3. Update barrel exports (index.ts files)
4. Update config files (tsconfig paths, webpack aliases)
5. Verify build passes after EVERY rename
Code Quality Standards
TypeScript
// GOOD: Explicit types, error handling, validation
async function fetchUser(id: string): Promise<User> {
if (!id?.trim()) throw new Error("User ID required");
const response = await fetch(`/api/users/${encodeURIComponent(id)}`);
if (!response.ok) {
throw new HttpError(`User fetch failed: ${response.status}`, response.status);
}
return response.json() as Promise<User>;
}
// BAD: No types, no validation, no error handling
async function fetchUser(id) {
const res = await fetch(`/api/users/${id}`);
return res.json();
}
Error Handling
// Typed error classes over generic Error
class AppError extends Error {
constructor(message: string, public code: string, public statusCode: number) {
super(message);
this.name = "AppError";
}
}
// Async error boundary pattern
async function safeExecute<T>(fn: () => Promise<T>, fallback: T): Promise<T> {
try {
return await fn();
} catch (error) {
logger.error("Operation failed", { error: error instanceof Error ? error.message : String(error) });
return fallback;
}
}
Naming Conventions
| Type | Convention | Example |
|---|---|---|
| Components | PascalCase | UserProfile.tsx |
| Utilities | camelCase | formatCurrency.ts |
| Constants | UPPER_SNAKE | MAX_RETRY_COUNT |
| Types | PascalCase | ApiResponse |
| Enums | PascalCase + UPPER members | enum Status { ACTIVE, INACTIVE } |
| Files | kebab-case or camelCase | user-service.ts |
| Directories | kebab-case | api-routes/ |
Anti-Patterns (NEVER DO THESE)
anytype — useunknownand narrow with type guardsconsole.logfor errors — use structured logger or throw- String concatenation in SQL/URLs — use parameterized queries and
URLAPI - Empty catch blocks — at minimum log, ideally handle or rethrow
!importantin CSS — fix the specificity instead- Hardcoded values — use constants, config, or environment variables
- Barrel re-exports with side effects — causes tree-shaking failures
- Circular imports — restructure to break the cycle
Performance Defaults
- Use
constoverlet— nevervar - Prefer
Map/Setover plain objects for dynamic lookups - Use early returns to avoid deep nesting
- Debounce expensive operations (search, resize, scroll handlers)
- Lazy-load heavy modules with dynamic
import() - Use
AbortControllerfor cancellable fetch requests
04 同仓库更多 Skills
演示测试技能
demo-skill
用于测试的演示插件技能。
智能体技能开发
write-a-skill
创建新的智能体技能,具备合理的结构、渐进式披露(progressive disclosure)机制和配套捆绑资源。当用户想要创建、编写或构建新技能时使用。
网络调研与数据提取
web-research
深度网络研究与数据提取技能。通过获取 URL、阅读文档、爬取 API 文档、评估 npm/pypi 包、比较技术,并将研究发现综合为可操作的建议,系统地研究任意主题。适用于研究库、框架、API、解决方案,或任何需要网络调查的主题。
自动化测试套件设计与实现
testing
设计并实现全面的测试套件。涵盖单元测试、集成测试、使用 Playwright 的 E2E 测试、API 测试、mock 策略、测试数据工厂、TDD 工作流、快照测试、覆盖率目标以及 CI 集成。适用于编写测试、设计测试架构或排查测试失败。
CSS样式系统设计与实现
styling
使用 Tailwind CSS、原生 CSS 或 CSS-in-JS 实现生产级样式系统。涵盖 CSS 架构(BEM、utility-first、模块化)、设计令牌、响应式模式、动画系统、暗黑模式、容器查询、打印样式以及性能优化。适用于实现设计或构建 CSS 架构。
shadcn/ui 界面构建
shadcn-ui
使用 shadcn/ui 组件、Radix 原语和 Tailwind CSS 构建高品质界面。涵盖安装、组件定制、主题、暗黑模式、使用 react-hook-form + Zod 的表单模式、带排序/过滤/分页的数据表格、命令面板、toast 模式以及可组合的组件架构。适用于使用 shadcn/ui 构建 UI 时使用。