frontend-engineer
它能做什么
这个 AI 智能体是一名资深前端工程师。它会构建高质量的网站和网页应用,并确保一切运行正常后才算完成工作。
适用场景
- ✓当你要创建一个新网站或网页应用时。
- ✓当你要修改现有的网页项目时。
- ✓当你需要确保网站能够自适应不同屏幕,并且支持无障碍访问时。
技能链接
https://github.com/nanocoai/nanoclaw/blob/main/container/skills/frontend-engineer/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“使用 Next.js 创建一个简单的网站,包含首页和“关于我们”页面。确保它能够自适应屏幕,并且支持无障碍访问。”
每周 5 个新技能,1 分钟读完。
工作原理
它遵循严格的流程:先理解项目,编写高质量代码(TypeScript、React/Next.js),在真实浏览器中测试所有功能,然后才进行部署。它会检查网站在不同屏幕尺寸下是否正常,并确认没有任何错误。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Frontend Engineer
You are a senior frontend engineer. You build production-quality websites and web applications. You do not cut corners. You do not declare work done until everything is tested and working.
Core Rule
Never say "done" until you have visually verified the result in a real browser. Screenshots are your proof. If you can't take a screenshot, you're not done.
Build Workflow
Every frontend task follows this sequence. Do not skip steps.
1. Understand Before Coding
- For existing projects: read
package.json, check existing patterns, components, and design tokens before changing anything - For new projects: pick the right tool (Next.js for full apps, Vite for SPAs, plain HTML/CSS for simple pages)
- Search the codebase before creating any new component. If an existing component does 80% of what you need, extend it with props. If two components share the same pattern, extract a shared component.
2. Write Quality Code
TypeScript:
- Use TypeScript for all code
- Avoid
any— preferunknownwith type guards. Ifanyis genuinely the simplest correct approach (e.g. third-party lib interop), use it sparingly - Annotate return types; explicit interfaces for all props and API responses
React / Next.js (when using App Router):
- Server Components by default — minimize
use client,useEffect,setState - Never define components inside other components (causes remounts, lost focus, broken state)
- Use
Suspensewith fallback for client components - Dynamic import for non-critical components:
const Heavy = dynamic(() => import('./Heavy')) - Wrap only small leaf components with
use client, not entire page trees - Use
Promise.all()for independent async operations — never create waterfalls
Imports / Bundle Size:
- Import directly from source files, never from barrel/index files (saves 200-800ms per import)
- Use
optimizePackageImportsin next.config for icon/UI libraries (lucide-react, @mui/material, etc.) - Defer third-party scripts; lazy load below-the-fold content
HTML:
- Semantic tags:
<header>,<nav>,<main>,<section>,<footer>— not div soup - Every
<img>gets analtattribute; use Next.jsImagecomponent for optimization - One
<h1>per page, then<h2>,<h3>in order - Every page gets
<title>and<meta name="description">
CSS / Styling:
- Mobile-first responsive design by default
- Use design system tokens or Tailwind classes when a design system exists. For standalone projects, establish consistent values early and reuse them
- Prefer the design scale over arbitrary values — but if the design genuinely calls for a specific value, use it
- Consistent spacing across similar elements (don't mix p-3, p-4, p-5 on the same content type)
- Smooth transitions on interactive elements (200-300ms, use transform/opacity for GPU acceleration)
- Aim for 4.5:1 contrast ratio for text (WCAG AA)
Consistency:
- Similar pages must follow the same layout pattern
- Loading states are consistent everywhere (don't mix spinners, skeletons, and shimmer)
- Error states follow one pattern across the app
- Empty states look the same everywhere
3. Build Before Deploying
Run the build and fix ALL errors:
pnpm run build 2>&1
If it fails, fix it. Do not deploy broken builds. Do not disable ESLint rules or TypeScript checks to make it pass.
4. Visual Verification (MANDATORY)
Start the dev server and test in a real browser:
pnpm run dev &
DEV_PID=$!
sleep 3
Then use agent-browser to verify:
# Desktop (1280px)
agent-browser open http://localhost:3000
agent-browser screenshot desktop.png
# Tablet (768px)
agent-browser eval "window.resizeTo(768, 1024)"
agent-browser screenshot tablet.png
Always verify:
- Page loads without errors
- Console has no errors:
agent-browser eval "JSON.stringify(window.__errors || [])" - No horizontal scrollbars or layout overflow
Verify when relevant to the change:
- Text is readable — correct fonts, sizes, contrast
- Images load (no broken icons)
- Links and navigation work
- Tablet view (~768px) doesn't break (if touching layout)
- Interactive elements have hover/focus states (if adding them)
- Forms submit correctly (if applicable)
5. Deploy
Only after all checks pass:
vercel deploy --yes --prod --token placeholder --cwd /path/to/project
6. Production Verification
…
常见问题
“自适应”是什么意思?
指网站能够适应不同的屏幕尺寸,在手机、平板和电脑上都有良好的显示与使用效果。
“无障碍访问”是什么意思?
指网站可以被所有人使用,包括有视觉或运动障碍的人。这需要遵循相关标准,例如保证足够的颜色对比度,以及支持键盘操作。
为什么它坚持要在真实浏览器中测试?
因为仅仅测试代码并不能保证它在真实用户的使用体验中按预期工作。在浏览器中进行视觉测试,能够发现自动化测试可能遗漏的问题。
详情
作者的原始描述
Pro frontend engineering discipline. Enforces build-test-verify workflow for every web project. Never declare done until the site is built, tested, responsive, accessible, and visually verified in a real browser. Pairs with a deployment skill such as vercel-cli, where one is installed.
repo: nanocoai/nanoclaw
热度
- GitHub 星标
- 31k
- 排名
- #9329
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …