add

A project knowledge-entry command for recording bug fixes, reusable code patterns, design decisions, and rules in structured spec files.

In plain words
What is it for?
Use it to add entries interactively or from scripts, with automatic categorisation and extra fields for bugs, patterns, and decisions.
Why use it?
It keeps important project knowledge in one consistent format instead of leaving it scattered or undocumented.

Command for Claude Code

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/catlog22/claude-code-workflow/add
Clone the repo
git clone --depth 1 https://github.com/catlog22/Claude-Code-Workflow

Made for: Claude Code.

Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 7,602 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.00023 $0.07602
Opus 5 $0.00012 $0.03801
Sonnet 5 $0.00005 $0.01520
Haiku 4.5 $0.00002 $0.00760

Measured 2d ago against content hash 2786f136087e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add 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 2d 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.

.claude/commands/workflow/spec/add.md · 895 lines

How it starts

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

Auto Mode

When --yes or -y: Auto-categorize and add entry without confirmation.

Spec Add Command (/workflow:spec:add)

Overview

Unified command for adding structured knowledge entries one at a time. Supports 4 knowledge types with optional extended fields for complex entries (bug debugging, code patterns, architecture decisions).

Key Features:

  • 4 knowledge types: bug, pattern, decision, rule
  • Unified entry format: - [type:tag] summary (date)
  • Extended fields for complex types (bug/pattern/decision)
  • Interactive wizard with type-specific field prompts
  • Direct CLI mode with auto-detection
  • Backward compatible: [tag] = [rule:tag] shorthand
  • Auto-confirm mode (-y/--yes) for scripted usage

Knowledge Type System

Type Purpose Format Target File
bug Debugging experience (symptoms → cause → fix) Extended learnings.md
pattern Reusable code patterns / reference implementations Extended coding-conventions.md
decision Architecture / design decisions (ADR-lite) Extended architecture-constraints.md
rule Hard constraints, conventions, general insights Simple (single line) By content (conventions / constraints)

Extended Fields Per Type

bug (core: 原因, 修复 | optional: 症状, 参考):

- [bug:api] API 返回 502 Bad Gateway (2026-03-06)
    - 原因: 路由处理器未在 server.ts 路由分发中注册
    - 修复: 在路由分发逻辑中导入并调用 app.use(newRouter)
    - 参考: src/server.ts:45

pattern (core: 场景, 代码 | optional: 步骤):

- [pattern:routing] 添加新 API 路由标准流程 (2026-03-06)
    - 场景: Express 应用新增业务接口
    - 步骤: 1.创建 routes/xxx.ts → 2.server.ts import → 3.app.use() 挂载
    - 代码:
        ```typescript
        if (pathname.startsWith('/api/xxx')) {
          if (await handleXxxRoutes(routeContext)) return;
        }
        ```

decision (core: 决策, 理由 | optional: 背景, 备选, 状态):

- [decision:db] 选用 PostgreSQL 作为主数据库 (2026-03-01)
    - 决策: 使用 PostgreSQL 15
    - 理由: JSONB 支持完善,PostGIS 扩展成熟
    - 备选: MySQL(JSON弱) / SQLite(不适合并发)
    - 状态: accepted

Read the full file on GitHub · 895 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. 2d ago First seen · 895 lines · 23 tokens per session scan A 2786f136087e

Subscribe to this mod's changes

add is a command published in the GitHub repository catlog22/Claude-Code-Workflow (2,135 stars, last pushed 2mo ago), licensed MIT. It adds 23 tokens to every session and 7,602 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-30.