ai-agent-rules 0.15.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. ai_agent_rules-0.15.2.dist-info/METADATA +451 -0
  2. ai_agent_rules-0.15.2.dist-info/RECORD +52 -0
  3. ai_agent_rules-0.15.2.dist-info/WHEEL +5 -0
  4. ai_agent_rules-0.15.2.dist-info/entry_points.txt +3 -0
  5. ai_agent_rules-0.15.2.dist-info/licenses/LICENSE +22 -0
  6. ai_agent_rules-0.15.2.dist-info/top_level.txt +1 -0
  7. ai_rules/__init__.py +8 -0
  8. ai_rules/agents/__init__.py +1 -0
  9. ai_rules/agents/base.py +68 -0
  10. ai_rules/agents/claude.py +123 -0
  11. ai_rules/agents/cursor.py +70 -0
  12. ai_rules/agents/goose.py +47 -0
  13. ai_rules/agents/shared.py +35 -0
  14. ai_rules/bootstrap/__init__.py +75 -0
  15. ai_rules/bootstrap/config.py +261 -0
  16. ai_rules/bootstrap/installer.py +279 -0
  17. ai_rules/bootstrap/updater.py +344 -0
  18. ai_rules/bootstrap/version.py +52 -0
  19. ai_rules/cli.py +2434 -0
  20. ai_rules/completions.py +194 -0
  21. ai_rules/config/AGENTS.md +249 -0
  22. ai_rules/config/chat_agent_hints.md +1 -0
  23. ai_rules/config/claude/CLAUDE.md +1 -0
  24. ai_rules/config/claude/agents/code-reviewer.md +121 -0
  25. ai_rules/config/claude/commands/agents-md.md +422 -0
  26. ai_rules/config/claude/commands/annotate-changelog.md +191 -0
  27. ai_rules/config/claude/commands/comment-cleanup.md +161 -0
  28. ai_rules/config/claude/commands/continue-crash.md +38 -0
  29. ai_rules/config/claude/commands/dev-docs.md +169 -0
  30. ai_rules/config/claude/commands/pr-creator.md +247 -0
  31. ai_rules/config/claude/commands/test-cleanup.md +244 -0
  32. ai_rules/config/claude/commands/update-docs.md +324 -0
  33. ai_rules/config/claude/hooks/subagentStop.py +92 -0
  34. ai_rules/config/claude/mcps.json +1 -0
  35. ai_rules/config/claude/settings.json +119 -0
  36. ai_rules/config/claude/skills/doc-writer/SKILL.md +293 -0
  37. ai_rules/config/claude/skills/doc-writer/resources/templates.md +495 -0
  38. ai_rules/config/claude/skills/prompt-engineer/SKILL.md +272 -0
  39. ai_rules/config/claude/skills/prompt-engineer/resources/prompt_engineering_guide_2025.md +855 -0
  40. ai_rules/config/claude/skills/prompt-engineer/resources/templates.md +232 -0
  41. ai_rules/config/cursor/keybindings.json +14 -0
  42. ai_rules/config/cursor/settings.json +81 -0
  43. ai_rules/config/goose/.goosehints +1 -0
  44. ai_rules/config/goose/config.yaml +55 -0
  45. ai_rules/config/profiles/default.yaml +6 -0
  46. ai_rules/config/profiles/work.yaml +11 -0
  47. ai_rules/config.py +644 -0
  48. ai_rules/display.py +40 -0
  49. ai_rules/mcp.py +369 -0
  50. ai_rules/profiles.py +187 -0
  51. ai_rules/symlinks.py +207 -0
  52. ai_rules/utils.py +35 -0
@@ -0,0 +1,495 @@
1
+ # Documentation Templates
2
+
3
+ Minimal, proven templates for technical documentation. Use as-is or adapt to your needs.
4
+
5
+ ## Core Templates
6
+
7
+ These are the essential docs for most projects:
8
+
9
+ ---
10
+
11
+ ## README.md
12
+
13
+ **When**: Every repository needs one
14
+ **Length**: 50-100 lines ideal, 200 max
15
+
16
+ ```markdown
17
+ # project-name
18
+
19
+ One-line description of what this does.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pip install project-name
25
+ # or
26
+ npm install project-name
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ```python
32
+ from project import Client
33
+
34
+ client = Client(api_key="key")
35
+ result = client.do_thing()
36
+ ```
37
+
38
+ ## Configuration
39
+
40
+ Key configuration options if non-obvious:
41
+
42
+ - `API_KEY`: Your API key from dashboard
43
+ - `TIMEOUT`: Request timeout in seconds (default: 30)
44
+
45
+ ## Documentation
46
+
47
+ Full docs at https://docs.example.com
48
+
49
+ ## License
50
+
51
+ MIT
52
+ ```
53
+
54
+ **What to cut:**
55
+ - "About" or "Introduction" section
56
+ - "Features" list (show in code)
57
+ - "Roadmap" or "Future Plans"
58
+ - "Contributing" (link to CONTRIBUTING.md instead)
59
+
60
+ ---
61
+
62
+ ## ARCHITECTURE.md
63
+
64
+ **When**: Multiple components OR non-obvious design decisions
65
+ **Length**: 100-300 lines depending on complexity
66
+
67
+ ```markdown
68
+ # Architecture
69
+
70
+ ## System Overview
71
+
72
+ ```
73
+ ┌─────────┐ ┌──────────┐ ┌──────────┐
74
+ │ Web API │─────▶│ Queue │─────▶│ Workers │
75
+ └─────────┘ └──────────┘ └──────────┘
76
+ │ │
77
+ ▼ ▼
78
+ ┌─────────┐ ┌──────────┐
79
+ │ Redis │ │ Postgres │
80
+ └─────────┘ └──────────┘
81
+ ```
82
+
83
+ - **Web API**: Express.js, handles HTTP requests, publishes jobs to queue
84
+ - **Queue**: Redis + Bull, distributes work to workers
85
+ - **Workers**: Node.js processes, execute background jobs
86
+ - **Redis**: Session storage + job queue
87
+ - **Postgres**: Persistent data storage
88
+
89
+ ## Data Flow
90
+
91
+ 1. Client sends request to Web API
92
+ 2. API validates, writes to Postgres, publishes job to Queue
93
+ 3. Worker picks up job, processes, updates Postgres
94
+ 4. Client polls API for results or receives webhook
95
+
96
+ ## Key Design Decisions
97
+
98
+ ### Why Redis for queue instead of database polling?
99
+ - Need to process 10K+ jobs/min
100
+ - Database polling adds latency and load
101
+ - Bull provides retry logic and job prioritization
102
+
103
+ ### Why separate workers from web API?
104
+ - CPU-intensive processing (image resizing, PDF generation)
105
+ - Prevents API request timeouts
106
+ - Scales worker and API independently
107
+
108
+ ### Why webhooks instead of WebSockets?
109
+ - Most clients are server-side (no persistent connection)
110
+ - Webhooks integrate with existing infrastructure
111
+ - Simpler failure recovery (retry logic)
112
+
113
+ ## Component Details
114
+
115
+ ### Web API
116
+ - Tech: Express.js, Node 20+
117
+ - Entry: `src/api/server.js`
118
+ - Routes: `src/api/routes/`
119
+ - Auth: JWT tokens in Redis
120
+
121
+ ### Workers
122
+ - Tech: Node.js, Bull workers
123
+ - Entry: `src/workers/index.js`
124
+ - Job handlers: `src/workers/jobs/`
125
+ - Concurrency: 5 workers/process
126
+
127
+ ## Deployment
128
+
129
+ - API: 3+ EC2 instances behind ALB
130
+ - Workers: Auto-scaling group (2-20 instances)
131
+ - Redis: ElastiCache cluster
132
+ - Postgres: RDS Multi-AZ
133
+ ```
134
+
135
+ **What to cut:**
136
+ - Implementation details (variable names, file structure if obvious)
137
+ - Historical context ("We used to use X but switched to Y")
138
+ - Obvious explanations (don't explain what Express.js is)
139
+
140
+ ---
141
+
142
+ ## TROUBLESHOOTING.md
143
+
144
+ **When**: Users encounter common issues OR non-obvious errors
145
+ **Length**: 20-100 lines total
146
+
147
+ ```markdown
148
+ # Troubleshooting
149
+
150
+ Common issues and solutions.
151
+
152
+ ## Installation
153
+
154
+ ### npm install fails with "EACCES: permission denied"
155
+
156
+ **Solution**: Don't use sudo. Fix npm permissions:
157
+ ```bash
158
+ mkdir ~/.npm-global
159
+ npm config set prefix '~/.npm-global'
160
+ export PATH=~/.npm-global/bin:$PATH
161
+ ```
162
+
163
+ ### Python module not found after installation
164
+
165
+ **Cause**: Multiple Python versions installed
166
+
167
+ **Solution**: Use virtual environment:
168
+ ```bash
169
+ python3 -m venv venv
170
+ source venv/bin/activate
171
+ pip install package-name
172
+ ```
173
+
174
+ ## Runtime
175
+
176
+ ### API returns 500 error
177
+
178
+ **Check**: Environment variables set?
179
+ ```bash
180
+ echo $API_KEY # Should not be empty
181
+ ```
182
+
183
+ **Solution**: Copy `.env.example` to `.env` and fill in values.
184
+
185
+ ### Connection timeout to database
186
+
187
+ **Cause**: Database not running or wrong credentials
188
+
189
+ **Solution**:
190
+ 1. Check database is running: `pg_isready -h localhost`
191
+ 2. Verify connection string in `.env`
192
+ 3. Check firewall allows port 5432
193
+
194
+ ## Performance
195
+
196
+ ### Slow API responses (>1s)
197
+
198
+ **Check**: Database indexes exist?
199
+ ```sql
200
+ SELECT * FROM pg_indexes WHERE tablename = 'users';
201
+ ```
202
+
203
+ **Solution**: Add index on frequently queried columns:
204
+ ```sql
205
+ CREATE INDEX idx_users_email ON users(email);
206
+ ```
207
+ ```
208
+
209
+ **What to cut:**
210
+ - Issues that only happened once
211
+ - Obvious errors with clear messages
212
+ - Problems fixed in latest version (update instead)
213
+
214
+ ---
215
+
216
+ ## API Documentation
217
+
218
+ **When**: Public API, library, or SDK
219
+ **Length**: 5-20 lines per function/class
220
+
221
+ ### Function Template
222
+
223
+ ```python
224
+ def process_payment(
225
+ amount: Decimal,
226
+ currency: str,
227
+ customer_id: str,
228
+ idempotency_key: str = None
229
+ ) -> Payment:
230
+ """Process a payment transaction.
231
+
232
+ Args:
233
+ amount: Payment amount (e.g., Decimal("10.99"))
234
+ currency: ISO 4217 currency code (e.g., "USD")
235
+ customer_id: Customer's unique identifier
236
+ idempotency_key: Optional key to prevent duplicate charges
237
+
238
+ Returns:
239
+ Payment object with id, status, and timestamp fields
240
+
241
+ Raises:
242
+ InvalidAmountError: If amount <= 0
243
+ PaymentFailedError: If payment provider rejects transaction
244
+
245
+ Example:
246
+ payment = process_payment(
247
+ amount=Decimal("29.99"),
248
+ currency="USD",
249
+ customer_id="cus_123"
250
+ )
251
+ print(payment.status) # "succeeded"
252
+ """
253
+ ```
254
+
255
+ ### Class Template
256
+
257
+ ```python
258
+ class APIClient:
259
+ """HTTP client for the FooBar API.
260
+
261
+ Handles authentication, retries, and rate limiting automatically.
262
+
263
+ Args:
264
+ api_key: Your API key from the dashboard
265
+ timeout: Request timeout in seconds (default: 30)
266
+ max_retries: Maximum retry attempts for failed requests (default: 3)
267
+
268
+ Example:
269
+ client = APIClient(api_key="sk_live_...", timeout=60)
270
+ response = client.get("/users/123")
271
+ """
272
+
273
+ def __init__(
274
+ self,
275
+ api_key: str,
276
+ timeout: int = 30,
277
+ max_retries: int = 3
278
+ ):
279
+ ...
280
+
281
+ def get(self, path: str, params: dict = None) -> Response:
282
+ """Send GET request.
283
+
284
+ Args:
285
+ path: API endpoint path (e.g., "/users/123")
286
+ params: Optional query parameters
287
+
288
+ Returns:
289
+ Response object with status_code, data, and headers
290
+
291
+ Example:
292
+ response = client.get("/users", params={"limit": 10})
293
+ """
294
+ ```
295
+
296
+ **What to cut:**
297
+ - Redundant descriptions ("This function processes a payment" when name is `process_payment`)
298
+ - Type information in docstring if already in type hints
299
+ - Obvious parameter explanations (`user_id: The user ID`)
300
+
301
+ ---
302
+
303
+ ## Examples / Tutorials
304
+
305
+ **When**: Integration is non-trivial OR common use cases need guidance
306
+ **Length**: 20-100 lines of code + minimal comments
307
+
308
+ ### Minimal Example Template
309
+
310
+ ```markdown
311
+ # Example: User Authentication
312
+
313
+ Shows how to authenticate users and manage sessions.
314
+
315
+ ## Setup
316
+
317
+ ```python
318
+ from auth import Authenticator
319
+ from database import Database
320
+
321
+ db = Database("postgresql://localhost/myapp")
322
+ auth = Authenticator(db, secret_key="your-secret")
323
+ ```
324
+
325
+ ## Register New User
326
+
327
+ ```python
328
+ # Validate and hash password
329
+ user = auth.register(
330
+ email="user@example.com",
331
+ password="secure_password_123"
332
+ )
333
+
334
+ print(f"User created: {user.id}")
335
+ ```
336
+
337
+ ## Login
338
+
339
+ ```python
340
+ # Returns token on success, None on failure
341
+ token = auth.login(
342
+ email="user@example.com",
343
+ password="secure_password_123"
344
+ )
345
+
346
+ if token:
347
+ print(f"Access token: {token}")
348
+ ```
349
+
350
+ ## Verify Token
351
+
352
+ ```python
353
+ # Validate token from Authorization header
354
+ user = auth.verify_token(token)
355
+
356
+ if user:
357
+ print(f"Authenticated as: {user.email}")
358
+ else:
359
+ print("Invalid token")
360
+ ```
361
+
362
+ ## Complete Flow
363
+
364
+ ```python
365
+ from auth import Authenticator
366
+
367
+ auth = Authenticator(secret_key="your-secret")
368
+
369
+ # Registration
370
+ user = auth.register("user@example.com", "password123")
371
+
372
+ # Login
373
+ token = auth.login("user@example.com", "password123")
374
+
375
+ # Protected endpoint
376
+ authenticated_user = auth.verify_token(token)
377
+ ```
378
+ ```
379
+
380
+ ### Tutorial Template
381
+
382
+ ```markdown
383
+ # Tutorial: Building a REST API
384
+
385
+ Learn to build a REST API with authentication and database persistence.
386
+
387
+ ## What You'll Build
388
+
389
+ An API with endpoints for creating, reading, updating, and deleting users.
390
+
391
+ ## Prerequisites
392
+
393
+ - Python 3.9+
394
+ - PostgreSQL installed
395
+
396
+ ## Step 1: Project Setup
397
+
398
+ ```bash
399
+ mkdir myapi && cd myapi
400
+ python -m venv venv
401
+ source venv/bin/activate
402
+ pip install flask sqlalchemy psycopg2
403
+ ```
404
+
405
+ ## Step 2: Database Model
406
+
407
+ Create `models.py`:
408
+
409
+ ```python
410
+ from sqlalchemy import Column, Integer, String, create_engine
411
+ from sqlalchemy.ext.declarative import declarative_base
412
+
413
+ Base = declarative_base()
414
+
415
+ class User(Base):
416
+ __tablename__ = "users"
417
+ id = Column(Integer, primary_key=True)
418
+ email = Column(String, unique=True, nullable=False)
419
+ name = Column(String, nullable=False)
420
+ ```
421
+
422
+ ## Step 3: API Endpoints
423
+
424
+ Create `app.py`:
425
+
426
+ ```python
427
+ from flask import Flask, request, jsonify
428
+ from models import User, Base
429
+ from sqlalchemy import create_engine
430
+ from sqlalchemy.orm import sessionmaker
431
+
432
+ app = Flask(__name__)
433
+ engine = create_engine("postgresql://localhost/myapi")
434
+ Base.metadata.create_all(engine)
435
+ Session = sessionmaker(bind=engine)
436
+
437
+ @app.route("/users", methods=["POST"])
438
+ def create_user():
439
+ session = Session()
440
+ user = User(email=request.json["email"], name=request.json["name"])
441
+ session.add(user)
442
+ session.commit()
443
+ return jsonify({"id": user.id}), 201
444
+
445
+ @app.route("/users/<int:user_id>")
446
+ def get_user(user_id):
447
+ session = Session()
448
+ user = session.query(User).get(user_id)
449
+ if not user:
450
+ return jsonify({"error": "Not found"}), 404
451
+ return jsonify({"id": user.id, "email": user.email, "name": user.name})
452
+ ```
453
+
454
+ ## Step 4: Run the API
455
+
456
+ ```bash
457
+ flask run
458
+ ```
459
+
460
+ Test it:
461
+ ```bash
462
+ curl -X POST http://localhost:5000/users \
463
+ -H "Content-Type: application/json" \
464
+ -d '{"email":"test@example.com","name":"Test User"}'
465
+ ```
466
+ ```
467
+
468
+ **What to cut:**
469
+ - Excessive explanatory comments in code
470
+ - Multiple ways to do the same thing (show one recommended way)
471
+ - Trivial examples (don't show how to call a function that takes no parameters)
472
+
473
+ ---
474
+
475
+ ## Selection Guide
476
+
477
+ | Need | Use Template | Typical Length |
478
+ |------|--------------|----------------|
479
+ | Project introduction | README.md | 50-100 lines |
480
+ | System design overview | ARCHITECTURE.md | 100-300 lines |
481
+ | Common issues/solutions | TROUBLESHOOTING.md | 20-100 lines total |
482
+ | Function/class reference | API docs | 5-20 lines each |
483
+ | Integration guide | Example | 20-50 lines code |
484
+ | Step-by-step tutorial | Tutorial | 50-200 lines code |
485
+
486
+ ---
487
+
488
+ ## General Tips
489
+
490
+ 1. **Start minimal, expand only if needed** - Begin with the smallest template, add sections when users ask
491
+ 2. **Code examples > prose** - Show working code instead of explaining in paragraphs
492
+ 3. **One example per concept** - Don't show 5 ways to authenticate, show the recommended way
493
+ 4. **Real code, not pseudocode** - Examples should copy-paste and run
494
+ 5. **Update with breaking changes** - Outdated docs worse than no docs
495
+ 6. **Link don't duplicate** - Reference existing docs instead of repeating them