---
name: Fix Schema
slug: fix-schema
category: Quality
description: Fix Schema updates Zod schemas to support new session log data formats while maintaining backward compatibility. Use it when session log JSON parsing fails and a pull request is needed.
github: "https://github.com/d-kimuson/claude-code-viewer/tree/main/.agents/skills/fix-schema"
language: TypeScript
stars: 1272
forks: 157
install: "npx degit https://github.com/d-kimuson/claude-code-viewer/tree/main/.agents/skills/fix-schema ~/.claude/skills/fix-schema"
installs_to: ~/.claude/skills/fix-schema
source_path: .agents/skills/fix-schema/SKILL.md
collection_size: 3
category_size: 1354
collection_url: "https://dirskills.com/collections/d-kimuson/claude-code-viewer"
added: 2026-08-20T07:55:08.184Z
last_synced: 2026-08-20T07:55:08.184Z
canonical_url: "https://dirskills.com/skills/fix-schema"
---

# Fix Schema

Fix Schema updates Zod schemas to support new session log data formats while maintaining backward compatibility. Use it when session log JSON parsing fails and a pull request is needed.

**Install:**

```bash
npx degit https://github.com/d-kimuson/claude-code-viewer/tree/main/.agents/skills/fix-schema ~/.claude/skills/fix-schema
```

## README

<role>
Fix schema parse errors in session logs by updating Zod schemas to support new data formats while maintaining backward compatibility. Create PR after verification.
</role>

<input>
User provides failing JSON data from session logs. The data structure indicates what needs to be supported.
</input>

<workflow>
**1. Locate and update schema**:
- Identify schema file in `src/lib/conversation-schema/` based on JSON `type` field
- Update schema to support new data format
- Maintain backward compatibility with existing JSONL files

**2. Fix type errors**:

- Update affected components to handle new schema types
- Follow project type safety rules (no `as` casting)

**3. Add tests**:

- Create or update test files for modified schemas
- Verify both old and new formats parse successfully

**4. Verify and commit**:

- Run `pnpm typecheck` (must pass)
- Run `pnpm test` (must pass)
- Run `pnpm fix`
- Commit changes

**5. Create PR**:

- Push branch
- Create draft PR with summary of schema changes
  </workflow>

<principles>
- **Backward compatibility**: Existing JSONL files must continue to parse
- **Type safety**: Follow project rules (no `as` casting)
- **Atomic commits**: All related changes in single commit (schema + UI + tests)
- **Pattern consistency**: Follow existing schema patterns in codebase
</principles>
