rev-design

A command that reads an existing codebase and turns its architecture, data flows, APIs, database schema, and TypeScript types into design documents.

In plain words
What is it for?
Use it to create architecture notes, data-flow documentation, API specifications, database schema files, and a collected set of TypeScript interfaces under a design documentation folder.
Why use it?
It helps recover documentation when the system was built without complete design records or when the implementation has changed over time.

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/classmethod/tsumiki/rev-design
Clone the repo
git clone --depth 1 https://github.com/classmethod/tsumiki
Per session 64 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,365 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.00064 $0.03365
Opus 5 $0.00032 $0.01682
Sonnet 5 $0.00013 $0.00673
Haiku 4.5 $0.00006 $0.00336

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

Security

Grade A, and why

rev-design 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.

commands/rev-design.md · 498 lines

How it starts

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

rev-design

目的

既存のコードベースから技術設計文書を逆生成する。実装されたアーキテクチャ、データフロー、API仕様、データベーススキーマ、TypeScriptインターフェースを分析し、設計書として文書化する。

前提条件

  • 分析対象のコードベースが存在する
  • docs/design/{要件名}/ ディレクトリが存在する(なければ作成)
  • 可能であれば事前に /tsumiki:rev-tasks を実行済み

実行内容

  1. アーキテクチャの分析

    • プロジェクト構造からアーキテクチャパターンを特定
    • レイヤー構成の確認(MVC、Clean Architecture等)
    • マイクロサービス構成の有無
    • フロントエンド/バックエンドの分離状況
  2. データフローの抽出

    • ユーザーインタラクションの流れ
    • API呼び出しの流れ
    • データベースアクセスパターン
    • 状態管理の流れ
  3. API仕様の抽出

    • エンドポイント一覧の生成
    • リクエスト/レスポンス構造の分析
    • 認証・認可方式の確認
    • エラーレスポンス形式
  4. データベーススキーマの逆生成

    • テーブル定義の抽出
    • リレーションシップの分析
    • インデックス設定の確認
    • 制約条件の抽出
  5. TypeScript型定義の整理

    • エンティティ型の抽出
    • API型の抽出
    • 共通型の整理
    • 型の依存関係分析
  6. コンポーネント設計の分析

    • UIコンポーネント階層
    • Propsインターフェース
    • 状態管理の設計
    • ルーティング設計
  7. ファイルの作成

    • docs/design/{要件名}/architecture.md - アーキテクチャ概要
    • docs/design/{要件名}/dataflow.md - データフロー図
    • docs/design/{要件名}/api-endpoints.md - API仕様
    • docs/design/{要件名}/database-schema.sql - DB設計
    • docs/design/{要件名}/interfaces.ts - 型定義集約

出力フォーマット例

architecture.md

# {要件名} アーキテクチャ設計(逆生成)

## 分析日時
{実行日時}

## システム概要

### 実装されたアーキテクチャ
- **パターン**: {特定されたアーキテクチャパターン}
- **フレームワーク**: {使用フレームワーク}
- **構成**: {発見された構成}

### 技術スタック

#### フロントエンド
- **フレームワーク**: {React/Vue/Angular等}
- **状態管理**: {Redux/Zustand/Pinia等}
- **UI ライブラリ**: {Material-UI/Ant Design等}
- **スタイリング**: {CSS Modules/styled-components等}

#### バックエンド
- **フレームワーク**: {Express/NestJS/FastAPI等}
- **認証方式**: {JWT/Session/OAuth等}
- **ORM/データアクセス**: {TypeORM/Prisma/Sequelize等}
- **バリデーション**: {Joi/Yup/zod等}

#### データベース
- **DBMS**: {PostgreSQL/MySQL/MongoDB等}
- **キャッシュ**: {Redis/Memcached等 or なし}
- **接続プール**: {実装されているか}

#### インフラ・ツール
- **ビルドツール**: {Webpack/Vite/Rollup等}
- **テストフレームワーク**: {Jest/Vitest/Pytest等}
- **コード品質**: {ESLint/Prettier/SonarQube等}

## レイヤー構成

### 発見されたレイヤー

{実際のディレクトリ構造}


### レイヤー責務分析
- **プレゼンテーション層**: {実装状況}
- **アプリケーション層**: {実装状況}
- **ドメイン層**: {実装状況}
- **インフラストラクチャ層**: {実装状況}

## デザインパターン

### 発見されたパターン
- **Dependency Injection**: {実装されているか}
- **Repository Pattern**: {実装されているか}
- **Factory Pattern**: {使用箇所}
- **Observer Pattern**: {使用箇所}
- **Strategy Pattern**: {使用箇所}

## 非機能要件の実装状況

### セキュリティ
- **認証**: {実装方式}
- **認可**: {実装方式}
- **CORS設定**: {設定状況}
- **HTTPS対応**: {対応状況}

### パフォーマンス
- **キャッシュ**: {実装状況}
- **データベース最適化**: {インデックス等}
- **CDN**: {使用状況}
- **画像最適化**: {実装状況}

### 運用・監視
- **ログ出力**: {実装状況}
- **エラートラッキング**: {実装状況}
- **メトリクス収集**: {実装状況}
- **ヘルスチェック**: {実装状況}

Read the full file on GitHub · 498 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 · 498 lines · 64 tokens per session scan A 7142f4c88117

Subscribe to this mod's changes

rev-design is a command published in the GitHub repository classmethod/tsumiki (974 stars, last pushed 26d ago), licensed MIT. It adds 64 tokens to every session and 3,365 once invoked, about $0.0003 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.