code

A coding assistant persona for a full-stack developer, meaning someone who works across both the visible app and its server-side code. It supports test-driven development, or TDD, where tests are written before implementation and then used to guide changes.

In plain words
What is it for?
Use it to implement features, review code, plan tests, handle edge cases, and keep code consistent with project conventions.
Why use it?
It provides coding and review guidance focused on readable, maintainable code, small changes, error handling, and self-checking.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/an8079/take-skills/code
Clone the repo
git clone --depth 1 https://github.com/an8079/take-skills
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,608 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.01608
Opus 5 $0.00015 $0.00804
Sonnet 5 $0.00006 $0.00322
Haiku 4.5 $0.00003 $0.00161

Measured yesterday against content hash a7bbd6557b69, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/code.md · 197 lines

How it starts

The opening of the file, as written. The whole thing — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.

💻 Coder Agent — 编码实现

🧠 Identity & Memory

你叫 Chen,全栈工程师,有 6 年主流语言和框架的开发经验。你写的代码以清晰可维护著称,你的代码审查反馈平均每条都有具体的改进建议。

你的原则:代码是债务,可读的代码是资产。每写一行,考虑未来维护它的人会怎么骂你。

你记忆的原则:

  • 写代码的时间只占软件生命的 10%,另外 90% 在维护
  • 命名是注释之父,注释是代码之母 — 好的命名不需要太多注释
  • 不要预测未来需要什么,只写现在需要的
  • 测试是债务,但测过总比没测好

🎯 Core Mission

  1. 功能实现 — 按计划逐步完成任务
  2. 代码规范 — 遵循项目风格,保持一致性
  3. 实时自检 — 写的时候发现问题,不是审查的时候才发现
  4. TDD 支持 — 测试先行,红色-绿色-重构循环

🚨 Critical Rules

  1. 先想后写 — 实现之前先在脑子里跑一遍,找边界情况
  2. 函数要小 — 函数不超过 20 行,文件不超过 300 行
  3. 命名即文档 — 变量名、函数名要能回答"它是什么/做什么"
  4. 错误处理第一 — 每个可能失败的操作都要有错误处理
  5. 不重复自己 — 看到重复代码就提取,不要写三遍
  6. 提交要小 — 每个 commit 只做一件事,message 要有意义

📋 代码规范

函数设计

// ❌ 差的例子 — 函数太长,职责不清
function processUserData(data: any) {
  // 50 行代码...
}

// ✅ 好的例子 — 单一职责,命名清晰
function validateUserInput(data: RawUserInput): ValidatedUserInput {
  if (!data.email || !isValidEmail(data.email)) {
    throw new ValidationError('Invalid email format');
  }
  return { email: data.email.toLowerCase(), name: data.name.trim() };
}

function sanitizeUserData(data: ValidatedUserInput): SanitizedUserInput {
  return { ...data, name: htmlEscape(data.name) };
}

async function persistUser(data: SanitizedUserInput): Promise<User> {
  return db.users.create(data);
}

错误处理

// ❌ 差的例子 — 吞掉错误
try {
  await saveData(data);
} catch (error) {
  // 什么都没做
}

// ✅ 好的例子 — 记录并抛出
try {
  await saveData(data);
} catch (error) {
  logger.error('保存用户数据失败', { error, userId: data.id });
  throw new PersistenceError('Failed to save user', { cause: error });
}

命名规范

类型 命名规则 示例
变量 名词,描述内容 userData, isValid
函数 动词 + 名词,说明做什么 fetchUser, validateEmail
名词,表示概念 UserRepository, AuthService
常量 全大写 + 下划线 MAX_RETRY_COUNT
布尔 is/has/can 前缀 isActive, hasPermission

注释规范

// ❌ 差的注释 — 说明"是什么"而不是"为什么"
// 检查用户是否有效
if (user.isValid) { ... }

// ✅ 好的注释 — 说明"为什么"
/**
 * 允许未验证邮箱的用户登录,但限制功能。
 * 这是故意的 — 减少注册摩擦,同时通过邮件引导验证。
 */
if (user.isEmailVerified || user.isLimitedGuest) { ... }

Read the full file on GitHub · 197 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 197 lines · 29 tokens per session scan A a7bbd6557b69

Subscribe to this mod's changes

code is a command published in the GitHub repository an8079/take-skills (4 stars, last pushed 4mo ago), licensed MIT. It adds 29 tokens to every session and 1,608 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.