Agent Skillsinvolvex/youtube-music-cli › react:components

react:components

GitHub

将 Stitch 设计稿转换为模块化 React 组件,包含元数据获取、资源下载、代码生成及 AST 验证流程。

.claude/skills/react-components/SKILL.md involvex/youtube-music-cli

Trigger Scenarios

需要将设计稿转换为 React 代码 生成基于 Stitch 设计的 UI 组件

Install

npx skills add involvex/youtube-music-cli --skill react:components -g -y
More Options

Non-standard path

npx skills add https://github.com/involvex/youtube-music-cli/tree/main/.claude/skills/react-components -g -y

Use without installing

npx skills use involvex/youtube-music-cli@react:components

指定 Agent (Claude Code)

npx skills add involvex/youtube-music-cli --skill react:components -a claude-code -g -y

安装 repo 全部 skill

npx skills add involvex/youtube-music-cli --all -g -y

预览 repo 内 skill

npx skills add involvex/youtube-music-cli --list

SKILL.md

Frontmatter
{
    "name": "react:components",
    "description": "Converts Stitch designs into modular Vite and React components using system-level networking and AST-based validation.",
    "allowed-tools": [
        "stitch*:*",
        "Bash",
        "Read",
        "Write",
        "web_fetch"
    ]
}

Stitch to React Components

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.

Retrieval and networking

  1. Namespace discovery: Run list_tools to find the Stitch MCP prefix. Use this prefix (e.g., stitch:) for all subsequent calls.
  2. Metadata fetch: Call [prefix]:get_screen to retrieve the design JSON.
  3. Check for existing designs: Before downloading, check if .stitch/designs/{page}.html and .stitch/designs/{page}.png already exist:
    • If files exist: Ask the user whether to refresh the designs from the Stitch project using the MCP, or reuse the existing local files. Only re-download if the user confirms.
    • If files do not exist: Proceed to step 4.
  4. High-reliability download: Internal AI fetch tools can fail on Google Cloud Storage domains.
    • HTML: bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" ".stitch/designs/{page}.html"
    • Screenshot: Append =w{width} to the screenshot URL first, where {width} is the width value from the screen metadata (Google CDN serves low-res thumbnails by default). Then run: bash scripts/fetch-stitch.sh "[screenshot.downloadUrl]=w{width}" ".stitch/designs/{page}.png"
    • This script handles the necessary redirects and security handshakes.
  5. Visual audit: Review the downloaded screenshot (.stitch/designs/{page}.png) to confirm design intent and layout details.

Architectural rules

  • Modular components: Break the design into independent files. Avoid large, single-file outputs.
  • Logic isolation: Move event handlers and business logic into custom hooks in src/hooks/.
  • Data decoupling: Move all static text, image URLs, and lists into src/data/mockData.ts.
  • Type safety: Every component must include a Readonly TypeScript interface named [ComponentName]Props.
  • Project specific: Focus on the target project's needs and constraints. Leave Google license headers out of the generated React components.
  • Style mapping:
    • Extract the tailwind.config from the HTML <head>.
    • Sync these values with resources/style-guide.json.
    • Use theme-mapped Tailwind classes instead of arbitrary hex codes.

Execution steps

  1. Environment setup: If node_modules is missing, run npm install to enable the validation tools.
  2. Data layer: Create src/data/mockData.ts based on the design content.
  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.
  4. Application wiring: Update the project entry point (like App.tsx) to render the new components.
  5. Quality check:
    • Run npm run validate <file_path> for each component.
    • Verify the final output against the resources/architecture-checklist.md.
    • Start the dev server with npm run dev to verify the live result.

Troubleshooting

  • Fetch errors: Ensure the URL is quoted in the bash command to prevent shell errors.
  • Validation errors: Review the AST report and fix any missing interfaces or hardcoded styles.

Version History

  • 5b71f46 Current 2026-08-20 08:07

Same Skill Collection

.agents/skills/brainstorming/SKILL.md
.agents/skills/bun-build/SKILL.md
.agents/skills/bun-dev-server/SKILL.md
.agents/skills/bun-init/SKILL.md
.agents/skills/bun-test/SKILL.md
.agents/skills/bun-win32/SKILL.md
.agents/skills/cli-mastery/SKILL.md
.agents/skills/create-implementation-plan/SKILL.md
.agents/skills/planning-with-files/SKILL.md
.agents/skills/powershell-windows/SKILL.md
.agents/skills/react-best-practices/SKILL.md
.agents/skills/react-components/SKILL.md
.agents/skills/react-patterns/SKILL.md
.agents/skills/react-state-management/SKILL.md
.agents/skills/systematic-debugging/SKILL.md
.agents/skills/writing-plans/SKILL.md
.claude/skills/brainstorming/SKILL.md
.claude/skills/bun-build/SKILL.md
.claude/skills/bun-dev-server/SKILL.md
.claude/skills/bun-init/SKILL.md
.claude/skills/bun-test/SKILL.md
.claude/skills/bun-win32/SKILL.md
.claude/skills/cli-mastery/SKILL.md
.claude/skills/create-implementation-plan/SKILL.md
.claude/skills/planning-with-files/SKILL.md
.claude/skills/powershell-windows/SKILL.md
.claude/skills/react-best-practices/SKILL.md
.claude/skills/react-patterns/SKILL.md
.claude/skills/react-state-management/SKILL.md
.claude/skills/systematic-debugging/SKILL.md
.claude/skills/writing-plans/SKILL.md
.agents/skills/bun-development/SKILL.md
.agents/skills/cli-expert/SKILL.md
.claude/skills/bun-development/SKILL.md
.claude/skills/cli-expert/SKILL.md

Metadata

Files
0
Version
5b71f46
Hash
d7d97de6
Indexed
2026-08-20 08:07

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 06:27
浙ICP备14020137号-1 $방문자$