You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@mind-fold/open-flow

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mind-fold/open-flow - npm Package Compare versions

Comparing version
0.2.11
to
0.2.12
+1
-1
dist/templates/commands/break-loop.txt
# Break the Loop - Deep Bug Analysis
When debug is complete, use this command for deep analysis to break the "fix bug → forget → repeat" cycle.
When debug is complete, use this command for deep analysis to break the "fix bug -> forget -> repeat" cycle.

@@ -5,0 +5,0 @@ ---

@@ -48,4 +48,4 @@ # Cross-Layer Check

**Checklist**:
- [ ] Read flow: Database → Service → API → Hook → Component
- [ ] Write flow: Component → Hook → API → Service → Database
- [ ] Read flow: Database -> Service -> API -> Hook -> Component
- [ ] Write flow: Component -> Hook -> API -> Service -> Database
- [ ] Types correctly passed between layers?

@@ -73,3 +73,3 @@ - [ ] Errors properly propagated to UI?

```
- [ ] If 2+ places define same value → Should extract to shared constant
- [ ] If 2+ places define same value -> Should extract to shared constant
- [ ] After modification, all usage sites updated?

@@ -76,0 +76,0 @@ - [ ] If creating utility: Does similar utility already exist?

@@ -71,3 +71,3 @@ # Create New Slash Command

```
✅ Created Slash Command: /<command-name>
[OK] Created Slash Command: /<command-name>

@@ -87,3 +87,3 @@ File paths:

### ✅ Good command content
### [OK] Good command content

@@ -95,3 +95,3 @@ 1. **Clear and concise**: Immediately understandable

### ❌ Avoid
### [X] Avoid

@@ -152,4 +152,4 @@ 1. **Too vague**: e.g., "optimize code"

### Check Results
- ✅ Passed items
- ❌ Issues found
- [OK] Passed items
- [X] Issues found

@@ -156,0 +156,0 @@ ### Suggestions

@@ -20,7 +20,7 @@ # Extract Development Guidelines from LLM Documents

> ⚠️ **Important**: The extracted content should be **development guidelines**, not direct project code.
> [!] **Important**: The extracted content should be **development guidelines**, not direct project code.
>
> - Guidelines content → Write to `workflow/structure/{target}/doc.md`
> - Code examples → Place in `workflow/structure/{target}/examples/services/<service-name>/`
> - Example files → Use `.template` suffix to avoid IDE errors
> - Guidelines content -> Write to `workflow/structure/{target}/doc.md`
> - Code examples -> Place in `workflow/structure/{target}/examples/services/<service-name>/`
> - Example files -> Use `.template` suffix to avoid IDE errors
>

@@ -104,3 +104,3 @@ > Where `{target}` is `frontend` or `backend`, determined by service type.

@@@section:service-<service-name>
## 🔌 <Service Name> Integration Guide
## # <Service Name> Integration Guide

@@ -144,10 +144,10 @@ ### Overview

workflow/structure/{target}/
├── doc.md # Add service-related section
├── index.md # Update index
└── examples/
└── services/
└── <service-name>/
├── README.md # Example documentation
├── basic-usage.ts.template
└── advanced-usage.ts.template
|-- doc.md # Add service-related section
|-- index.md # Update index
\-- examples/
\-- services/
\-- <service-name>/
|-- README.md # Example documentation
|-- basic-usage.ts.template
\-- advanced-usage.ts.template
```

@@ -169,3 +169,3 @@

### 📋 Source
### # Source
- **Document URL**: [llms.txt](url)

@@ -175,3 +175,3 @@ - **Service Type**: [Frontend/Backend/Full-stack]

### 📚 Extracted Content
### # Extracted Content

@@ -185,3 +185,3 @@ | Category | Content |

### 📁 Integration Locations
### # Integration Locations

@@ -194,3 +194,3 @@ | Type | Path |

### ✅ Completed Changes
### [OK] Completed Changes

@@ -202,3 +202,3 @@ - [ ] Added `@@@section:service-<name>` section to `doc.md`

### 🔗 External Links
### # External Links

@@ -205,0 +205,0 @@ - [Official Documentation](url)

@@ -46,3 +46,3 @@ # Extract Knowledge to Development Rules

**⚠️ CRITICAL**: Extract **EVERYTHING** - do not summarize or omit details!
**[!] CRITICAL**: Extract **EVERYTHING** - do not summarize or omit details!

@@ -54,19 +54,19 @@ ### Step 3: Determine Integration Target

**For Frontend**:
- Component patterns → Add to "Component Development" section
- Hook patterns → Add to "Hook Guidelines" section
- State management → Add to "State Management" section
- Performance tips → Add to "Performance Optimization" section
- New category → Create new section
- Component patterns -> Add to "Component Development" section
- Hook patterns -> Add to "Hook Guidelines" section
- State management -> Add to "State Management" section
- Performance tips -> Add to "Performance Optimization" section
- New category -> Create new section
**For Backend**:
- API patterns → Add to "Directory Structure" section
- Database patterns → Add to "Database Operations" section
- Type safety → Add to "Type Safety" section
- Performance patterns → Add to "Performance Patterns" section
- New category → Create new section
- API patterns -> Add to "Directory Structure" section
- Database patterns -> Add to "Database Operations" section
- Type safety -> Add to "Type Safety" section
- Performance patterns -> Add to "Performance Patterns" section
- New category -> Create new section
**Decision Rules**:
1. If content fits existing section → Add as subsection
2. If content is new domain → Create new top-level section
3. If content has multiple aspects → Consider splitting
1. If content fits existing section -> Add as subsection
2. If content is new domain -> Create new top-level section
3. If content has multiple aspects -> Consider splitting

@@ -121,3 +121,3 @@ ### Step 4: Read Current Guidelines

**⚠️ IMPORTANT**:
**[!] IMPORTANT**:
1. Include ALL examples from source

@@ -154,7 +154,7 @@ 2. Include ALL code snippets from source

<target>/doc.md (approx. XXXX lines)
├── ...
├── <emoji> <Title> (`<section-id>`)
│ ├── Subsection 1 (`<subsection-id>`)
│ └── Subsection 2 (`<subsection-id>`)
└── ...
|-- ...
|-- <emoji> <Title> (`<section-id>`)
| |-- Subsection 1 (`<subsection-id>`)
| \-- Subsection 2 (`<subsection-id>`)
\-- ...
```

@@ -198,3 +198,3 @@

**Anti-Pattern** ❌:
**Anti-Pattern** [X]:
```<language>

@@ -204,3 +204,3 @@ <bad-code>

**Correct** ✅:
**Correct** [OK]:
```<language>

@@ -254,3 +254,3 @@ <good-code>

```markdown
✅ Knowledge Extracted and Integrated
[OK] Knowledge Extracted and Integrated

@@ -266,7 +266,7 @@ **Source**: <source-file-path>

**Updates**:
- ✅ index.md - Added to Quick Navigation
- ✅ index.md - Added to Scenario X
- ✅ index.md - Added to Core Rules
- ✅ index.md - Updated Document Structure
- ✅ doc.md - Added complete section with X subsections
- [OK] index.md - Added to Quick Navigation
- [OK] index.md - Added to Scenario X
- [OK] index.md - Added to Core Rules
- [OK] index.md - Updated Document Structure
- [OK] doc.md - Added complete section with X subsections

@@ -290,3 +290,3 @@ **Content Included**:

### ✅ DO
### [OK] DO

@@ -323,3 +323,3 @@ 1. **Extract EVERYTHING** from source document

### ❌ DON'T
### [X] DON'T

@@ -415,5 +415,5 @@ 1. **Don't summarize** - Extract complete content

1. Compare with existing section
2. If identical → Skip, note in summary
3. If complementary → Merge into existing section
4. If different approach → Add as alternative pattern
2. If identical -> Skip, note in summary
3. If complementary -> Merge into existing section
4. If different approach -> Add as alternative pattern

@@ -440,6 +440,6 @@ ### Issue: Too much content

1. ✅ All source content is in doc.md
2. ✅ Index.md accurately reflects new content
3. ✅ Section can be extracted with sed command
4. ✅ New developers can find and use the knowledge
5. ✅ No information loss from source document
1. [OK] All source content is in doc.md
2. [OK] Index.md accurately reflects new content
3. [OK] Section can be extracted with sed command
4. [OK] New developers can find and use the knowledge
5. [OK] No information loss from source document

@@ -40,3 +40,3 @@ # Finish Work - Pre-Commit Checklist

If YES → Update the relevant structure doc.
If YES -> Update the relevant structure doc.

@@ -110,9 +110,9 @@ ### 3. API Changes

Development Flow:
Write code → Test → /finish-work → git commit → /record-agent-flow
↑ ↑
Write code -> Test -> /finish-work -> git commit -> /record-agent-flow
| |
Ensure completeness Record progress
Debug Flow:
Hit bug → Fix → /break-loop → Knowledge capture
Hit bug -> Fix -> /break-loop -> Knowledge capture
|
Deep analysis

@@ -119,0 +119,0 @@ ```

@@ -9,3 +9,3 @@ # Generate Backend Structure Guidelines

## ⚠️ CRITICAL: Requirements
## [!] CRITICAL: Requirements

@@ -108,3 +108,3 @@ 1. **Language**: All documentation must be written in **English**

@@@section:directory-structure
## 📁 Directory Structure Guidelines
## # Directory Structure Guidelines

@@ -117,3 +117,3 @@ ### Module Organization

@@@section:type-safety
## 🎯 Type Safety Guidelines
## # Type Safety Guidelines

@@ -125,3 +125,3 @@ @@@section:non-null-assertion

#### ❌ Wrong Approach
#### [X] Wrong Approach

@@ -132,7 +132,7 @@ ```typescript

.set({ name: newName })
.where(eq(profiles.id, user.profileId!)); // ❌ non-null assertion
.where(eq(profiles.id, user.profileId!)); // [X] non-null assertion
}
```
#### ✅ Correct Approach
#### [OK] Correct Approach

@@ -144,3 +144,3 @@ ```typescript

.set({ name: newName })
.where(eq(profiles.id, profileId)); // ✅ type safe
.where(eq(profiles.id, profileId)); // [OK] type safe
}

@@ -186,3 +186,3 @@ ```

@@@section:logging
## 🪵 Logging Guidelines
## # Logging Guidelines

@@ -198,6 +198,6 @@ ### Use Structured Logging

@@@section:database-operations
## 🗄️ Database Operation Guidelines
## # Database Operation Guidelines
@@@section:no-loops
### 🚨 Never Execute Database Operations in Loops
### [!] Never Execute Database Operations in Loops

@@ -217,3 +217,3 @@ [anti-pattern and correct pattern examples]

@@@section:error-handling
## 🎨 Error Handling
## # Error Handling

@@ -229,3 +229,3 @@ ### Graceful Degradation

@@@section:router-guidelines
## 🎯 Router Guidelines
## # Router Guidelines

@@ -241,3 +241,3 @@ ### Hono Router Example

@@@section:checklist
## ✅ Checklist
## [OK] Checklist

@@ -260,3 +260,3 @@ Before committing, confirm:

@@@section:reference-examples
## 📚 Reference Examples
## # Reference Examples

@@ -283,9 +283,9 @@ | Feature | Reference File |

|---------|-------------|------------|
| 📁 Directory Structure | Module directory template, examples | `directory-structure` |
| 🎯 Type Safety Guidelines | TypeScript rules, Zod Schema | `type-safety` |
| 🪵 Logging Guidelines | Structured logging, no console | `logging` |
| 🗄️ Database Operations | Query directory, batch operations | `database-operations` |
| 🎨 Error Handling | Graceful degradation, response format | `error-handling` |
| 🎯 Router Guidelines | Route definitions, middleware | `router-guidelines` |
| ✅ Checklist | Pre-commit checks | `checklist` |
| # Directory Structure | Module directory template, examples | `directory-structure` |
| # Type Safety Guidelines | TypeScript rules, Zod Schema | `type-safety` |
| # Logging Guidelines | Structured logging, no console | `logging` |
| # Database Operations | Query directory, batch operations | `database-operations` |
| # Error Handling | Graceful degradation, response format | `error-handling` |
| # Router Guidelines | Route definitions, middleware | `router-guidelines` |
| [OK] Checklist | Pre-commit checks | `checklist` |

@@ -302,12 +302,12 @@ ## How to Read Sections

### Scenario 1: Create New API Module
- Required: 📁 Directory Structure (`directory-structure`)
- Also read: 🎯 Type Safety Guidelines (`type-safety`)
- Required: # Directory Structure (`directory-structure`)
- Also read: # Type Safety Guidelines (`type-safety`)
### Scenario 2: Write Database Operations
- Required: 🗄️ Database Operations (`database-operations`)
- Reference: 🎨 Error Handling (`error-handling`)
- Required: # Database Operations (`database-operations`)
- Reference: # Error Handling (`error-handling`)
### Scenario 3: Add New Endpoint
- Required: 🎯 Router Guidelines (`router-guidelines`)
- Reference: 🎯 Type Safety Guidelines (`type-safety`)
- Required: # Router Guidelines (`router-guidelines`)
- Reference: # Type Safety Guidelines (`type-safety`)

@@ -314,0 +314,0 @@ [... add more scenarios based on project needs ...]

@@ -9,3 +9,3 @@ # Generate Frontend Structure Guidelines

## ⚠️ CRITICAL: Requirements
## [!] CRITICAL: Requirements

@@ -102,3 +102,3 @@ 1. **Language**: All documentation must be written in **English**

@@@section:directory-structure
## 📁 Directory Structure Guidelines
## # Directory Structure Guidelines

@@ -117,3 +117,3 @@ @@@section:module-organization

@@@section:type-safety
## 🎯 Type Safety Guidelines
## # Type Safety Guidelines

@@ -123,6 +123,6 @@ @@@section:backend-contract-types

#### ✅ Correct Approach - Import Types from Backend
#### [OK] Correct Approach - Import Types from Backend
[code example]
#### ❌ Wrong Approach
#### [X] Wrong Approach
[anti-pattern code example]

@@ -135,3 +135,3 @@

@@@section:hook-development
## 🪝 Hook Development Guidelines
## # Hook Development Guidelines

@@ -141,3 +141,3 @@ @@@section:query-hook-guidelines

#### ✅ Correct Query Hook Pattern
#### [OK] Correct Query Hook Pattern
[code example]

@@ -150,3 +150,3 @@

#### ✅ Correct Mutation Hook Pattern
#### [OK] Correct Mutation Hook Pattern
[code example]

@@ -159,3 +159,3 @@

@@@section:api-calls
## 🔌 API Call Guidelines
## # API Call Guidelines

@@ -168,3 +168,3 @@ ### Basic Usage

@@@section:state-management
## 🏗️ State Management Guidelines
## # State Management Guidelines

@@ -180,3 +180,3 @@ ### 1. URL State Management

@@@section:component-development
## 🎨 Component Development Guidelines
## # Component Development Guidelines

@@ -192,3 +192,3 @@ ### 1. Component Structure

@@@section:performance-optimization
## ⚡ Performance Optimization Guidelines
## # Performance Optimization Guidelines

@@ -200,3 +200,3 @@ [performance rules]

@@@section:code-quality
## 🔍 Code Quality Guidelines
## # Code Quality Guidelines

@@ -209,3 +209,3 @@ ### Lint and Formatting

@@@section:checklist
## ✅ Checklist
## [OK] Checklist

@@ -219,3 +219,3 @@ - [ ] Code passes lint check

@@@section:reference-examples
## 📚 Reference Examples
## # Reference Examples

@@ -222,0 +222,0 @@ | Feature | Reference File |

@@ -19,7 +19,7 @@ # Integrate Claude Skill into Project Guidelines

> ⚠️ **Important**: The goal of skill integration is to update **development guidelines**, not to generate project code directly.
> [!] **Important**: The goal of skill integration is to update **development guidelines**, not to generate project code directly.
>
> - Guidelines content → Write to `workflow/structure/{target}/doc.md`
> - Code examples → Place in `workflow/structure/{target}/examples/skills/<skill-name>/`
> - Example files → Use `.template` suffix (e.g., `component.tsx.template`) to avoid IDE errors
> - Guidelines content -> Write to `workflow/structure/{target}/doc.md`
> - Code examples -> Place in `workflow/structure/{target}/examples/skills/<skill-name>/`
> - Example files -> Use `.template` suffix (e.g., `component.tsx.template`) to avoid IDE errors
>

@@ -68,3 +68,3 @@ > Where `{target}` is `frontend` or `backend`, determined by skill type.

@@@section:skill-<skill-name>
## 🎨 <Skill Name> Integration Guide
## # <Skill Name> Integration Guide

@@ -96,10 +96,10 @@ ### Overview

workflow/structure/{target}/
├── doc.md # Add skill-related section
├── index.md # Update index
└── examples/
└── skills/
└── <skill-name>/
├── README.md # Example documentation
├── example-1.ts.template # Code example (use .template suffix)
└── example-2.tsx.template
|-- doc.md # Add skill-related section
|-- index.md # Update index
\-- examples/
\-- skills/
\-- <skill-name>/
|-- README.md # Example documentation
|-- example-1.ts.template # Code example (use .template suffix)
\-- example-2.tsx.template
```

@@ -126,13 +126,13 @@

### 📋 Overview
### # Overview
- **Skill description**: [Functionality description]
- **Integration target**: `workflow/structure/{target}/`
### 🔧 Tech Stack Compatibility
### # Tech Stack Compatibility
| Skill Requirement | Project Status | Compatibility |
|-------------------|----------------|---------------|
| [Tech 1] | [Project tech] | ✅/⚠️/❌ |
| [Tech 1] | [Project tech] | [OK]/[!]/[X] |
### 📁 Integration Locations
### # Integration Locations

@@ -147,3 +147,3 @@ | Type | Path |

### 📦 Dependencies (if needed)
### # Dependencies (if needed)

@@ -159,3 +159,3 @@ ```bash

### ✅ Completed Changes
### [OK] Completed Changes

@@ -167,3 +167,3 @@ - [ ] Added `@@@section:skill-<name>` section to `doc.md`

### 📚 Related Guidelines
### # Related Guidelines

@@ -197,11 +197,11 @@ - [Existing related section IDs]

workflow/structure/backend/
├── doc.md # Add MCP section
├── index.md # Add index entry
└── examples/
└── skills/
└── mcp-builder/
├── README.md
├── server.ts.template
├── tools.ts.template
└── types.ts.template
|-- doc.md # Add MCP section
|-- index.md # Add index entry
\-- examples/
\-- skills/
\-- mcp-builder/
|-- README.md
|-- server.ts.template
|-- tools.ts.template
\-- types.ts.template
```

@@ -213,3 +213,3 @@

@@@section:skill-mcp-builder
## 🔌 MCP Server Development Guide
## # MCP Server Development Guide

@@ -216,0 +216,0 @@ ### Overview

@@ -368,4 +368,4 @@ A new developer needs onboarding.

1. /init-agent
→ See context: Branch "main", 2 uncommitted files
→ Active feature: none
-> See context: Branch "main", 2 uncommitted files
-> Active feature: none

@@ -376,3 +376,3 @@ 2. Create feature:

3. /before-frontend-dev
→ Read component guidelines
-> Read component guidelines

@@ -385,8 +385,8 @@ 4. Investigate and fix:

5. /check-frontend
→ Type check: ✅ passed
→ Lint: ✅ 0 errors
-> Type check: [OK] passed
-> Lint: [OK] 0 errors
6. /finish-work
→ Pre-commit checklist
→ Confirm all changes are ready
-> Pre-commit checklist
-> Confirm all changes are ready

@@ -397,3 +397,3 @@ 7. Human tests and commits:

8. /record-agent-flow
→ ./workflow/scripts/add-session.sh --title "Fix SyncIndicator" --commit "abc123"
-> ./workflow/scripts/add-session.sh --title "Fix SyncIndicator" --commit "abc123"

@@ -410,3 +410,3 @@ 9. Archive feature:

1. /init-agent
→ Understand current state
-> Understand current state

@@ -424,3 +424,3 @@ 2. Create feature:

5. /record-agent-flow (no commit)
→ ./workflow/scripts/add-session.sh --title "Migration Docs Planning" --summary "Created 14 subtasks"
-> ./workflow/scripts/add-session.sh --title "Migration Docs Planning" --summary "Created 14 subtasks"
```

@@ -434,6 +434,6 @@

1. /init-agent
→ Continue feature: entity-filesystem-refactor
-> Continue feature: entity-filesystem-refactor
2. /before-backend-dev
→ Read database and error handling guidelines
-> Read database and error handling guidelines

@@ -446,7 +446,7 @@ 3. Fix each CR issue:

4. /check-backend
→ All checks passed
-> All checks passed
5. /finish-work
→ Pre-commit checklist
→ Document lessons learned:
-> Pre-commit checklist
-> Document lessons learned:
- "All queries with workspaceId column must include WHERE clause"

@@ -464,3 +464,3 @@ - "buildXxxValues must match *DataSchema types"

1. /init-agent
→ Create feature: workflow-monorepo-adaptation
-> Create feature: workflow-monorepo-adaptation

@@ -476,3 +476,3 @@ 2. Plan phases:

4. /finish-work
→ Final verification checklist
-> Final verification checklist

@@ -489,6 +489,6 @@ 5. Human commits multiple times, record with multiple commit hashes:

1. /init-agent
→ Continue feature: fix-sync-data-inconsistency
-> Continue feature: fix-sync-data-inconsistency
2. /before-backend-dev
→ Read sync and database guidelines
-> Read sync and database guidelines

@@ -502,13 +502,13 @@ 3. Investigation loop:

4. /check-backend
→ All checks passed
-> All checks passed
5. /break-loop (when investigation is complete)
→ Summarize findings:
-> Summarize findings:
- Root cause: Transaction failure without error logging
- Temporary fix: Manual SQL update
- Permanent fix: Add detailed logging in applyEvent
→ Document for future reference
-> Document for future reference
6. /finish-work
→ Pre-commit checklist
-> Pre-commit checklist

@@ -518,3 +518,3 @@ 7. Human tests and commits

8. /record-agent-flow
→ Include lessons learned in session record
-> Include lessons learned in session record
```

@@ -521,0 +521,0 @@

@@ -1,2 +0,2 @@

⚠️ **Prerequisite**: This command should only be used AFTER the human has tested and committed the code.
[!] **Prerequisite**: This command should only be used AFTER the human has tested and committed the code.

@@ -38,5 +38,5 @@ **AI must NOT execute git commit** - only read history (`git log`, `git status`, `git diff`).

**Auto-completes**:
- ✅ Appends session to progress-N.md
- ✅ Auto-detects line count, creates new file if >2000 lines
- ✅ Updates index.md (Total Sessions +1, Last Active, line stats, history)
- [OK] Appends session to progress-N.md
- [OK] Auto-detects line count, creates new file if >2000 lines
- [OK] Updates index.md (Total Sessions +1, Last Active, line stats, history)

@@ -43,0 +43,0 @@ ---

@@ -123,4 +123,4 @@ # Sync Knowledge from Runtime

|-----|--------|-------|
| database-guidelines.md | ✅ Added | Adapted from Turso to generic ORM |
| logging-guidelines.md | ✅ Added | No changes needed |
| database-guidelines.md | [OK] Added | Adapted from Turso to generic ORM |
| logging-guidelines.md | [OK] Added | No changes needed |

@@ -127,0 +127,0 @@ ### Updated Files

@@ -15,9 +15,9 @@ # Agent Progress Index

agent-progress/
├── index.md # This file - main index
└── {developer}/ # Per-developer directory
├── index.md # Personal index with session history
├── features/ # Feature files
│ ├── *.json # Active features
│ └── archive/ # Archived features by month
└── progress-N.md # Progress files (sequential: 1, 2, 3...)
|-- index.md # This file - main index
\-- {developer}/ # Per-developer directory
|-- index.md # Personal index with session history
|-- features/ # Feature files
| |-- *.json # Active features
| \-- archive/ # Archived features by month
\-- progress-N.md # Progress files (sequential: 1, 2, 3...)
```

@@ -110,7 +110,7 @@

- ✅ {Test result}
- [OK] {Test result}
### Status
✅ **Completed** / 🔄 **In Progress** / ⏸️ **Blocked**
[OK] **Completed** / # **In Progress** / [P] **Blocked**

@@ -117,0 +117,0 @@ ### Next Steps

@@ -12,8 +12,8 @@ # Backend Development Guidelines

packages/api/modules/
├── {module}/
│ ├── router.ts # Route definitions
│ ├── procedures/ # Business logic
│ ├── types.ts # Type definitions
│ └── api/ # API documentation
│ └── *.md
|-- {module}/
| |-- router.ts # Route definitions
| |-- procedures/ # Business logic
| |-- types.ts # Type definitions
| \-- api/ # API documentation
| \-- *.md
```

@@ -32,3 +32,3 @@

```typescript
// ✅ Good - use local variable
// [OK] Good - use local variable
const user = await getUser(id);

@@ -40,3 +40,3 @@ if (!user) {

// ❌ Bad - non-null assertion
// [X] Bad - non-null assertion
const userName = user!.name;

@@ -75,3 +75,3 @@ ```

```typescript
// ✅ Good - parallel execution
// [OK] Good - parallel execution
const results = await Promise.all(

@@ -81,3 +81,3 @@ ids.map(id => db.query.users.findFirst({ where: eq(users.id, id) }))

// ❌ Bad - sequential execution
// [X] Bad - sequential execution
for (const id of ids) {

@@ -119,6 +119,6 @@ await db.query.users.findFirst({ where: eq(users.id, id) });

```typescript
// ✅ Good
// [OK] Good
logger.info('User created', { userId: user.id, email: user.email });
// ❌ Bad
// [X] Bad
console.log('User created: ' + user.id);

@@ -125,0 +125,0 @@ ```

@@ -23,6 +23,6 @@ # Development Workflow

1. **Read Before Write** - Understand context before starting
2. **Follow Standards** - ⚠️ **MUST read `workflow/structure/` guidelines before coding**
2. **Follow Standards** - [!] **MUST read `workflow/structure/` guidelines before coding**
3. **Incremental Development** - Complete one feature at a time
4. **Record Promptly** - Update tracking files immediately after completion
5. **Document Limits** - ⚠️ **Max 2000 lines per agent-progress document**
5. **Document Limits** - [!] **Max 2000 lines per agent-progress document**

@@ -33,38 +33,38 @@ ### File System

workflow/
├── .developer # Developer identity (gitignored)
├── scripts/
│ ├── init-developer.sh # Initialize developer identity
│ ├── get-developer.sh # Get current developer name
│ ├── feature.sh # Manage features
│ ├── get-context.sh # Get session context
│ ├── update-index.sh # Auto-update index.md
│ └── add-session.sh # One-click session recording
├── agent-progress/ # AI Agent work progress records
│ ├── index.md # Progress index + Session template
│ └── {developer}/ # Per-developer directories
│ ├── index.md # Personal index (with @@@auto markers)
│ ├── features/ # Feature tracking
│ └── progress-N.md # Progress files (sequential numbering)
├── structure/ # ⚠️ MUST READ before coding
│ ├── frontend/ # Frontend guidelines (multi-doc)
│ │ ├── index.md # Start here - guidelines index
│ │ ├── directory-structure.md # Directory layout
│ │ ├── type-safety.md # TypeScript patterns
│ │ ├── hook-guidelines.md # React Query hooks
│ │ ├── component-guidelines.md # Component patterns
│ │ ├── state-management.md # State patterns
│ │ └── quality-guidelines.md # Code standards
│ ├── backend/ # Backend guidelines (multi-doc)
│ │ ├── index.md # Start here - guidelines index
│ │ ├── directory-structure.md # Directory layout
│ │ ├── type-safety.md # Zod, TypeScript patterns
│ │ ├── database-guidelines.md # ORM, batch operations
│ │ ├── logging-guidelines.md # Structured logging
│ │ ├── error-handling.md # Error types, handling
│ │ └── quality-guidelines.md # Code standards
│ └── flows/ # Cross-layer specifications
│ ├── index.md # Flow specs index
│ ├── cross-layer-thinking-guide.md # Pre-implementation checklist
│ └── spec-flow-template.md # Template for new flows
└── flow.md # This document
|-- .developer # Developer identity (gitignored)
|-- scripts/
| |-- init-developer.sh # Initialize developer identity
| |-- get-developer.sh # Get current developer name
| |-- feature.sh # Manage features
| |-- get-context.sh # Get session context
| |-- update-index.sh # Auto-update index.md
| \-- add-session.sh # One-click session recording
|-- agent-progress/ # AI Agent work progress records
| |-- index.md # Progress index + Session template
| \-- {developer}/ # Per-developer directories
| |-- index.md # Personal index (with @@@auto markers)
| |-- features/ # Feature tracking
| \-- progress-N.md # Progress files (sequential numbering)
|-- structure/ # [!] MUST READ before coding
| |-- frontend/ # Frontend guidelines (multi-doc)
| | |-- index.md # Start here - guidelines index
| | |-- directory-structure.md # Directory layout
| | |-- type-safety.md # TypeScript patterns
| | |-- hook-guidelines.md # React Query hooks
| | |-- component-guidelines.md # Component patterns
| | |-- state-management.md # State patterns
| | \-- quality-guidelines.md # Code standards
| |-- backend/ # Backend guidelines (multi-doc)
| | |-- index.md # Start here - guidelines index
| | |-- directory-structure.md # Directory layout
| | |-- type-safety.md # Zod, TypeScript patterns
| | |-- database-guidelines.md # ORM, batch operations
| | |-- logging-guidelines.md # Structured logging
| | |-- error-handling.md # Error types, handling
| | \-- quality-guidelines.md # Code standards
| \-- flows/ # Cross-layer specifications
| |-- index.md # Flow specs index
| |-- cross-layer-thinking-guide.md # Pre-implementation checklist
| \-- spec-flow-template.md # Template for new flows
\-- flow.md # This document
```

@@ -88,5 +88,5 @@

### Step 2: Read Development Guidelines ⚠️ REQUIRED
### Step 2: Read Development Guidelines [!] REQUIRED
**⚠️ CRITICAL: MUST read guidelines before writing any code**
**[!] CRITICAL: MUST read guidelines before writing any code**

@@ -143,22 +143,22 @@ Based on what you'll develop (frontend/backend), read the corresponding guidelines:

1. Create or select feature
└─> ./workflow/scripts/feature.sh create <name> or list
\-> ./workflow/scripts/feature.sh create <name> or list
2. Write code according to guidelines
└─> Read workflow/structure/[frontend|backend]/ docs
└─> For cross-layer: read workflow/structure/flows/
└─> Frontend: Type safety, Hook standards, Component standards
└─> Backend: Directory structure, Type safety, Database, Logging
\-> Read workflow/structure/[frontend|backend]/ docs
\-> For cross-layer: read workflow/structure/flows/
\-> Frontend: Type safety, Hook standards, Component standards
\-> Backend: Directory structure, Type safety, Database, Logging
3. Self-test
└─> pnpm lint (must pass)
└─> pnpm type-check (must pass)
└─> Manual feature testing
\-> pnpm lint (must pass)
\-> pnpm type-check (must pass)
\-> Manual feature testing
4. Commit code
└─> git add <files>
└─> git commit -m "type(scope): description"
\-> git add <files>
\-> git commit -m "type(scope): description"
Format: feat/fix/docs/refactor/test/chore
5. Record session (one command)
└─> ./workflow/scripts/add-session.sh --title "Title" --commit "hash"
\-> ./workflow/scripts/add-session.sh --title "Title" --commit "hash"
```

@@ -169,17 +169,17 @@

**Must pass before commit**:
- ✅ `pnpm lint` - 0 errors
- ✅ `pnpm type-check` - No type errors
- ✅ Manual feature testing passes
- [OK] `pnpm lint` - 0 errors
- [OK] `pnpm type-check` - No type errors
- [OK] Manual feature testing passes
**Frontend-specific checks** (see `frontend/quality-guidelines.md`):
- ✅ Use semantic HTML (`<button>` not `<div role="button">`)
- ✅ Use Next.js `<Image>` instead of `<img>`
- ✅ Import types from backend, don't redefine
- ✅ Avoid non-null assertions `!`
- [OK] Use semantic HTML (`<button>` not `<div role="button">`)
- [OK] Use Next.js `<Image>` instead of `<img>`
- [OK] Import types from backend, don't redefine
- [OK] Avoid non-null assertions `!`
**Backend-specific checks** (see `backend/quality-guidelines.md`):
- ✅ Strictly avoid non-null assertion `!`
- ✅ All API inputs/outputs have Zod Schema
- ✅ Use structured logging (`logger`), forbidden `console.log`
- ✅ Database operations avoid `await` in loops
- [OK] Strictly avoid non-null assertion `!`
- [OK] All API inputs/outputs have Zod Schema
- [OK] Use structured logging (`logger`), forbidden `console.log`
- [OK] Database operations avoid `await` in loops

@@ -210,7 +210,7 @@ ---

Use `/finish-work` command to run through:
1. ✅ All code committed, commit message follows convention
2. ✅ Session recorded via `add-session.sh`
3. ✅ No lint/type-check errors
4. ✅ Working directory clean (or WIP noted)
5. ✅ Structure docs updated if needed
1. [OK] All code committed, commit message follows convention
2. [OK] Session recorded via `add-session.sh`
3. [OK] No lint/type-check errors
4. [OK] Working directory clean (or WIP noted)
5. [OK] Structure docs updated if needed

@@ -228,13 +228,13 @@ ---

agent-progress/
├── index.md # Main index (Active Developers table)
└── {developer}/ # Per-developer directory
├── index.md # Personal index (with @@@auto markers)
├── features/ # Feature files
└── progress-N.md # Progress files (sequential: 1, 2, 3...)
|-- index.md # Main index (Active Developers table)
\-- {developer}/ # Per-developer directory
|-- index.md # Personal index (with @@@auto markers)
|-- features/ # Feature files
\-- progress-N.md # Progress files (sequential: 1, 2, 3...)
```
**When to update**:
- ✅ End of each session
- ✅ Complete important feature
- ✅ Fix important bug
- [OK] End of each session
- [OK] Complete important feature
- [OK] Fix important bug

@@ -248,17 +248,17 @@ ### 2. structure/ - Development Guidelines

structure/
├── frontend/ # Frontend docs
│ ├── index.md # Start here
│ └── *.md # Topic-specific docs
├── backend/ # Backend docs
│ ├── index.md # Start here
│ └── *.md # Topic-specific docs
└── flows/ # Cross-layer specs
├── index.md # Start here
└── *.md # Flow-specific docs
|-- frontend/ # Frontend docs
| |-- index.md # Start here
| \-- *.md # Topic-specific docs
|-- backend/ # Backend docs
| |-- index.md # Start here
| \-- *.md # Topic-specific docs
\-- flows/ # Cross-layer specs
|-- index.md # Start here
\-- *.md # Flow-specific docs
```
**When to update**:
- ✅ New pattern discovered
- ✅ Bug fixed that reveals missing guidance
- ✅ New convention established
- [OK] New pattern discovered
- [OK] Bug fixed that reveals missing guidance
- [OK] New convention established

@@ -278,10 +278,10 @@ ### 3. Features - Feature Tracking

### ✅ DO - Should Do
### [OK] DO - Should Do
1. **Before session start**:
- Run `./workflow/scripts/get-context.sh` for full context
- ⚠️ **MUST read** relevant `workflow/structure/` docs
- [!] **MUST read** relevant `workflow/structure/` docs
2. **During development**:
- ⚠️ **Follow** `workflow/structure/` guidelines
- [!] **Follow** `workflow/structure/` guidelines
- For cross-layer features, use `/check-cross-layer`

@@ -297,10 +297,10 @@ - Develop only one feature at a time

### ❌ DON'T - Should Not Do
### [X] DON'T - Should Not Do
1. ⚠️ **Don't** skip reading `workflow/structure/` guidelines
2. ⚠️ **Don't** let agent-progress single file exceed 2000 lines
1. [!] **Don't** skip reading `workflow/structure/` guidelines
2. [!] **Don't** let agent-progress single file exceed 2000 lines
3. **Don't** develop multiple unrelated features simultaneously
4. **Don't** commit code with lint/type-check errors
5. **Don't** forget to update structure docs after learning something
6. ⚠️ **Don't** execute `git commit` - AI should not commit code
6. [!] **Don't** execute `git commit` - AI should not commit code
7. **Don't** write `workflow/structure/` docs in Chinese - **English only**

@@ -358,8 +358,8 @@

Following this workflow ensures:
- ✅ Continuity across multiple sessions
- ✅ Consistent code quality
- ✅ Trackable progress
- ✅ Knowledge accumulation in structure docs
- ✅ Transparent team collaboration
- [OK] Continuity across multiple sessions
- [OK] Consistent code quality
- [OK] Trackable progress
- [OK] Knowledge accumulation in structure docs
- [OK] Transparent team collaboration
**Core Philosophy**: Read before write, follow standards, record promptly, capture learnings

@@ -12,7 +12,7 @@ # Frontend Development Guidelines

modules/
├── {feature}/
│ ├── components/ # UI components
│ ├── hooks/ # Custom hooks
│ ├── context/ # React context
│ └── types.ts # Type definitions
|-- {feature}/
| |-- components/ # UI components
| |-- hooks/ # Custom hooks
| |-- context/ # React context
| \-- types.ts # Type definitions
```

@@ -32,6 +32,6 @@

```typescript
// ✅ Good
// [OK] Good
import type { User } from '@/packages/api';
// ❌ Bad - don't redefine
// [X] Bad - don't redefine
interface User {

@@ -119,6 +119,6 @@ id: string;

```tsx
// ✅ Good
// [OK] Good
<button onClick={handleClick}>Click me</button>
// ❌ Bad
// [X] Bad
<div role="button" onClick={handleClick}>Click me</div>

@@ -135,7 +135,7 @@ ```

```tsx
// ✅ Good
// [OK] Good
import Image from 'next/image';
<Image src="/logo.png" alt="Logo" width={100} height={100} />
// ❌ Bad
// [X] Bad
<img src="/logo.png" alt="Logo" />

@@ -142,0 +142,0 @@ ```

@@ -23,3 +23,3 @@ # Database Guidelines

```typescript
// ❌ BAD: N+1 queries (1 + N database calls)
// [X] BAD: N+1 queries (1 + N database calls)
const users = await db.select().from(users).all();

@@ -35,3 +35,3 @@ for (const user of users) {

```typescript
// ✅ GOOD: Single query with JOIN
// [OK] GOOD: Single query with JOIN
const usersWithPosts = await db.query.users.findMany({

@@ -47,3 +47,3 @@ with: {

```typescript
// ✅ GOOD: Two queries total (1 for users, 1 for all posts)
// [OK] GOOD: Two queries total (1 for users, 1 for all posts)
import { inArray } from 'drizzle-orm';

@@ -67,3 +67,3 @@

```typescript
// ⚠️ OK for small N, but watch connection limits
// [!] OK for small N, but watch connection limits
const results = await Promise.all(

@@ -171,7 +171,7 @@ ids.slice(0, 10).map(id =>

```typescript
// ❌ BAD: Mixing seconds and milliseconds
// [X] BAD: Mixing seconds and milliseconds
const timestamp = Math.floor(Date.now() / 1000); // Seconds
new Date(timestamp); // Wrong! Expects milliseconds
// ✅ GOOD: Consistent milliseconds
// [OK] GOOD: Consistent milliseconds
const timestamp = Date.now(); // Milliseconds

@@ -178,0 +178,0 @@ new Date(timestamp); // Correct

@@ -11,30 +11,30 @@ # Directory Structure

server/
├── db/ # Database layer
│ ├── client.ts # Database client initialization
│ ├── schema.ts # Table definitions
│ └── migrations/ # Migration files
├── lib/ # Shared utilities
│ ├── logger.ts # Logger setup
│ ├── errors.ts # Custom error classes
│ └── utils.ts # Helper functions
├── middleware/ # Middleware
│ ├── auth.ts # Authentication
│ ├── error-handler.ts # Error handling
│ └── request-context.ts # Request context
├── routes/ # API routes (domain-driven)
│ └── {domain}/
│ ├── types.ts # Zod schemas + TypeScript types
│ ├── router.ts # Route definitions
│ ├── procedures/ # One file per endpoint
│ │ ├── list.ts
│ │ ├── get.ts
│ │ ├── create.ts
│ │ ├── update.ts
│ │ └── delete.ts
│ └── lib/ # Domain-specific logic
└── types.ts # Shared types (AppContext, etc.)
|-- db/ # Database layer
| |-- client.ts # Database client initialization
| |-- schema.ts # Table definitions
| \-- migrations/ # Migration files
|
|-- lib/ # Shared utilities
| |-- logger.ts # Logger setup
| |-- errors.ts # Custom error classes
| \-- utils.ts # Helper functions
|
|-- middleware/ # Middleware
| |-- auth.ts # Authentication
| |-- error-handler.ts # Error handling
| \-- request-context.ts # Request context
|
|-- routes/ # API routes (domain-driven)
| \-- {domain}/
| |-- types.ts # Zod schemas + TypeScript types
| |-- router.ts # Route definitions
| |-- procedures/ # One file per endpoint
| | |-- list.ts
| | |-- get.ts
| | |-- create.ts
| | |-- update.ts
| | \-- delete.ts
| \-- lib/ # Domain-specific logic
|
\-- types.ts # Shared types (AppContext, etc.)
```

@@ -41,0 +41,0 @@

@@ -44,12 +44,12 @@ # Backend Development Guidelines

server/
├── db/ # Database (client, schema)
├── lib/ # Shared utilities
├── middleware/ # Middleware
├── routes/ # API routes (domain-driven)
│ └── {domain}/
│ ├── types.ts # Zod schemas + types
│ ├── router.ts # Route definitions
│ ├── procedures/ # One file per endpoint
│ └── lib/ # Domain-specific logic
└── types.ts # Shared types
|-- db/ # Database (client, schema)
|-- lib/ # Shared utilities
|-- middleware/ # Middleware
|-- routes/ # API routes (domain-driven)
| \-- {domain}/
| |-- types.ts # Zod schemas + types
| |-- router.ts # Route definitions
| |-- procedures/ # One file per endpoint
| \-- lib/ # Domain-specific logic
\-- types.ts # Shared types
```

@@ -56,0 +56,0 @@

@@ -32,3 +32,3 @@ # Logging Guidelines

```typescript
// ✅ GOOD: Structured with context
// [OK] GOOD: Structured with context
logger.info('user_created', {

@@ -44,3 +44,3 @@ userId: user.id,

// ❌ BAD: Unstructured string concatenation
// [X] BAD: Unstructured string concatenation
console.log('User created: ' + user.id);

@@ -155,6 +155,6 @@ logger.info('Error: ' + error.message);

```typescript
// ❌ BAD
// [X] BAD
logger.info('login_attempt', { email, password });
// ✅ GOOD
// [OK] GOOD
logger.info('login_attempt', { email });

@@ -161,0 +161,0 @@ ```

@@ -29,7 +29,7 @@ # Quality Guidelines

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
const name = user!.name;
const data = response!.data;
// ✅ REQUIRED
// [OK] REQUIRED
const user = await getUser(id);

@@ -45,7 +45,7 @@ if (!user) {

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
console.log('Debug:', data);
console.error('Error:', error);
// ✅ REQUIRED
// [OK] REQUIRED
logger.debug('processing_data', { data });

@@ -58,3 +58,3 @@ logger.error('operation_failed', error);

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
for (const id of ids) {

@@ -64,3 +64,3 @@ await db.select().from(users).where(eq(users.id, id));

// ✅ REQUIRED
// [OK] REQUIRED
const results = await db

@@ -75,7 +75,7 @@ .select()

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
const data = input as UserData;
const config = JSON.parse(str) as Config;
// ✅ REQUIRED
// [OK] REQUIRED
const data = userDataSchema.parse(input);

@@ -88,7 +88,7 @@ const config = configSchema.parse(JSON.parse(str));

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
function process(data: any) { ... }
const result: any = await fetch(...);
// ✅ REQUIRED
// [OK] REQUIRED
function process(data: unknown) {

@@ -160,7 +160,7 @@ const validated = schema.parse(data);

```typescript
// ✅ GOOD: Explain WHY, not WHAT
// [OK] GOOD: Explain WHY, not WHAT
// Skip validation for internal calls to avoid performance overhead
const data = trustInternalData(input);
// ❌ BAD: Obvious comment
// [X] BAD: Obvious comment
// Get user by id

@@ -167,0 +167,0 @@ const user = await getUser(id);

@@ -80,3 +80,3 @@ # Type Safety

```typescript
// ❌ BAD: Crashes if user is null
// [X] BAD: Crashes if user is null
const user = await getUser(id);

@@ -89,3 +89,3 @@ const name = user!.name; // TypeScript trusts you, runtime doesn't

```typescript
// ✅ GOOD: Explicit null check
// [OK] GOOD: Explicit null check
const user = await getUser(id);

@@ -102,3 +102,3 @@ if (!user) {

```typescript
// ✅ GOOD: Early return pattern
// [OK] GOOD: Early return pattern
async function getUserName(id: string): Promise<string> {

@@ -184,9 +184,9 @@ const user = await getUser(id);

// Trust external data
const data = externalInput as User; // ❌
const data = externalInput as User; // [X]
// Use non-null assertion
const name = user!.name; // ❌
const name = user!.name; // [X]
// Ignore parse errors
const data = userSchema.parse(input); // ❌ Throws on invalid
const data = userSchema.parse(input); // [X] Throws on invalid
```

@@ -193,0 +193,0 @@

@@ -162,3 +162,3 @@ # Code Reuse Thinking Guide

**The Problem**: Same domain concept displayed in multiple components, each with its own config. Changing one, forgetting others → inconsistency.
**The Problem**: Same domain concept displayed in multiple components, each with its own config. Changing one, forgetting others -> inconsistency.

@@ -168,6 +168,6 @@ **Example - Before (bug)**:

// TodoColumn.tsx
const stateConfig = { open: { label: "Open", ... } }; // ✅ Updated
const stateConfig = { open: { label: "Open", ... } }; // [OK] Updated
// TodoDetailPanel.tsx (FORGOT!)
const stateConfig = { open: { label: "Todo", ... } }; // ❌ Still old
const stateConfig = { open: { label: "Todo", ... } }; // [X] Still old

@@ -203,3 +203,3 @@ // Result: Column shows "Open", Detail panel shows "Todo"

**The Problem**: Visual representation and logic use different criteria → inconsistent behavior.
**The Problem**: Visual representation and logic use different criteria -> inconsistent behavior.

@@ -271,3 +271,3 @@ **Example - Before (bug)**:

**Rule of thumb**:
> "Duplication is cheaper than the wrong abstraction" — Sandi Metz
> "Duplication is cheaper than the wrong abstraction" -- Sandi Metz

@@ -304,14 +304,14 @@ But once you see 3+ occurrences, it's time to abstract.

You're about to write some code
├─ Does similar code exist?
│ ├─ Yes → Can you reuse/extend it?
│ │ ├─ Yes → Reuse it
│ │ └─ No → Why not? (might need abstraction)
│ └─ No → Continue
├─ Is this the 3rd time writing this pattern?
│ ├─ Yes → Time to abstract
│ └─ No → OK to duplicate for now
└─ Done
|
|- Does similar code exist?
| |- Yes -> Can you reuse/extend it?
| | |- Yes -> Reuse it
| | \- No -> Why not? (might need abstraction)
| \- No -> Continue
|
|- Is this the 3rd time writing this pattern?
| |- Yes -> Time to abstract
| \- No -> OK to duplicate for now
|
\- Done
```

@@ -318,0 +318,0 @@

@@ -40,4 +40,4 @@ # Cross-Layer Thinking Guide

```
[ ] Read flow: Database → Service → API → Hook → Component
[ ] Write flow: Component → Hook → API → Service → Database
[ ] Read flow: Database -> Service -> API -> Hook -> Component
[ ] Write flow: Component -> Hook -> API -> Service -> Database
[ ] Both ways (bidirectional)

@@ -86,28 +86,28 @@ ```

```
┌─────────────────────────────────────────────────────────────┐
│ THINK THROUGH │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. CREATE │
│ └─ UI: What triggers creation? (button, form) │
│ └─ API: What's the input schema? │
│ └─ DB: What tables are affected? │
│ └─ Response: What does UI need back? │
│ │
│ 2. READ │
│ └─ List view: What fields needed? (avoid over-fetch) │
│ └─ Detail view: Lazy load heavy content? │
│ └─ Loading: Show skeleton? Empty state? │
│ │
│ 3. UPDATE │
│ └─ Optimistic UI? (update local before API responds) │
│ └─ Validation: Same rules as create? │
│ └─ Partial update? (PATCH vs PUT) │
│ │
│ 4. DELETE │
│ └─ Soft delete? (isDeleted flag) │
│ └─ Cascade? (related entities) │
│ └─ Confirmation required? │
│ │
└─────────────────────────────────────────────────────────────┘
+-------------------------------------------------------------+
| THINK THROUGH |
|-------------------------------------------------------------|
| |
| 1. CREATE |
| \- UI: What triggers creation? (button, form) |
| \- API: What's the input schema? |
| \- DB: What tables are affected? |
| \- Response: What does UI need back? |
| |
| 2. READ |
| \- List view: What fields needed? (avoid over-fetch) |
| \- Detail view: Lazy load heavy content? |
| \- Loading: Show skeleton? Empty state? |
| |
| 3. UPDATE |
| \- Optimistic UI? (update local before API responds) |
| \- Validation: Same rules as create? |
| \- Partial update? (PATCH vs PUT) |
| |
| 4. DELETE |
| \- Soft delete? (isDeleted flag) |
| \- Cascade? (related entities) |
| \- Confirmation required? |
| |
\-------------------------------------------------------------+
```

@@ -118,27 +118,27 @@

```
┌─────────────────────────────────────────────────────────────┐
│ THINK THROUGH │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. INPUT │
│ └─ What fields are required vs optional? │
│ └─ What validations on each field? │
│ └─ Real-time validation or on submit? │
│ │
│ 2. SUBMISSION │
│ └─ Disable button while submitting? │
│ └─ Show loading indicator? │
│ └─ Prevent double submission? │
│ │
│ 3. SUCCESS │
│ └─ Redirect to where? │
│ └─ Show success message? │
│ └─ Invalidate which queries? │
│ │
│ 4. ERROR │
│ └─ Show inline errors or toast? │
│ └─ Which fields keep values? │
│ └─ How to retry? │
│ │
└─────────────────────────────────────────────────────────────┘
+-------------------------------------------------------------+
| THINK THROUGH |
|-------------------------------------------------------------|
| |
| 1. INPUT |
| \- What fields are required vs optional? |
| \- What validations on each field? |
| \- Real-time validation or on submit? |
| |
| 2. SUBMISSION |
| \- Disable button while submitting? |
| \- Show loading indicator? |
| \- Prevent double submission? |
| |
| 3. SUCCESS |
| \- Redirect to where? |
| \- Show success message? |
| \- Invalidate which queries? |
| |
| 4. ERROR |
| \- Show inline errors or toast? |
| \- Which fields keep values? |
| \- How to retry? |
| |
\-------------------------------------------------------------+
```

@@ -149,27 +149,27 @@

```
┌─────────────────────────────────────────────────────────────┐
│ THINK THROUGH │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. FILTERS │
│ └─ Which filters are available? │
│ └─ Filters in URL for shareability? │
│ └─ Server-side or client-side filtering? │
│ │
│ 2. PAGINATION │
│ └─ Page-based or cursor-based? │
│ └─ Total count needed? │
│ └─ Infinite scroll or explicit pages? │
│ │
│ 3. SORTING │
│ └─ Default sort order? │
│ └─ Multi-column sort? │
│ └─ Server-side or client-side? │
│ │
│ 4. LOADING │
│ └─ Skeleton for initial load? │
│ └─ Overlay for filter change? │
│ └─ Keep previous data while loading? │
│ │
└─────────────────────────────────────────────────────────────┘
+-------------------------------------------------------------+
| THINK THROUGH |
|-------------------------------------------------------------|
| |
| 1. FILTERS |
| \- Which filters are available? |
| \- Filters in URL for shareability? |
| \- Server-side or client-side filtering? |
| |
| 2. PAGINATION |
| \- Page-based or cursor-based? |
| \- Total count needed? |
| \- Infinite scroll or explicit pages? |
| |
| 3. SORTING |
| \- Default sort order? |
| \- Multi-column sort? |
| \- Server-side or client-side? |
| |
| 4. LOADING |
| \- Skeleton for initial load? |
| \- Overlay for filter change? |
| \- Keep previous data while loading? |
| |
\-------------------------------------------------------------+
```

@@ -219,20 +219,20 @@

Start: New Feature
├─ Touches 3+ layers?
│ ├─ Yes → Use this thinking guide
│ └─ No → Standard implementation
├─ Has form submission?
│ ├─ Yes → Think through Pattern B
│ └─ No → Skip
├─ Has data list?
│ ├─ Yes → Think through Pattern C
│ └─ No → Skip
├─ Has CRUD operations?
│ ├─ Yes → Think through Pattern A
│ └─ No → Skip
└─ Done: Implementation checklist ready
|
|- Touches 3+ layers?
| |- Yes -> Use this thinking guide
| \- No -> Standard implementation
|
|- Has form submission?
| |- Yes -> Think through Pattern B
| \- No -> Skip
|
|- Has data list?
| |- Yes -> Think through Pattern C
| \- No -> Skip
|
|- Has CRUD operations?
| |- Yes -> Think through Pattern A
| \- No -> Skip
|
\- Done: Implementation checklist ready
```

@@ -239,0 +239,0 @@

@@ -21,14 +21,14 @@ # Cross-Layer Flow Specifications

Before writing ANY code
├─ Read: Pre-Implementation Checklist
│ └─ "Will this constant be used elsewhere?"
│ └─ "Does this pattern already exist?"
├─ If feature spans 3+ layers
│ └─ Read: Cross-Layer Thinking Guide
│ └─ Consider creating a Flow Spec
└─ During/After implementation
└─ Reference: Code Reuse Thinking Guide
└─ Run: /check-cross-layer command
|
|- Read: Pre-Implementation Checklist
| \- "Will this constant be used elsewhere?"
| \- "Does this pattern already exist?"
|
|- If feature spans 3+ layers
| \- Read: Cross-Layer Thinking Guide
| \- Consider creating a Flow Spec
|
\- During/After implementation
\- Reference: Code Reuse Thinking Guide
\- Run: /check-cross-layer command
```

@@ -60,3 +60,3 @@

- [ ] Spans 3+ layers (e.g., API → Service → Component → Hook)
- [ ] Spans 3+ layers (e.g., API -> Service -> Component -> Hook)
- [ ] Has transformation points where data format changes

@@ -71,17 +71,17 @@ - [ ] Has multiple consumers with different requirements

### Pattern 1: API → Service → Component
### Pattern 1: API -> Service -> Component
```
API Route # Validate input, call service
|
v
Service Layer # Business logic, database
|
v
Response # Format for client
|
v
React Query Hook # Cache, loading states
|
v
Component # Render UI

@@ -92,17 +92,17 @@ ```

### Pattern 2: User Action → State → API → Refetch
### Pattern 2: User Action -> State -> API -> Refetch
```
User clicks button # UI Layer
|
v
Call mutation hook # React Query mutation
|
v
API Request # POST/PATCH/DELETE
|
v
Invalidate queries # Trigger refetch
|
v
UI updates # New data rendered

@@ -109,0 +109,0 @@ ```

@@ -9,3 +9,3 @@ # Pre-Implementation Checklist

Most code quality issues aren't caught during implementation—they're **designed in** from the start:
Most code quality issues aren't caught during implementation--they're **designed in** from the start:

@@ -29,11 +29,11 @@ | Problem | Root Cause | Cost |

- [ ] **Cross-layer usage?** Will this value be used in both frontend and backend?
- If yes → Put in shared constants file
- If yes -> Put in shared constants file
- Example: Batch size used by backend sync AND frontend threshold check
- [ ] **Multiple consumers?** Will this value be used in 2+ files within the same layer?
- If yes → Put in a shared constants file for that layer
- If yes -> Put in a shared constants file for that layer
- Example: Don't define `DEBOUNCE_MS = 2000` in each hook file
- [ ] **Magic number?** Is this a hardcoded value that could change?
- If yes → Extract to named constant with comment explaining why
- If yes -> Extract to named constant with comment explaining why
- Example: `BATCH_SIZE: 15 // API limit constraint`

@@ -53,7 +53,7 @@

- [ ] **Will repeat?** Will this exact logic be needed in 2+ places?
- If yes → Create a shared hook/utility **first**, then use it
- If yes -> Create a shared hook/utility **first**, then use it
- Don't copy-paste and plan to refactor later
- [ ] **Callback pattern?** Does the logic need optional callbacks (onStart, onComplete, onError)?
- If yes → Design the abstraction with callback support from the start
- If yes -> Design the abstraction with callback support from the start

@@ -65,3 +65,3 @@ ### 3. Types & Interfaces

- [ ] **Cross-layer type?** Is this type used across API boundary?
- If yes → Define in shared types location
- If yes -> Define in shared types location
- Never duplicate type definitions between frontend and backend

@@ -80,3 +80,3 @@

- [ ] **State lifecycle?** Will this component unmount during normal user flow?
- If yes → Consider where state should persist (parent, context, store)
- If yes -> Consider where state should persist (parent, context, store)

@@ -89,10 +89,10 @@ ---

Adding a value/constant?
├── Used in frontend AND backend? → Shared constants
├── Used in 2+ files in same layer? → Layer-specific shared constants
└── Single file only? → Local constant is fine
|-- Used in frontend AND backend? -> Shared constants
|-- Used in 2+ files in same layer? -> Layer-specific shared constants
\-- Single file only? -> Local constant is fine
Adding logic/behavior?
├── Similar pattern exists? → Extend or reuse existing
├── Will be used in 2+ places? → Create shared hook/utility first
└── Single use only? → Implement directly (but document pattern)
|-- Similar pattern exists? -> Extend or reuse existing
|-- Will be used in 2+ places? -> Create shared hook/utility first
\-- Single use only? -> Implement directly (but document pattern)
```

@@ -104,3 +104,3 @@

### ❌ Copy-Paste-Modify
### [X] Copy-Paste-Modify

@@ -117,3 +117,3 @@ ```typescript

### ✅ Shared Abstraction
### [OK] Shared Abstraction

@@ -130,3 +130,3 @@ ```typescript

### ❌ Local Constant Aliases
### [X] Local Constant Aliases

@@ -139,3 +139,3 @@ ```typescript

### ✅ Direct Usage
### [OK] Direct Usage

@@ -184,3 +184,3 @@ ```typescript

| Same logic copied multiple times | If logic will repeat, create abstraction **before** first use |
| Created local aliases for imported constants | Never create local aliases—use imported constants directly |
| Created local aliases for imported constants | Never create local aliases--use imported constants directly |

@@ -187,0 +187,0 @@ ---

@@ -19,19 +19,19 @@ # Flow Spec: [Feature Name]

[Source]
[Layer 1] ─────────────────────────────┐
│ │
│ Data: { field1, field2 } │
│ Transform: none │
│ │
▼ │
[Layer 2] ─────────────────────────────┤
│ │
│ Data: { field1, field2, extra } │
│ Transform: add computed field │
│ │
▼ │
[Layer 3] ─────────────────────────────┘
|
v
[Layer 1] -----------------------------+
| |
| Data: { field1, field2 } |
| Transform: none |
| |
v |
[Layer 2] -----------------------------|
| |
| Data: { field1, field2, extra } |
| Transform: add computed field |
| |
v |
[Layer 3] -----------------------------+
|
v
[Consumer]

@@ -67,4 +67,4 @@ ```

**Error Handling**:
- Validation errors → 400 response
- Not found → 404 response
- Validation errors -> 400 response
- Not found -> 404 response

@@ -92,3 +92,3 @@ ---

**Error Handling**:
- Business logic errors → throw CustomError
- Business logic errors -> throw CustomError

@@ -95,0 +95,0 @@ ---

@@ -71,6 +71,6 @@ # Component Guidelines

```typescript
// ✅ GOOD: Use button for actions
// [OK] GOOD: Use button for actions
<button onClick={handleClick}>Click me</button>
// ❌ BAD: Don't use div as button
// [X] BAD: Don't use div as button
<div role="button" onClick={handleClick}>Click me</div>

@@ -88,3 +88,3 @@ ```

// ❌ BAD: Button that looks like a link but navigates
// [X] BAD: Button that looks like a link but navigates
<button onClick={() => router.push('/about')}>About</button>

@@ -96,3 +96,3 @@ ```

```typescript
// ✅ GOOD: Proper heading hierarchy
// [OK] GOOD: Proper heading hierarchy
<article>

@@ -106,3 +106,3 @@ <h1>Page Title</h1>

// ❌ BAD: Skipping heading levels
// [X] BAD: Skipping heading levels
<h1>Title</h1>

@@ -115,3 +115,3 @@ <h3>Subsection</h3> // Missing h2

```typescript
// ✅ GOOD: Use list elements for lists
// [OK] GOOD: Use list elements for lists
<ul>

@@ -123,3 +123,3 @@ {items.map(item => (

// ❌ BAD: Divs for list
// [X] BAD: Divs for list
<div>

@@ -141,3 +141,3 @@ {items.map(item => (

// ✅ GOOD: Use Next.js Image
// [OK] GOOD: Use Next.js Image
<Image

@@ -150,3 +150,3 @@ src="/avatar.png"

// ❌ BAD: Native img tag
// [X] BAD: Native img tag
<img src="/avatar.png" alt="User avatar" />

@@ -183,7 +183,7 @@ ```

```typescript
// ✅ GOOD: Associated label
// [OK] GOOD: Associated label
<label htmlFor="email">Email</label>
<input id="email" type="email" />
// ✅ GOOD: Implicit label
// [OK] GOOD: Implicit label
<label>

@@ -194,3 +194,3 @@ Email

// ❌ BAD: No label
// [X] BAD: No label
<input type="email" placeholder="Email" />

@@ -197,0 +197,0 @@ ```

@@ -11,33 +11,33 @@ # Directory Structure

src/
├── app/ # Next.js App Router (if using Next.js)
│ ├── (marketing)/ # Marketing pages group
│ ├── (app)/ # Application pages group
│ └── api/ # API routes
├── components/ # Shared components
│ ├── ui/ # Base UI components (Button, Input, etc.)
│ └── common/ # Composite components (Header, Footer, etc.)
├── modules/ # Feature modules
│ └── {feature}/
│ ├── components/ # Feature-specific components
│ ├── hooks/ # Feature-specific hooks
│ ├── context/ # Feature-specific context
│ ├── lib/ # Feature-specific utilities
│ └── types.ts # Feature types
├── hooks/ # Shared hooks
│ ├── use-debounce.ts
│ └── use-local-storage.ts
├── lib/ # Shared utilities
│ ├── api-client.ts # API client setup
│ ├── utils.ts # Helper functions
│ └── constants.ts # Global constants
├── types/ # Shared type definitions
│ └── index.ts
└── styles/ # Global styles
└── globals.css
|-- app/ # Next.js App Router (if using Next.js)
| |-- (marketing)/ # Marketing pages group
| |-- (app)/ # Application pages group
| \-- api/ # API routes
|
|-- components/ # Shared components
| |-- ui/ # Base UI components (Button, Input, etc.)
| \-- common/ # Composite components (Header, Footer, etc.)
|
|-- modules/ # Feature modules
| \-- {feature}/
| |-- components/ # Feature-specific components
| |-- hooks/ # Feature-specific hooks
| |-- context/ # Feature-specific context
| |-- lib/ # Feature-specific utilities
| \-- types.ts # Feature types
|
|-- hooks/ # Shared hooks
| |-- use-debounce.ts
| \-- use-local-storage.ts
|
|-- lib/ # Shared utilities
| |-- api-client.ts # API client setup
| |-- utils.ts # Helper functions
| \-- constants.ts # Global constants
|
|-- types/ # Shared type definitions
| \-- index.ts
|
\-- styles/ # Global styles
\-- globals.css
```

@@ -53,19 +53,19 @@

modules/users/
├── components/
│ ├── user-card.tsx # Display component
│ ├── user-form.tsx # Form component
│ └── user-list.tsx # List component
├── hooks/
│ ├── use-user.ts # Single user query
│ ├── use-users.ts # Users list query
│ └── use-update-user.ts # Update mutation
├── context/
│ └── user-context.tsx # Feature-level state
├── lib/
│ └── user-utils.ts # Feature-specific helpers
└── types.ts # Feature types (if not from API)
|-- components/
| |-- user-card.tsx # Display component
| |-- user-form.tsx # Form component
| \-- user-list.tsx # List component
|
|-- hooks/
| |-- use-user.ts # Single user query
| |-- use-users.ts # Users list query
| \-- use-update-user.ts # Update mutation
|
|-- context/
| \-- user-context.tsx # Feature-level state
|
|-- lib/
| \-- user-utils.ts # Feature-specific helpers
|
\-- types.ts # Feature types (if not from API)
```

@@ -81,8 +81,8 @@

components/ui/
├── button.tsx # Base button
├── input.tsx # Base input
├── select.tsx # Base select
├── dialog.tsx # Modal dialog
├── dropdown-menu.tsx # Dropdown menu
└── index.ts # Barrel export
|-- button.tsx # Base button
|-- input.tsx # Base input
|-- select.tsx # Base select
|-- dialog.tsx # Modal dialog
|-- dropdown-menu.tsx # Dropdown menu
\-- index.ts # Barrel export
```

@@ -94,7 +94,7 @@

components/common/
├── header.tsx # App header
├── sidebar.tsx # Navigation sidebar
├── page-layout.tsx # Page wrapper
├── error-boundary.tsx # Error boundary
└── loading-spinner.tsx # Loading state
|-- header.tsx # App header
|-- sidebar.tsx # Navigation sidebar
|-- page-layout.tsx # Page wrapper
|-- error-boundary.tsx # Error boundary
\-- loading-spinner.tsx # Loading state
```

@@ -164,3 +164,3 @@

```
✅ ALLOWED:
[OK] ALLOWED:
- modules/users/ imports from components/ui/

@@ -170,3 +170,3 @@ - modules/users/ imports from hooks/

❌ NOT ALLOWED:
[X] NOT ALLOWED:
- modules/users/ imports from modules/orders/

@@ -173,0 +173,0 @@ (Use shared hooks or lift to common location)

@@ -53,3 +53,3 @@ # Hook Guidelines

```typescript
// ✅ GOOD: Include all dependencies in query key
// [OK] GOOD: Include all dependencies in query key
queryKey: ['user', userId]

@@ -59,3 +59,3 @@ queryKey: ['users', { page, pageSize, filter }]

// ❌ BAD: Missing dependencies
// [X] BAD: Missing dependencies
queryKey: ['user'] // Same key for different users!

@@ -263,3 +263,3 @@ queryKey: ['users'] // Same key for different pages!

useEffect(() => {
fetch('/api/user').then(...) // ❌ Use useQuery instead
fetch('/api/user').then(...) // [X] Use useQuery instead
}, []);

@@ -269,6 +269,6 @@

const { data } = useUser(id);
return <div>{data.name}</div>; // ❌ data might be undefined
return <div>{data.name}</div>; // [X] data might be undefined
// Don't mutate query data directly
data.name = 'New Name'; // ❌ Use mutation
data.name = 'New Name'; // [X] Use mutation
```

@@ -275,0 +275,0 @@

@@ -39,15 +39,15 @@ # Frontend Development Guidelines

src/
├── components/ # Shared components
│ ├── ui/ # Base UI components
│ └── common/ # Common composite components
├── modules/ # Feature modules
│ └── {feature}/
│ ├── components/ # Feature-specific components
│ ├── hooks/ # Feature-specific hooks
│ └── types.ts # Feature types
├── hooks/ # Shared hooks
├── lib/ # Utilities
└── types/ # Shared types
|-- components/ # Shared components
| |-- ui/ # Base UI components
| \-- common/ # Common composite components
|
|-- modules/ # Feature modules
| \-- {feature}/
| |-- components/ # Feature-specific components
| |-- hooks/ # Feature-specific hooks
| \-- types.ts # Feature types
|
|-- hooks/ # Shared hooks
|-- lib/ # Utilities
\-- types/ # Shared types
```

@@ -54,0 +54,0 @@

@@ -29,7 +29,7 @@ # Quality Guidelines

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
function process(data: any) { ... }
const result: any = await fetch(...);
// ✅ REQUIRED
// [OK] REQUIRED
function process(data: unknown) {

@@ -45,7 +45,7 @@ if (isValidData(data)) {

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
const name = user!.name;
const element = document.querySelector('.item')!;
// ✅ REQUIRED
// [OK] REQUIRED
if (!user) return null;

@@ -61,7 +61,7 @@ const name = user.name;

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
const data = response as UserData;
const config = JSON.parse(str) as Config;
// ✅ REQUIRED
// [OK] REQUIRED
const data = userDataSchema.parse(response);

@@ -74,7 +74,7 @@ if (!isUserData(response)) throw new Error('Invalid data');

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
<div role="button" onClick={handleClick}>Click</div>
<div onClick={handleNavigate}>Go to page</div>
// ✅ REQUIRED
// [OK] REQUIRED
<button onClick={handleClick}>Click</button>

@@ -87,6 +87,6 @@ <Link href="/page">Go to page</Link>

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
<img src="/photo.jpg" alt="Photo" />
// ✅ REQUIRED
// [OK] REQUIRED
import Image from 'next/image';

@@ -99,3 +99,3 @@ <Image src="/photo.jpg" alt="Photo" width={200} height={200} />

```typescript
// ❌ FORBIDDEN
// [X] FORBIDDEN
useEffect(() => {

@@ -107,3 +107,3 @@ fetch('/api/users')

// ✅ REQUIRED
// [OK] REQUIRED
const { data: users } = useQuery({

@@ -122,3 +122,3 @@ queryKey: ['users'],

```typescript
// ✅ REQUIRED: Handle all states
// [OK] REQUIRED: Handle all states
function UserList() {

@@ -138,3 +138,3 @@ const { data, isLoading, error } = useUsers();

```typescript
// ✅ REQUIRED: Labels for all inputs
// [OK] REQUIRED: Labels for all inputs
<label htmlFor="email">Email</label>

@@ -148,3 +148,3 @@ <input id="email" type="email" aria-describedby="email-error" />

```typescript
// ✅ REQUIRED: Wrap feature modules
// [OK] REQUIRED: Wrap feature modules
<ErrorBoundary fallback={<ErrorFallback />}>

@@ -209,3 +209,3 @@ <FeatureModule />

```typescript
// ✅ Memoize expensive calculations
// [OK] Memoize expensive calculations
const sortedItems = useMemo(

@@ -216,3 +216,3 @@ () => items.sort((a, b) => a.name.localeCompare(b.name)),

// ✅ Memoize callbacks passed to children
// [OK] Memoize callbacks passed to children
const handleClick = useCallback(() => {

@@ -222,3 +222,3 @@ doSomething(id);

// ❌ Don't memoize everything - only when needed
// [X] Don't memoize everything - only when needed
const name = useMemo(() => user.name, [user.name]); // Unnecessary

@@ -230,10 +230,10 @@ ```

```typescript
// ❌ BAD: Creates new object every render
// [X] BAD: Creates new object every render
<Component style={{ color: 'red' }} />
// ✅ GOOD: Stable reference
// [OK] GOOD: Stable reference
const style = { color: 'red' }; // Outside component
<Component style={style} />
// ✅ GOOD: Or use className
// [OK] GOOD: Or use className
<Component className="text-red" />

@@ -240,0 +240,0 @@ ```

@@ -223,8 +223,8 @@ # State Management

Is the state needed by multiple components?
├─ No → Local state (useState)
└─ Yes → Is it from the server?
├─ Yes → React Query
└─ No → Should it persist in URL?
├─ Yes → URL state (searchParams)
└─ No → Context or Zustand
|- No -> Local state (useState)
\- Yes -> Is it from the server?
|- Yes -> React Query
\- No -> Should it persist in URL?
|- Yes -> URL state (searchParams)
\- No -> Context or Zustand
```

@@ -239,3 +239,3 @@

```typescript
// ❌ BAD: Duplicating server state
// [X] BAD: Duplicating server state
const { data: users } = useUsers();

@@ -248,3 +248,3 @@ const [localUsers, setLocalUsers] = useState<User[]>([]);

// ✅ GOOD: Use server state directly
// [OK] GOOD: Use server state directly
const { data: users } = useUsers();

@@ -257,6 +257,6 @@ // Use users directly, mutate with mutations

```typescript
// ❌ BAD: Everything in global state
// [X] BAD: Everything in global state
const { isModalOpen, setModalOpen } = useGlobalStore();
// ✅ GOOD: Local state for local UI
// [OK] GOOD: Local state for local UI
const [isModalOpen, setIsModalOpen] = useState(false);

@@ -268,3 +268,3 @@ ```

```typescript
// ❌ BAD: Storing derived value
// [X] BAD: Storing derived value
const [items, setItems] = useState([]);

@@ -277,3 +277,3 @@ const [filteredItems, setFilteredItems] = useState([]);

// ✅ GOOD: Compute derived value
// [OK] GOOD: Compute derived value
const [items, setItems] = useState([]);

@@ -280,0 +280,0 @@ const filteredItems = items.filter(i => i.active);

@@ -21,3 +21,3 @@ # Type Safety

```typescript
// ✅ GOOD: Import from API package
// [OK] GOOD: Import from API package
import type { User, CreateUserInput } from '@/api/types';

@@ -29,3 +29,3 @@

// ❌ BAD: Redefining types
// [X] BAD: Redefining types
interface User {

@@ -54,3 +54,3 @@ id: string;

```typescript
// ✅ GOOD: Inferred type
// [OK] GOOD: Inferred type
const [count, setCount] = useState(0); // number

@@ -60,3 +60,3 @@ const [name, setName] = useState(''); // string

// ❌ BAD: Redundant type annotation
// [X] BAD: Redundant type annotation
const [count, setCount] = useState<number>(0);

@@ -68,3 +68,3 @@ ```

```typescript
// ✅ GOOD: Inferred return type
// [OK] GOOD: Inferred return type
function formatDate(date: Date) {

@@ -74,3 +74,3 @@ return date.toISOString(); // returns string

// ✅ GOOD: Explicit when complex
// [OK] GOOD: Explicit when complex
function getUser(id: string): Promise<User | null> {

@@ -84,3 +84,3 @@ return api.users.get(id);

```typescript
// ✅ GOOD: Props interface
// [OK] GOOD: Props interface
interface ButtonProps {

@@ -104,3 +104,3 @@ children: React.ReactNode;

```typescript
// ✅ GOOD: Explicit null check
// [OK] GOOD: Explicit null check
function UserProfile({ userId }: { userId: string }) {

@@ -121,6 +121,6 @@ const { data: user } = useUser(userId);

```typescript
// ✅ GOOD: Optional chaining for nested access
// [OK] GOOD: Optional chaining for nested access
const userName = user?.profile?.name ?? 'Anonymous';
// ❌ BAD: Non-null assertion
// [X] BAD: Non-null assertion
const userName = user!.profile!.name;

@@ -132,3 +132,3 @@ ```

```typescript
// ✅ GOOD: Default values with nullish coalescing
// [OK] GOOD: Default values with nullish coalescing
const displayName = user.nickname ?? user.name ?? 'Unknown';

@@ -135,0 +135,0 @@ const items = response.data ?? [];

@@ -120,7 +120,7 @@ #!/bin/bash

- ✅ (Add test results)
- [OK] (Add test results)
### Status
✅ **Completed**
[OK] **Completed**

@@ -205,3 +205,3 @@ ### Next Steps

target_num=$((current_num + 1))
echo "⚠️ Exceeds $MAX_LINES lines, creating progress-$target_num.md" >&2
echo "[!] Exceeds $MAX_LINES lines, creating progress-$target_num.md" >&2
target_file=$(create_new_progress_file "$target_num")

@@ -212,3 +212,3 @@ echo "Created: $target_file" >&2

echo "$session_content" >> "$target_file"
echo "✅ Appended session to $(basename "$target_file")" >&2
echo "[OK] Appended session to $(basename "$target_file")" >&2

@@ -226,3 +226,3 @@ echo "" >&2

echo "========================================" >&2
echo "✅ Session $new_session added successfully!" >&2
echo "[OK] Session $new_session added successfully!" >&2
echo "========================================" >&2

@@ -229,0 +229,0 @@ echo "" >&2

@@ -49,3 +49,3 @@ #!/bin/zsh

show_help() {
echo "📚 Markdown Heading Line Number Extraction Tool"
echo "# Markdown Heading Line Number Extraction Tool"
echo ""

@@ -199,3 +199,3 @@ echo "Purpose: Auto-extract headings and line numbers from markdown files"

table)
echo -e "${GREEN}📋 Heading List${NC}"
echo -e "${GREEN}# Heading List${NC}"
echo -e "${CYAN}File: $MD_FILE${NC}"

@@ -217,3 +217,3 @@ echo ""

list)
echo -e "${GREEN}📋 Heading List${NC}"
echo -e "${GREEN}# Heading List${NC}"
echo -e "${CYAN}File: $MD_FILE${NC}"

@@ -220,0 +220,0 @@ echo ""

@@ -212,3 +212,3 @@ #!/bin/bash

if [[ "$lines" -gt 1800 ]]; then
echo "⚠️ WARNING: Approaching 2000 line limit!"
echo "[!] WARNING: Approaching 2000 line limit!"
fi

@@ -215,0 +215,0 @@ else

@@ -111,5 +111,5 @@ #!/bin/bash

echo "✅ Developer identity initialized: $DEVELOPER_NAME"
echo "[OK] Developer identity initialized: $DEVELOPER_NAME"
echo " Progress directory: $PROGRESS_DIR"
echo " Features directory: $FEATURES_DIR"

@@ -206,6 +206,6 @@ #!/bin/bash

echo "✅ Updated index.md successfully!"
echo "[OK] Updated index.md successfully!"
echo ""
echo "Changes:"
echo " - Total Sessions: $current_session → $new_session"
echo " - Total Sessions: $current_session -> $new_session"
echo " - Last Active: $TODAY"

@@ -212,0 +212,0 @@ echo " - New session row added to history"

{
"name": "@mind-fold/open-flow",
"version": "0.2.11",
"version": "0.2.12",
"description": "AI-assisted development workflow initializer for Cursor, Claude Code and more",

@@ -5,0 +5,0 @@ "type": "module",