solmate-skills 1.0.0
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/AGENTS.md +90 -0
- package/README.md +42 -0
- package/bin/cli.js +85 -0
- package/design-md/README.md +34 -0
- package/design-md/SKILL.md +172 -0
- package/design-md/examples/DESIGN.md +154 -0
- package/dev-conventions/SKILL.md +305 -0
- package/enhance-prompt/README.md +34 -0
- package/enhance-prompt/SKILL.md +204 -0
- package/enhance-prompt/references/KEYWORDS.md +114 -0
- package/implementation-workflow/SKILL.md +131 -0
- package/init-skills.sh +41 -0
- package/manage-collaboration/SKILL.md +50 -0
- package/manage-docs/SKILL.md +389 -0
- package/manage-skills/SKILL.md +52 -0
- package/obsidian-sync/SKILL.md +44 -0
- package/old_AGENTS.md +124 -0
- package/package.json +31 -0
- package/react-components/README.md +36 -0
- package/react-components/SKILL.md +47 -0
- package/react-components/examples/gold-standard-card.tsx +80 -0
- package/react-components/package.json +16 -0
- package/react-components/resources/architecture-checklist.md +15 -0
- package/react-components/resources/component-template.tsx +37 -0
- package/react-components/resources/stitch-api-reference.md +14 -0
- package/react-components/resources/style-guide.json +27 -0
- package/react-components/scripts/fetch-stitch.sh +30 -0
- package/react-components/scripts/validate.js +68 -0
- package/remotion/README.md +105 -0
- package/remotion/SKILL.md +393 -0
- package/remotion/examples/WalkthroughComposition.tsx +78 -0
- package/remotion/examples/screens.json +56 -0
- package/remotion/resources/composition-checklist.md +124 -0
- package/remotion/resources/screen-slide-template.tsx +123 -0
- package/remotion/scripts/download-stitch-asset.sh +38 -0
- package/shadcn-ui/README.md +248 -0
- package/shadcn-ui/SKILL.md +326 -0
- package/shadcn-ui/examples/auth-layout.tsx +177 -0
- package/shadcn-ui/examples/data-table.tsx +313 -0
- package/shadcn-ui/examples/form-pattern.tsx +177 -0
- package/shadcn-ui/resources/component-catalog.md +481 -0
- package/shadcn-ui/resources/customization-guide.md +516 -0
- package/shadcn-ui/resources/migration-guide.md +463 -0
- package/shadcn-ui/resources/setup-guide.md +412 -0
- package/shadcn-ui/scripts/verify-setup.sh +134 -0
- package/stitch-loop/README.md +54 -0
- package/stitch-loop/SKILL.md +203 -0
- package/stitch-loop/examples/SITE.md +73 -0
- package/stitch-loop/examples/next-prompt.md +25 -0
- package/stitch-loop/resources/baton-schema.md +61 -0
- package/stitch-loop/resources/site-template.md +104 -0
- package/verify-docs/SKILL.md +34 -0
- package/verify-drizzle-schema/SKILL.md +44 -0
- package/verify-implementation/SKILL.md +39 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: obsidian-sync
|
|
3
|
+
description: Manages the synchronization between the project's documentation and an Obsidian vault via symbolic links. Ensures metadata compatibility and provides tools to verify the link status.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Obsidian Sync Skill
|
|
7
|
+
|
|
8
|
+
This skill maintains the connection between the project's `docs/` directory and an external Obsidian vault.
|
|
9
|
+
|
|
10
|
+
## 1. Setup Overview
|
|
11
|
+
|
|
12
|
+
The documentation is linked using a **Symbolic Link (Symlink)**. This allows real-time synchronization without duplicating files.
|
|
13
|
+
|
|
14
|
+
- **Source Path**: `[CURRENT_PROJECT_PATH]/docs`
|
|
15
|
+
- **Obsidian Path**: `/Users/namhyeongseog/Documents/obsidian/PROJECT/[PROJECT_NAME]/docs`
|
|
16
|
+
|
|
17
|
+
## 2. Key Features
|
|
18
|
+
|
|
19
|
+
- **Project Isolation**: Every project is managed under the `PROJECT/` parent directory in the vault.
|
|
20
|
+
- **Real-time Sync**: Uses symbolic links for instant updates.
|
|
21
|
+
- **Reusable Pattern**: Can be applied to any project by creating the corresponding folder and link.
|
|
22
|
+
|
|
23
|
+
## 3. Usage Instructions
|
|
24
|
+
|
|
25
|
+
### 3.1. General Sync Procedure
|
|
26
|
+
1. Identify the project name (e.g., `Rural-Rest`).
|
|
27
|
+
2. Create the target folder in Obsidian: `mkdir -p /Users/namhyeongseog/Documents/obsidian/PROJECT/[PROJECT_NAME]`
|
|
28
|
+
3. Create the symbolic link: `ln -sfn [ABS_PATH_TO_PROJECT]/docs /Users/namhyeongseog/Documents/obsidian/PROJECT/[PROJECT_NAME]/docs`
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### 3.2. Updating Metadata
|
|
32
|
+
When the user asks to "optimize for Obsidian", the agent should:
|
|
33
|
+
1. Ensure all markdown files have a consistent YAML header.
|
|
34
|
+
2. Add `#project/rural-rest` and `#layer/[layer_name]` tags to the metadata.
|
|
35
|
+
3. Ensure file-to-file links follow Obsidian's preferred format (e.g., `[[filename|label]]` is supported but we stick to standard markdown `[label](path)` for cross-compatibility).
|
|
36
|
+
|
|
37
|
+
## 4. Maintenance
|
|
38
|
+
|
|
39
|
+
If the project directory moves, the symlink MUST be recreated:
|
|
40
|
+
`ln -sfn [NEW_PROJECT_PATH]/docs /Users/namhyeongseog/Documents/obsidian/Rural-Rest/docs`
|
|
41
|
+
|
|
42
|
+
## 5. Related Skills
|
|
43
|
+
- **manage-docs**: The primary skill that generates the content being synced.
|
|
44
|
+
- **design-md**: Generates design-related documentation that will also be visible in Obsidian.
|
package/old_AGENTS.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Welcome! your AI coding agent. This file follows the [AGENTS.md](https://agents.md/) standard to provide me with the context and instructions I need to work on the **CHAT-BOT** project effectively.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
The project aims to provide an interactive experience that goes beyond simple content consumption by leveraging the IP of the character 'Chunsim', who currently boasts a fandom of 32,000 people. The primary objective is to strengthen emotional bonds and secure fandom loyalty by establishing a dedicated 1:1 conversation channel between users and Chunsim. At its core, the service offers seamless emotional conversations with a "special existence"āacting as both an idol and a loverāwith whom users can share their daily lives.
|
|
7
|
+
|
|
8
|
+
The ultimate vision is to position the service as a 'Daily Companion'. In this role, followers are encouraged to log in every day to share their daily routines and receive comfort, fostering a deep, ongoing relationship.
|
|
9
|
+
|
|
10
|
+
The core target audience consists of the 32,000 X (Twitter) users who currently follow the 'Chunsim' account. These users are characterized by their familiarity with mobile environments and a desire to communicate with the character through text-based interactions, driven by feelings of 'simulated romance' or strong fandom loyalty.
|
|
11
|
+
|
|
12
|
+
## Setup Commands
|
|
13
|
+
- Install dependencies: `npm install`
|
|
14
|
+
- Start development server: `npm run dev`
|
|
15
|
+
- Build production bundle: `npm run build`
|
|
16
|
+
- Database migration: `npx drizzle-kit push`
|
|
17
|
+
- Database studio: `npx drizzle-kit studio`
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Tech Stack
|
|
21
|
+
- **Framework**: React Router v7 (Vite)
|
|
22
|
+
- **Styling**: Tailwind CSS v4, shadcn/ui (Nova Preset)
|
|
23
|
+
- **Database**: Turso (libSQL) with Drizzle ORM
|
|
24
|
+
- **Authentication**: Better Auth (session-based authentication)
|
|
25
|
+
- **Validation**: Zod (schema validation)
|
|
26
|
+
- **Date/Time**: Luxon (date and time handling)
|
|
27
|
+
- **Media Storage**: Cloudinary (for image and video uploads)
|
|
28
|
+
- **Mobile**: Capacitor (iOS, Android native apps, PWA support)
|
|
29
|
+
- **AI**: Google Gemini API (for chatbot responses)
|
|
30
|
+
- **AI Workflow**: LangGraph (for managing complex conversation flows and persona state transitions)
|
|
31
|
+
- **Search (Optional)**: RAG system with Vector DB (Pinecone, Weaviate, or FAISS) and Embedding models (OpenAI or open-source)
|
|
32
|
+
- **Maps (Travel Blog)**: Google Maps API, Naver Maps API, or Mapbox (for location visualization and travel route mapping)
|
|
33
|
+
|
|
34
|
+
## ź°ė° ėźµ¬ ė° ė¦¬ģģ¤
|
|
35
|
+
|
|
36
|
+
### UI ėģģø ė° ģ“미ģ§
|
|
37
|
+
- **Stitch (UI ģģ± AI ėźµ¬)**: ģ“źø° UI ėģģø ė° ģŗė¦ķ° ģ“ėÆøģ§ ģģ±ģ ģ¬ģ©
|
|
38
|
+
- Stitchģģ ģģ±ė ģ“미ģ§ė Google ģ“ėÆøģ§ ķøģ¤ķ
(`lh3.googleusercontent.com/aida-public/...`) URLė” ģ ź³µėØ
|
|
39
|
+
- ķģ¬ `app/lib/characters.ts` ķģ¼ģ ģ“ė¬ķ Google URLģ“ ķėģ½ė©ėģ“ ģģ
|
|
40
|
+
- **ģ°øź³ **: ķ„ķ ķė”ģ ķøģģ ģ§ģ ģ ģķ ģ“미ģ§ė„¼ ģ¬ģ©ķ ģģ ģ“ėÆė”, Google URLģ Cloudinaryė” ė§ģ“ź·øė ģ“ģ
ķ ķģė ģģ
|
|
41
|
+
- ģ“ėÆøģ§ ģ
ė”ėė `scripts/upload-character-photos.mjs` ģ¤ķ¬ė¦½ķøė„¼ ķµķ“ Cloudinaryģ ģ
ė”ėķ ģ ģģ
|
|
42
|
+
|
|
43
|
+
## Code Style & Conventions
|
|
44
|
+
- Use **TypeScript** for all files.
|
|
45
|
+
- Stick to functional components and React Hooks.
|
|
46
|
+
- Follow the shadcn/ui Nova design system for UI consistency.
|
|
47
|
+
- Use **Zod** for all schema validations and type-safe parsing.
|
|
48
|
+
- Use **Luxon** for date and time handling.
|
|
49
|
+
- For React Router v7 route functions (`meta`, `loader`, `action`), import types from `react-router` (e.g., `LoaderFunctionArgs`, `ActionFunctionArgs`, `MetaFunction`).
|
|
50
|
+
- Use **Toast notifications** (Sonner - shadcn/ui넼 ķµķ“ ģ¤ģ¹ķė Toast 컓ķ¬ėķø) for user feedback on important actions:
|
|
51
|
+
- Success: Login, logout, signup, tweet creation/update/delete, comment creation, etc.
|
|
52
|
+
- Error: Failed actions, validation errors, etc.
|
|
53
|
+
- Info: General information messages
|
|
54
|
+
- Warning: Cautionary messages
|
|
55
|
+
- **Error Handling**: Always implement comprehensive error handling:
|
|
56
|
+
- Check for `error` field in all fetcher responses (`fetcher.data?.error`)
|
|
57
|
+
- Display errors using `toast.error()` instead of showing raw error messages on the UI
|
|
58
|
+
- Remove optimistic updates when errors occur (e.g., remove optimistic messages on send failure)
|
|
59
|
+
- Handle API errors gracefully in all `useEffect` hooks that process fetcher data
|
|
60
|
+
- Never leave error handling as an afterthought - it must be included from the initial implementation
|
|
61
|
+
- Git commit messages must follow Conventional Commits in Korean (e.g., `feat(ui): ė”ź·øģø źø°ė„ ģ¶ź°`).
|
|
62
|
+
|
|
63
|
+
## Workflow & Safety
|
|
64
|
+
- **[Safe Checkpoint Strategy]** ģė”ģ“ ģģ
ģ“ė ģ¤ģķ ė³ź²½(ģ ķģ¼ ģģ±, DB ģ¤ķ¤ė§ ģģ , ķØķ¤ģ§ ģ¤ģ¹ ė±)ģ ģģķźø° ģ ģ, ė°ėģ ķģ¬ ģķ넼 git commitķź±°ė ģģ
ėė ķ ė¦¬ź° ź¹Øėķģ§ ķģøģ ģģ²ķ“ģ¼ ķ©ėė¤.
|
|
65
|
+
|
|
66
|
+
## Communication Rules
|
|
67
|
+
- **[No Emojis]** ģ¬ģ©ģģģ ėŖØė ģ±ķ
ėķģģ ģ“ėŖØģ§(Emoji) ė° ģ“ėŖØķ°ģ½(Emoticon) ģ¬ģ©ģ ģ ė©“ źøģ§ķ©ėė¤. ķ
ģ¤ķøģ ģ½ėė§ģ¼ė” ėŖ
ķķź² ģ 볓넼 ģ ė¬ķģģģ¤.
|
|
68
|
+
- **[Strict Approval Rule]** ė°ėģ ģ½ė넼 ģģ ķźø° ģ ģ 묓ģģ ģģ ķź² ė¤ź³ ė³“ź³ ķź³ ģ¹ģøģ ģ»ģķ ģģ ģ ģ§ķķė¤.
|
|
69
|
+
- **[Strict Approval Rule]** ź·øė¦¬ź³ ģ½ė넼 ģģ ķė¼ė ģ§ģź° ģė ėķė ė°ėÆģ“ ģėµė§ ķė¼. ģ½ė넼 ģģ ķģ§ ė§ė¼.
|
|
70
|
+
- **[Strict Approval Rule]** ģ½ė ģģ ģ ģģķ ėė ė°ėģ "OOO źø°ė„ģ ģģ ķź² ģµėė¤"ė¼ź³ ėŖ
ķķ ėŖ©ģ ģ ė°ķź³ ģ§ķķė¤.
|
|
71
|
+
|
|
72
|
+
## Testing Instructions
|
|
73
|
+
- Currently, tests are being integrated as part of the development phase (Phase 9).
|
|
74
|
+
- Run available tests using: `npm test`
|
|
75
|
+
|
|
76
|
+
## Key Documentation
|
|
77
|
+
- `docs/01_Foundation/05_ROADMAP.md`: The roadmap for project completion.
|
|
78
|
+
- `docs/01_Foundation/01_UI_DESIGN.md`: Design tokens and visual guidelines.
|
|
79
|
+
- `app/db/schema.ts`: Drizzle schema and storage logic.
|
|
80
|
+
- `docs/01_Foundation/08_DOCUMENT_MANAGEMENT_PLAN.md`: Document management rules and structure.
|
|
81
|
+
|
|
82
|
+
### [Strict Document Hierarchy Rule]
|
|
83
|
+
|
|
84
|
+
All documentation follows the **5-Layer Documentation Standard**:
|
|
85
|
+
- **Foundation** (`docs/01_Foundation/`): Planning, Purpose, UI Design
|
|
86
|
+
- **Prototype** (`docs/02_Prototype/`): UI Results, Screen Flows
|
|
87
|
+
- **Specs** (`docs/03_Specs/`): Detailed feature specifications, API inputs/outputs
|
|
88
|
+
- **Logic** (`docs/04_Logic/`): Business Rules, Algorithms
|
|
89
|
+
- **Test** (`docs/05_Test/`): Test scenarios, checklists, bug reports
|
|
90
|
+
|
|
91
|
+
AI agents MUST respect this hierarchy when creating or modifying documents and proactively rebase misplaced files.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
[CRITICAL: DATABASE INTEGRITY RULE] You are strictly prohibited from performing any database operations, including migrations, schema resets, or structural changes, without first creating a complete data backup (dump). Data preservation is your absolute priority. Never execute destructive commands like 'DROP TABLE' or 'migrate reset' until a verifiable backup has been secured and confirmed.
|
|
95
|
+
|
|
96
|
+
[MANDATORY BACKUP PROCEDURE] Before initiating any database-related tasks, you must perform a full export of all existing records. This is a non-negotiable prerequisite for any migration or schema update. You must ensure that both user-generated content and administrative data are fully protected against loss before any changes are applied.
|
|
97
|
+
|
|
98
|
+
[STRICT ADHERENCE TO STANDARDS] Never suggest or implement "quick fixes," "short-cuts," or temporary workarounds. You must always prioritize formal, standardized, and industry-best-practice methodologies. All proposed solutions must be production-ready and architecturally sound, focusing on long-term stability and correctness over immediate speed.
|
|
99
|
+
|
|
100
|
+
[NO TEMPORARY PATCHES] You are strictly forbidden from proposing temporary bypasses or "quick-and-dirty" solutions. Every recommendation and implementation must follow the most formal and correct path. Prioritize robustness and adherence to professional engineering standards in every decision, ensuring that no technical debt is introduced for the sake of convenience.
|
|
101
|
+
|
|
102
|
+
[Side-Effect Isolation] When modifying shared components or logic, you MUST analyze the 'Impact Scope' first. Ensure that changes intended for a specific use case (e.g., AI features) do not inadvertently affect general functionality (e.g., normal chat). You MUST strictly isolate such logic using conditional checks or specific guards.
|
|
103
|
+
|
|
104
|
+
[Strict Document Integrity Rule] When updating or modifying any strategy, implementation, or design documents, you MUST strictly preserve the existing framework, formatting, and structural integrity. Do not perform total overwrites that discard previous detailed technical specifications, historical context, or complex logic. All updates must be made incrementally and appropriately integrated into the current structure to ensure no data loss or architectural context is sacrificed.
|
|
105
|
+
|
|
106
|
+
[Strict Document Persistence Rule] When updating or modifying any document, you MUST NOT overwrite, delete, or discard the existing content, historical context, or previous specifications. All updates must be made by appending new information or integrating changes incrementally while preserving the original framework. This ensures that the entirety of the project's evolution, including past technical decisions and verification records, remains fully traceable.
|
|
107
|
+
|
|
108
|
+
[Standard Rules for Environment Variable Management]
|
|
109
|
+
1. Strategic Isolation of Environments
|
|
110
|
+
Principle: Maintain strict separation between Local and Production environments using file suffixes.
|
|
111
|
+
Workflow:
|
|
112
|
+
Use .env.development or .env.local for local execution (test keys, localhost URLs).
|
|
113
|
+
Use .env.production as the source of truth for deployment parameters (production domains, live API keys).
|
|
114
|
+
Priority: AI must respect the framework's priority logic (typically: .env.development/local overrides .env).
|
|
115
|
+
2. Zero-Leak Security Policy (Git Integrity)
|
|
116
|
+
Rule: No part of any .env* file shall ever be committed to a Version Control System (VCS).
|
|
117
|
+
Verification: AI must proactively audit
|
|
118
|
+
.gitignore
|
|
119
|
+
to ensure global patterns like .env* are effectively blocking all potential environment files before suggesting any variable updates.
|
|
120
|
+
3. Cloud-Native Secret Management
|
|
121
|
+
Deployment Strategy: Environment variables in production must be managed via the hosting provider's secure dashboard (e.g., Vercel, AWS) or CLI, never via file transmission to the server.
|
|
122
|
+
Automation: When syncing variables, prioritize using official CLIs to pull/push secrets between the local .env files and the cloud environment to prevent manual entry errors.
|
|
123
|
+
4. Context-Aware Variable Configuration
|
|
124
|
+
Dynamic Mapping: Redirection URLs, Auth providers, and Database connection strings must be dynamically configured to point to localhost in development and the verified production domain in deployment, managed through the isolated .env files.
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "solmate-skills",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Curated skills for Solmate projects",
|
|
5
|
+
"main": "bin/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"solmate-skills": "bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"skills",
|
|
14
|
+
"solmate",
|
|
15
|
+
"antigravity",
|
|
16
|
+
"automation"
|
|
17
|
+
],
|
|
18
|
+
"author": "",
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/solmate30/solmate-skills.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/solmate30/solmate-skills/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/solmate30/solmate-skills#readme",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Stitch to React Components Skill
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx add-skill google-labs-code/stitch-skills --skill react:components --global
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Example Prompt
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Convert my Landing Page screen in my Podcast Stitch Project to a React component system.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Skill Structure
|
|
16
|
+
|
|
17
|
+
This repository follows the **Agent Skills** open standard. Each skill is self-contained with its own logic, validation scripts, and design tokens.
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
skills/react-components/
|
|
21
|
+
āāā SKILL.md ā Core instructions & workflow
|
|
22
|
+
āāā package.json ā Validator dependencies
|
|
23
|
+
āāā scripts/ ā Networking & AST validation
|
|
24
|
+
āāā resources/ ā Style guides & API references
|
|
25
|
+
āāā examples/ ā Gold-standard code samples
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## How it Works
|
|
29
|
+
|
|
30
|
+
When activated, the agent follows a high-fidelity engineering pipeline:
|
|
31
|
+
|
|
32
|
+
1. **Retrieval**: Uses a system-level `curl` script to bypass TLS/SNI issues on Google Cloud Storage.
|
|
33
|
+
2. **Mapping**: Cross-references Stitch metadata with the local `style-guide.json` to ensure token consistency.
|
|
34
|
+
3. **Generation**: Scaffolds components using a strict Atomic Design pattern.
|
|
35
|
+
4. **Validation**: Runs an automated AST check using `@swc/core` to prevent hardcoded hex values or missing interfaces.
|
|
36
|
+
5. **Audit**: Performs a final self-correction check against a 20-point architecture checklist.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react:components
|
|
3
|
+
description: Converts Stitch designs into modular Vite and React components using system-level networking and AST-based validation.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- "stitch*:*"
|
|
6
|
+
- "Bash"
|
|
7
|
+
- "Read"
|
|
8
|
+
- "Write"
|
|
9
|
+
- "web_fetch"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Stitch to React Components
|
|
13
|
+
|
|
14
|
+
You are a frontend engineer focused on transforming designs into clean React code. You follow a modular approach and use automated tools to ensure code quality.
|
|
15
|
+
|
|
16
|
+
## Retrieval and networking
|
|
17
|
+
1. **Namespace discovery**: Run `list_tools` to find the Stitch MCP prefix. Use this prefix (e.g., `stitch:`) for all subsequent calls.
|
|
18
|
+
2. **Metadata fetch**: Call `[prefix]:get_screen` to retrieve the design JSON.
|
|
19
|
+
3. **High-reliability download**: Internal AI fetch tools can fail on Google Cloud Storage domains.
|
|
20
|
+
- Use the `Bash` tool to run: `bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" "temp/source.html"`.
|
|
21
|
+
- This script handles the necessary redirects and security handshakes.
|
|
22
|
+
4. **Visual audit**: Check `screenshot.downloadUrl` to confirm the design intent and layout details.
|
|
23
|
+
|
|
24
|
+
## Architectural rules
|
|
25
|
+
* **Modular components**: Break the design into independent files. Avoid large, single-file outputs.
|
|
26
|
+
* **Logic isolation**: Move event handlers and business logic into custom hooks in `src/hooks/`.
|
|
27
|
+
* **Data decoupling**: Move all static text, image URLs, and lists into `src/data/mockData.ts`.
|
|
28
|
+
* **Type safety**: Every component must include a `Readonly` TypeScript interface named `[ComponentName]Props`.
|
|
29
|
+
* **Project specific**: Focus on the target project's needs and constraints. Leave Google license headers out of the generated React components.
|
|
30
|
+
* **Style mapping**:
|
|
31
|
+
* Extract the `tailwind.config` from the HTML `<head>`.
|
|
32
|
+
* Sync these values with `resources/style-guide.json`.
|
|
33
|
+
* Use theme-mapped Tailwind classes instead of arbitrary hex codes.
|
|
34
|
+
|
|
35
|
+
## Execution steps
|
|
36
|
+
1. **Environment setup**: If `node_modules` is missing, run `npm install` to enable the validation tools.
|
|
37
|
+
2. **Data layer**: Create `src/data/mockData.ts` based on the design content.
|
|
38
|
+
3. **Component drafting**: Use `resources/component-template.tsx` as a base. Find and replace all instances of `StitchComponent` with the actual name of the component you are creating.
|
|
39
|
+
4. **Application wiring**: Update the project entry point (like `App.tsx`) to render the new components.
|
|
40
|
+
5. **Quality check**:
|
|
41
|
+
* Run `npm run validate <file_path>` for each component.
|
|
42
|
+
* Verify the final output against the `resources/architecture-checklist.md`.
|
|
43
|
+
* Start the dev server with `npm run dev` to verify the live result.
|
|
44
|
+
|
|
45
|
+
## Troubleshooting
|
|
46
|
+
* **Fetch errors**: Ensure the URL is quoted in the bash command to prevent shell errors.
|
|
47
|
+
* **Validation errors**: Review the AST report and fix any missing interfaces or hardcoded styles.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
// Note for Agent: The '@' alias refers to the target project's src directory.
|
|
19
|
+
// Ensure src/data/mockData.ts is created before generating this component.
|
|
20
|
+
import { cardData } from '../data/mockData';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gold Standard: ActivityCard
|
|
24
|
+
* This file serves as the definitive reference for the agent.
|
|
25
|
+
*/
|
|
26
|
+
interface ActivityCardProps {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly username: string;
|
|
29
|
+
readonly action: 'MERGED' | 'COMMIT';
|
|
30
|
+
readonly timestamp: string;
|
|
31
|
+
readonly avatarUrl: string;
|
|
32
|
+
readonly repoName: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const ActivityCard: React.FC<ActivityCardProps> = ({
|
|
36
|
+
username,
|
|
37
|
+
action,
|
|
38
|
+
timestamp,
|
|
39
|
+
avatarUrl,
|
|
40
|
+
repoName,
|
|
41
|
+
}) => {
|
|
42
|
+
const isMerged = action === 'MERGED';
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="flex items-center justify-between gap-4 rounded-lg bg-surface-dark p-4 min-h-14 shadow-sm ring-1 ring-white/10">
|
|
46
|
+
<div className="flex items-center gap-4 overflow-hidden">
|
|
47
|
+
<div
|
|
48
|
+
className="aspect-square h-10 w-10 flex-shrink-0 rounded-full bg-cover bg-center bg-no-repeat"
|
|
49
|
+
style={{ backgroundImage: `url(${avatarUrl})` }}
|
|
50
|
+
aria-label={`Avatar for ${username}`}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm sm:text-base">
|
|
54
|
+
<a href="#" className="font-semibold text-primary hover:underline truncate">
|
|
55
|
+
{username}
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
<span className={`inline-block px-2 py-0.5 text-xs font-semibold rounded-full ${isMerged ? 'bg-purple-500/30 text-purple-300' : 'bg-primary/30 text-primary'
|
|
59
|
+
}`}>
|
|
60
|
+
{action}
|
|
61
|
+
</span>
|
|
62
|
+
|
|
63
|
+
<span className="text-white/60">in</span>
|
|
64
|
+
|
|
65
|
+
<a href="#" className="text-primary hover:underline truncate">
|
|
66
|
+
{repoName}
|
|
67
|
+
</a>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div className="shrink-0">
|
|
72
|
+
<p className="text-sm font-normal leading-normal text-white/50">
|
|
73
|
+
{timestamp}
|
|
74
|
+
</p>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default ActivityCard;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Design-to-code prompt to React components for Stitch MCP",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"validate": "node scripts/validate.js",
|
|
8
|
+
"fetch": "bash scripts/fetch-stitch.sh"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@swc/core": "^1.3.100"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18.0.0"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Architecture Quality Gate
|
|
2
|
+
|
|
3
|
+
### Structural integrity
|
|
4
|
+
- [ ] Logic extracted to custom hooks in `src/hooks/`.
|
|
5
|
+
- [ ] No monolithic files; strictly Atomic/Composite modularity.
|
|
6
|
+
- [ ] All static text/URLs moved to `src/data/mockData.ts`.
|
|
7
|
+
|
|
8
|
+
### Type safety and syntax
|
|
9
|
+
- [ ] Props use `Readonly<T>` interfaces.
|
|
10
|
+
- [ ] File is syntactically valid TypeScript (no red squiggles).
|
|
11
|
+
- [ ] Placeholders from templates (e.g., `StitchComponent`) have been replaced with actual names.
|
|
12
|
+
|
|
13
|
+
### Styling and theming
|
|
14
|
+
- [ ] Dark mode (`dark:`) applied to all color classes.
|
|
15
|
+
- [ ] No hardcoded hex values; use theme-mapped Tailwind classes.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
|
|
19
|
+
// Use a valid identifier like 'StitchComponent' as the placeholder
|
|
20
|
+
interface StitchComponentProps {
|
|
21
|
+
readonly children?: React.ReactNode;
|
|
22
|
+
readonly className?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const StitchComponent: React.FC<StitchComponentProps> = ({
|
|
26
|
+
children,
|
|
27
|
+
className = '',
|
|
28
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
return (
|
|
31
|
+
<div className={`relative ${className}`} {...props}>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default StitchComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Stitch API reference
|
|
2
|
+
|
|
3
|
+
This document describes the data structures returned by the Stitch MCP server to ensure accurate component mapping.
|
|
4
|
+
|
|
5
|
+
### Metadata schema
|
|
6
|
+
When calling `get_screen`, the server returns a JSON object with these key properties:
|
|
7
|
+
* **htmlCode**: Contains a `downloadUrl`. This is a signed URL that requires a system-level fetch (curl) to handle redirects and security handshakes.
|
|
8
|
+
* **screenshot**: Includes a `downloadUrl` for the visual design. Use this to verify layout intent that might not be obvious in the raw HTML.
|
|
9
|
+
* **deviceType**: Usually set to `DESKTOP`. All generated components should prioritize the corresponding viewport (2560px width) as the base layout.
|
|
10
|
+
|
|
11
|
+
### Technical mapping rules
|
|
12
|
+
1. **Element tracking**: Preserve `data-stitch-id` attributes as comments in the TSX to allow for future design synchronization.
|
|
13
|
+
2. **Asset handling**: Treat background images in the HTML as dynamic data. Extract the URLs into `mockData.ts` rather than hardcoding them into the component styles.
|
|
14
|
+
3. **Style extraction**: The HTML `<head>` contains a localized `tailwind.config`. This config must be merged with the local project theme to ensure colors like `primary` and `background-dark` render correctly.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"theme": {
|
|
3
|
+
"colors": {
|
|
4
|
+
"primary": "#19e66f",
|
|
5
|
+
"background": {
|
|
6
|
+
"light": "#f6f8f7",
|
|
7
|
+
"dark": "#112118",
|
|
8
|
+
"elevated": "#1A1A1A"
|
|
9
|
+
},
|
|
10
|
+
"accent": {
|
|
11
|
+
"purple": "#8A2BE2",
|
|
12
|
+
"lavender": "#D0A9F5"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"typography": {
|
|
16
|
+
"display": [
|
|
17
|
+
"Space Grotesk",
|
|
18
|
+
"sans-serif"
|
|
19
|
+
],
|
|
20
|
+
"icons": "Material Symbols Outlined"
|
|
21
|
+
},
|
|
22
|
+
"spacing": {
|
|
23
|
+
"header-h": "72px",
|
|
24
|
+
"container-max": "960px"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Copyright 2026 Google LLC
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
URL=$1
|
|
17
|
+
OUTPUT=$2
|
|
18
|
+
if [ -z "$URL" ] || [ -z "$OUTPUT" ]; then
|
|
19
|
+
echo "Usage: $0 <url> <output_path>"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
echo "Initiating high-reliability fetch for Stitch HTML..."
|
|
23
|
+
curl -L -f -sS --connect-timeout 10 --compressed "$URL" -o "$OUTPUT"
|
|
24
|
+
if [ $? -eq 0 ]; then
|
|
25
|
+
echo "ā
Successfully retrieved HTML at: $OUTPUT"
|
|
26
|
+
exit 0
|
|
27
|
+
else
|
|
28
|
+
echo "ā Error: Failed to retrieve content. Check TLS/SNI or URL expiration."
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import swc from '@swc/core';
|
|
18
|
+
import fs from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
|
|
21
|
+
async function validateComponent(filePath) {
|
|
22
|
+
const code = fs.readFileSync(filePath, 'utf-8');
|
|
23
|
+
const filename = path.basename(filePath);
|
|
24
|
+
try {
|
|
25
|
+
const ast = await swc.parse(code, { syntax: "typescript", tsx: true });
|
|
26
|
+
let hasInterface = false;
|
|
27
|
+
let tailwindIssues = [];
|
|
28
|
+
|
|
29
|
+
console.log("š Scanning AST...");
|
|
30
|
+
|
|
31
|
+
const walk = (node) => {
|
|
32
|
+
if (!node) return;
|
|
33
|
+
if (node.type === 'TsInterfaceDeclaration' && node.id.value.endsWith('Props')) hasInterface = true;
|
|
34
|
+
if (node.type === 'JSXAttribute' && node.name.name === 'className') {
|
|
35
|
+
if (node.value?.value && /#[0-9A-Fa-f]{6}/.test(node.value.value)) tailwindIssues.push(node.value.value);
|
|
36
|
+
}
|
|
37
|
+
for (const key in node) { if (node[key] && typeof node[key] === 'object') walk(node[key]); }
|
|
38
|
+
};
|
|
39
|
+
walk(ast);
|
|
40
|
+
|
|
41
|
+
console.log(`--- Validation for: ${filename} ---`);
|
|
42
|
+
if (hasInterface) {
|
|
43
|
+
console.log("ā
Props declaration found.");
|
|
44
|
+
} else {
|
|
45
|
+
console.error("ā MISSING: Props interface (must end in 'Props').");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (tailwindIssues.length === 0) {
|
|
49
|
+
console.log("ā
No hardcoded hex values found.");
|
|
50
|
+
} else {
|
|
51
|
+
console.error(`ā STYLE: Found ${tailwindIssues.length} hardcoded hex codes.`);
|
|
52
|
+
tailwindIssues.forEach(hex => console.error(` - ${hex}`));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (hasInterface && tailwindIssues.length === 0) {
|
|
56
|
+
console.log("\n⨠COMPONENT VALID.");
|
|
57
|
+
process.exit(0);
|
|
58
|
+
} else {
|
|
59
|
+
console.error("\nš« VALIDATION FAILED.");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
} catch (err) {
|
|
63
|
+
console.error("ā PARSE ERROR:", err.message);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
validateComponent(process.argv[2]);
|