@fredwsw/frontend-rules 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +302 -0
  2. package/bin/cli.js +155 -0
  3. package/package.json +22 -0
  4. package/template/docs/uv-ui-docs/action-sheet-cn.md +180 -0
  5. package/template/docs/uv-ui-docs/album-cn.md +104 -0
  6. package/template/docs/uv-ui-docs/alert-cn.md +71 -0
  7. package/template/docs/uv-ui-docs/avatar-cn.md +149 -0
  8. package/template/docs/uv-ui-docs/back-top-cn.md +121 -0
  9. package/template/docs/uv-ui-docs/badge-cn.md +100 -0
  10. package/template/docs/uv-ui-docs/button-cn.md +181 -0
  11. package/template/docs/uv-ui-docs/calendar-cn.md +179 -0
  12. package/template/docs/uv-ui-docs/calendars-cn.md +264 -0
  13. package/template/docs/uv-ui-docs/cell-cn.md +163 -0
  14. package/template/docs/uv-ui-docs/checkbox-cn.md +164 -0
  15. package/template/docs/uv-ui-docs/code-cn.md +122 -0
  16. package/template/docs/uv-ui-docs/code-input-cn.md +127 -0
  17. package/template/docs/uv-ui-docs/collapse-cn.md +206 -0
  18. package/template/docs/uv-ui-docs/color-cn.md +122 -0
  19. package/template/docs/uv-ui-docs/count-down-cn.md +169 -0
  20. package/template/docs/uv-ui-docs/count-to-cn.md +125 -0
  21. package/template/docs/uv-ui-docs/datetime-picker-cn.md +167 -0
  22. package/template/docs/uv-ui-docs/divider-cn.md +90 -0
  23. package/template/docs/uv-ui-docs/drop-down-cn.md +287 -0
  24. package/template/docs/uv-ui-docs/empty-cn.md +76 -0
  25. package/template/docs/uv-ui-docs/form-cn.md +220 -0
  26. package/template/docs/uv-ui-docs/gap-cn.md +63 -0
  27. package/template/docs/uv-ui-docs/grid-cn.md +187 -0
  28. package/template/docs/uv-ui-docs/icon-cn.md +255 -0
  29. package/template/docs/uv-ui-docs/image-cn.md +170 -0
  30. package/template/docs/uv-ui-docs/index-list-cn.md +132 -0
  31. package/template/docs/uv-ui-docs/input-cn.md +157 -0
  32. package/template/docs/uv-ui-docs/keyboard-cn.md +156 -0
  33. package/template/docs/uv-ui-docs/layout-cn.md +215 -0
  34. package/template/docs/uv-ui-docs/line-cn.md +77 -0
  35. package/template/docs/uv-ui-docs/line-progress-cn.md +132 -0
  36. package/template/docs/uv-ui-docs/link-cn.md +97 -0
  37. package/template/docs/uv-ui-docs/list-cn.md +185 -0
  38. package/template/docs/uv-ui-docs/load-more-cn.md +144 -0
  39. package/template/docs/uv-ui-docs/loading-icon-cn.md +125 -0
  40. package/template/docs/uv-ui-docs/loading-page-cn.md +85 -0
  41. package/template/docs/uv-ui-docs/modal-cn.md +212 -0
  42. package/template/docs/uv-ui-docs/navbar-cn.md +171 -0
  43. package/template/docs/uv-ui-docs/no-network-cn.md +112 -0
  44. package/template/docs/uv-ui-docs/notice-bar-cn.md +119 -0
  45. package/template/docs/uv-ui-docs/notify-cn.md +185 -0
  46. package/template/docs/uv-ui-docs/number-box-cn.md +131 -0
  47. package/template/docs/uv-ui-docs/overlay-cn.md +122 -0
  48. package/template/docs/uv-ui-docs/parse-cn.md +177 -0
  49. package/template/docs/uv-ui-docs/pick-color-cn.md +147 -0
  50. package/template/docs/uv-ui-docs/picker-cn.md +159 -0
  51. package/template/docs/uv-ui-docs/popup-cn.md +184 -0
  52. package/template/docs/uv-ui-docs/qrcode-cn.md +150 -0
  53. package/template/docs/uv-ui-docs/radio-cn.md +166 -0
  54. package/template/docs/uv-ui-docs/rate-cn.md +91 -0
  55. package/template/docs/uv-ui-docs/read-more-cn.md +191 -0
  56. package/template/docs/uv-ui-docs/scroll-list-cn.md +188 -0
  57. package/template/docs/uv-ui-docs/search-cn.md +107 -0
  58. package/template/docs/uv-ui-docs/skeleton-cn.md +101 -0
  59. package/template/docs/uv-ui-docs/skeletons-cn.md +312 -0
  60. package/template/docs/uv-ui-docs/slider-cn.md +98 -0
  61. package/template/docs/uv-ui-docs/steps-cn.md +158 -0
  62. package/template/docs/uv-ui-docs/sticky-cn.md +82 -0
  63. package/template/docs/uv-ui-docs/subsection-cn.md +161 -0
  64. package/template/docs/uv-ui-docs/swipe-action-cn.md +207 -0
  65. package/template/docs/uv-ui-docs/swiper-cn.md +247 -0
  66. package/template/docs/uv-ui-docs/switch-cn.md +136 -0
  67. package/template/docs/uv-ui-docs/tabbar-cn.md +224 -0
  68. package/template/docs/uv-ui-docs/tabs-cn.md +260 -0
  69. package/template/docs/uv-ui-docs/tags-cn.md +191 -0
  70. package/template/docs/uv-ui-docs/text-cn.md +178 -0
  71. package/template/docs/uv-ui-docs/textarea-cn.md +132 -0
  72. package/template/docs/uv-ui-docs/toast-cn.md +110 -0
  73. package/template/docs/uv-ui-docs/tooltip-cn.md +91 -0
  74. package/template/docs/uv-ui-docs/transition-cn.md +202 -0
  75. package/template/docs/uv-ui-docs/upload-cn.md +156 -0
  76. package/template/docs/uv-ui-docs/vtabs-cn.md +190 -0
  77. package/template/docs/uv-ui-docs/waterfall-cn.md +276 -0
  78. package/template/rules/common.mdc +90 -0
  79. package/template/rules/uv-ui-docs.mdc +111 -0
  80. package/template/skills/code-simplifier/SKILL.md +109 -0
  81. package/template/skills/frontend-design/SKILL.md +44 -0
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: code-simplifier
3
+ description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise, and applies project-specific standards such as those defined in CLAUDE.md.
4
+ ---
5
+
6
+ # Code Simplifier
7
+
8
+ This skill simplifies and refines code for clarity, consistency, and long-term maintainability while preserving exact behavior.
9
+
10
+ The agent acts as an expert code simplification specialist who applies project-specific best practices without changing what the code does.
11
+
12
+ ## When to Use
13
+
14
+ - Use after writing or modifying code to refine its structure and readability.
15
+ - Use when recently changed code feels complex, inconsistent, or hard to maintain.
16
+ - Use when aligning code with project standards from `CLAUDE.md` or other local conventions.
17
+ - By default, focus on **recently modified code** in the current session unless explicitly asked to broaden the scope.
18
+
19
+ ## Core Principles
20
+
21
+ - **Preserve functionality**
22
+ - Never change public behavior, side effects, or outputs.
23
+ - Keep all existing features, edge cases, and error paths intact.
24
+ - Treat tests and existing usage as the ground truth for expected behavior.
25
+
26
+ - **Apply project standards**
27
+ - Follow coding conventions defined in `CLAUDE.md` and project docs.
28
+ - Use ES modules with consistent import style and ordering when applicable.
29
+ - Prefer `function` declarations over arrow functions for top-level functions where that matches project style.
30
+ - Add explicit return type annotations for top-level functions in typed codebases when that is the local norm.
31
+ - Follow established React or framework-specific component patterns (props types, state management, hooks usage, etc.).
32
+ - Use the project's preferred error handling patterns; avoid unnecessary `try/catch` if there is a simpler, safer pattern.
33
+ - Maintain consistent naming conventions that match the surrounding code.
34
+ - Enforce clear, meaningful naming:
35
+ - Use descriptive names that reflect the domain intent for variables, functions, and components.
36
+ - Avoid meaningless or opaque identifiers (such as arbitrary letters or numbers) except for very short‑lived loop indices.
37
+ - Avoid mixing languages within the same identifier (for example, part Chinese and part English); follow the dominant language and style of the current file or project.
38
+ - Keep naming style consistent (for example, `camelCase`, `PascalCase`, `SNAKE_CASE`) with nearby code and project guidelines.
39
+
40
+ - **Enhance clarity**
41
+ - Reduce unnecessary nesting and deeply indented branches where possible.
42
+ - Remove redundant code, dead branches, and unused variables when safe.
43
+ - Replace confusing flows with clearer control structures while keeping behavior the same.
44
+ - Improve naming for variables, functions, and components when it increases readability and matches local style.
45
+ - Remove comments that merely restate what obvious code does; keep or add comments that clarify non-obvious intent or constraints.
46
+ - **Avoid nested ternary operators**; prefer `if/else` chains or `switch` statements for multi-branch conditions.
47
+ - Prefer explicit, readable code over overly compact one-liners.
48
+
49
+ - **Maintain balance**
50
+ - Do not over-simplify in ways that hide important abstractions or domain concepts.
51
+ - Avoid "clever" tricks that make code shorter but harder to understand or debug.
52
+ - Keep helpful abstractions and separation of concerns intact.
53
+ - Do not merge unrelated responsibilities into a single function or component just to reduce line count.
54
+ - Prefer code that future contributors can easily extend and debug.
55
+
56
+ ## Scope of Changes
57
+
58
+ - Default scope:
59
+ - Focus on **recently modified or newly written code** in the current session.
60
+ - Avoid refactoring distant or untouched areas unless explicitly requested.
61
+ - Expanded scope (only when asked):
62
+ - May scan related files or modules to align interfaces and naming.
63
+ - May simplify shared utilities if they directly affect the modified code path.
64
+
65
+ ## Workflow
66
+
67
+ When using this skill, follow this refinement process:
68
+
69
+ 1. **Identify target code**
70
+ - Locate recently modified functions, components, or modules.
71
+ - Use git diff, editor change history, or explicit user instructions as guidance.
72
+
73
+ 2. **Analyze for improvements**
74
+ - Look for duplicated logic, unnecessary abstractions, and overly complex control flow.
75
+ - Check consistency with nearby code and project standards.
76
+ - Pay attention to error handling, naming, and structure.
77
+
78
+ 3. **Refine the implementation**
79
+ - Simplify conditionals and loops while preserving all branches and edge cases.
80
+ - Consolidate related logic into well-named helpers when it improves clarity.
81
+ - Replace nested ternaries with clearer `if/else` or `switch`.
82
+ - Remove redundant checks, parameters, or temporary variables that add no clarity.
83
+ - Keep function signatures and external contracts the same unless explicitly allowed to change them.
84
+
85
+ 4. **Validate behavior**
86
+ - Re-check the refined code against original behavior.
87
+ - Ensure all inputs, outputs, side effects, and error cases are preserved.
88
+ - Where possible, rely on existing tests or usage examples to confirm equivalence.
89
+
90
+ 5. **Document meaningful changes**
91
+ - Only call out changes that affect how someone reasons about or maintains the code.
92
+ - Summarize structural changes (e.g., "extracted validation into helper", "replaced nested ternaries with switch").
93
+ - Avoid narrating trivial edits such as formatting or simple renames when they are obvious.
94
+
95
+ ## Autonomy and Usage Pattern
96
+
97
+ - The agent may proactively apply this skill:
98
+ - Immediately after generating or editing code.
99
+ - When the user asks to "simplify", "clean up", "refine", or "polish" code.
100
+ - Always prioritize:
101
+ - **Correctness first**
102
+ - **Clarity and maintainability second**
103
+ - **Brevity only when it does not harm readability**
104
+
105
+ ## Notes
106
+
107
+ - If `CLAUDE.md` or other project guidelines conflict with these instructions, prefer the **project-specific** rules.
108
+ - Never introduce breaking API changes, remove features, or alter user-visible behavior unless the user explicitly requests such changes.
109
+
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: frontend-design
3
+ description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
4
+ license: Complete terms in LICENSE.txt
5
+ ---
6
+
7
+ This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.
8
+
9
+ The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints.
10
+
11
+ ## Design Thinking
12
+
13
+ Before coding, understand the context and commit to a BOLD aesthetic direction:
14
+ - **Purpose**: What problem does this interface solve? Who uses it?
15
+ - **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.
16
+ - **Constraints**: Technical requirements (framework, performance, accessibility).
17
+ - **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
18
+
19
+ **CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work - the key is intentionality, not intensity.
20
+
21
+ Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:
22
+ - Production-grade and functional
23
+ - Visually striking and memorable
24
+ - Cohesive with a clear aesthetic point-of-view
25
+ - Meticulously refined in every detail
26
+
27
+ ## Frontend Aesthetics Guidelines
28
+
29
+ Focus on:
30
+ - **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font.
31
+ - **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
32
+ - **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.
33
+ - **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
34
+ - **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays.
35
+
36
+ NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character.
37
+
38
+ Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.
39
+
40
+ **IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.
41
+
42
+ Remember: Claude is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
43
+
44
+