Skip to content

Commit 2a72ba8

Browse files
Merge pull request #626 from nimblehq/chore/618-add-agentsmd
[#618] Add AGENTS.md
2 parents d3fe052 + e502787 commit 2a72ba8

File tree

3 files changed

+442
-1
lines changed

3 files changed

+442
-1
lines changed

AGENTS.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# AGENTS.md
2+
3+
You are an experienced Android developer working on a project template generator.
4+
5+
Android project template generator using [Nimble Compass](https://nimblehq.co/compass/) conventions.
6+
7+
## Technology Stack
8+
9+
| Category | Technology |
10+
|----------|------------|
11+
| **Language** | Kotlin |
12+
| **UI Framework** | Jetpack Compose |
13+
| **Architecture** | MVVM / Clean Architecture (app → domain ← data) |
14+
| **Dependency Injection** | Hilt |
15+
| **Generator** | Kscript |
16+
| **Build System** | Gradle (Kotlin DSL) |
17+
| **Static Analysis** | Detekt, Android Lint |
18+
| **Coverage** | Kover |
19+
20+
## Project Structure
21+
22+
```
23+
/scripts → Generator script (new_project.kts)
24+
/template-compose → Source template (see its AGENTS.md for Android guidance)
25+
/sample-compose → Example output (regenerate, don't edit directly)
26+
/.github → CI workflows and PR templates
27+
```
28+
29+
## Prerequisites
30+
31+
- Android Studio (Latest Stable)
32+
- JDK 17+
33+
- Kscript installed (`brew install holgerbrandl/tap/kscript`)
34+
35+
## Commands
36+
37+
### Build
38+
```bash
39+
cd template-compose && ./gradlew assembleDebug
40+
```
41+
42+
### Static Analysis
43+
```bash
44+
cd template-compose && ./gradlew detekt lint
45+
```
46+
47+
### Tests
48+
```bash
49+
cd template-compose && ./gradlew app:testStagingDebugUnitTest data:testDebugUnitTest domain:test
50+
```
51+
52+
### Coverage
53+
```bash
54+
cd template-compose && ./gradlew koverXmlReportCustom
55+
```
56+
57+
### Generate New Project
58+
```bash
59+
cd scripts && kscript new_project.kts package-name=com.example.app app-name="My App" template=compose
60+
```
61+
62+
## Testing
63+
64+
**Before commit:**
65+
```bash
66+
cd template-compose && ./gradlew detekt lint assembleDebug
67+
```
68+
69+
**Before PR:**
70+
```bash
71+
cd template-compose && ./gradlew detekt lint app:testStagingDebugUnitTest data:testDebugUnitTest domain:test koverXmlReportCustom
72+
```
73+
74+
**After template changes:** Verify generator works:
75+
```bash
76+
cd scripts && kscript new_project.kts package-name=co.test.app app-name="Test App" template=compose
77+
```
78+
79+
## Configuration Files
80+
81+
| File | Purpose |
82+
|------|---------|
83+
| `template-compose/detekt-config.yml` | Detekt rules |
84+
| `.github/workflows/run_detekt_and_unit_tests.yml` | CI pipeline (Detekt + unit tests) |
85+
| `.github/workflows/review_pull_request.yml` | PR automation and checks |
86+
| `.github/workflows/verify_newproject_script.yml` | Validate generator script on PRs |
87+
88+
## CI/CD
89+
90+
**Pipeline:** Detekt → Lint → Tests → Coverage → Danger
91+
92+
Workflows defined in `.github/workflows/`:
93+
- `run_detekt_and_unit_tests.yml` — Main CI (Detekt + unit tests)
94+
- `review_pull_request.yml` — PR automation and checks
95+
- `verify_newproject_script.yml` — Validate generator script on PRs
96+
97+
## Template Placeholders
98+
99+
The generator replaces these strings — don't modify them:
100+
101+
| Placeholder | Replaced With |
102+
|-------------|---------------|
103+
| `co.nimblehq.template.compose` | Package name |
104+
| `co/nimblehq/template/compose` | Package path |
105+
| `Template Compose` | App name |
106+
| `TemplateCompose` | App name (no spaces) |
107+
108+
## Git Workflow
109+
110+
**Branches:**
111+
- `main` — Production (protected, no direct commits)
112+
- `develop` — Staging (protected, no direct commits)
113+
- Feature branches from `develop` using `kebab-case`: `feature/add-login`, `bug/fix-crash`
114+
115+
**Commits:**
116+
- Format: `[#123] Add feature` — capitalize first word, present tense
117+
- One logical change per commit
118+
- Include ticket ID for traceability
119+
120+
**Pull Requests:**
121+
- Title: `[#ticket] Description`
122+
- 2 approvals required (include Team Lead or senior for large squads)
123+
- Target merge within 2-3 days
124+
- Only Team Lead merges to protected branches
125+
126+
## Key Guidelines for Agents
127+
128+
1. **Template Awareness**: Never modify placeholder strings used by the generator
129+
2. **Regenerate, Don't Edit**: Changes to `sample-compose/` are overwritten — modify `template-compose/` instead
130+
3. **Static Analysis**: Always run `./gradlew detekt lint` before committing
131+
4. **Test Generator**: After any template change, verify generation still works
132+
5. **Module Boundaries**: Core modules must not depend on feature modules
133+
6. **Compose Only**: All UI must use Jetpack Compose — never suggest XML layouts
134+
135+
## Boundaries
136+
137+
**Required:**
138+
- Run `detekt lint` before commits
139+
- Test generator after template changes
140+
- 2 PR approvals
141+
- Follow Nimble Compass conventions
142+
143+
⚠️ **Ask before:**
144+
- Adding modules to template
145+
- Changing generator behavior
146+
- Changing Detekt/coverage thresholds
147+
- Adding CI workflows
148+
149+
🚫 **Don't:**
150+
- Edit `sample-compose/` directly (regenerate it)
151+
- Push to `main` or `develop`
152+
- Skip CI checks
153+
- Commit secrets or credentials
154+
- Merge PRs without Team Lead approval

scripts/new_project.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ object NewProject {
295295
showMessage("=> 🔎 Renaming package name within files...")
296296
File(projectPath)
297297
.walk()
298-
.filter { it.name.endsWithAny(".kt", ".xml", ".gradle.kts") }
298+
.filter { it.name.endsWithAny(".kt", ".xml", ".gradle.kts", ".md") }
299299
.forEach { filePath ->
300300
rename(
301301
sourcePath = filePath.toString(),

0 commit comments

Comments
 (0)