Skip to content

Commit 4e8421b

Browse files
committed
Add AGENTS.md to outline contribution guidelines and project rules
1 parent 9d91b87 commit 4e8421b

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# AGENTS.md
2+
3+
## Purpose
4+
This repository is a Laravel package (`binkode/laravel-paystack`) that wraps Paystack APIs for Laravel apps. Use these rules to keep contributions safe, compatible, and consistent.
5+
6+
## Project Facts (Source of Truth)
7+
- Package type: Composer library (`type: package`)
8+
- Namespace: `Binkode\\Paystack\\`
9+
- Runtime dependency target: `illuminate/support ^8|^9|^10|^11`
10+
- Test framework: PHPUnit via `composer test`
11+
- Package test harness: `orchestra/testbench`
12+
13+
## Non-Negotiable Rules
14+
- Preserve backward compatibility for public APIs in `src/Support/*`, routes, config keys, and facade/provider wiring.
15+
- Prefer minimal, focused changes over broad refactors.
16+
- Do not introduce breaking signature or route changes unless explicitly requested.
17+
- Add or update tests for behavior changes.
18+
- Update `readme.md` when public usage changes.
19+
20+
## Code Style and Compatibility
21+
- Follow existing style in this codebase for spacing, naming, and method layout.
22+
- Keep syntax compatible with Laravel 8-11 ecosystem constraints.
23+
- Avoid introducing framework-version-specific helpers unless guarded.
24+
- Reuse existing abstractions before adding new layers.
25+
26+
## Package Architecture Rules
27+
- HTTP calls belong in support classes using `Binkode\\Paystack\\Traits\\Request`.
28+
- Route exposure is centralized in `src/routes.php`.
29+
- Controllers are thin adapters that delegate to support classes.
30+
- Service container bindings and route/config registration stay in `src/PaystackServiceProvider.php`.
31+
- Configuration keys and defaults stay in `config/paystack.php`.
32+
33+
## Endpoint Addition Checklist
34+
When adding or changing a Paystack endpoint:
35+
1. Implement or update method in the relevant class under `src/Support/`.
36+
2. If route exposure is required, register/update route entry in `src/routes.php`.
37+
3. Ensure controller dispatch maps correctly to support method.
38+
4. Add tests for success and failure behavior.
39+
5. Update usage docs in `readme.md` if public surface changed.
40+
41+
## Testing Rules
42+
- Run `composer test` after code changes.
43+
- For HTTP behavior, use Laravel HTTP fakes; do not rely on live Paystack calls.
44+
- Validate both happy path and failed response handling.
45+
- If tests cannot run locally, report exactly why.
46+
47+
## Safe Change Boundaries
48+
- Keep edits scoped to files needed for the task.
49+
- Do not rename classes, namespaces, config keys, or route paths without explicit approval.
50+
- Avoid dependency additions unless required and justified.
51+
52+
## High-Signal Prompting Template (Use for Codex Requests)
53+
Use this template for best results:
54+
55+
```md
56+
Task: <one clear outcome>
57+
Context: <feature/bug + why it matters>
58+
Scope: <files allowed to change>
59+
Constraints: <BC rules, style, versions, no new deps, etc.>
60+
Acceptance Criteria:
61+
- <observable behavior 1>
62+
- <observable behavior 2>
63+
Tests:
64+
- <exact command, usually `composer test`>
65+
Deliverable:
66+
- <expected summary format, e.g., changed files + rationale>
67+
```
68+
69+
## Example Prompt
70+
```md
71+
Task: Add support for Paystack endpoint X in this package.
72+
Context: Needed by merchants to perform Y from Laravel jobs.
73+
Scope: `src/Support/X.php`, `src/routes.php`, `src/Http/Controllers/XController.php`, `tests/*`, `readme.md`.
74+
Constraints: Keep backward compatibility, no new dependencies, match existing code style.
75+
Acceptance Criteria:
76+
- New support method calls the correct endpoint with expected HTTP method.
77+
- Route dispatch reaches the support method.
78+
- Failure responses are handled consistently with existing request trait behavior.
79+
Tests:
80+
- `composer test`
81+
Deliverable:
82+
- Patch + short summary + any follow-up risks.
83+
```
84+
85+
## Definition of Done
86+
- Code compiles and aligns with existing package patterns.
87+
- Tests added/updated and executed (or blocker clearly stated).
88+
- Docs updated when behavior or API usage changed.
89+
- No unintended API or routing regressions.

0 commit comments

Comments
 (0)