This project is a Next.js + TypeScript component library using TailwindCSS, Storybook, and shadcn/ui patterns.
This repository uses a unified AI instruction system. Source files are in docs/ai-instructions/.
Primary References (follow in order):
docs/ai-instructions/context.md– Project context and overviewdocs/ai-instructions/development.md– Development patterns and practicesdocs/ai-instructions/testing.md– Comprehensive testing guidelinesdocs/ai-instructions/comment-style.md– Code comment standardsdocs/ai-instructions/new-component.md– Component creation process
"Sparkle Design" is a React component library built with modern web technologies, providing consistent UI components for web applications.
- Framework: Next.js 15.5.18 + React 18 + TypeScript
- Styling: TailwindCSS 4 + CVA (Class Variance Authority)
- Testing: Vitest + Testing Library + jsdom
- Documentation: Storybook
- Package Manager: pnpm
- Node.js: 22.14.0 (see
.node-version)
src/
├── app/ # Next.js app directory
├── components/ui/ # UI component library
│ └── [component]/
│ ├── index.tsx # Component implementation
│ └── index.test.tsx # Component tests
├── docs/ # Documentation files
├── lib/ # Utility functions
└── test/ # Shared test helpers
docs/ai-instructions/ # AI guidance documents (source)
public/r/ # Component registry JSON
scripts/ # Build and setup tools
- Setup:
pnpm installfor dependencies - Development:
pnpm devfor local server - Component Creation:
./scripts/setup.sh <ComponentName> - Documentation:
pnpm storybookfor component stories - Quality Checks:
pnpm lint && pnpm format - Testing:
pnpm testbefore commits
package.json: Dependencies and scriptstsconfig.json: TypeScript configurationpostcss.config.mjs: TailwindCSS setupvitest.config.ts: Testing configurationcomponents.json: Component library configsparkle.config.json: Design token settings
- Comments: Japanese first, then English with
en:prefix - Commits: Japanese with emoji prefix (see
.github/copilot-commit-message-instructions.md) - Components: Follow shadcn/ui patterns with CVA variants
- Testing: Comprehensive coverage following t_wada's best practices
- Accessibility: ARIA labels and semantic HTML
- Language: Japanese required
- Format: Emoji prefix + Conventional Commit format
- Structure: Title, blank line, bullet list of changes
- Reference:
.github/copilot-commit-message-instructions.md
- Allowed characters: English letters, digits, dots, hyphens, underscores, plus a single
/used only as a separator between a category prefix and name - Pattern:
feature/component-name,fix/issue-description,chore/update-deps, etc. - Example:
feature/button-component,chore/update-deps
pnpm lint # ESLint checks
pnpm format # Prettier formatting
pnpm test # Component tests- Never amend + force-push: address review feedback and mistakes with new commits
- No direct push to
main: always go through a PR (admin merge required) - PR merges use normal merge (
--merge): never squash-merge (squashing loses commits) - Update the lockfile whenever
package.jsonchanges: CI runspnpm install --frozen-lockfileand will fail otherwise - Use the pinned toolchain: Node.js 22.14.0 / pnpm 10.12.4 (see
.tool-versions; newer pnpm majors can rewrite the lockfile)
scripts/hooks/irreversible-ops-guard.sh (a PreToolUse hook wired in .claude/settings.json) blocks:
npm/pnpm/yarn/bun publish(an enabled--dry-runpasses),unpublish,deprecategh pr merge,gh release create/delete,gh repo create/delete/archive, publish workflows- Release tag pushes,
--tags, force pushes (including a+refspec), and remote ref deletion (--delete/:ref)
It also looks inside command substitutions ($(...)) and bash -c "...", so those are not a way around it.
- These run only when the user names the operation. A broad "release it" / "go ahead" is not approval.
- Once instructed, re-run with
SPARKLE_CONFIRM=1in front of that command. Adding that prefix without an instruction defeats the guard. - An inherited/exported
SPARKLE_CONFIRM=1is deliberately ignored — approval is per command, not per session. - Agents without hook support must follow the same rule — the hook is a backstop, not the rule itself.
- Tests:
pnpm test:hooks
- Refer to specific instruction files for detailed guidance:
docs/ai-instructions/testing.mdfor testingdocs/ai-instructions/development.mdfor development patternsdocs/ai-instructions/comment-style.mdfor code commentsdocs/ai-instructions/new-component.mdfor component creation
- Important: After editing any file in
docs/ai-instructions/, runmake ai-instructionsto sync changes to tool-specific locations - This ensures GitHub Copilot, Cursor, Claude Code, and Codex all receive the updated instructions