name: ai-context-patterns
description: Guides the ai-context-writer subagent in creating and maintaining AI_CONTEXT_PATTERNS.md, documenting code organization, typing, error handling, testing, data models, dependency injection, and validation patterns for the python-vis project. Use when generating or updating the patterns AI context file.
AI Context Patterns Skill
Purpose
Help the ai-context-writer subagent produce 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
@python_service/ — parsing, models, server behavior
@src/ — extension host patterns, TS types, conversion functions
@webview-ui/ — React and Rete integration, node components
@tests/ — how tests are structured and named
- Existing
@docs/AI_CONTEXT/AI_CONTEXT_REPOSITORY.md — overall architecture context
Prefer reading specific files that demonstrate patterns instead of every file.
Required Sections in AI_CONTEXT_PATTERNS.md
Include at least:
Metadata
- Version
- Last Updated (ISO date)
- Tags including
patterns, conventions
- Cross-References to repository and component-specific AI_CONTEXT docs
Code Organization
- How Python modules, TS files, and React components are grouped.
- Naming conventions for files and directories (e.g.
parser.py, server.py, extension.ts).
Type & Model Patterns
- Pydantic models in
python_service/schema.py (NodeData, ReteNode, etc.).
- TypeScript types in
src/types.ts and webview-ui/src/types.ts.
- Conversion patterns between Python and TS (
conversion.ts files).
Error Handling & Logging
- How
ASTParseServer reports syntax vs internal errors (codes, messages).
- How the extension logs to the Output channel and surfaces user-facing errors.
- How the webview presents error banners and supports retries.
Testing & TDD
- Where Python tests live and typical test naming/structure.
- Where TypeScript/React tests live (if present).
- How to approach test-first development in this repo (high level).
Dependency Injection & Validation
- How non-deterministic dependencies are passed into functions/classes (per dev rules).
- How Pydantic models are used for input validation instead of ad-hoc checks.
Q&A Behavior Examples
- Short Q&A style entries explaining typical workflows, for example:
- “How do I add support for a new AST node type?”
- “How should I propagate parse errors to the webview?”
- Each answer should reference concrete files and functions.
Style & Constraints
- Use Q&A style for behavior explanations where possible.
- Provide short, real code snippets, not pseudocode, and reference actual paths.
- Keep each example focused; do not dump large code blocks.
- Keep the file under the content length limit; if it grows, split by topic (e.g.
patterns-testing.md, patterns-errors.md) with an index file as per content_length rules.
Update Strategy
When implementation patterns evolve:
- Sync documented patterns with what the code actually does.
- Remove or clearly mark any deprecated patterns.
- Add new Q&A entries for newly introduced workflows or tricky behaviors.
- Refresh metadata and cross-references.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: benweatherall-vscode-python-ast-extension-ai-context-pattern3description: ---4---5---6name: ai-context-patterns7description: Guides the ai-context-writer subagent in creating and maintaining AI_CONTEXT_PATTERNS.md, documenting code organization, typing, error handling, testing, data models, dependency injection, and validation patterns for the python-vis project. Use when generating or updating the patterns AI context file.8---910# AI Context Patterns Skill1112## Purpose1314Help the `ai-context-writer` subagent produce `docs/AI_CONTEXT/AI_CONTEXT_PATTERNS.md` as a **pattern and convention catalog**:1516- How code is organized17- How data and types are modelled18- How errors, logging, and validation are handled19- How tests and TDD are approached2021This document guides other agents in writing code that **fits the existing system**.2223## Sources to Read2425Before updating patterns, read (selectively):2627- `@.cursor/rules/development_practices.mdc` — TDD, models, DI, validation rules28- `@.cursor/rules/environment.mdc` — tooling and layout assumptions29- `@python_service/` — parsing, models, server behavior30- `@src/` — extension host patterns, TS types, conversion functions31- `@webview-ui/` — React and Rete integration, node components32- `@tests/` — how tests are structured and named33- Existing `@docs/AI_CONTEXT/AI_CONTEXT_REPOSITORY.md` — overall architecture context3435Prefer reading **specific files that demonstrate patterns** instead of every file.3637## Required Sections in AI_CONTEXT_PATTERNS.md3839Include at least:40411. **Metadata**42 - Version43 - Last Updated (ISO date)44 - Tags including `patterns`, `conventions`45 - Cross-References to repository and component-specific AI_CONTEXT docs46472. **Code Organization**48 - How Python modules, TS files, and React components are grouped.49 - Naming conventions for files and directories (e.g. `parser.py`, `server.py`, `extension.ts`).50513. **Type & Model Patterns**52 - Pydantic models in `python_service/schema.py` (NodeData, ReteNode, etc.).53 - TypeScript types in `src/types.ts` and `webview-ui/src/types.ts`.54 - Conversion patterns between Python and TS (`conversion.ts` files).55564. **Error Handling & Logging**57 - How `ASTParseServer` reports syntax vs internal errors (codes, messages).58 - How the extension logs to the Output channel and surfaces user-facing errors.59 - How the webview presents error banners and supports retries.60615. **Testing & TDD**62 - Where Python tests live and typical test naming/structure.63 - Where TypeScript/React tests live (if present).64 - How to approach test-first development in this repo (high level).65666. **Dependency Injection & Validation**67 - How non-deterministic dependencies are passed into functions/classes (per dev rules).68 - How Pydantic models are used for input validation instead of ad-hoc checks.69707. **Q&A Behavior Examples**71 - Short Q&A style entries explaining typical workflows, for example:72 - “How do I add support for a new AST node type?”73 - “How should I propagate parse errors to the webview?”74 - Each answer should reference concrete files and functions.7576## Style & Constraints7778- Use **Q&A style** for behavior explanations where possible.79- Provide **short, real code snippets**, not pseudocode, and reference actual paths.80- Keep each example focused; do not dump large code blocks.81- Keep the file under the content length limit; if it grows, split by topic (e.g. `patterns-testing.md`, `patterns-errors.md`) with an index file as per `content_length` rules.8283## Update Strategy8485When implementation patterns evolve:86871. Sync documented patterns with what the code actually does.882. Remove or clearly mark any deprecated patterns.893. Add new Q&A entries for newly introduced workflows or tricky behaviors.904. Refresh metadata and cross-references.919293---94> Converted and distributed by [TomeVault](https://tomevault.io/claim/benweatherall) — claim your Tome and manage your conversions.95<!-- tomevault:4.0:skill_md:2026-04-14 -->