leafygreen-authoring

โดย mongodb

ถูกเรียกใช้โดยอัตโนมัติเมื่อเขียนหรือแก้ไขคอมโพเนนต์ React (.tsx/.ts) ในโปรเจกต์ที่มีแพ็กเกจ @leafygreen-ui ใน package.json ให้การแมปคอมโพเนนต์…

npx skills add https://github.com/mongodb/leafygreen-ui --skill leafygreen-authoring

LeafyGreen Authoring Conventions

Apply these conventions whenever writing or editing React components in a project that uses @leafygreen-ui/* packages.

Always prefer LeafyGreen components over plain HTML

When a user asks to add any UI element — in plain language, from a Figma design, or anywhere else — always check if a LeafyGreen component exists for it first. Never use a plain HTML element (<button>, <input>, <select>, etc.) when an @leafygreen-ui equivalent is available.

Common mappings:

User asks for…Use
Button, CTA@leafygreen-ui/buttonButton
Text input, text field@leafygreen-ui/text-inputTextInput
Dropdown, select@leafygreen-ui/selectSelect, Option
Searchable dropdown@leafygreen-ui/comboboxCombobox
Search box@leafygreen-ui/search-inputSearchInput
Number field@leafygreen-ui/number-inputNumberInput
Checkbox@leafygreen-ui/checkboxCheckbox
Radio button@leafygreen-ui/radio-groupRadioGroup, Radio
Toggle, switch@leafygreen-ui/toggleToggle
Icon button@leafygreen-ui/icon-buttonIconButton
Icon@leafygreen-ui/iconIcon
Heading, body text, label@leafygreen-ui/typographyH1H3, Body, Label, Subtitle
Modal, dialog@leafygreen-ui/modalModal
Tooltip@leafygreen-ui/tooltipTooltip
Tabs@leafygreen-ui/tabsTabs, Tab
Table@leafygreen-ui/tableTable, Row, Cell
Badge, tag, chip@leafygreen-ui/badgeBadge
Banner, alert@leafygreen-ui/bannerBanner
Toast, notification@leafygreen-ui/toastToast
Menu, context menu@leafygreen-ui/menuMenu, MenuItem
Card@leafygreen-ui/cardCard
Code block@leafygreen-ui/codeCode
Logo / logomark@leafygreen-ui/logoMongoDBLogoMark, MongoDBLogo
Stepper, progress steps@leafygreen-ui/stepperStepper, Step
Pipeline@leafygreen-ui/pipelinePipeline, Stage

If a package is not yet installed, install it before writing the component code:

npm install @leafygreen-ui/[package-name]

Component imports

Always use named imports for LG components:

import { H1, Body, Subtitle } from '@leafygreen-ui/typography'
import { Button } from '@leafygreen-ui/button'
import Icon from '@leafygreen-ui/icon'           // default import
import { MongoDBLogoMark } from '@leafygreen-ui/logo'

Styling approach

Always use design tokens from @leafygreen-ui/tokens for colors — never hard-coded hex values. Tokens are the single source of truth for color in the design system and automatically resolve to the correct value for dark or light mode.

import { palette } from '@leafygreen-ui/tokens'

// Correct: use a token
color: palette.gray.dark2

// Avoid: hard-coded hex
color: '#3D4F58'

Figma MCP → auto-install missing packages

When implementing a design from the Figma MCP, the component descriptions include the LeafyGreen package name, e.g.:

⚛️ React name: @leafygreen-ui/text-input
⚛️ React name: @leafygreen-ui/select

Before writing any component code:

  1. Scan all ⚛️ React name: entries in the Figma design context
  2. Cross-check each @leafygreen-ui/* package against package.json
  3. Install any that are missing: npm install @leafygreen-ui/[package-name]
  4. Never substitute plain HTML for a LeafyGreen component that is called out in the design spec

File structure

  • New components go in src/components/[ComponentName].tsx
  • One component per file
  • Name files and components in PascalCase: ProjectCard.tsx, not project-card.tsx
  • Ask before creating new folders outside of src/components/

TypeScript

  • Always define prop types explicitly using TypeScript interfaces
  • Do not use any as a type

General

  • Keep components focused. If a component is doing more than one thing, split it.

Skills เพิ่มเติมจาก mongodb

atlas-stream-processing
mongodb
จัดการเวิร์กโฟลว์ MongoDB Atlas Stream Processing (ASP) ดูแลการจัดเตรียมเวิร์กสเปซ การเชื่อมต่อแหล่งข้อมูล/ซิงก์ การดำเนินการวงจรชีวิตของโปรเซสเซอร์…
official
mongodb-atlas-stream-processing
mongodb
จัดการเวิร์กโฟลว์ MongoDB Atlas Stream Processing (ASP) ดูแลการจัดเตรียมเวิร์กสเปซ การเชื่อมต่อแหล่งข้อมูล/ปลายทาง การดำเนินการวงจรชีวิตของโปรเซสเซอร์,…
official
mongodb-connection
mongodb
ปรับแต่งการกำหนดค่าการเชื่อมต่อไคลเอนต์ MongoDB (พูล, ไทม์เอาต์, รูปแบบ) สำหรับภาษาไดรเวอร์ที่รองรับใด ๆ ใช้ทักษะนี้เมื่อทำงาน/อัปเดต/ตรวจสอบ…
official
mongodb-mcp-setup
mongodb
แนะนำผู้ใช้ในการกำหนดค่าตัวเลือกหลักของ MongoDB MCP server ใช้สกิลนี้เมื่อผู้ใช้ติดตั้ง MongoDB MCP server แล้วแต่ยังไม่ได้กำหนดค่า…
official
mongodb-natural-language-querying
mongodb
สร้างคิวรี MongoDB แบบอ่านอย่างเดียว (find) หรือ aggregation pipelines โดยใช้ภาษาธรรมชาติ พร้อมบริบทของ schema คอลเลกชันและเอกสารตัวอย่าง ใช้สกิลนี้…
official
mongodb-query-optimizer
mongodb
ช่วยเหลือเกี่ยวกับการปรับแต่งคิวรี MongoDB และการสร้างดัชนี ใช้เฉพาะเมื่อผู้ใช้ขอการปรับแต่งหรือประสิทธิภาพ: "ฉันจะปรับแต่งคิวรีนี้อย่างไร?", "ฉันจะ...
official
mongodb-schema-design
mongodb
รูปแบบและแนวทางปฏิบัติที่ไม่ควรทำในการออกแบบ schema ของ MongoDB ใช้เมื่อออกแบบโมเดลข้อมูล ตรวจสอบ schema ย้ายข้อมูลจาก SQL หรือแก้ไขปัญหาด้านประสิทธิภาพ...
official
mongodb-search-and-ai
mongodb
Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when…
official