-
-
Notifications
You must be signed in to change notification settings - Fork 516
AI Agent Workflow
George Dawoud edited this page Feb 17, 2026
·
1 revision
Purpose
- Explain how contributors and maintainers can use AI coding agents to accelerate feature work, address PRs, and fix bugs while keeping ChurchCRM a modern, safe, and auditable project.
Principles (must follow)
- Agents are assistants, not automatic committers — a human reviews and approves all changes.
- Always run existing tests and CI locally before merging anything an agent produces.
- Keep the service layer as the source of business logic: agents should add or update services in
src/ChurchCRM/Service/whenever logic is non-trivial. - Use Perpl ORM Query classes — never raw SQL. Agents must follow TableMap and
addForeignValueCondition()rules. See/.github/skills/database-operations.md.
When to use an AI agent
- Prototyping new endpoints, extracting logic into services, writing tests, creating route skeletons, updating documentation, and writing localized UI text.
- Not for committing secrets, performing irreversible production changes, or replacing code reviews.
How to start (best practice)
- Identify the task and pick relevant skills (examples):
- Add API endpoint:
api-development.md,slim-4-best-practices.md,service-layer.md,php-best-practices.md. - Migrate admin page:
admin-mvc-migration.md,refactor.md,frontend-development.md. - Add i18n strings:
i18n-localization.mdand runnpm run locale:build.
- Add API endpoint:
- Provide the agent with: short goal, target files/areas, and constraints (PHP version, ORM rules, security). Example: "Create
src/groups/sundaySchool/routes/members.phpand aGroupServicemethod to add a member; include unit tests and Cypress scenario." - Let the agent produce a focused change (one logical change per run). Review and iterate.
Agent workflows (step-by-step)
Add a feature (API + UI)
- Step A — Plan: Ask the agent to draft a small plan (routes → service → view → tests). Confirm.
- Step B — Implement skeletons: Agent creates route file under
src/<area>/routes/, service stub insrc/ChurchCRM/Service/, and view template undersrc/<area>/views/if needed. - Step C — Tests: Agent generates unit tests for service and API integration tests (Cypress for UI flows). Run tests locally.
- Step D — Local verification: Run
npm run buildandcomposer install(insrc/) and run tests:npm run testornpx cypress runas appropriate. - Step E — Human review & commit: Reviewer inspects code, verifies style and security, then commits with a clear message and opens a PR.
Fix a bug / address a PR
- Step A — Reproduce: Ask the agent to create a minimal failing test reproducing the bug. This ensures regression coverage.
- Step B — Diagnose: Provide relevant logs, error messages, and the failing test; agent proposes a minimal fix following project rules (Perpl ORM, RedirectUtils, SlimUtils).
- Step C — Implement & test: Agent implements the fix, updates tests, and documents the change in the PR description.
- Step D — Review & merge: Human reviewer confirms tests pass and merges.
Security & Permissions
- Agents must not modify auth checks without explicit human approval. All permission checks should use the existing
Usermethods (e.g.,isAdmin(),canEditPerson()), and useRedirectUtils::securityRedirect()for redirects.
i18n & Frontend
- If the change adds UI strings, run
npm run locale:buildand commit updates tolocale/terms/messages.pobefore the code PR. Then runnpm run buildto regenerate frontend assets. - Frontend libraries & versions (from
package.json): Bootstrap 4.6.2, AdminLTE 3.2.0, React 19.2.4, TypeScript 5.9.3, webpack 5.105.2. Agents should not propose breaking frontend upgrades without an RFC.
Testing / CI
- Unit tests: put PHP tests under the appropriate test folder following existing project patterns.
- Cypress: Add UI scenarios under
cypress/e2e/ui/<feature>/and API tests undercypress/e2e/api/. Usenpm run testornode_modules/cypress/bin/cypress run --e2eto execute.
Commit / PR conventions
- Small, focused commits; use the project's commit message style, examples:
feat(groups): add sundaySchool group membership APIfix(api): validate person ID in people-groups endpoint
- Include a short description, testing steps, and any migrations or i18n checklist in the PR body.
Agent prompt templates (examples)
- Add feature:
"You are an expert ChurchCRM developer. Create a Slim route
POST /groups/sundaySchool/membersinsrc/groups/sundaySchool/routes/members.phpthat callsGroupService::addMember($groupId, $personId). AddGroupServicestub insrc/ChurchCRM/Service/GroupService.php, unit tests, and a Cypress UI test. Follow Perpl ORM and useSlimUtils::renderErrorJSON()for errors. Don't commit — show the diff." - Bug fix:
"Reproduce the bug by adding a unit test that fails for
src/api/routes/people/people-groups.phpwhen person id is non-numeric. Then implement a minimal fix that validates and returnsSlimUtils::renderErrorJSON()with status 400."
Best practices & warnings
- Always run
composer validateandcomposer install --no-devundersrc/if you change PHP dependencies. - Do not let agents change
composer.jsonorpackage.jsonversions without human review. - Keep database schema changes separate: open a migration PR with DB scripts and follow
db-schema-migration.md. - Keep a clear audit trail: reference JIRA/Issue numbers in commits and PRs for traceability.
Where to read more
- Skills directory (use the relevant skills for agent prompts):
.github/skills/— e.g.,slim-4-best-practices.md,api-development.md,service-layer.md,i18n-localization.md,testing.md.
Want me to create a pull request template or an agent-ready checklist file for PR authors? Reply and I'll add it.
- Home
- Wiki → Docs links — User & admin manuals moved to docs.churchcrm.io
→ docs.churchcrm.io for installation & setup
- Installation ← Start here!
- First Run Setup
- Features Overview
→ docs.churchcrm.io for user manuals
- User Guide (docs)
- People Management — docs
- Groups & Events
- Tools
- Finances
→ docs.churchcrm.io for admin manuals
- User Management
- System Maintenance
- Configuration
- Troubleshooting
- Localization
Contributing to ChurchCRM
- Quick Start
- Testing & CI/CD
- Code & Architecture
- Localization
- Release & Security