From 0db2f2f15f1bc4067dbe48548a2ae5164f10973a Mon Sep 17 00:00:00 2001 From: V-LiuShuang Date: Mon, 7 Sep 2026 17:18:59 +0800 Subject: [PATCH] add --- frontend-design/LICENSE.txt | 177 ------------------------------------ frontend-design/SKILL.md | 55 ----------- frontend-spec/SKILL.md | 147 ------------------------------ 3 files changed, 379 deletions(-) delete mode 100644 frontend-design/LICENSE.txt delete mode 100644 frontend-design/SKILL.md delete mode 100644 frontend-spec/SKILL.md diff --git a/frontend-design/LICENSE.txt b/frontend-design/LICENSE.txt deleted file mode 100644 index f433b1a..0000000 --- a/frontend-design/LICENSE.txt +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/frontend-design/SKILL.md b/frontend-design/SKILL.md deleted file mode 100644 index decdff4..0000000 --- a/frontend-design/SKILL.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -name: frontend-design -description: Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. -license: Complete terms in LICENSE.txt ---- - -# Frontend Design - -Approach this as the design lead at a small studio known for giving every client a visual identity that could not be mistaken for anyone else's. This client has already rejected proposals that felt templated, and is paying for a distinctive point of view: make deliberate, opinionated choices about palette, typography, and layout that are specific to this brief, and take one real aesthetic risk you can justify. - -## Ground it in the subject - -If the brief does not pin down what the product or subject is, pin it yourself before designing: name one concrete subject, its audience, and the page's single job, and state your choice. If there's any information in your memory about the human's preferences, context about what they're building, or designs you've made before – use that as a hint. The subject's own world, its materials, instruments, artifacts, and vernacular, is where distinctive choices come from. Build with the brief's real content and subject matter throughout. - -## Design principles - -For web designs, the hero is a thesis. Open with the most characteristic thing in the subject's world, in whatever form makes sense for it: a headline, an image, an animation, a live demo, an interactive moment. Be deliberate with your choice: a big number with a small label, supporting stats, and a gradient accent is the template answer, only use if that's truly the best option. - -Typography carries the personality of the page. Pair the display and body faces deliberately, not the same families you would reach for on any other project, and set a clear type scale with intentional weights, widths, and spacing. Make the type treatment itself a memorable part of the design, not a neutral delivery vehicle for the content. - -Structure is information. Structural devices, numbering, eyebrows, dividers, labels, should encode something true about the content, not decorate it. Many generic designs use numbered markers (01 / 02 / 03), but that's only appropriate if the content actually is a sequence - like a real process or a typed timeline where order carries information the reader needs. Question if choices like numbered markers actually make sense before incorporating them. - -Leverage motion deliberately. Think about where and if animation can serve the subject: a page-load sequence, a scroll-triggered reveal, hover micro-interactions, ambient atmosphere. An orchestrated moment usually lands harder than scattered effects; choose what the direction calls for. However, sometimes less is more, and extra animation contributes to the feeling that the design is AI-generated. - -Match complexity to the vision. Maximalist directions need elaborate execution; minimal directions need precision in spacing, type, and detail. Elegance is executing the chosen vision well. - -Consider written content carefully. Often a design brief may not contain real content, and it's up to you to come up with copy. Copy can make a design feel as templated as the design itself. See the below section on writing for more guidance. - -## Process: brainstorm, explore, plan, critique, build, critique again - -For calibration: AI-generated design right now clusters around three looks: (1) a warm cream background (near #F4F1EA) with a high-contrast serif display and a terracotta accent; (2) a near-black background with a single bright acid-green or vermilion accent; (3) a broadsheet-style layout with hairline rules, zero border-radius, and dense newspaper-like columns. All three are legitimate for some briefs, but they are defaults rather than choices, and they appear regardless of subject. Where the brief pins down a visual direction, follow it exactly — the brief's own words always win, including when it asks for one of these looks. Where it leaves an axis free, don't spend that freedom on one of these defaults. Just like a human designer who's hired, there's often a careful balance between doing what you're good at and taking each project as a chance to experiment and learn. - -Work in two passes. First, brainstorm a short design plan based on the human's design brief: create a compact token system with color, type, layout, and signature. Color: describe the palette as 4–6 named hex values. Type: the typefaces for 2+ roles (a characterful display face that's used with restraint, a complementary body face, and a utility face for captions or data if needed). Layout: a layout concept, using one-sentence prose descriptions and ASCII wireframes to ideate and compare. Signature: the single unique element this page will be remembered by that embodies the brief in an appropriate way. - -Then review that plan against the brief before building: if any part of it reads like the generic default you would produce for any similar page (work through a similar prompt to see if you arrive somewhere similar) rather than a choice made for this specific brief — revise that part, say what you changed and why. Only after you've confirmed the relative uniqueness of your design plan should you start to write the code, following the revised plan exactly and deriving every color and type decision from it. - -When writing the code, be careful of structuring your CSS selector specificities. It's easy to generate CSS classes that cancel each other out (especially with a type-based selector like .section and a element-based selector like .cta). This can happen often with paddings/margins between sections. - -Try to do a lot of this planning and iteration in your thinking, and only show ideas to the user when you have higher confidence it'll delight them. - -## Restraint and self-critique - -Spend your boldness in one place. Let the signature element be the one memorable thing, keep everything around it quiet and disciplined, and cut any decoration that does not serve the brief. Not taking a risk can be a risk itself! Build to a quality floor without announcing it: responsive down to mobile, visible keyboard focus, reduced motion respected. Critique your own work as you build, taking screenshots if your environment supports it – a picture is worth 1000 tokens. Consider Chanel's advice: before leaving the house, take a look in the mirror and remove one accessory. Human creators have memory and always try to do something new, so if you have a space to quickly jot down notes about what you've tried, it can help you in future passes. - -## More on writing in design - -Words appear in a design for one reason: to make it easier to understand, and therefore easier to use. They are design material, not decoration. Bring the same intentionality to copy that you would bring to spacing and color. Before writing anything, ask what the design needs to say, and how it can best be said to help the person navigate the experience. - -Write from the end user's side of the screen. Name things by what people control and recognize, never by how the system is built. A person manages notifications, not webhook config. Describe what something does in plain terms rather than selling it. Being specific is always better than being clever. - -Use active voice as default. A control should say exactly what happens when it's used: "Save changes," not "Submit." An action keeps the same name through the whole flow, so the button that says "Publish" produces a toast that says "Published." The vocabulary of an interface is the signposting for someone navigating the product. Cohesion and consistency are how people learn their way around. - -Treat failure and emptiness as moments for direction, not mood. Explain what went wrong and how to fix it, in the interface's voice rather than a person's. Errors don't apologize, and they are never vague about what happened. An empty screen is an invitation to act. - -Keep the register conversational and tuned: plain verbs, sentence case, no filler, with tone matched to the brand and the audience. Let each element do exactly one job. A label labels, an example demonstrates, and nothing quietly does double duty. diff --git a/frontend-spec/SKILL.md b/frontend-spec/SKILL.md deleted file mode 100644 index a31c469..0000000 --- a/frontend-spec/SKILL.md +++ /dev/null @@ -1,147 +0,0 @@ ---- -name: frontend-spec -version: 1.0.0 -description: 企业级前端开发规范 Skill,包含命名、目录、CSS/JS/TS、Vue/React、Git、构建、性能、安全完整规范 -trigger: 前端规范|代码规范|命名规范|目录规范|css规范|js规范|ts规范|vue规范|react规范|git规范|eslint规范|前端最佳实践 -author: huhu -license: MIT-0 ---- - -# 前端开发规范 Skill(企业级) - -本 Skill 提供**完整、可落地、团队统一**的前端开发规范,适用于中后台、移动端、Web 应用。 - -## 覆盖范围 -- 项目结构与目录规范 -- 文件命名规范 -- HTML 编写规范 -- CSS / SCSS 规范 -- JavaScript / TypeScript 规范 -- Vue / React 编码规范 -- Git 提交规范 -- ESLint / Prettier 规范 -- 构建与性能优化规范 -- 安全规范 - -## 使用方式 -你可以直接问: -- 前端项目目录怎么设计? -- JS 变量命名有什么规范? -- Vue 组件编写最佳实践 -- Git commit 信息怎么写? -- 如何配置 ESLint 规范? -- 前端性能优化有哪些规则? - -## 1. 项目目录规范(通用) - -```text -src/ -├── api/ # 接口请求 -├── assets/ # 静态资源 -├── components/ # 公共组件 -├── composables/ # 组合式函数 -├── constants/ # 常量 -├── hooks/ # 业务 hooks -├── layouts/ # 布局 -├── pages/ # 页面 -├── router/ # 路由 -├── store/ # 状态管理 -├── styles/ # 全局样式 -├── utils/ # 工具函数 -└── App.vue/main.ts -``` - -## 2. 命名规范 - -### 文件命名 -- 组件:大驼峰 `UserList.vue` -- 工具/页面:短横线 `user-info.ts` -- 样式:短横线 `index.scss`、`button.scss` - -### 变量/函数 -- 变量:小驼峰 `userList` -- 常量:全大写下划线 `MAX_COUNT` -- 布尔:is/has/should 开头 `isVisible` -- 函数:动词开头 `getUserInfo()` - -## 3. HTML 规范 -- 语义化标签:header/main/section/aside/footer -- 类名使用短横线:`class="user-card"` -- 禁止冗余标签、禁止行内样式 -- 图片必须加 alt,懒加载使用 loading="lazy" - -## 4. CSS / SCSS 规范 -- 使用 BEM 或短横线命名 -- 禁止嵌套超过 3 层 -- 公共样式抽离到 variables/mixins -- z-index 统一管理 -- 单位优先使用 rem / vh / % -- 颜色使用变量,禁止硬编码 - -## 5. JavaScript 规范 -- 使用 const/let,禁止 var -- 优先使用箭头函数 -- 异步优先 async/await -- 禁止嵌套过深(<3 层) -- 禁止魔法数字,抽为常量 -- 数组优先使用 map/filter/reduce - -## 6. TypeScript 规范 -- 必须定义接口/类型 -- 禁止 any,能用 unknown 替代 -- 接口使用 I 前缀或后缀 Type -- 函数参数与返回值必须标注类型 -- 类型复用优先使用 type / interface - -## 7. Vue 规范 -- 组件名多单词,避免与 HTML 重名 -- props 必须定义类型、默认值、校验 -- 指令缩写:: @ # -- 计算属性避免副作用 -- watch 慎用,优先 computed -- 方法命名遵循动词+名词 - -## 8. React 规范 -- 组件使用函数式 + Hooks -- 状态扁平化,避免嵌套 -- 禁止在循环/条件中使用 Hooks -- 事件处理函数以 handle 开头 -- 样式使用 CSS Modules / styled-components - -## 9. Git 规范 -提交格式: -type(scope): content - -type: -- feat: 新功能 -- fix: 修复 -- docs: 文档 -- style: 格式 -- refactor: 重构 -- perf: 性能 -- test: 测试 -- chore: 构建/工具 - -## 10. ESLint + Prettier 规范 -- 2 空格缩进 -- 单引号 -- 语句末尾分号 -- 文件末尾空行 -- 禁止未使用变量 -- 禁止 console(生产环境) - -## 11. 性能规范 -- 图片压缩、WebP -- 懒加载图片、组件 -- 路由懒加载 -- 防抖节流处理高频事件 -- 大数据列表使用虚拟滚动 -- 减少冗余渲染 - -## 12. 安全规范 -- 防止 XSS:过滤用户输入 -- 防止 CSRF:token 校验 -- 敏感信息不放在 localStorage -- 接口必须做权限控制 -- 禁止前端明文存储密钥/Token -