AI Agent Hub
Back to skills
CodeRules Intelligent Code Standards Assistant icon

CodeRules Intelligent Code Standards Assistant

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 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, checks tsconfig.json, next.config.js, vue.config.js, go.mod, and requirements.txt, and profiles source file extensions such as .ts, .py, .go, and .vue; scripts/analyzer.js can automate this step.
  • Rule loading: loads language rules from rules/languages/, framework rules from rules/frameworks/, and detection rules from rules/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