Skip to content

Adonis0123/adonis-skills / skills/figma-mcp

figma-mcp

Verified

Handles every /figma-mcp invocation, which covers two jobs. First, implement or match a UI from a Figma design URL or file key (e.g. '/figma-mcp 按设计稿把这个页面做成 React', '/figma-mcp 还原度要高'): hand the visual work to figma-design-to-code and follow through to a finished screen, not just a metadata read or screenshot. Second, install, authenticate, switch accounts, recover or verify the official Figma MCP server in Codex, Claude Code, Cursor or Grok Build, keeping registration account-neutral and each host's OAuth flow authoritative. Use whoami for readiness, named-account, recovery, write and multi-host checks; for a current-account single-host read, including implement/match, let the first official read prove readiness instead of a separate identity call. Also read, filter, or audit Figma file comments (resolved review threads), which the MCP cannot read, and decide when to fall back to the Figma REST API with the user's token, e.g. on hosts outside the MCP Catalog like pi. Never copy OAuth tokens between hosts.

evals/test_rest_scope.py

View on GitHub
"""Offline behavior checks; FIGMA_REST_SCRIPT can select the saved baseline."""
import importlib.util
import io
import json
import os
from pathlib import Path
from types import SimpleNamespace
import unittest
from unittest.mock import patch

path = Path(os.environ.get('FIGMA_REST_SCRIPT', str(Path(__file__).resolve().parents[1] / 'scripts/figma_rest.py')))
spec = importlib.util.spec_from_file_location('figma_rest_scope_test', path)
rest = importlib.util.module_from_spec(spec)
spec.loader.exec_module(rest)


class ScopeTests(unittest.TestCase):
    def args(self, **kwargs):
        return SimpleNamespace(**dict(dict(metadata='metadata', scope_ids=None,
            file_key='fixture', resolved='all'), **kwargs))

    def parse(self, text):
        with patch('builtins.open', return_value=io.StringIO(text)):
            return rest.load_scope(self.args())

    def test_supported_metadata_shapes(self):
        xml = '<frame id="1:2"><text id="3:4"/></frame>'
        entries = [{'type': 'text', 'text': 'Selected nodes'}, {'type': 'text', 'text': xml}]
        for text in (xml, '<?xml version="1.0"?>' + xml,
                     json.dumps(entries), json.dumps({'content': entries})):
            with self.subTest(text=text):
                self.assertEqual(self.parse(text), {'1:2', '3:4'})

    def test_invalid_metadata_fails_before_request(self):
        for raw in ('', 'not metadata', '[]', '{}', 'null', '123',
                    '{"content": "bad"}', '[{"text": null}]', '<frame id="1:2">'):
            with self.subTest(raw=raw), patch('builtins.open', return_value=io.StringIO(raw)), patch.object(rest, 'get') as request:
                with self.assertRaisesRegex(SystemExit, 'scope|metadata'):
                    rest.cmd_comments(self.args(), 'dummy')
                request.assert_not_called()

    def test_empty_scope_ids_fails_before_request(self):
        with patch('builtins.open', return_value=io.StringIO(' \n')), patch.object(rest, 'get') as request:
            with self.assertRaisesRegex(SystemExit, 'scope'):
                rest.cmd_comments(self.args(metadata=None, scope_ids='ids'), 'dummy')
            request.assert_not_called()

    def test_explicit_ids(self):
        with patch('builtins.open', return_value=io.StringIO('1:2\n3:4\n')):
            self.assertEqual(rest.load_scope(self.args(metadata=None, scope_ids='ids')), {'1:2', '3:4'})

    def test_comments_scoped_and_unscoped(self):
        comments = [{'id': str(i), 'client_meta': {'node_id': node},
                     'user': {'handle': 'fixture'}, 'created_at': '2026-01-01',
                     'message': 'Fix title', 'order_id': str(i)}
                    for i, node in ((2, '1:2'), (1, '9:9'))]
        with patch.object(rest, 'get', return_value={'comments': comments}):
            with patch('builtins.open', return_value=io.StringIO('<frame id="1:2"/>')):
                threads, _ = rest.cmd_comments(self.args(), 'dummy')
                self.assertEqual([t['node_id'] for t in threads], ['1:2'])
            threads, _ = rest.cmd_comments(self.args(metadata=None), 'dummy')
            self.assertEqual([t['node_id'] for t in threads], ['9:9', '1:2'])


if __name__ == '__main__':
    unittest.main()
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall