A skill for preparing for tax audits or diagnosing the fulfillment status of favorable electronic books requirements. Based on Article 5, Paragraph 5 of the Enforcement Regulations of the Act on Preservation of National Tax-Related Books and Documents in Electronic Form (requirements for favorable electronic books), automatically checks whether shinkoku's book data meets the requirements.
Prerequisite Knowledge
- Details of e-bookkeeping law requirements: Run /tax-ebookkeeping-context
- System overview document:
docs/system-overview.md
Step 0: Prerequisite Confirmation
Confirm the following with the user:
- DB path:
--db-pathPath of the database file used for - Target fiscal year:
--fiscal-yearFiscal year used for - Submission status of the notification form: Whether the "Notification Form Concerning Preservation of National Tax-Related Books via Electronic Records, etc." has been submitted to the competent tax office
About the notification: To apply preservation of favorable electronic books, a notification form must be submitted in advance. If applying from the 2027 tax year, the notification form must be submitted during 2026. The notification form format can be downloaded from the National Tax Agency website.
Step 1: Automatic Diagnosis & Summary Output
Execute the following commands to diagnose the system's compliance status. Present the results to the user in table format.
Check Items and Execution Commands
| # | Requirement | Provision | Check Method |
|---|---|---|---|
| G1 | Installation of system-related documents | Enforcement Regulations Article 2, Paragraph 2, Item 1 | docs/system-overview.md Confirm the existence of the file |
| G2 | Ensuring readability | Enforcement Regulations Article 2, Paragraph 2, Item 2 | shinkoku ledger trial-balance --db-path <db> --fiscal-year <year> Execute and confirm normal output |
| G3 | Download support | Enforcement Regulations Article 2, Paragraph 2, Item 3 | shinkoku ledger search --db-path <db> --input <params> --format csv Execute and confirm CSV output |
| G4 | Correction/deletion history | Enforcement Regulations Article 5, Paragraph 5, Item 1 (a) | shinkoku ledger audit-log --db-path <db> Execute and confirm that the table functions |
| G5 | Ensuring mutual relevance | Enforcement Regulations Article 5, Paragraph 5, Item 1 (b) | shinkoku ledger general-ledger --db-path <db> --fiscal-year <year> --account-code <code> Execute and confirm the relationship between the journal entry book and the general ledger |
| G6 | Counterparty search | Enforcement Regulations Article 5, Paragraph 5, Item 1 (c) | counterparty_contains Execute a search with the parameter |
| G7 | Date/amount range specification search | Enforcement Regulations Article 5, Paragraph 5, Item 1 (c) | date_from/date_to/amount_min/amount_max Execute a search with the parameter |
| G8 | Combination search | Enforcement Regulations Article 5, Paragraph 5, Item 1 (c) | Execute a search combining date + counterparty + amount |
Diagnosis Procedure
- G1:
docs/system-overview.mdConfirm the existence of - G2: Generate a trial balance
shinkoku ledger trial-balance --db-path <db> --fiscal-year <year> - G3: Output journal entries in CSV format
(params containsshinkoku ledger search --db-path <db> --input <params> --format csv{"fiscal_year": <year>, "limit": 5}specify) - G4: Retrieve audit log
shinkoku ledger audit-log --db-path <db> - G5: Output the general ledger for any account (use an account for which journal entries exist)
shinkoku ledger general-ledger --db-path <db> --fiscal-year <year> --account-code <code> - G6-G8: Test search functionality
# G6: 取引先検索 shinkoku ledger search --db-path <db> --input <params> # params: {"fiscal_year": <year>, "counterparty_contains": "<取引先名の一部>"} # G7: 範囲指定検索 # params: {"fiscal_year": <year>, "date_from": "<開始日>", "date_to": "<終了日>", "amount_min": 1, "amount_max": 1000000} # G8: 組合せ検索 # params: {"fiscal_year": <year>, "date_from": "...", "counterparty_contains": "...", "amount_min": 1}
Summary output format
Output the diagnostic results in the following table format:
## 優良な電子帳簿 コンプライアンス診断結果
| # | 要件 | 条文 | 結果 | 備考 |
|---|------|------|------|------|
| G1 | システム関係書類 | 施行規則2条2項1号 | ✓ / ✗ | ... |
| G2 | 見読可能性 | 施行規則2条2項2号 | ✓ / ✗ | ... |
| G3 | ダウンロード対応 | 施行規則2条2項3号 | ✓ / ✗ | ... |
| G4 | 訂正・削除履歴 | 施行規則5条5項1号イ | ✓ / ✗ | ... |
| G5 | 相互関連性 | 施行規則5条5項1号ロ | ✓ / ✗ | ... |
| G6 | 取引先検索 | 施行規則5条5項1号ハ | ✓ / ✗ | ... |
| G7 | 範囲指定検索 | 施行規則5条5項1号ハ | ✓ / ✗ | ... |
| G8 | 組合せ検索 | 施行規則5条5項1号ハ | ✓ / ✗ | ... |
If there are non-conforming items, provide guidance on how to address them.
Step 2: Evidence output (optional)
Execute when the user requests "check details" or "output evidence".
(a) Ledger output
Output each ledger with the following commands and present them to the user in table format:
# 残高試算表
shinkoku ledger trial-balance --db-path <db> --fiscal-year <year>
# 損益計算書
shinkoku ledger pl --db-path <db> --fiscal-year <year>
# 貸借対照表
shinkoku ledger bs --db-path <db> --fiscal-year <year>
# 総勘定元帳(主要科目)
shinkoku ledger general-ledger --db-path <db> --fiscal-year <year> --account-code <code>
Inform that CSV output is also possible:
# CSV 形式で出力する場合は --format csv を追加
shinkoku ledger trial-balance --db-path <db> --fiscal-year <year> --format csv
(b) Audit log
shinkoku ledger audit-log --db-path <db> --fiscal-year <year>
Display the change history in table format.
(c) Search demo
Demonstrate each search by date range, amount range, and vendor, and confirm that the search functionality works properly.
(d) System-related documents
docs/system-overview.md Provide the location of. Display the contents as needed.
Step 3: Result summary & next actions
When all requirements are satisfied
## 診断結果: 全要件適合
shinkoku は優良な電子帳簿の要件(施行規則第5条第5項)を
技術的に充足しています。
### 次のアクション
1. 届出書の提出(未提出の場合)
- 「国税関係帳簿の電磁的記録等による保存等に係る届出書」を所轄税務署に提出
2. 定期的なバックアップの実施
3. 帳簿データの7年間保存の確保
When there are deficiencies
Display a list of deficiencies and corresponding actions.
Disclaimer
> **注記**: 本システムは電子帳簿保存法施行規則第5条第5項に定める優良な電子帳簿の
> 技術的要件を満たすよう設計されています。令和3年度税制改正により事前承認制度は
> 廃止されており、JIIMA認証等の第三者認証は法令上の要件ではありません
> (ただし要件充足の確認手段として活用できます)。
> 優良な電子帳簿の保存の適用にあたっては、あらかじめ所轄税務署への届出書の
> 提出が必要です(電子帳簿保存法第8条第4項)。
Limitations
> **制限事項**:
> - 監査ログ(journal_audit_log)はアプリケーション層で記録しており、
> データベースの直接操作による変更は記録されません。
> 改ざん防止のためのデータベーストリガーは今後の対応予定です。
> - タイムスタンプは UTC で記録されています(JST への変換は今後対応予定)。
> - 操作者情報の記録は個人利用を前提としているため、現在は未実装です。