AI Context Patterns Skill
Purpose
Help the ai-context-writer subagent produce {context_docs_dir}/AI_CONTEXT_PATTERNS.md (default: docs/AI_CONTEXT/AI_CONTEXT_PATTERNS.md) as a pattern and convention catalog:
- •How code is organized
- •How data and types are modelled
- •How errors, logging, and validation are handled
- •How tests and TDD are approached
This document guides other agents in writing code that fits the existing system.
Sources to Read
Before updating patterns, read (selectively):
- •
@.cursor/rules/development_practices.mdc— TDD, models, DI, validation rules - •
@.cursor/rules/environment.mdc— tooling and layout assumptions - •Representative source directories — code organization, types, error handling
- •
@tests/or project test layout — how tests are structured and named - •Existing
@{context_docs_dir}/AI_CONTEXT_REPOSITORY.md— overall architecture context
Prefer reading specific files that demonstrate patterns instead of every file.
Required Sections
Include at least:
- •Metadata — Version, Last Updated (ISO date), Tags (e.g.
patterns,conventions), Cross-References to repository and component-specific AI context docs - •Code Organization — How modules and components are grouped; naming conventions for files and directories
- •Type & Model Patterns — How data is modelled (e.g. Pydantic, TypeScript types, dataclasses); conversion patterns if applicable
- •Error Handling & Logging — How errors are reported and surfaced; logging approach
- •Testing & TDD — Where tests live; typical test naming/structure; how to approach test-first development in this repo
- •Dependency Injection & Validation — How non-deterministic dependencies are passed in; how validation is done (per dev rules)
- •Q&A Behavior Examples — Short Q&A style entries for typical workflows (e.g. "How do I add X?"; "How should I handle Y?") with concrete file/function references
Style & Constraints
- •Use Q&A style for behavior explanations where possible
- •Provide short, real code snippets and reference actual paths
- •Keep each example focused
- •Keep the file under the content length limit; split by topic with an index if needed (per
content_lengthrules)
Update Strategy
When implementation patterns evolve: sync documented patterns with the code; remove or mark deprecated patterns; add new Q&A entries for new workflows; refresh metadata and cross-references.