coding-guidelines

A project-specific set of coding conventions for ExStruct, with rules intended to make code easier for both people and AI agents to maintain. It includes type hints, single-purpose functions, and guidance for Pydantic models and dataclasses.

In plain words
What is it for?
Guiding Python code generation and review, especially around type annotations, function boundaries, data models, Excel-processing structures, Ruff, mypy, and Pydantic.
Why use it?
It gives generated and hand-written code a consistent structure and aligns it with the project’s stated tooling and design practices.

Agent

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 agents/harumiweb/exstruct/coding-guidelines
Clone the repo
git clone --depth 1 https://github.com/harumiWeb/exstruct
Per session 0 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,180 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.00000 $0.01180
Opus 5 $0.00000 $0.00590
Sonnet 5 $0.00000 $0.00236
Haiku 4.5 $0.00000 $0.00118

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

Security

Grade A, and why

coding-guidelines 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.

dev-docs/agents/coding-guidelines.md · 231 lines

How it starts

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

ExStruct Coding Guidelines

These are ExStruct-specific coding conventions for achieving a codebase that AI (Codex) and humans can maintain together over the long term. The conventions below also apply when having Codex generate code. They are intended to stabilize the quality of AI-generated code, improve maintainability, and align with Ruff / mypy / Pydantic.


1. Core Principles (Most Important)

1.1 Type hints are required

Add complete type hints to all functions, methods, and classes.

Good

def extract_shapes(sheet: xw.Sheet) -> list[Shape]:
    ...

Bad

def extract_shapes(sheet):
    ...

1.2 Functions should have a single responsibility

Because complex Excel processing tends to bloat functions, enforce 1 function = 1 logic strictly.

Good examples

  • extract_raw_shapes
  • normalize_shape
  • detect_shape_direction

1.3 Use BaseModel at boundaries, dataclass internally as primary data structures

Raw*Data (e.g., SheetRawData, WorkbookRawData) are for internal use only and must not appear in the public API or be re-exported from the package __init__.

Always return a Pydantic BaseModel or dataclass, never a dictionary or tuple.

Benefits:

  • Less ambiguous for AI
  • Easier to develop with an IDE
  • Better compatibility with JSON serialization

2. Naming Conventions

2.1 snake_case (functions and variables)

Examples: parse_chart_labels, shape_items

2.2 PascalCase (classes)

Examples: WorkbookParser, ChartSeries

2.3 Module names should be short and indicate responsibility

Examples: shape_parser.py, chart_reader.py


3. Import Rules

Follow Ruff's isort rules.

Order:

  1. Standard library
  2. Third-party
  3. Internal library (exstruct)

Example

import json
from typing import Any

import xlwings as xw
from pydantic import BaseModel

from exstruct.models import Shape

4. Docstring Conventions

Use Google style and always include:

Read the full file on GitHub · 231 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 · 231 lines · 0 tokens per session scan A 6230a7bc6e89

Subscribe to this mod's changes

coding-guidelines is an agent published in the GitHub repository harumiWeb/exstruct (195 stars, last pushed 2mo ago), licensed BSD-3-Clause. It costs nothing until one of its globs matches a file; then it loads 1,180 tokens. 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-30.

Related

Other agents, from other repositories

ai-chat

AI 对话编排领域。任务涉及编排器 AgentOrchestrator、ToolRegistry、SSE 事件流、上下文组装、记忆系统、MCP、子 Agent、模型路由、回放评测时,先读本文档再动代码。.

zeweihan/aiworkdeck · 62 tokens

ai-doc-bridge

AI↔文档编辑桥接领域。任务涉及 doc/sheet/slide 编辑原语、EditorBridgeService、editorcommand 契约、修订(redline)、文档检查点、EDITORACTIONS/uicommand 白名单时,先读本文档再动代码。.

zeweihan/aiworkdeck · 67 tokens

licensing-billing

授权与计费领域。任务涉及解锁门(试用码/账户 Key)、与官网账户的连接、entitlement 权益判定、免费额度与付费解锁、平台 AI 通道计费、广场付费项闸门、本机免登身份解析时,先读本文档再动代码。.

zeweihan/aiworkdeck · 76 tokens

version-control

项目级版本记录领域。任务涉及版本记录/工作段(work session)、时间线、退回版本、丢弃工作、另起一稿/多稿并行/采纳-放弃-冲突三选一、项目 Git 仓库(com.checkba.version 包)、文件树清单 .awd/tree.json 时,先读本文档再动代码。.

zeweihan/aiworkdeck · 84 tokens

office-addin

Microsoft Office 与 WPS 插件领域。任务涉及 Word/Excel/PPT 任务窗格插件(office-addin/)、manifest、Office.js、WPS 加载项(wps/ 壳、wpsExecutor、publish 安装页)、插件与后端的对话/上下文契约、sideload 调试时,先读本文档再动代码。.

zeweihan/aiworkdeck · 83 tokens

sidebar-shell

侧边栏与工作台外壳领域。任务涉及左侧 rail/左栏、工作台四列布局、面板切换、页面路由与页面栈、设置入口、project-overview.vue 结构、CSS 体系时,先读本文档再动代码。.

zeweihan/aiworkdeck · 65 tokens