CodeRules Intelligent Code Standards Assistant
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md and install @user_3b34947d/coderules-skill into your AI assistant.
About this skill
Problem It Addresses
When large language models generate code directly, the output often ignores the existing stack, mixes logging and error-handling patterns, or hard-codes secrets. CodeRules turns code standards into pre-generation constraints instead of post-hoc review. It identifies the project stack, loads matching language and framework rules, and keeps generated code closer to project conventions.
How It Works
- Project analysis: reads dependencies and devDependencies from
package.json, checkstsconfig.json,next.config.js,vue.config.js,go.mod, andrequirements.txt, and profiles source file extensions such as.ts,.py,.go, and.vue;scripts/analyzer.jscan automate this step. - Rule loading: loads language rules from
rules/languages/, framework rules fromrules/frameworks/, and detection rules fromrules/index.json, then merges them by priority: user custom > custom rules > framework > language > default. - Constrained generation: before generating, lists files to create or modify, cites at least three key rules, generates code, and self-checks which rules were followed.
- General constraints: covers async error handling, unified logging, environment variables for secrets, input validation, parameterized queries, route-level lazy loading, caching strategy, unit-test naming, and coverage targets.
Boundaries
It fits projects with a stable stack and clear style requirements. If conventions change frequently, maintain .coderules.json and rules/index.json; otherwise the default rules may drift from team expectations.
Use Cases
- Before adding a route component in a Next.js/TypeScript project, read tsconfig, package.json, and nextjs.json, then output a file list with lazy loading and error handling.
- When adding API endpoints in a Python project, require input validation, parameterized queries, environment-variable secrets, and unit tests with expected naming.
- During a Vue 3 component refactor, load vue.json and typescript.json to standardize logging and why-comments, and avoid console.log or hard-coded config.
- Before creating a Go service module, load go.json from go.mod and source files to constrain error handling, input validation, and test coverage.
Best For
- Frontend engineers refactoring components who want Vue and TypeScript rules loaded before code generation
- Backend engineers maintaining APIs who need input validation, secrets, and query handling to follow security standards
- Tech leads who need AI code output to list target files and cite key rules before writing code
- Engineering managers who want team defaults overridden via .coderules.json for consistent style
Related Skills
Creates themed learning sites by generating flashcards, lessons, quizzes, index, and progress pages into a deployable website.
End-to-end mathematical optimization modeling with Gurobi and Python, covering data validation, code generation, solving, result analysis, and iterative revision.
Executes an Eversheet Web CDP login using externally supplied baseUrl, username, and password, then verifies the page reaches a logged-in home state.
Clarify product goals, user flows, pages, data, and permissions, then output an implementation-ready development prompt and lightweight spec.