A library of Agent Skills designed to work with the Stitch MCP server. Each skill follows the Agent Skills open standard, for compatibility with coding agents such as Antigravity, Gemini CLI, Claude Code, Cursor.
TypeScript
perf(skills): traverse only AST nodes in validate.js walkers
Emp15009a6ea47d4804
diff --git a/plugins/stitch-build/skills/react-components/scripts/validate.js b/plugins/stitch-build/skills/react-components/scripts/validate.jsindex 4094b06..883ba9b 100644--- a/plugins/stitch-build/skills/react-components/scripts/validate.js+++ b/plugins/stitch-build/skills/react-components/scripts/validate.js@@ -31,12 +31,20 @@ async function validateComponent(filePath) {console.log("🔍 Scanning AST...");const walk = (node) => {- if (!node) return;+ if (!node || typeof node !== 'object') return;+ if (Array.isArray(node)) {+ for (const item of node) walk(item);+ return;+ }+ if (typeof node.type !== 'string') return;if (node.type === 'TsInterfaceDeclaration' && node.id.value.endsWith('Props')) hasInterface = true;if (node.type === 'JSXAttribute' && (node.name?.value === 'className' || node.name?.name === 'className')) {if (node.value?.value && HEX_COLOR_REGEX.test(node.value.value)) tailwindIssues.push(node.value.value);}- for (const key in node) { if (node[key] && typeof node[key] === 'object') walk(node[key]); }+ for (const key in node) {+ if (key === 'span') continue;+ if (node[key] && typeof node[key] === 'object') walk(node[key]);+ }};walk(ast);diff --git a/plugins/stitch-build/skills/react-native/scripts/validate.js b/plugins/stitch-build/skills/react-native/scripts/validate.jsindex 133d9db..e91a461 100644--- a/plugins/stitch-build/skills/react-native/scripts/validate.js+++ b/plugins/stitch-build/skills/react-native/scripts/validate.js@@ -35,7 +35,12 @@ async function validateComponent(filePath) {console.log("Scanning AST...");const walk = (node, parent) => {- if (!node) return;+ if (!node || typeof node !== 'object') return;+ if (Array.isArray(node)) {+ for (const item of node) walk(item, parent);+ return;+ }+ if (typeof node.type !== 'string') return;if (node.type === 'TsInterfaceDeclaration' && node.id.value.endsWith('Props')) {hasInterface = true;@@ -63,6 +68,7 @@ async function validateComponent(filePath) {}for (const key in node) {+ if (key === 'span') continue;if (node[key] && typeof node[key] === 'object') walk(node[key], node);}};