skills/ai-friendly-architecture/SKILL.md
Design AI-friendly architecture with explicit patterns, layered documentation, and semantic boundaries. Use when: structuring projects for AI collaboration, optimizing codebase for AI analysis, setting up AI context. Keywords: architecture, AI-friendly, context, modules, documentation layers, .ai-context.yaml.
npx skillsauth add asiaostrich/universal-dev-standards ai-friendly-architectureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Language: English | 繁體中文
Version: 1.0.0 Last Updated: 2026-01-25 Applicability: Claude Code Skills
Core Standard: This skill implements AI-Friendly Architecture. For comprehensive methodology documentation, refer to the core standard.
This skill is part of a three-layer AI collaboration system:
| Layer | Skill | Question it Answers | 回答的問題 |
|-------|-------|-------------------|-----------|
| Behavior (Immediate) | /ai-collaboration | "How should AI respond accurately?" | 「AI 如何準確回應?」 |
| Configuration (Session) | /ai-instruction-standards | "What to write in CLAUDE.md?" | 「CLAUDE.md 該寫什麼?」 |
| Architecture (Long-term) | /ai-friendly-architecture (this) | "How to structure code for AI?" | 「如何讓專案對 AI 友善?」 |
This skill helps design project architecture that maximizes AI collaboration effectiveness through explicit patterns, layered documentation, and semantic boundaries.
| Principle | Description | Benefit | |-----------|-------------|---------| | Explicit Over Implicit | Document behavior explicitly | AI understands without guessing | | Layered Context | Multi-level documentation | Appropriate detail per task | | Semantic Boundaries | Clear module boundaries | Independent analysis | | Discoverable Structure | Self-documenting structure | Quick orientation |
| Layer | Token Budget | Content | |-------|--------------|---------| | L1: Quick Ref | < 500 | One-liners, API signatures, entry points | | L2: Detailed | < 5,000 | Full API docs, usage examples | | L3: Examples | Unlimited | Complete implementations, edge cases |
project/
├── .ai-context.yaml # AI context configuration
├── docs/
│ ├── QUICK-REF.md # Level 1 documentation
│ └── ARCHITECTURE.md # Level 2 documentation
├── src/
│ └── auth/
│ ├── index.ts # Entry point with module header
│ ├── QUICK-REF.md # Module quick reference
│ └── README.md # Module documentation
└── CLAUDE.md # AI instruction file
/**
* ═══════════════════════════════════════════════════════════
* MODULE: [Module Name]
* ═══════════════════════════════════════════════════════════
*
* PURPOSE: [One-sentence description]
*
* DEPENDENCIES:
* - [dep1]: [reason]
* - [dep2]: [reason]
*
* EXPORTS:
* - [function1](params): [description]
* - [function2](params): [description]
*
* CONFIGURATION:
* - [CONFIG_VAR]: [description]
*
* ═══════════════════════════════════════════════════════════
*/
For complete standards, see:
For AI assistants, use the YAML format file for reduced token usage:
ai/standards/ai-friendly-architecture.ai.yaml# .ai-context.yaml - AI Context Configuration
version: 1.0.0
project:
name: my-project
type: web-app # web-app | library | cli | api | monorepo
primary-language: typescript
modules:
- name: auth
path: src/auth/
entry: index.ts
description: Authentication and authorization
dependencies: [database, crypto]
priority: high
- name: api
path: src/api/
entry: routes.ts
description: REST API endpoints
dependencies: [auth, database]
priority: high
analysis-hints:
entry-points:
- src/main.ts
- src/index.ts
ignore-patterns:
- node_modules
- dist
- "*.test.ts"
architecture-type: layered
documentation:
quick-ref: docs/QUICK-REF.md
detailed: docs/ARCHITECTURE.md
examples: docs/examples/
| Priority | Content Type | Reason | |----------|--------------|--------| | 1 | Entry points | Application structure | | 2 | .ai-context.yaml | Module map and dependencies | | 3 | QUICK-REF files | Rapid API understanding | | 4 | Modified files | Direct task relevance | | 5 | Dependency chain | Context for changes |
| Anti-Pattern | Problem | Solution | |--------------|---------|----------| | Magic strings | AI can't trace constants | Typed constants with docs | | Implicit routing | Hidden behavior | Explicit route mappings | | Global state | Unpredictable deps | Dependency injection | | Circular deps | Context confusion | Hierarchical dependencies | | Monolithic files | Context overflow | Focused modules |
.ai-context.yaml with module listQUICK-REF.md to project root.ai-context.yaml configurationQUICK-REF.md to each major moduleThis skill supports project-specific configuration.
.ai-context.yamlQUICK-REF.md filesIf no configuration found:
.ai-context.yaml templateQUICK-REF.md in project rootAfter /ai-friendly-architecture completes, the AI assistant should suggest:
AI 友善架構指南已掌握。建議下一步 / AI-friendly architecture guide understood. Suggested next steps:
- 執行
/sdd將 AI 友善架構設計納入正式規格 ⭐ Recommended / 推薦 — 確保架構決策有規格追蹤 / Ensure architecture decisions are tracked in specs- 建立
.ai-context.yaml和QUICK-REF.md— 立即實作 AI 友善結構 / Implement AI-friendly structure immediately- 執行
/ai-instruction-standards更新 CLAUDE.md 以反映架構配置 — 讓 AI 指令檔案與架構保持同步 / Keep AI instruction files in sync with architecture
| Version | Date | Changes | |---------|------|---------| | 1.0.0 | 2026-01-25 | Initial release |
This skill is released under CC BY 4.0.
Source: universal-dev-standards
tools
[UDS] 從規格衍生 BDD 場景、TDD 骨架或 ATDD 表格
development
[UDS] /methodology: 選擇並追蹤開發方法論(SDD/BDD/TDD)。 Use when: 選擇方法論、切換開發模式、查詢當前方法論狀態。 若要查詢各階段對應指令請用 /dev-workflow。
testing
[UDS] Derive BDD scenarios, TDD skeletons, or ATDD tables from specifications
development
[UDS] Create or review specification documents for Spec-Driven Development