Python: Fix prek runner duplication and add skills (#3791)

* Python: fix prek runner running fmt/lint in all packages on core change

When a core package file changed, run_tasks_in_changed_packages.py ran
fmt, lint, and pyright in ALL 22 packages (66 tasks). Only type-checking
tasks (pyright, mypy) need to propagate to all packages since type
changes in core affect downstream packages. File-local tasks (fmt, lint)
only need to run in packages with actual file changes.

This reduces a core-only change from 66 tasks to 24 tasks (2 local +
22 pyright).

Also adds no-commit-to-branch builtin hook to protect the main branch
from direct commits.

* Python: add agent skills extracted from AGENTS.md and coding standards

Add 5 skills to python/.github/skills/ following the Agent Skills format:
- python-development: coding standards, type annotations, docstrings, logging
- python-testing: test structure, fixtures, running tests, async mode
- python-code-quality: linting, formatting, type checking, prek hooks, CI
- python-package-management: monorepo structure, lazy loading, versioning
- python-samples: sample structure, PEP 723, documentation guidelines

* Python: deduplicate AGENTS.md and instructions with agent skills

* updated skills

* fixes from review

* Python: increase timeout for web search integration test
This commit is contained in:
Eduard van Valkenburg
2026-02-10 13:13:38 +01:00
committed by GitHub
Unverified
parent 56603ab472
commit 8ad66637d8
10 changed files with 513 additions and 56 deletions
+12 -30
View File
@@ -5,13 +5,20 @@ Instructions for AI coding agents working in the Python codebase.
**Key Documentation:**
- [DEV_SETUP.md](DEV_SETUP.md) - Development environment setup and available poe tasks
- [CODING_STANDARD.md](CODING_STANDARD.md) - Coding standards, docstring format, and performance guidelines
- [samples/SAMPLE_GUIDELINES.md](samples/SAMPLE_GUIDELINES.md) - Sample structure and guidelines
**Agent Skills** (`.github/skills/`) — detailed, task-specific instructions loaded on demand:
- `python-development` — coding standards, type annotations, docstrings, logging, performance
- `python-testing` — test structure, fixtures, async mode, running tests
- `python-code-quality` — linting, formatting, type checking, prek hooks, CI workflow
- `python-package-management` — monorepo structure, lazy loading, versioning, new packages
- `python-samples` — sample file structure, PEP 723, documentation guidelines
## Maintaining Documentation
When making changes to a package, check if the package's `AGENTS.md` file needs updates. This includes:
- Adding/removing/renaming public classes or functions
- Changing the package's purpose or architecture
- Modifying import paths or usage patterns
When making changes to a package, check if the following need updates:
- The package's `AGENTS.md` file (adding/removing/renaming public APIs, architecture changes, import path changes)
- The agent skills in `.github/skills/` if conventions, commands, or workflows change
## Quick Reference
@@ -30,6 +37,7 @@ python/
│ ├── ollama/ # agent-framework-ollama
│ └── ... # Other provider packages
├── samples/ # Sample code and examples
├── .github/skills/ # Agent skills for Copilot
└── tests/ # Integration tests
```
@@ -39,32 +47,6 @@ python/
- Provider packages (`azure-ai`, `anthropic`, etc.) extend core with specific integrations
- Core uses lazy loading via `__getattr__` in provider folders (e.g., `agent_framework/azure/`)
### Import Patterns
```python
# Core imports
from agent_framework import ChatAgent, ChatMessage, tool
# Provider imports (lazy-loaded)
from agent_framework.openai import OpenAIChatClient
from agent_framework.azure import AzureOpenAIChatClient, AzureAIAgentClient
```
## Key Conventions
- **Copyright**: `# Copyright (c) Microsoft. All rights reserved.` at top of all `.py` files
- **Types**: Always specify return types and parameter types; use `Type | None` not `Optional`
- **Logging**: `from agent_framework import get_logger` (never `import logging`)
- **Docstrings**: Google-style for public APIs
- **Tests**: Do not use `@pytest.mark.asyncio` (auto mode enabled); run only related tests, not the entire suite
- **Line length**: 120 characters
- **Comments**: Avoid excessive comments; prefer clear code
- **Formatting**: Format only files you changed, not the entire codebase
## Samples
See [samples/SAMPLE_GUIDELINES.md](samples/SAMPLE_GUIDELINES.md) for sample structure, external dependency handling (PEP 723), and syntax checking instructions.
## Package Documentation
### Core