Agent Skillsagent-sh/agentsys › enhance-cross-file

enhance-cross-file

GitHub

分析跨文件语义一致性,检测工具声明与使用不符、代理引用缺失、指令重复或矛盾等问题,辅助维护多文件协作规范。

.kiro/skills/enhance-cross-file/SKILL.md agent-sh/agentsys

Trigger Scenarios

检查跨文件一致性 验证工具与frontmatter匹配 发现冲突规则

Install

npx skills add agent-sh/agentsys --skill enhance-cross-file -g -y
More Options

Non-standard path

npx skills add https://github.com/agent-sh/agentsys/tree/main/.kiro/skills/enhance-cross-file -g -y

Use without installing

npx skills use agent-sh/agentsys@enhance-cross-file

指定 Agent (Claude Code)

npx skills add agent-sh/agentsys --skill enhance-cross-file -a claude-code -g -y

安装 repo 全部 skill

npx skills add agent-sh/agentsys --all -g -y

预览 repo 内 skill

npx skills add agent-sh/agentsys --list

SKILL.md

Frontmatter
{
    "name": "enhance-cross-file",
    "version": "5.1.0",
    "description": "Use when checking cross-file consistency: tools vs frontmatter, agent references, duplicate rules, contradictions.",
    "argument-hint": "[path]"
}

enhance-cross-file

Analyze cross-file semantic consistency across agents, skills, and workflows.

Parse Arguments

const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const targetPath = args.find(a => !a.startsWith('--')) || '.';

Purpose

Detects issues that span multiple files - things single-file analysis misses:

  • Tools used in prompt body but not declared in frontmatter
  • Agent references that don't exist
  • Duplicate instructions across files (maintenance burden)
  • Contradictory rules (ALWAYS vs NEVER conflicts)
  • Orphaned agents not referenced by any workflow
  • Skill tool mismatches (allowed-tools vs actual usage)

Workflow

  1. Run Analyzer - Execute the JavaScript analyzer to get findings:

    node -e "const a = require('./lib/enhance/cross-file-analyzer.js'); console.log(JSON.stringify(a.analyze('.'), null, 2));"
    

    For a specific path: a.analyze('./plugins/enhance')

  2. Parse Results - The analyzer returns JSON with summary and findings

  3. Report - Return findings grouped by category

The JavaScript analyzer (lib/enhance/cross-file-analyzer.js) implements all cross-file detection. The patterns below are reference documentation.

Detection Patterns

1. Tool Consistency (MEDIUM Certainty)

tool_not_in_allowed_list: Tool used in prompt body but not in frontmatter tools: list

# Frontmatter declares:
tools: Read, Grep

# But body uses:
Use Write({ file_path: "/out" })  # <- Not declared!

skill_tool_mismatch: Skill's allowed-tools doesn't match actual tool usage in skill body

2. Workflow Consistency (MEDIUM Certainty)

missing_workflow_agent: subagent_type: "plugin:agent-name" references non-existent agent

orphaned_prompt: Agent file exists but no workflow references it (may be entry point - check manually)

incomplete_phase_transition: Workflow phase mentions "Phase N" but no corresponding section

3. Instruction Consistency (MEDIUM Certainty)

duplicate_instructions: Same MUST/NEVER instruction in 3+ files (extract to shared location)

contradictory_rules: One file says "ALWAYS X" while another says "NEVER X"

Output Format

## Cross-File Analysis

**Files Analyzed**: {agents} agents, {skills} skills, {commands} commands

### Tool Consistency ({n})
| Agent | Issue | Fix |
|-------|-------|-----|
| exploration-agent | Uses Write but not in tools list | Add Write to frontmatter |

### Workflow Issues ({n})
| Source | Issue | Fix |
|--------|-------|-----|
| workflow.md | References nonexistent agent | Check spelling or create agent |

### Instruction Consistency ({n})
| Instruction | Files | Fix |
|-------------|-------|-----|
| "NEVER push --force" | 4 files | Extract to CLAUDE.md |

Constraints

  • All patterns are MEDIUM certainty (require context)
  • No auto-fix (cross-file changes need human review)
  • Skip content inside <bad-example>, <bad_example>, <badexample> tags
  • Skip content inside code blocks with "bad" in info string
  • Entry point agents (orchestrator, validator, discoverer) are not orphaned

Pattern Statistics

Category Patterns Auto-Fixable
Tool Consistency 2 0
Workflow 3 0
Consistency 3 0
Total 8 0

Version History

  • a92c0cb Current 2026-07-25 11:24

Same Skill Collection

.kiro/skills/consult/SKILL.md
.kiro/skills/debate/SKILL.md
.kiro/skills/deslop/SKILL.md
.kiro/skills/discover-tasks/SKILL.md
.kiro/skills/drift-analysis/SKILL.md
.kiro/skills/enhance-agent-prompts/SKILL.md
.kiro/skills/enhance-claude-memory/SKILL.md
.kiro/skills/enhance-docs/SKILL.md
.kiro/skills/enhance-hooks/SKILL.md
.kiro/skills/enhance-orchestrator/SKILL.md
.kiro/skills/enhance-plugins/SKILL.md
.kiro/skills/enhance-prompts/SKILL.md
.kiro/skills/enhance-skills/SKILL.md
.kiro/skills/learn/SKILL.md
.kiro/skills/orchestrate-review/SKILL.md
.kiro/skills/perf-analyzer/SKILL.md
.kiro/skills/perf-baseline-manager/SKILL.md
.kiro/skills/perf-benchmarker/SKILL.md
.kiro/skills/perf-code-paths/SKILL.md
.kiro/skills/perf-investigation-logger/SKILL.md
.kiro/skills/perf-profiler/SKILL.md
.kiro/skills/perf-theory-gatherer/SKILL.md
.kiro/skills/perf-theory-tester/SKILL.md
.kiro/skills/repo-intel/SKILL.md
.kiro/skills/sync-docs/SKILL.md
.kiro/skills/validate-delivery/SKILL.md
meta/skills/maintain-cross-platform/SKILL.md

Metadata

Files
0
Version
a0b2c8d
Hash
699cd023
Indexed
2026-07-25 11:24

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 07:11
浙ICP备14020137号-1 $mapa de visitantes$