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.
npx skills add claude-office-skills/claude-office-plugin --skill code-rulesgit clone --depth 1 https://github.com/claude-office-skills/claude-office-pluginWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/claude-office-skills/claude-office-plugin/code-rules)<a href="https://agentmods.dev/skills/claude-office-skills/claude-office-plugin/code-rules"><img src="https://agentmods.dev/badge/skills/claude-office-skills/claude-office-plugin/code-rules.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00026 | $0.01421 |
| Opus 5 | $0.00013 | $0.00711 |
| Sonnet 5 | $0.00005 | $0.00284 |
| Haiku 4.5 | $0.00003 | $0.00142 |
Grade A, and why
code-rules 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 7d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.
代码生成规则(严格遵守)
⚠️ 最重要的规则:所有操作必须在一个代码块中完成!
绝对禁止拆分代码
- 禁止将代码拆成 "Part 1", "Part 2", "Part 3" 等多段
- 禁止写 "先运行这段,再运行下一段"
- 无论任务多复杂(DCF 建模、财务分析、仪表板),都必须在一个 javascript 块中完成
- 如果代码太长(>300行),优先简化设计而非拆分代码
代码规范
- 一个代码块完成所有逻辑(不可拆分!)
- 代码顶部必须定义 CL() 辅助函数
- 禁止使用 ws.Cells()、ws.Rows()、ws.Columns(),全部用 ws.Range() 替代
- 代码最后一行是返回值字符串
- 始终用中文回复和注释
- 列宽用 ws.Range("A:A").ColumnWidth = N
- 行高用 ws.Range("1:1").RowHeight = N
⚠️ 始终使用 ActiveSheet(禁止硬编码 sheet 名称)
操作当前表时,必须用 Application.ActiveSheet,绝对不要用 wb.Sheets.Item("表名") 硬编码 sheet 名称。因为用户可能已经重命名了 sheet,硬编码名称会导致代码操作错误的 sheet 或报错。
// ✅ 正确
var ws = Application.ActiveSheet;
// ❌ 错误:sheet 可能已被重命名
// var ws = wb.Sheets.Item("库存管理系统");
仅在明确需要跨 sheet 操作(如从源表读数据写到新表)时,才通过 WPS 上下文提供的 sheetName 引用特定 sheet。
不要覆盖用户已有数据
- 数据分析/趋势分析/建模任务:必须新建工作表,不得在现有工作表上执行 Clear() 或覆盖数据
// 创建新工作表(正确模式)
var wb = Application.ActiveWorkbook;
var srcWs = Application.ActiveSheet; // 先保存原始数据表引用
var ws;
try { ws = wb.Sheets.Item("分析结果"); ws.UsedRange.Clear(); } catch(e) {
wb.Sheets.Add();
ws = wb.ActiveSheet;
ws.Name = "分析结果";
}
ws.Activate(); // 必须激活新工作表
// 从 srcWs 读取原始数据,写入 ws 做分析
- ⚠️ wb.Sheets.Add() 返回 null,必须用 wb.ActiveSheet 获取新建的工作表引用
- ⚠️ 新建工作表后必须调用 ws.Activate() 让用户能看到结果
- 仅当用户明确说"修改/替换/清除现有数据"时,才在 ActiveSheet 上操作
WPS JSAPI 兼容性(VS Excel VBA / Office.js 关键差异)
⚠️ 这是 WPS Office JS 宏环境,不是 Excel VBA 也不是 Office.js! 以下差异必须严格遵守:
| VBA / Office.js 写法(❌ 错误) | WPS JSAPI 写法(✅ 正确) |
|---|---|
ws.Cells(row, col) |
ws.Cells.Item(row, col) 或 ws.Range(CL(col)+row) |
ws.Rows(5) |
ws.Range("5:5") |
ws.Columns("D") |
ws.Range("D:D") |
ws.Columns("D:F") |
ws.Range("D:F") |
Worksheets(1) |
Worksheets.Item(1) |
wb.Sheets("名称") |
wb.Sheets.Item("名称") |
chart.SeriesCollection(1) |
chart.SeriesCollection.Item(1) |
Range("A1").Value |
Range("A1").Value2(写入)/ Range("A1").Value()(读取) |
ActiveSheet(无前缀) |
Application.ActiveSheet |
ActiveWorkbook(无前缀) |
Application.ActiveWorkbook |
[A1] = 5 |
Range("A1").Value2 = 5 |
.Select / .Activate(无括号) |
.Select() / .Activate()(必须加括号) |
AddChart2(-1, type, ...) |
AddChart2(0, type, ...)(Style -1 返回 null) |
chartWs.Cells.Clear() |
chartWs.UsedRange.Clear() |
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.
- 7d ago First seen · 110 lines · 26 tokens per session scan A 04f1ff8680a5
code-rules is a skill published in the GitHub repository claude-office-skills/claude-office-plugin (9 stars, last pushed 5mo ago), licensed MIT. It adds 26 tokens to every session and 1,421 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.
Other skills, from other repositories
code-rules
A set of rules for generating code, including safety constraints. The description is provided in Chinese and does not give more detail about the specific rules.
dcf-model
Build discounted cash flow valuation workbooks in Excel.
audit-xls
Audit a spreadsheet for formula accuracy, errors, and common mistakes. Scopes to a selected range, a single sheet, or the entire model (including financial-model integrity checks like BS balance, cash tie-out, and logic sanity). Triggers on "audit this sheet", "check my formulas", "find formula errors", "QA this…
google-drive-sheets
Find, read, export, edit, and manage the user's Google Drive, Docs, Sheets, and Slides through per-user OAuth.
feishu
Work with Feishu or Lark bots, docs, sheets, bitables, approval flows, and OpenAPI/MCP setup without hardcoding credentials.
large-file-parquet-analysis-and-highlight
A workflow for processing large Excel workbooks by counting their rows, converting them to Parquet when needed, and finding maximum values. Parquet is a data-file format designed for efficient reading.