code-metrics-analysis by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill code-metrics-analysis测量和分析代码质量度量指标,以识别复杂性、可维护性问题以及需要改进的领域。
最小工作示例:
import * as ts from "typescript";
import * as fs from "fs";
interface ComplexityMetrics {
cyclomaticComplexity: number;
cognitiveComplexity: number;
linesOfCode: number;
functionCount: number;
classCount: number;
maxNestingDepth: number;
}
class CodeMetricsAnalyzer {
analyzeFile(filePath: string): ComplexityMetrics {
const sourceCode = fs.readFileSync(filePath, "utf-8");
const sourceFile = ts.createSourceFile(
filePath,
sourceCode,
ts.ScriptTarget.Latest,
true,
);
const metrics: ComplexityMetrics = {
cyclomaticComplexity: 0,
cognitiveComplexity: 0,
// ... (完整实现请参阅参考指南)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/ 目录下的详细实现:
| 指南 | 内容 |
|---|---|
| TypeScript 复杂性分析器 | TypeScript 复杂性分析器 |
| Python 代码度量(使用 radon) | Python 代码度量(使用 radon) |
| 用于复杂性的 ESLint 插件 | ESLint 插件用于复杂性 |
| CI/CD 质量门禁 | CI/CD 质量门禁 |
每周安装量
114
代码仓库
GitHub 星标数
116
首次出现
2026年1月21日
安全审计
安装于
opencode95
gemini-cli93
codex90
claude-code88
cursor84
github-copilot76
Measure and analyze code quality metrics to identify complexity, maintainability issues, and areas for improvement.
Minimal working example:
import * as ts from "typescript";
import * as fs from "fs";
interface ComplexityMetrics {
cyclomaticComplexity: number;
cognitiveComplexity: number;
linesOfCode: number;
functionCount: number;
classCount: number;
maxNestingDepth: number;
}
class CodeMetricsAnalyzer {
analyzeFile(filePath: string): ComplexityMetrics {
const sourceCode = fs.readFileSync(filePath, "utf-8");
const sourceFile = ts.createSourceFile(
filePath,
sourceCode,
ts.ScriptTarget.Latest,
true,
);
const metrics: ComplexityMetrics = {
cyclomaticComplexity: 0,
cognitiveComplexity: 0,
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| TypeScript Complexity Analyzer | TypeScript Complexity Analyzer |
| Python Code Metrics (using radon) | Python Code Metrics (using radon) |
| ESLint Plugin for Complexity | ESLint Plugin for Complexity |
| CI/CD Quality Gates | CI/CD Quality Gates |
Weekly Installs
114
Repository
GitHub Stars
116
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketWarnSnykPass
Installed on
opencode95
gemini-cli93
codex90
claude-code88
cursor84
github-copilot76
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
40,000 周安装
Spec设计调研技能:AI驱动需求分析,系统化提取未知项并生成研究任务
95 周安装
Playwright 高质量应用截图生成工具 - 一键创建营销级 HiDPI 截图
95 周安装
arch-tsdown-cli:TypeScript CLI项目启动模板,支持ESM、d.ts自动生成与npm可信发布
95 周安装
Confluence 专家指南:空间管理、文档架构、模板与协作知识库搭建
96 周安装
构建完整AI聊天应用指南:Next.js + Neon + AI SDK实现持久化聊天与自动命名
96 周安装
员工手册AI助手:快速解答公司政策、福利、流程问题,提升HR效率
96 周安装