Code Style Consistency
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.pyor 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.
Related Skills
A one-shot coding agent built on Claude Code CLI that runs non-interactively, supports a specified workdir, and can be monitored in the foreground or background.
Preview and confirm file sorting by extension, with recursive cleanup, ignore rules, and transactional rollback.
An engineering assistant for static HTML/CSS/JS pages, design-token extraction, IE8-compatible review, and structured delivery.
An engineering workflow for requirement analysis, scenario modeling, risk planning, quality gates, testing, and knowledge capture, with lightweight, standard, and full modes.