Skip to content

Commit c1f7992

Browse files
authored
Merge pull request #55 from james-see/feat/agent-template
Add agent support files and repository guidance
2 parents 24bbd57 + 21238d9 commit c1f7992

5 files changed

Lines changed: 139 additions & 0 deletions

File tree

‎.editorconfig‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.py]
10+
indent_style = space
11+
indent_size = 4
12+
13+
[*.md]
14+
trim_trailing_whitespace = false
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: python-examples
3+
description: Navigate and safely extend the james-see/python-examples repository. Use when a user asks about learning Python libraries, running example scripts, adding a new example, cleaning an example, or adapting one of these scripts.
4+
---
5+
6+
# Python Examples
7+
8+
This repository contains standalone examples for common Python libraries. It is not
9+
a library package; run individual scripts directly.
10+
11+
## Workflow
12+
13+
1. Inspect the target example script before making changes.
14+
2. Check it compiles with `python -m py_compile python-examples/<file>`.
15+
3. Do not run network/API examples unless the user explicitly requests it.
16+
4. Follow `.env.example` for secrets.
17+
5. Add concise, focused examples rather than large multi-concept scripts.
18+
6. Keep dependencies in `pyproject.toml` and `uv.lock` when adding imports.
19+
20+
## Safety
21+
22+
- Never commit API keys, tokens, or personal data.
23+
- Use read-only or throwaway accounts for paid/remote APIs.
24+
- Place scripts that produce large side effects under `python-examples/` with clear warnings.
25+
26+
## Suggested quality checks
27+
28+
```sh
29+
uv run ruff check --fix python-examples
30+
uv run python -m py_compile python-examples/example.py
31+
```

‎.pre-commit-config.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.10
4+
hooks:
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format

‎AGENTS.md‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Agent Guide for `python-examples`
2+
3+
This repository is a collection of small, focused Python examples. It is not a
4+
published Python package; individual files are meant to be copied or adapted.
5+
6+
## Navigation
7+
8+
- Examples are in `python-examples/`.
9+
- File names use `-example.py`.
10+
- Shared boilerplate may live in `python-examples/main.py`, `useragents.py`, or `src/` inside the script.
11+
- Data and fixtures are usually next to the example that uses them.
12+
- Documentation for the Astro site lives in `docs/`.
13+
14+
## Run examples
15+
16+
```sh
17+
uv run python python-examples/requests-example.py
18+
```
19+
20+
or activate the environment first:
21+
22+
```sh
23+
uv sync
24+
source .venv/bin/activate
25+
python python-examples/requests-example.py
26+
```
27+
28+
## Conventions
29+
30+
- Target Python `>=3.12`.
31+
- Prefer the existing style and imports of the nearest example.
32+
- Keep examples small and one-concept focused.
33+
- Do not add network credentials. Use `.env.example`.
34+
- Prefer `pathlib.Path` for new filesystem code.
35+
- Add comments when an example demonstrates a non-obvious API behavior.
36+
- Make scripts safe to import, especially when rerun by agents.
37+
38+
## Testing
39+
40+
There is no central application test suite. Smoke-test a changed example with:
41+
42+
```sh
43+
python -m py_compile python-examples/<name>-example.py
44+
```
45+
46+
For dependency changes:
47+
48+
```sh
49+
uv lock --check
50+
uv sync
51+
```
52+
53+
## Security and cost
54+
55+
Examples may hit third-party APIs. Do not run them automatically unless the user
56+
explicitly asks, and never commit API keys or tokens.

‎skills/python-examples/SKILL.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: python-examples
3+
description: Navigate and safely extend the james-see/python-examples repository. Use when a user asks about learning Python libraries, running example scripts, adding a new example, cleaning an example, or adapting one of these scripts.
4+
---
5+
6+
# Python Examples
7+
8+
This repository contains standalone examples for common Python libraries. It is not
9+
a library package; run individual scripts directly.
10+
11+
## Workflow
12+
13+
1. Inspect the target example script before making changes.
14+
2. Check it compiles with `python -m py_compile python-examples/<file>`.
15+
3. Do not run network/API examples unless the user explicitly requests it.
16+
4. Follow `.env.example` for secrets.
17+
5. Add concise, focused examples rather than large multi-concept scripts.
18+
6. Keep dependencies in `pyproject.toml` and `uv.lock` when adding imports.
19+
20+
## Safety
21+
22+
- Never commit API keys, tokens, or personal data.
23+
- Use read-only or throwaway accounts for paid/remote APIs.
24+
- Place scripts that produce large side effects under `python-examples/` with clear warnings.
25+
26+
## Suggested quality checks
27+
28+
```sh
29+
uv run ruff check --fix python-examples
30+
uv run python -m py_compile python-examples/example.py
31+
```

0 commit comments

Comments
 (0)