Skip to content

Commit 5093a3f

Browse files
dgarrosclaudepetercrocker
authored
Add AGENTS files (#609)
* docs: add and streamline AGENTS.md files for AI coding assistants 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]> Co-authored-by: Pete Crocker <[email protected]>
1 parent 983da61 commit 5093a3f

File tree

7 files changed

+336
-316
lines changed

7 files changed

+336
-316
lines changed

.vale/styles/spelling-exceptions.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ Containerlab
2020
content_type
2121
convert_query_response
2222
coroutine
23+
callouts
2324
cypher
2425
Dagster
2526
datastore
27+
Diataxis
2628
default_branch
2729
default_filter
2830
deserialized
@@ -42,6 +44,7 @@ eslint
4244
excalidraw
4345
fanout
4446
file_path
47+
frontmatter
4548
generator_definition
4649
generator_definitions
4750
github
@@ -114,6 +117,7 @@ template_path
114117
toml
115118
Towncrier
116119
towncrier
120+
Typer
117121
uncheck
118122
uniqueness_constraints
119123
userinfo

AGENTS.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# AGENTS.md
2+
3+
Infrahub Python SDK - async/sync client for Infrahub infrastructure management.
4+
5+
## Commands
6+
7+
```bash
8+
uv sync --all-groups --all-extras # Install all deps
9+
uv run invoke format # Format code
10+
uv run invoke lint # Lint (ruff + mypy + yamllint)
11+
uv run pytest tests/unit/ # Unit tests
12+
uv run pytest tests/integration/ # Integration tests
13+
```
14+
15+
## Tech Stack
16+
17+
Python 3.10-3.13, UV, pydantic >=2.0, httpx, graphql-core
18+
19+
## Code Pattern
20+
21+
```python
22+
# Always provide both async and sync versions
23+
client = InfrahubClient() # async
24+
client = InfrahubClientSync() # sync
25+
26+
node = await client.get(kind="NetworkDevice")
27+
await node.save()
28+
```
29+
30+
## Project Structure
31+
32+
```text
33+
infrahub_sdk/
34+
├── client.py # Main client implementations
35+
├── config.py # Pydantic configuration
36+
├── node/ # Node system (core data model)
37+
├── ctl/ # CLI (infrahubctl)
38+
└── pytest_plugin/ # Custom pytest plugin
39+
```
40+
41+
## Markdown Style
42+
43+
When editing `.md` or `.mdx` files, run `uv run invoke lint-docs` before committing.
44+
45+
Key rules:
46+
47+
- Use `text` language for directory structure code blocks
48+
- Add blank lines before and after lists
49+
- Always specify language in fenced code blocks (`python`, `bash`, `text`)
50+
51+
## Boundaries
52+
53+
**Always**
54+
55+
- Run `uv run invoke format lint` before committing Python code
56+
- Run markdownlint before committing markdown changes
57+
- Follow async/sync dual pattern for new features
58+
- Use type hints on all function signatures
59+
60+
⚠️ **Ask first**
61+
62+
- Adding new dependencies
63+
- Changing public API signatures
64+
65+
🚫 **Never**
66+
67+
- Push to GitHub automatically (always wait for user approval)
68+
- Mix async/sync inappropriately
69+
- Modify generated code (protocols.py)
70+
- Bypass type checking without justification
71+
72+
## Subdirectory Guides
73+
74+
- [docs/AGENTS.md](docs/AGENTS.md) - Documentation (Docusaurus)
75+
- [infrahub_sdk/ctl/AGENTS.md](infrahub_sdk/ctl/AGENTS.md) - CLI development
76+
- [infrahub_sdk/pytest_plugin/AGENTS.md](infrahub_sdk/pytest_plugin/AGENTS.md) - Pytest plugin
77+
- [tests/AGENTS.md](tests/AGENTS.md) - Testing

0 commit comments

Comments
 (0)