| name | ai-friendly-architecture |
| scope | uds-specific |
| description | 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, ๆถๆง, AI ๅๅ, ไธไธๆ.
|
AI-Friendly Architecture Guide
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.
AI Skills Hierarchy | AI ๆ่ฝๅฑค็ด
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 ๅๅ๏ผใ |
Purpose
This skill helps design project architecture that maximizes AI collaboration effectiveness through explicit patterns, layered documentation, and semantic boundaries.
Quick Reference
Core Principles
| 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 |
Context Layers
| 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 |
Recommended Structure
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 Header Template
Detailed Guidelines
For complete standards, see:
AI-Optimized Format (Token-Efficient)
For AI assistants, use the YAML format file for reduced token usage:
- Base standard:
ai/standards/ai-friendly-architecture.ai.yaml
.ai-context.yaml Configuration
version: 1.0.0
project:
name: my-project
type: web-app
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/
Context Priority Guidelines
| 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-Patterns to Avoid
| 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 |
Implementation Checklist
Quick Start (< 1 hour)
Standard Implementation (< 1 day)
Configuration Detection
This skill supports project-specific configuration.
Detection Order
- Check for existing
.ai-context.yaml
- Check for
QUICK-REF.md files
- If not found, suggest creating AI-friendly structure
First-Time Setup
If no configuration found:
- Suggest: "This project hasn't been configured for AI collaboration. Would you like to set up an AI-friendly structure?"
- Create
.ai-context.yaml template
- Create
QUICK-REF.md in project root
Next Steps Guidance | ไธไธๆญฅๅผๅฐ
After /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-instructions ๆดๆฐ CLAUDE.md ไปฅๅๆ ๆถๆง้
็ฝฎ โ ่ฎ AI ๆไปคๆชๆก่ๆถๆงไฟๆๅๆญฅ / Keep AI instruction files in sync with architecture
Related Standards
Version History
| Version | Date | Changes |
|---|
| 1.0.0 | 2026-01-25 | Initial release |
License
This skill is released under CC BY 4.0.
Source: universal-dev-standards