AI Agent Hub
Back to skills
Code Style Consistency icon

Code Style Consistency

Development Updated 2026.08.29

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_3299e856/code-style-consistency.

About this skill

Problem It Solves

Models often generate code with default habits: a project uses @/ aliases while output writes ../; a project wraps request, but generated code calls fetch; a project uses cn() for Tailwind classes, while output writes conflicting raw classes. The code may run, but it feels like a temporary contribution. This skill focuses on identifying project conventions before generation.

How It Works

  • Style fingerprinting: uses scripts/scan_style.py or user-provided reference files to extract stack, naming, import style, component patterns, CSS approach, request wrappers, and error handling.
  • Reference-first generation: before adding components, pages, or APIs, it locates the closest existing file and mirrors its skeleton, props, imports, and exports, replacing only business logic.
  • Hard constraints: keeps UI libraries, styling, state management, TypeScript strictness, naming, and comment language aligned with the project.
  • Explicit deviations: if a generated piece must depart from project style, it states the reason instead of silently changing conventions.

Boundaries

Best for frontend projects, existing codebases, and clear tech stacks; the source materials specifically mention scan_style.py, Ant Design, Tailwind, and CSS Modules. If conventions exist only in tribal knowledge, the user still needs to provide reference files or answer a few probe questions.

Use Cases

  • When adding a product card in a React repo, mirror the closest component's imports, props, and exports.
  • When editing an existing service function, preserve its error handling, comments, and request wrapper.
  • When styling a modal with Tailwind, use the project's class-merging helper to avoid conflicts.
  • When adding API calls, match the existing api or services folder's aliases and type definitions.

Best For

  • Frontend engineers maintaining React component libraries who want new components to avoid default-style drift.
  • Engineers inheriting legacy code who need features added through existing request wrappers and typing patterns.
  • Engineering leads using AI-generated code who require output to follow ESLint, Prettier, and alias rules.
  • Code reviewers who want fewer reworks from inconsistent styling, state management, or naming.