Co-Pilot / 辅助式
更新于 a month ago

intent-layer

Ccrafter-station
0.0k
crafter-station/skills/context-engineering/intent-layer
78
Agent 评分

💡 摘要

该技能为代码库设置层次化意图层,以增强AI的导航和理解能力。

🎯 适合人群

软件工程师项目经理技术写作人员DevOps工程师AI开发者

🤖 AI 吐槽:看起来很能打,但别让配置把人劝退。

安全分析中风险

风险:Medium。建议检查:是否执行 shell/命令行指令;文件读写范围与路径穿越风险。以最小权限运行,并在生产环境启用前审计代码与依赖。


name: intent-layer description: > Set up hierarchical Intent Layer (AGENTS.md files) for codebases. Use when initializing a new project, adding context infrastructure to an existing repo, user asks to set up AGENTS.md, add intent layer, make agents understand the codebase, or scaffolding AI-friendly project documentation.

Intent Layer

Hierarchical AGENTS.md infrastructure so agents navigate codebases like senior engineers.

Core Principle

Only ONE root context file. CLAUDE.md and AGENTS.md should NOT coexist at project root. Child AGENTS.md in subdirectories are encouraged for complex subsystems.

Workflow

1. Detect state
   scripts/detect_state.sh /path/to/project
   → Returns: none | partial | complete

2. Route
   none/partial → Initial setup (steps 3-5)
   complete     → Maintenance (step 6)

3. Measure [gate - show table first]
   scripts/analyze_structure.sh /path/to/project
   scripts/estimate_tokens.sh /path/to/each/source/dir

4. Decide
   No root file  → Ask: CLAUDE.md or AGENTS.md?
   Has root file → Add Intent Layer section + child nodes if needed

5. Execute
   Use references/templates.md for structure
   Use references/node-examples.md for real-world patterns
   Validate: one root, READ-FIRST directive, <4k tokens per node

6. Maintenance mode (when state=complete)
   Ask user:
   a) Audit nodes     → Use references/capture-protocol.md for SME questions
   b) Find candidates → Re-measure tokens, suggest new nodes
   c) Both

When to Create Child Nodes

| Signal | Action | |--------|--------| | >20k tokens in directory | Create AGENTS.md | | Responsibility shift | Create AGENTS.md | | Hidden contracts/invariants | Document in nearest ancestor | | Cross-cutting concern | Place at LCA |

Do NOT create for: every directory, simple utilities, test folders (unless complex).

Capture Questions

When documenting existing code, ask:

  1. What does this area own? What's out of scope?
  2. What invariants must never be violated?
  3. What repeatedly confuses new engineers?
  4. What patterns should always be followed?

Resources

Scripts:

  • scripts/detect_state.sh - Check Intent Layer state (none/partial/complete)
  • scripts/analyze_structure.sh - Find semantic boundaries
  • scripts/estimate_tokens.sh - Measure directory complexity

References:

  • references/templates.md - Root and child node templates
  • references/node-examples.md - Real-world examples
  • references/capture-protocol.md - SME interview protocol
五维分析
清晰度8/10
创新性7/10
实用性9/10
完整性8/10
可维护性7/10
优缺点分析

优点

  • 增强AI对代码库的理解。
  • 促进更好的文档编写实践。
  • 鼓励结构化项目组织。

缺点

  • 需要初始设置工作。
  • 可能使简单项目复杂化。
  • 依赖特定脚本。

相关技能

useful-ai-prompts

A
toolCo-Pilot / 辅助式
88/ 100

“一个提示的宝藏,但别指望它们为你写小说。”

fastmcp

A
toolCo-Pilot / 辅助式
86/ 100

“FastMCP:因为谁不喜欢在AI中添加一点复杂性呢?”

python-pro

A
toolCo-Pilot / 辅助式
86/ 100

“看起来很能打,但别让配置把人劝退。”

免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。

版权归原作者所有 crafter-station.