软件工程师:生产就绪的代码与整洁架构 - Openclaw Skills
作者:互联网
2026-04-05
什么是 软件工程师?
软件工程师技能旨在通过生成符合高级工程师标准的编码,提升 AI 驱动的开发水平。它优先采用“先读后写”的方法,确保每一行新代码都尊重项目现有的风格、命名规范和依赖版本。通过将此技能集成到您的 Openclaw Skills 库中,您可以让您的智能体做出明智的架构决策,平衡交付速度与长期可维护性。
该技能通过在处理程序、服务和存储库之间强制执行严格的边界,超越了简单的代码生成。它将错误视为一等公民,摒弃通用的 catch 块,转向类型化、上下文感知的错误处理。结果是代码读起来像散文一样——简单、可预测且随时可以进行拉取请求(PR)审查。
下载入口:https://github.com/openclaw/skills/tree/main/skills/ivangdavila/software-engineer
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install software-engineer
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 software-engineer。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
软件工程师 应用场景
- 在保持严格架构层的同时,从零开始构建新功能。
- 将复杂的遗留函数重构为模块化、可测试的组件。
- 在关键业务路径中实现稳健的错误处理和日志记录。
- 记录架构折中方案,确保技术债得到跟踪和管理。
- 自动化代码审查,以识别反模式、幻数和过度工程。
- 该技能首先扫描当前代码库,以映射出既有的模式、库和项目结构。
- 它根据 YAGNI(你不需要它)原则评估特定需求,以避免过度工程。
- 遵循分层的关注点分离编写代码,确保业务逻辑与基础设施细节隔离。
- 在逻辑中注入稳健的错误处理,提供上下文并区分致命故障与可恢复故障。
- 应用最终的 PR 就绪检查清单,确保函数简洁、边缘情况得到处理且删除了死代码。
软件工程师 配置指南
要在您的环境中激活此技能,请确保已在智能体配置中注册。Openclaw Skills 旨在与您现有的开发工具无缝协作。
# 通过 CLI 安装
clawdbot install software-engineer
安装完成后,为智能体提供对 patterns.md 或 architecture.md 文件的访问权限,以便根据您的特定组织标准进一步定制其输出。
软件工程师 数据架构与分类体系
软件工程师技能通过以下元数据和文档文件,利用结构化方法实现项目情报:
| 组件 | 用途 |
|---|---|
patterns.md |
存储项目特定的编码模式和重复逻辑结构。 |
architecture.md |
记录高层设计选择及系统边界背后的基本原理。 |
testing.md |
为新代码定义所需的测试框架和质量基准。 |
数据分层处理,从处理程序(验证)到服务(逻辑)再到存储库(数据访问),确保没有任何一层成为瓶颈或紧耦合的源头。
name: Software Engineer
slug: software-engineer
version: 1.0.0
homepage: https://clawic.com/skills/software-engineer
description: Write production-ready code with clean architecture, proper error handling, and pragmatic trade-offs between shipping fast and building right.
metadata: {"clawdbot":{"emoji":"?????","requires":{"bins":[]},"os":["linux","darwin","win32"]}}
When to Use
Agent needs to write, review, or refactor code. Handles implementation decisions, architecture trade-offs, and code quality across any language or framework.
Quick Reference
| Topic | File |
|---|---|
| Code patterns | patterns.md |
| Architecture decisions | architecture.md |
| Testing practices | testing.md |
Core Rules
1. Read Before Write
- Check existing code style, patterns, and conventions before writing new code
- Respect the current stack — never swap libraries without explicit request
- Match naming conventions, formatting, and project structure already in place
2. Code That Compiles
Every code block must:
- Have correct imports for the actual library versions in use
- Use APIs that exist in the project's dependency versions
- Pass basic syntax checks — no placeholder
// TODO: implement
3. Minimal First
- Solve the specific problem, not hypothetical future problems
- One abstraction when you have three concrete cases, not before
- Features that might be needed → skip. Features that are needed → implement
4. Errors as First-Class Citizens
? catch (e) {}
? catch (e) { console.log(e) }
? catch (e) { logger.error('context', { error: e, input }); throw new DomainError(...) }
- Typed errors over generic strings
- Include context: what operation failed, with what input
- Distinguish recoverable vs fatal errors
5. Boundaries and Separation
| Layer | Contains | Never Contains |
|---|---|---|
| Handler/Controller | HTTP/CLI parsing, validation | Business logic, SQL |
| Service/Domain | Business rules, orchestration | Infrastructure details |
| Repository/Adapter | Data access, external APIs | Business decisions |
6. Explicit Trade-offs
When making architectural choices, state:
- What you chose and why
- What you traded away
- When to revisit the decision
Example: "Using SQLite for simplicity. Trade-off: no concurrent writes. Revisit if >1 write/sec needed."
7. PR-Ready Code
Before delivering any code:
- No dead code, commented blocks, or debug statements
- Functions under 30 lines
- No magic numbers — use named constants
- Early returns over nested conditionals
- Edge cases handled: null, empty, error states
Code Quality Signals
Senior code reads like prose:
- Names explain "what" and "why", not "how"
- A junior understands it in 30 seconds
- No cleverness that requires comments to explain
The best code is boring:
- Predictable patterns
- Standard library over dependencies when reasonable
- Explicit over implicit
Common Traps
| Trap | Consequence | Prevention |
|---|---|---|
| Inventing APIs | Code doesn't compile | Verify method exists in docs first |
| Over-engineering | 3 hours instead of 30 min | Ask: "Do I have 3 concrete cases?" |
| Ignoring context | Suggests wrong stack | Read existing files before suggesting |
| Copy-paste without understanding | Hidden bugs surface later | Explain what the code does |
| Empty error handling | Silent failures in production | Always log + type + rethrow |
| Premature abstraction | Complexity without benefit | YAGNI until proven otherwise |
Pragmatic Shipping
Critical paths (do it right):
- Authentication, authorization
- Payment processing
- Data integrity, migrations
- Secrets management
Experimental paths (ship fast, iterate):
- UI/UX features
- Admin panels
- Analytics
- Anything unvalidated with users
Test for critical path: "Can this wake me at 3am or lose money?"
Security & Privacy
This skill does NOT:
- Store any data externally
- Make network requests
- Access files outside the current project
All code suggestions are generated in context of the conversation.
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
从零搭建 AI 智能体:OpenClaw 2.6.2 Windows 一键部署超详细教程
AI 英语教育 APP 的开发
Tokens是什么?AI大模型中的Token是干什么的?开通百炼可以免费领取7000万Tokens
什么是阿里云AI通用型节省计划?AI大模型节省计划Tokens如何计费?
《TikTok 商品详情页前端性能优化实战》
一个客户需求,捅穿了 Anthropic 整套 Agent 架构
Claude 开始进桌面之后,AI 系统的测试边界是不是又变了?
4. OpenClaw 2.6.2 常见问题排查|部署与使用避坑指南
本地 AI 智能体 OpenClaw 2.6.2 环境搭建教程
OpenClaw 2026最新使用手册
AI精选
