一键导入
code-writer
Use when writing or modifying code in any programming language. Apply when adding functions, fixing bugs, or implementing features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when writing or modifying code in any programming language. Apply when adding functions, fixing bugs, or implementing features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when writing or modifying ZSH functions.
Use when user says "ralph <dir>" or "ralph this". Implements the highest-priority issue from state.json in the given directory using TDD, updates docs, runs review in a subagent, fixes actionable feedback, then stops for user to commit. Argument is the directory containing state.json and GUIDANCE.md.
Use when user says "sidequest". Compact conversation context into a document for a fresh agent to pick up.
Use when writing or modifying JavaScript code. Apply when adding functions, fixing bugs, or implementing features.
Use when writing or modifying Python code. Apply when adding functions, fixing bugs, or implementing features.
Use when creating or updating skills.
| name | code-writer |
| description | Use when writing or modifying code in any programming language. Apply when adding functions, fixing bugs, or implementing features. |
Code should communicate intent clearly. Excessive comments and output statements create noise that obscures logic.
Core principle: Minimize noise, maximize signal. Comments explain why, not what. Output statements serve a purpose, not narration.
These guidelines apply to all programming languages. For language-specific patterns and conventions, use the appropriate language-specific skill:
js-writer skill for JavaScript/Node.js codezsh-writer skill for ZSH functions in .oroshi repositoryLanguage-specific skills extend these core guidelines with syntax and idioms specific to that language.
When NOT to use:
Output statements include: console.log(), print(), echo, printf(), puts, System.out.println(), etc.
Allowed ONLY for:
FORBIDDEN:
"Processing...", "Starting...", "Done")"Found X items", "Total: Y")console.log(""))"===== Summary =====")"checkpoint 1", "here")// ✅ Display function - output IS the purpose
function listBranches(branches) {
branches.forEach(b => console.log(b.name));
}
// ✅ Error to stderr
if (!filePath) {
console.error("Error: File path required");
return null;
}
// ❌ FORBIDDEN - Progress narration
console.log("Starting analysis...");
const results = compute(data);
console.log(`Found ${results.length} items`);
If unsure whether to add output: DON'T.
Allowed:
FORBIDDEN:
// Process each item)// color1 #ef4444 when RGB already in code)// from palette index 5)// Additional colors)// ✅ Explains semantic meaning
#define BLACK ((Color){0, 0, 0}) // Off/disabled
// ❌ FORBIDDEN - Redundant format conversion
#define RED ((Color){239, 68, 68}) // #ef4444
// ❌ FORBIDDEN - Per-line metadata
#define PURPLE ((Color){128, 90, 213}) // color5 from kitty
// ❌ FORBIDDEN - Obvious section header
// Additional color definitions
#define CYAN ((Color){8, 145, 178})
// ✅ Function documentation
/**
* Retry operation up to maxAttempts times
* @param {Function} operation - Async function to retry
* @returns {Promise} Result of operation
*/
async function retryOperation(operation, maxAttempts) {
// ...
}
// ✅ ONE section comment for 3+ validations
// Validate required config fields
if (!config.apiKey) throw new Error("Missing apiKey");
if (!config.endpoint) throw new Error("Missing endpoint");
if (!config.timeout) throw new Error("Missing timeout");
// ✅ Data meaning
// First line contains headers
if (lineNumber === 0) {
return parseHeaders(line);
}
// ❌ FORBIDDEN - Explains what code does
// Check if file exists
if (!fs.existsSync(filePath)) {
return null;
}
// ❌ FORBIDDEN - Loop comment
// Loop through users
for (const user of users) {
processUser(user);
}
When editing existing code: Never remove existing comments.
If unsure whether to add comment: DON'T.
| Category | Default | Allowed | Forbidden |
|---|---|---|---|
| Output | Zero | Display functions, errors to stderr | Progress, status, decorative headers |
| Comments | Function docs only | Section (3+ ops), data meaning | What code does, per-line, format conversions |
| Mistake | Why Wrong | Fix |
|---|---|---|
| Per-line comments | Visual noise, obvious from code | Remove, use descriptive names |
| Format conversion comments | Redundant data in different format | Remove, keep one format |
| Progress messages | Narrates obvious execution | Remove or use logging framework |
| Section headers stating obvious | Spatial grouping already clear | Remove |
| Breadcrumb comments | Documents debugging journey | Remove after fixing |
Before:
// Additional colors from kitty palette
#define RED ((Color){239, 68, 68}) // color1 #ef4444
#define PURPLE ((Color){128, 90, 213}) // color5 #805ad5
#define CYAN ((Color){8, 145, 178}) // color6 #0891b2
After:
#define RED ((Color){239, 68, 68})
#define PURPLE ((Color){128, 90, 213})
#define CYAN ((Color){8, 145, 178})
Clean code: 60% less noise, same information, better readability.