소스 정보
- 저장소
- microwind/ai-skills
- 최근 소스 활동
- 2026년 3월 29일 10:03
- 감지된 SKILL.md 언어
- 중국어
- 스타
- 68
- 포크
- 17
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/microwind/ai-skills --skill javascript명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | JavaScript分析器 |
| description | 当进行JavaScript代码审查、性能优化、浏览器兼容性检查或安全审计时,分析JavaScript代码质量和最佳实践。 |
| license | MIT |
JavaScript的灵活性是一把双刃剑。分析代码以防止运行时意外。
核心原则: JavaScript的灵活性是一把双刃剑。分析代码以防止运行时意外。
始终:
触发短语:
问题:
异步操作处理不当
错误示例:
- 回调地狱
- Promise未正确处理
- async/await滥用
- 错误处理缺失
解决方案:
1. 使用async/await替代回调
2. 正确处理Promise错误
3. 避免阻塞主线程
4. 实现错误边界
问题:
内存使用不当导致泄漏
错误示例:
- 事件监听器未移除
- 定时器未清理
- 闭包引用过多
- DOM节点引用未释放
解决方案:
1. 及时清理事件监听器
2. 清理定时器和间隔器
3. 避免不必要的闭包
4. 使用WeakMap/WeakSet
问题:
JavaScript动态类型导致错误
错误示例:
- 类型转换错误
- 未定义属性访问
- 参数类型不匹配
- 返回值类型不确定
解决方案:
1. 使用TypeScript
2. 添加JSDoc类型注解
3. 运行时类型检查
4. 使用PropTypes
const fs = require('fs');
const path = require('path');
const { parse } = require('@babel/parser');
const traverse = require('@babel/traverse').default;
class JavaScriptAnalyzer {
constructor(options = {}) {
this.options = {
ecmaVersion: 2020,
sourceType: 'module',
plugins: [
'jsx',
'typescript',
'decorators-legacy',
'classProperties',
'objectRestSpread',
'asyncGenerators',
'functionBind',
'exportDefaultFrom',
'exportNamespaceFrom',
'dynamicImport',
'nullishCoalescingOperator',
'optionalChaining'
],
...options
};
this.issues = [];
this.metrics = {
totalFiles: 0,
totalLines: 0,
totalFunctions: 0,
: ,
: ,
:
};
}
() {
{
content = fs.(filePath, );
ast = .(content, filePath);
(!ast) {
{
: filePath,
: ,
: []
};
}
. = [];
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
{
: filePath,
: .,
: .(ast, content)
};
} (error) {
{
: filePath,
: error.,
: [{
: ,
: ,
: ,
: error.?. || ,
: error.?. ||
}]
};
}
}
() {
results = [];
allIssues = [];
() {
items = fs.(dir);
( item items) {
fullPath = path.(dir, item);
stat = fs.(fullPath);
(stat.()) {
(!item.() && item !== ) {
(fullPath);
}
} ((item)) {
result = .(fullPath);
results.(result);
allIssues.(...(result. || []));
}
}
}
() {
ext = path.(fileName);
[, , , , ].(ext);
}
scanDirectory.(, directory);
{
directory,
: results,
: .(allIssues),
: .(allIssues)
};
}
() {
{
(content, {
....,
: filePath
});
} (error) {
.(, error);
;
}
}
() {
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
}
() {
namingPatterns = {
: ,
: ,
: ,
:
};
(ast, {
(path) {
id = path..;
(id. === ) {
name = id.;
(path.. === ) {
(!namingPatterns..(name) && name !== name.()) {
..({
: ,
: ,
: ,
: id.?. || ,
: id.?. || ,
:
});
}
}
(path.. === || path.. === ) {
(!namingPatterns..(name)) {
..({
: ,
: ,
: ,
: id.?. || ,
: id.?. || ,
:
});
}
}
}
}
});
}
() {
(ast, {
(path) {
.(path, filePath);
},
(path) {
.(path, filePath);
},
(path) {
.(path, filePath);
}
});
}
() {
functionNode = path.;
startLine = functionNode.?.. || ;
endLine = functionNode.?.. || ;
lines = endLine - startLine + ;
(lines > ) {
functionName = functionNode.?. || ;
..({
: ,
: ,
: ,
: startLine,
: ,
:
});
}
}
() {
functionCalls = ();
(ast, {
(path) {
callee = path..;
(callee. === ) {
name = callee.;
line = callee.?. || ;
(!functionCalls.(name)) {
functionCalls.(name, []);
}
functionCalls.(name).(line);
}
}
});
( [name, lines] functionCalls) {
(lines. > ) {
..({
: ,
: ,
: ,
: .(...lines),
: ,
:
});
}
}
}
() {
declaredVariables = ();
usedVariables = ();
(ast, {
(path) {
id = path..;
(id. === ) {
declaredVariables.(id., {
: id.?. || ,
: id.?. ||
});
}
}
});
(ast, {
(path) {
(path.()) {
usedVariables.(path..);
}
}
});
( [name, location] declaredVariables) {
(!usedVariables.(name) && !name.()) {
..({
: ,
: ,
: ,
: location.,
: location.,
:
});
}
}
}
() {
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
}
() {
(ast, {
(path) {
callee = path..;
(callee. === ) {
object = callee.;
property = callee.;
(object. === && object. === ) {
(property. === &&
[, , ].(property.)) {
..({
: ,
: ,
: ,
: property.?. || ,
: property.?. || ,
:
});
}
}
}
}
});
}
() {
(ast, {
(path) {
callee = path..;
(callee. === &&
[, ].(callee.)) {
..({
: ,
: ,
: ,
: callee.?. || ,
: callee.?. || ,
:
});
}
}
});
}
() {
(ast, {
(path) {
callee = path..;
(callee. === ) {
property = callee.;
(property. === && property. === ) {
..({
: ,
: ,
: ,
: property.?. || ,
: property.?. || ,
:
});
}
}
}
});
}
() {
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
}
() {
(ast, {
(path) {
callee = path..;
(callee. === ) {
property = callee.;
(property. === && property. === ) {
..({
: ,
: ,
: ,
: property.?. || ,
: property.?. || ,
:
});
}
}
}
});
}
() {
(ast, {
(path) {
callee = path..;
(callee. === && callee. === ) {
..({
: ,
: ,
: ,
: callee.?. || ,
: callee.?. || ,
:
});
}
}
});
}
() {
(ast, {
(path) {
callee = path..;
(callee. === ) {
object = callee.;
property = callee.;
(object. === && object. === ) {
(property. === && property. === ) {
..({
: ,
: ,
: ,
: property.?. || ,
: property.?. || ,
:
});
}
}
}
}
});
}
() {
.(ast, filePath);
.(ast, filePath);
}
() {
(ast, {
(path) {
complexity = .(path.);
functionName = path..?. || ;
(complexity > ) {
..({
: ,
: ,
: ,
: path..?.. || ,
: ,
:
});
}
}
});
}
() {
complexity = ;
( child node. || []) {
complexity += .(child);
}
complexity;
}
() {
complexity = ;
(node.) {
:
:
:
:
:
:
:
complexity += ;
;
:
(node. === || node. === ) {
complexity += ;
}
;
}
( key node) {
(node[key] && node[key] === ) {
(.(node[key])) {
( child node[key]) {
complexity += .(child);
}
} {
complexity += .(node[key]);
}
}
}
complexity;
}
() {
(ast, {
(path) {
depth = .(path);
(depth > ) {
..({
: ,
: ,
: ,
: path..?.. || ,
: ,
:
});
}
}
});
}
() {
maxDepth = currentDepth;
( child path.().() || []) {
(child.() || child.() || child.()) {
childDepth = .(child, currentDepth + );
maxDepth = .(maxDepth, childDepth);
}
}
maxDepth;
}
() {
.(ast, filePath);
.(ast, filePath);
.(ast, filePath);
}
() {
(ast, {
(path) {
callee = path..;
(callee. === ) {
object = callee.;
property = callee.;
(object. === && object. === ) {
..({
: ,
: ,
: ,
: property.?. || ,
: property.?. || ,
:
});
}
}
}
});
}
() {
(ast, {
(path) {
callee = path..;
(callee. === &&
callee.. === &&
callee.. === ) {
parent = path.;
hasCatch = ;
(parent && parent. === ) {
parentCallee = parent..;
(parentCallee. === &&
parentCallee.. === &&
parentCallee.. === ) {
hasCatch = ;
}
}
(!hasCatch) {
..({
: ,
: ,
: ,
: callee..?. || ,
: callee..?. || ,
:
});
}
}
}
});
}
() {
hasStrictMode = ;
(ast, {
(path) {
expression = path..;
(expression. === && expression. === ) {
hasStrictMode = ;
}
}
});
(!hasStrictMode) {
..({
: ,
: ,
: ,
: ,
: ,
:
});
}
}
() {
lines = content.().;
functions = ;
classes = ;
complexity = ;
(ast, {
() { functions++; },
() { functions++; },
() { functions++; },
() { classes++; }
});
{
lines,
functions,
classes,
complexity
};
}
() {
summary = {
: issues.,
: {},
: {
: ,
: ,
:
}
};
( issue issues) {
summary.[issue.]++;
(!summary.[issue.]) {
summary.[issue.] = ;
}
summary.[issue.]++;
}
summary;
}
() {
recommendations = [];
issueCounts = {};
( issue issues) {
(!issueCounts[issue.]) {
issueCounts[issue.] = ;
}
issueCounts[issue.]++;
}
(issueCounts. > ) {
recommendations.({
: ,
: ,
:
});
}
(issueCounts. > ) {
recommendations.({
: ,
: ,
:
});
}
(issueCounts. > ) {
recommendations.({
: ,
: ,
:
});
}
(issueCounts. > ) {
recommendations.({
: ,
: ,
:
});
}
recommendations;
}
() {
str.(, letter.());
}
}
() {
analyzer = ();
fileResult = analyzer.();
.();
.();
directoryResult = analyzer.();
.();
.();
.();
( rec directoryResult.) {
.();
.();
}
}
. = ;
(. === ) {
();
}
class JavaScriptPerformanceAnalyzer {
constructor() {
this.metrics = new Map();
this.observers = new Map();
}
// 函数性能监控
profileFunction(name, fn) {
const wrappedFn = async (...args) => {
const startTime = performance.now();
const startMemory = this.getMemoryUsage();
try {
const result = await fn(...args);
const endTime = performance.now();
const endMemory = this.getMemoryUsage();
this.recordMetric(name, {
executionTime: endTime - startTime,
memoryDelta: endMemory - startMemory,
success: true
});
return result;
} catch (error) {
const endTime = performance.now();
const endMemory = .();
.(name, {
: endTime - startTime,
: endMemory - startMemory,
: ,
: error.
});
error;
}
};
wrappedFn;
}
() {
(!.) {
.();
;
}
observer = ( {
( entry list.()) {
(entry. === ) {
.(, {
: entry.,
: entry.,
: entry.
});
}
}
});
observer.({ : [] });
..(, observer);
{
: performance.(),
: {
performance.();
performance.(name, , );
}
};
}
() {
(!.) {
;
}
observer = ( {
( entry list.()) {
(entry. === ) {
.(, {
: entry.,
: entry.,
: entry. || ,
: .(entry.)
});
}
}
});
observer.({ : [] });
..(, observer);
observer;
}
() {
(!. || !..) {
.();
;
}
checkInterval = ( {
memory = {
: ...,
: ...,
: ...
};
.(, {
: memory.,
: memory.,
: memory.,
: memory. / memory.
});
(memory. > ) {
.(, memory.);
}
}, );
(checkInterval);
}
() {
(!..(type)) {
..(type, []);
}
..(type).({
: .(),
...data
});
records = ..(type);
(records. > ) {
records.();
}
}
() {
(. && ..) {
...;
}
;
}
() {
extension = url.().().();
typeMap = {
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
:
};
typeMap[extension] || ;
}
() {
report = {
: .(),
: {},
: {},
: []
};
( [type, records] .) {
report.[type] = .(type, records);
}
report. = .(report.);
report. = .(report.);
report;
}
() {
(records. === ) {
{ : };
}
analysis = {
: records.,
: records[records. - ],
: {},
: {},
: {}
};
(type) {
:
.(records, analysis);
;
:
.(records, analysis);
;
:
.(records, analysis);
;
:
.(records, analysis);
;
}
analysis;
}
() {
times = records.( r.);
memoryDeltas = records.( r.);
successRate = records.( r.). / records.;
analysis. = {
: .(times),
: .(memoryDeltas),
: successRate
};
analysis. = {
: .(...times),
: .(...memoryDeltas)
};
analysis. = {
: .(...times),
: .(...memoryDeltas)
};
}
() {
durations = records.( r.);
analysis. = {
: .(durations)
};
analysis. = {
: .(...durations)
};
analysis. = {
: .(...durations)
};
analysis. = records.(
current. > (slowest?. || ) ? current : slowest, );
}
() {
durations = records.( r.);
sizes = records.( r.);
analysis. = {
: .(durations),
: .(sizes)
};
analysis. = {
: .(...durations),
: .(...sizes)
};
analysis. = {
: .(...durations),
: .(...sizes)
};
analysis. = .(records);
}
() {
usageRatios = records.( r.);
analysis. = {
: .(usageRatios),
: .(records.( r. / / ))
};
analysis. = {
: .(...usageRatios)
};
analysis. = {
: .(...usageRatios)
};
analysis. = .(records.( r.));
}
() {
grouped = {};
( record records) {
(!grouped[record.]) {
grouped[record.] = [];
}
grouped[record.].(record);
}
( type grouped) {
typeRecords = grouped[type];
grouped[type] = {
: typeRecords.,
: .(typeRecords.( r.)),
: .(typeRecords.( r.))
};
}
grouped;
}
() {
(values. < ) ;
first = values[];
last = values[values. - ];
change = (last - first) / first;
(change > ) ;
(change < -) ;
;
}
() {
values.( sum + val, ) / values.;
}
() {
summary = {
: ,
: ,
: []
};
(metrics.) {
fnMetrics = metrics.;
(fnMetrics.. > ) {
summary..({
: ,
: ,
: fnMetrics..
});
summary. -= ;
}
}
(metrics.) {
domMetrics = metrics.;
(domMetrics.. > ) {
summary..({
: ,
: ,
: domMetrics..
});
summary. -= ;
}
}
(metrics.) {
netMetrics = metrics.;
(netMetrics.. > ) {
summary..({
: ,
: ,
: netMetrics..
});
summary. -= ;
}
}
(metrics.) {
memMetrics = metrics.;
(memMetrics.. > ) {
summary..({
: ,
: ,
: memMetrics..
});
summary. -= ;
}
}
summary. = summary..;
summary;
}
() {
recommendations = [];
(metrics. && metrics... > ) {
recommendations.({
: ,
: ,
: ,
: [
,
,
]
});
}
(metrics. && metrics... > ) {
recommendations.({
: ,
: ,
: ,
: [
,
,
]
});
}
(metrics. && metrics... > ) {
recommendations.({
: ,
: ,
: ,
: [
,
,
,
]
});
}
(metrics. && metrics... > ) {
recommendations.({
: ,
: ,
: ,
: [
,
,
,
]
});
}
recommendations;
}
() {
( observer ..()) {
observer.();
}
..();
..();
}
}
perfAnalyzer = ();
slowFunction = perfAnalyzer.(, () => {
( (resolve, ));
.();
});
domMonitor = perfAnalyzer.(.);
domMonitor.();
domMonitor.();
( {
report = perfAnalyzer.();
.(, report);
}, );
. = ;