@champpaba/claude-agent-kit 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/02-uxui-frontend.md +111 -2
- package/.claude/commands/pageplan.md +369 -9
- package/.claude/contexts/design/box-thinking.md +358 -0
- package/.claude/contexts/patterns/animation-patterns.md +768 -0
- package/.claude/contexts/patterns/performance-optimization.md +421 -0
- package/.claude/contexts/patterns/ui-component-consistency.md +49 -2
- package/.claude/lib/agent-executor.md +69 -10
- package/.claude/templates/page-plan-example.md +131 -0
- package/LICENSE +21 -21
- package/README.md +1278 -1179
- package/bin/cli.js +59 -61
- package/lib/helpers.js +144 -0
- package/lib/init.js +57 -52
- package/lib/update.js +90 -73
- package/package.json +1 -1
|
@@ -539,6 +539,364 @@ Product Card Box
|
|
|
539
539
|
|
|
540
540
|
---
|
|
541
541
|
|
|
542
|
+
## Flexbox vs Grid: Decision Guide
|
|
543
|
+
|
|
544
|
+
**Core Question:** Is this a 1-dimensional or 2-dimensional layout?
|
|
545
|
+
|
|
546
|
+
### Rule of Thumb
|
|
547
|
+
|
|
548
|
+
```
|
|
549
|
+
┌─────────────────────────────────┐
|
|
550
|
+
│ Need to arrange boxes? │
|
|
551
|
+
└────────┬────────────────────────┘
|
|
552
|
+
│
|
|
553
|
+
┌────▼────┐
|
|
554
|
+
│ Is it: │
|
|
555
|
+
└────┬────┘
|
|
556
|
+
│
|
|
557
|
+
┌────┴────────────────┐
|
|
558
|
+
│ │
|
|
559
|
+
1D Layout 2D Layout
|
|
560
|
+
(row OR column) (row AND column)
|
|
561
|
+
│ │
|
|
562
|
+
▼ ▼
|
|
563
|
+
Use Flexbox Use Grid
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
**1D Layout (Flexbox):** Items flow in one direction (either horizontal OR vertical)
|
|
567
|
+
**2D Layout (Grid):** Items arranged in both directions (rows AND columns simultaneously)
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
### ✅ Use Flexbox When...
|
|
572
|
+
|
|
573
|
+
#### **1. Navigation Bar**
|
|
574
|
+
**Pattern:** Logo | Nav Menu | Actions (horizontal row)
|
|
575
|
+
|
|
576
|
+
```css
|
|
577
|
+
.navbar {
|
|
578
|
+
display: flex;
|
|
579
|
+
justify-content: space-between;
|
|
580
|
+
align-items: center;
|
|
581
|
+
gap: var(--spacing-4);
|
|
582
|
+
}
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
**Why Flexbox?**
|
|
586
|
+
- Single row (1D)
|
|
587
|
+
- Content-based sizing (logo + menu + actions)
|
|
588
|
+
- Easy alignment (center vertically)
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
#### **2. Button Group**
|
|
593
|
+
**Pattern:** [Cancel] [Save] [Submit]
|
|
594
|
+
|
|
595
|
+
```css
|
|
596
|
+
.button-group {
|
|
597
|
+
display: flex;
|
|
598
|
+
gap: var(--spacing-2);
|
|
599
|
+
justify-content: flex-end;
|
|
600
|
+
}
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
**Why Flexbox?**
|
|
604
|
+
- Single row (1D)
|
|
605
|
+
- Unknown number of buttons
|
|
606
|
+
- Auto-sizing based on content
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
#### **3. Vertical Stack**
|
|
611
|
+
**Pattern:** Title, Description, Button (vertical column)
|
|
612
|
+
|
|
613
|
+
```css
|
|
614
|
+
.card-content {
|
|
615
|
+
display: flex;
|
|
616
|
+
flex-direction: column;
|
|
617
|
+
gap: var(--spacing-4);
|
|
618
|
+
}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
**Why Flexbox?**
|
|
622
|
+
- Single column (1D)
|
|
623
|
+
- Content flows vertically
|
|
624
|
+
- Simple stacking
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
#### **4. Form Row (Label + Input)**
|
|
629
|
+
**Pattern:** Label: [Input field-------]
|
|
630
|
+
|
|
631
|
+
```css
|
|
632
|
+
.form-row {
|
|
633
|
+
display: flex;
|
|
634
|
+
align-items: center;
|
|
635
|
+
gap: var(--spacing-2);
|
|
636
|
+
}
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
**Why Flexbox?**
|
|
640
|
+
- Single row (1D)
|
|
641
|
+
- Label + input side-by-side
|
|
642
|
+
- Vertical centering
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
#### **5. Tags/Chips (Wrapping)**
|
|
647
|
+
**Pattern:** [Tag1] [Tag2] [Tag3] [Tag4] (wraps to next line)
|
|
648
|
+
|
|
649
|
+
```css
|
|
650
|
+
.tags {
|
|
651
|
+
display: flex;
|
|
652
|
+
flex-wrap: wrap;
|
|
653
|
+
gap: var(--spacing-2);
|
|
654
|
+
}
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
**Why Flexbox?**
|
|
658
|
+
- Unknown number of items
|
|
659
|
+
- Content-based sizing
|
|
660
|
+
- Auto-wrapping
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
### ✅ Use Grid When...
|
|
665
|
+
|
|
666
|
+
#### **1. Card Grid (Fixed Columns)**
|
|
667
|
+
**Pattern:** 3 equal-width cards in a row
|
|
668
|
+
|
|
669
|
+
```css
|
|
670
|
+
.card-grid {
|
|
671
|
+
display: grid;
|
|
672
|
+
grid-template-columns: repeat(3, 1fr);
|
|
673
|
+
gap: var(--spacing-6);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/* Responsive */
|
|
677
|
+
@media (max-width: 768px) {
|
|
678
|
+
.card-grid {
|
|
679
|
+
grid-template-columns: 1fr;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
**Why Grid?**
|
|
685
|
+
- 2D layout (rows + columns)
|
|
686
|
+
- Fixed column count (3 cols)
|
|
687
|
+
- Equal-width boxes
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
#### **2. Sidebar + Main Layout**
|
|
692
|
+
**Pattern:** [Sidebar: 250px] | [Main: rest of space]
|
|
693
|
+
|
|
694
|
+
```css
|
|
695
|
+
.layout {
|
|
696
|
+
display: grid;
|
|
697
|
+
grid-template-columns: 250px 1fr;
|
|
698
|
+
gap: var(--spacing-4);
|
|
699
|
+
}
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
**Why Grid?**
|
|
703
|
+
- 2D layout
|
|
704
|
+
- Fixed sidebar width
|
|
705
|
+
- Main content fills remaining space
|
|
706
|
+
|
|
707
|
+
---
|
|
708
|
+
|
|
709
|
+
#### **3. Dashboard (Complex 2D)**
|
|
710
|
+
**Pattern:** Header spanning full width, Sidebar + Main + Right panel, Footer spanning full width
|
|
711
|
+
|
|
712
|
+
```css
|
|
713
|
+
.dashboard {
|
|
714
|
+
display: grid;
|
|
715
|
+
grid-template-areas:
|
|
716
|
+
"header header header"
|
|
717
|
+
"sidebar main panel"
|
|
718
|
+
"footer footer footer";
|
|
719
|
+
grid-template-columns: 250px 1fr 300px;
|
|
720
|
+
grid-template-rows: auto 1fr auto;
|
|
721
|
+
gap: var(--spacing-4);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
.header { grid-area: header; }
|
|
725
|
+
.sidebar { grid-area: sidebar; }
|
|
726
|
+
.main { grid-area: main; }
|
|
727
|
+
.panel { grid-area: panel; }
|
|
728
|
+
.footer { grid-area: footer; }
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
**Why Grid?**
|
|
732
|
+
- Complex 2D layout
|
|
733
|
+
- Elements span multiple columns
|
|
734
|
+
- Explicit row/column placement
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
#### **4. Form Grid (2 Columns)**
|
|
739
|
+
**Pattern:** Fields arranged in 2 columns
|
|
740
|
+
|
|
741
|
+
```css
|
|
742
|
+
.form-grid {
|
|
743
|
+
display: grid;
|
|
744
|
+
grid-template-columns: repeat(2, 1fr);
|
|
745
|
+
gap: var(--spacing-4);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/* Full-width field */
|
|
749
|
+
.field-full {
|
|
750
|
+
grid-column: span 2;
|
|
751
|
+
}
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
**Why Grid?**
|
|
755
|
+
- 2D layout (rows + cols)
|
|
756
|
+
- Fixed column count
|
|
757
|
+
- Some fields span 2 columns
|
|
758
|
+
|
|
759
|
+
---
|
|
760
|
+
|
|
761
|
+
#### **5. Image Gallery (Auto-Fill)**
|
|
762
|
+
**Pattern:** Images auto-fit into available space
|
|
763
|
+
|
|
764
|
+
```css
|
|
765
|
+
.gallery {
|
|
766
|
+
display: grid;
|
|
767
|
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
768
|
+
gap: var(--spacing-4);
|
|
769
|
+
}
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
**Why Grid?**
|
|
773
|
+
- 2D layout
|
|
774
|
+
- Auto-responsive (no media queries!)
|
|
775
|
+
- Equal-sized images
|
|
776
|
+
|
|
777
|
+
---
|
|
778
|
+
|
|
779
|
+
### 📊 Comparison Table
|
|
780
|
+
|
|
781
|
+
| Use Case | Flexbox | Grid | Winner |
|
|
782
|
+
|----------|---------|------|--------|
|
|
783
|
+
| **Navigation bar** | ✅ Perfect | ⚠️ Overkill | Flexbox 🏆 |
|
|
784
|
+
| **Card grid (3 cols)** | ⚠️ Hacky | ✅ Perfect | Grid 🏆 |
|
|
785
|
+
| **Sidebar + Main** | ⚠️ Works | ✅ Better | Grid 🏆 |
|
|
786
|
+
| **Button group** | ✅ Perfect | ⚠️ Overkill | Flexbox 🏆 |
|
|
787
|
+
| **Form (2 cols)** | ⚠️ Complex | ✅ Simple | Grid 🏆 |
|
|
788
|
+
| **Vertical stack** | ✅ Perfect | ⚠️ Overkill | Flexbox 🏆 |
|
|
789
|
+
| **Unknown items count** | ✅ Perfect | ⚠️ Complex | Flexbox 🏆 |
|
|
790
|
+
| **Complex dashboard** | ❌ Can't | ✅ Perfect | Grid 🏆 |
|
|
791
|
+
|
|
792
|
+
---
|
|
793
|
+
|
|
794
|
+
### 🎯 Decision Flowchart
|
|
795
|
+
|
|
796
|
+
```
|
|
797
|
+
┌─────────────────────────────────────┐
|
|
798
|
+
│ Do items need to arrange in: │
|
|
799
|
+
└────────┬────────────────────────────┘
|
|
800
|
+
│
|
|
801
|
+
┌────▼────┐
|
|
802
|
+
│ │
|
|
803
|
+
Row OR Row AND
|
|
804
|
+
Column Column
|
|
805
|
+
│ │
|
|
806
|
+
▼ ▼
|
|
807
|
+
Flexbox Grid
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
**Additional Questions:**
|
|
811
|
+
|
|
812
|
+
**Q: Do you know the exact number of columns?**
|
|
813
|
+
- Yes (3 cols) → Grid
|
|
814
|
+
- No (dynamic) → Flexbox
|
|
815
|
+
|
|
816
|
+
**Q: Do items need to span multiple columns/rows?**
|
|
817
|
+
- Yes → Grid (use `grid-column: span 2`)
|
|
818
|
+
- No → Flexbox
|
|
819
|
+
|
|
820
|
+
**Q: Is content-based sizing important?**
|
|
821
|
+
- Yes (button width = text width) → Flexbox
|
|
822
|
+
- No (equal widths) → Grid
|
|
823
|
+
|
|
824
|
+
---
|
|
825
|
+
|
|
826
|
+
### 🚨 Common Mistakes
|
|
827
|
+
|
|
828
|
+
#### ❌ Mistake 1: Using Grid for Simple Row
|
|
829
|
+
|
|
830
|
+
```css
|
|
831
|
+
/* ❌ BAD: Overkill for simple row */
|
|
832
|
+
.navbar {
|
|
833
|
+
display: grid;
|
|
834
|
+
grid-template-columns: auto 1fr auto;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/* ✅ GOOD: Flexbox simpler */
|
|
838
|
+
.navbar {
|
|
839
|
+
display: flex;
|
|
840
|
+
justify-content: space-between;
|
|
841
|
+
}
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
---
|
|
845
|
+
|
|
846
|
+
#### ❌ Mistake 2: Using Flexbox for Card Grid
|
|
847
|
+
|
|
848
|
+
```css
|
|
849
|
+
/* ❌ BAD: Hacky, unequal widths */
|
|
850
|
+
.card-grid {
|
|
851
|
+
display: flex;
|
|
852
|
+
flex-wrap: wrap;
|
|
853
|
+
gap: var(--spacing-4);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
.card {
|
|
857
|
+
flex: 1 1 calc(33.333% - var(--spacing-4));
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/* ✅ GOOD: Grid handles it perfectly */
|
|
861
|
+
.card-grid {
|
|
862
|
+
display: grid;
|
|
863
|
+
grid-template-columns: repeat(3, 1fr);
|
|
864
|
+
gap: var(--spacing-4);
|
|
865
|
+
}
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
---
|
|
869
|
+
|
|
870
|
+
### 💡 Performance Note
|
|
871
|
+
|
|
872
|
+
**Both are fast!** Choose based on use case, not performance.
|
|
873
|
+
|
|
874
|
+
- Flexbox: ~3.5ms render time
|
|
875
|
+
- Grid: ~3-4ms render time
|
|
876
|
+
- Float-based: 14ms ❌ (avoid!)
|
|
877
|
+
|
|
878
|
+
**Source:** FreeCodeCamp Performance Handbook
|
|
879
|
+
|
|
880
|
+
---
|
|
881
|
+
|
|
882
|
+
### 📋 Quick Checklist
|
|
883
|
+
|
|
884
|
+
**Before choosing, ask:**
|
|
885
|
+
|
|
886
|
+
- [ ] Is this 1D (row OR column) or 2D (row AND column)? ✓
|
|
887
|
+
- [ ] Do I know the exact number of columns? ✓
|
|
888
|
+
- [ ] Do items need equal widths? ✓
|
|
889
|
+
- [ ] Will items wrap to multiple lines? ✓
|
|
890
|
+
- [ ] Do items need to span multiple cells? ✓
|
|
891
|
+
|
|
892
|
+
**Then decide:**
|
|
893
|
+
- **1D + Unknown count** → Flexbox
|
|
894
|
+
- **2D + Fixed columns** → Grid
|
|
895
|
+
- **Content-based sizing** → Flexbox
|
|
896
|
+
- **Equal-width boxes** → Grid
|
|
897
|
+
|
|
898
|
+
---
|
|
899
|
+
|
|
542
900
|
## Quick Reference
|
|
543
901
|
|
|
544
902
|
**Box Analysis Questions:**
|