@aicgen/aicgen 1.0.4 → 1.1.0

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.
@@ -0,0 +1,50 @@
1
+ # Bounded Contexts
2
+
3
+ ## Core Principle
4
+
5
+ Divide the domain into logical boundaries where a specific model applies. Each context has its own ubiquitous language, data model, and rules.
6
+
7
+ ## Context Mapping Patterns
8
+
9
+ Relates different bounded contexts to each other.
10
+
11
+ ### Partnership
12
+
13
+ Two contexts succeed or fail together. Teams work closely to align interfaces.
14
+
15
+ ### Shared Kernel
16
+
17
+ Sharing a subset of the domain model (code/database) between contexts. High coupling, use sparingly (e.g., for generic Auth/IDs).
18
+
19
+ ### Customer/Supplier
20
+
21
+ Downstream context (Customer) depends on Upstream context (Supplier). Upstream must negotiate changes with Downstream.
22
+
23
+ ### Conformist
24
+
25
+ Downstream blindly conforms to Upstream's model without negotiation.
26
+
27
+ ### Anticorruption Layer (ACL)
28
+
29
+ Downstream isolates itself from Upstream's model by translating it into its own internal model.
30
+
31
+ ## Implementation Structure
32
+
33
+ ```typescript
34
+ // Context: Sales
35
+ namespace Sales {
36
+ export class Order { ... } // Sales-specific Order model
37
+ }
38
+
39
+ // Context: Shipping
40
+ namespace Shipping {
41
+ export class Shipment { ... }
42
+ // Shipping might interact with Sales via ACL or events
43
+ }
44
+ ```
45
+
46
+ ## Best Practices
47
+
48
+ - **Explicit Boundaries**: Code for one context should not bleed into another.
49
+ - **Ubiquitous Language**: Use the same terminology in code as functionality.
50
+ - **Decoupled Deployment**: Ideally, contexts can be deployed independently (microservices or modular monoliths).
@@ -0,0 +1,7 @@
1
+ # Bounded Contexts
2
+
3
+ Domain-Driven Design (DDD) patterns for defining explicit model boundaries.
4
+
5
+ ## Guidelines
6
+
7
+ - `context-map` - Context Mapping patterns (Partnership, Shared Kernel, ACL) ([context-map.md](context-map.md))
@@ -0,0 +1,7 @@
1
+ # Component-Based Architecture
2
+
3
+ Composing applications from isolated, reusable UI/Logic components.
4
+
5
+ ## Guidelines
6
+
7
+ - `structure` - Atomic Design, State Management ([structure.md](structure.md))
@@ -0,0 +1,63 @@
1
+ # Component-Based Architecture
2
+
3
+ ## Core Principle
4
+
5
+ Build the application as a composition of reusable, self-contained components. Common in frontend (React/Vue/Flutter) and mobile development.
6
+
7
+ ## Component Types
8
+
9
+ ### Atoms (Basic UI)
10
+
11
+ Smallest units. Buttons, inputs, icons. No business logic.
12
+
13
+ ### Molecules (Composite)
14
+
15
+ Groups of atoms. Search bar (Input + Button), User Card (Avatar + Text).
16
+
17
+ ### Organisms (Complex Sections)
18
+
19
+ Complex standalone UI sections. Navigation bar, Product Grid.
20
+
21
+ ### Templates & Pages
22
+
23
+ Layout structures and full views connecting organisms with data.
24
+
25
+ ## State Management
26
+
27
+ - **Local State**: UI state specific to a component (e.g., `isOpen`).
28
+ - **Lifted State**: Shared state moved up to a common ancestor.
29
+ - **Global Store**: Application-wide state (Redux/Zustand/Bloc) for data accessed by many unrelated components.
30
+
31
+ ## Implementation Example (React)
32
+
33
+ ```tsx
34
+ // Atom
35
+ const Button = ({ onClick, children }) => (
36
+ <button onClick={onClick}>{children}</button>
37
+ );
38
+
39
+ // Molecule
40
+ const SearchBar = ({ onSearch }) => (
41
+ <div className="search">
42
+ <Input />
43
+ <Button onClick={onSearch}>Search</Button>
44
+ </div>
45
+ );
46
+
47
+ // Page (Organism composition)
48
+ const Dashboard = () => {
49
+ return (
50
+ <Layout>
51
+ <Header />
52
+ <SearchBar />
53
+ <UserGrid />
54
+ </Layout>
55
+ );
56
+ };
57
+ ```
58
+
59
+ ## Best Practices
60
+
61
+ - **Single Responsibility**: A component should do one thing well.
62
+ - **Props Interface**: Define clear contracts for data input.
63
+ - **Composition over Inheritance**: Build complex UIs by combining simpler components.
@@ -10,3 +10,5 @@ Architecture-specific guidelines and best practices.
10
10
  - `layered/` - Layered architecture
11
11
  - `hexagonal/` - Hexagonal (Ports & Adapters) architecture
12
12
  - `refactor/` - Refactoring strategies
13
+ - `bounded-contexts/` - Bounded Contexts architecture
14
+ - `component-based/` - Component-Based architecture
@@ -1203,3 +1203,115 @@ patterns-gof:
1203
1203
  - observer
1204
1204
  - decorator
1205
1205
  category: Design Patterns
1206
+ architecture-bounded-contexts:
1207
+ path: architecture/bounded-contexts/context-map.md
1208
+ architectures:
1209
+ - bounded-contexts
1210
+ levels:
1211
+ - standard
1212
+ - expert
1213
+ - full
1214
+ tags:
1215
+ - ddd
1216
+ - boundaries
1217
+ - context-mapping
1218
+ category: Architecture
1219
+
1220
+ architecture-component-based:
1221
+ path: architecture/component-based/structure.md
1222
+ architectures:
1223
+ - component-based
1224
+ levels:
1225
+ - basic
1226
+ - standard
1227
+ - expert
1228
+ - full
1229
+ tags:
1230
+ - components
1231
+ - react
1232
+ - ui
1233
+ - composition
1234
+ category: Architecture
1235
+ kotlin-basics:
1236
+ path: language/kotlin/basics.md
1237
+ languages:
1238
+ - kotlin
1239
+ levels:
1240
+ - basic
1241
+ - standard
1242
+ - expert
1243
+ - full
1244
+ tags:
1245
+ - kotlin
1246
+ - null-safety
1247
+ - basics
1248
+ category: Language
1249
+
1250
+ kotlin-coroutines:
1251
+ path: language/kotlin/coroutines.md
1252
+ languages:
1253
+ - kotlin
1254
+ levels:
1255
+ - standard
1256
+ - expert
1257
+ - full
1258
+ tags:
1259
+ - kotlin
1260
+ - async
1261
+ - coroutines
1262
+ category: Language
1263
+
1264
+ kotlin-idioms:
1265
+ path: language/kotlin/idioms.md
1266
+ languages:
1267
+ - kotlin
1268
+ levels:
1269
+ - expert
1270
+ - full
1271
+ tags:
1272
+ - kotlin
1273
+ - scope-functions
1274
+ - extensions
1275
+ category: Language
1276
+
1277
+ php-basics:
1278
+ path: language/php/basics.md
1279
+ languages:
1280
+ - php
1281
+ levels:
1282
+ - basic
1283
+ - standard
1284
+ - expert
1285
+ - full
1286
+ tags:
1287
+ - php
1288
+ - types
1289
+ - basics
1290
+ category: Language
1291
+
1292
+ php-oop:
1293
+ path: language/php/oop.md
1294
+ languages:
1295
+ - php
1296
+ levels:
1297
+ - standard
1298
+ - expert
1299
+ - full
1300
+ tags:
1301
+ - php
1302
+ - oop
1303
+ - interfaces
1304
+ category: Language
1305
+
1306
+ php-modern:
1307
+ path: language/php/modern.md
1308
+ languages:
1309
+ - php
1310
+ levels:
1311
+ - expert
1312
+ - full
1313
+ tags:
1314
+ - php
1315
+ - php8
1316
+ - attributes
1317
+ category: Language
@@ -12,3 +12,6 @@ Programming language best practices and idioms.
12
12
  - `java/` - Java guidelines
13
13
  - `csharp/` - C# guidelines
14
14
  - `ruby/` - Ruby guidelines
15
+ - `swift/` - Swift guidelines
16
+ - `kotlin/` - Kotlin guidelines
17
+ - `php/` - PHP guidelines
@@ -0,0 +1,35 @@
1
+ # Kotlin Basics
2
+
3
+ ## Null Safety
4
+
5
+ Kotlin distinguishes between nullable and non-nullable types.
6
+
7
+ - `String` - Cannot hold null.
8
+ - `String?` - Can hold null.
9
+
10
+ ```kotlin
11
+ var a: String = "abc"
12
+ // a = null // compilation error
13
+
14
+ var b: String? = "abc"
15
+ b = null // ok
16
+ ```
17
+
18
+ Use safe calls (`?.`) or the Elvis operator (`?:`) when dealing with nullable types.
19
+
20
+ ```kotlin
21
+ val l = b?.length ?: -1
22
+ ```
23
+
24
+ ## Val vs Var
25
+
26
+ - `val`: Read-only (immutable reference). Prefer this by default.
27
+ - `var`: Mutable.
28
+
29
+ ## Data Classes
30
+
31
+ Use data classes to hold data. They automatically generate `equals()`, `hashCode()`, `toString()`, and `copy()`.
32
+
33
+ ```kotlin
34
+ data class User(val name: String, val age: Int)
35
+ ```
@@ -0,0 +1,32 @@
1
+ # Kotlin Coroutines
2
+
3
+ ## Suspend Functions
4
+
5
+ Functions that can pause and resume execution without blocking the thread.
6
+
7
+ ```kotlin
8
+ suspend fun fetchData(): String {
9
+ delay(1000) // Non-blocking delay
10
+ return "Data"
11
+ }
12
+ ```
13
+
14
+ ## Builders
15
+
16
+ - `launch`: Starts a new coroutine that does not return a result (fire and forget).
17
+ - `async`: Starts a new coroutine that returns a `Deferred` (like a Promise).
18
+
19
+ ## Dispatchers
20
+
21
+ - `Dispatchers.Main`: UI thread.
22
+ - `Dispatchers.IO`: Network/Disk operations.
23
+ - `Dispatchers.Default`: CPU-intensive work.
24
+
25
+ ```kotlin
26
+ viewModelScope.launch(Dispatchers.IO) {
27
+ val data = fetchData()
28
+ withContext(Dispatchers.Main) {
29
+ updateUI(data)
30
+ }
31
+ }
32
+ ```
@@ -0,0 +1,48 @@
1
+ # Kotlin Idioms
2
+
3
+ ## Scope Functions
4
+
5
+ Functions that execute a block of code within the context of an object.
6
+
7
+ ### let
8
+
9
+ Use for null checks or mapping.
10
+
11
+ ```kotlin
12
+ val str: String? = "hello"
13
+ str?.let {
14
+ println(it.length)
15
+ }
16
+ ```
17
+
18
+ ### apply
19
+
20
+ Use for object configuration. Returns the object itself.
21
+
22
+ ```kotlin
23
+ val dialog = Dialog(context).apply {
24
+ setTitle("Hello")
25
+ show()
26
+ }
27
+ ```
28
+
29
+ ### run
30
+
31
+ Use for object configuration and computing a result.
32
+
33
+ ```kotlin
34
+ val result = service.run {
35
+ configure()
36
+ execute()
37
+ }
38
+ ```
39
+
40
+ ## Extension Functions
41
+
42
+ Add functionality to existing classes without inheriting from them.
43
+
44
+ ```kotlin
45
+ fun String.removeSpaces(): String = this.replace(" ", "")
46
+
47
+ val clean = "hello world".removeSpaces()
48
+ ```
@@ -0,0 +1,9 @@
1
+ # Kotlin Guidelines
2
+
3
+ Best practices for Kotlin development on Android and backend.
4
+
5
+ ## Guidelines
6
+
7
+ - `basics` - Syntax, Null Safety, Data Classes ([basics.md](basics.md))
8
+ - `coroutines` - Async programming, Suspended functions ([coroutines.md](coroutines.md))
9
+ - `idioms` - Scope functions (`let`, `apply`), Extensions ([idioms.md](idioms.md))
@@ -0,0 +1,39 @@
1
+ # PHP Basics
2
+
3
+ ## Strict Types
4
+
5
+ Always enable strict typing in new files to prevent unexpected type coercion.
6
+
7
+ ```php
8
+ declare(strict_types=1);
9
+ ```
10
+
11
+ ## Type Declarations
12
+
13
+ Always specify argument and return types.
14
+
15
+ ```php
16
+ function add(int $a, int $b): int {
17
+ return $a + $b;
18
+ }
19
+ ```
20
+
21
+ ## Union and Intersection Types
22
+
23
+ Use robust type definitions.
24
+
25
+ ```php
26
+ function process(Input|string $data): Result&Serializable {
27
+ // ...
28
+ }
29
+ ```
30
+
31
+ ## Nullable Types
32
+
33
+ Use `?Type` for nullable arguments or return values.
34
+
35
+ ```php
36
+ function find(?int $id): ?User {
37
+ return $id ? User::find($id) : null;
38
+ }
39
+ ```
@@ -0,0 +1,9 @@
1
+ # PHP Guidelines
2
+
3
+ Modern PHP standards and best practices (PHP 8.0+).
4
+
5
+ ## Guidelines
6
+
7
+ - `basics` - Strict types, Type declarations ([basics.md](basics.md))
8
+ - `oop` - Classes, Interfaces, Enums ([oop.md](oop.md))
9
+ - `modern` - Attributes, Match expressions ([modern.md](modern.md))
@@ -0,0 +1,36 @@
1
+ # Modern PHP
2
+
3
+ ## Attributes
4
+
5
+ Use Attributes (PHP 8+) instead of PHPDoc annotations.
6
+
7
+ ```php
8
+ #[Route('/api/users', methods: ['GET'])]
9
+ public function list(): Response { ... }
10
+ ```
11
+
12
+ ## Constructor Property Promotion
13
+
14
+ Reduce boilerplate by defining properties in the constructor.
15
+
16
+ ```php
17
+ class Point {
18
+ public function __construct(
19
+ public float $x = 0.0,
20
+ public float $y = 0.0,
21
+ ) {}
22
+ }
23
+ ```
24
+
25
+ ## Match Expression
26
+
27
+ Use `match` instead of `switch`. It is strict, returns a value, and doesn't fall through.
28
+
29
+ ```php
30
+ $message = match ($statusCode) {
31
+ 200, 300 => null,
32
+ 400 => 'not found',
33
+ 500 => 'server error',
34
+ default => 'unknown status code',
35
+ };
36
+ ```
@@ -0,0 +1,45 @@
1
+ # PHP OOP
2
+
3
+ ## Classes and properties
4
+
5
+ Use typed properties and visibility modifiers.
6
+
7
+ ```php
8
+ class User {
9
+ public function __construct(
10
+ private string $name,
11
+ public readonly int $id
12
+ ) {}
13
+ }
14
+ ```
15
+
16
+ ## Interfaces
17
+
18
+ Define contracts using interfaces.
19
+
20
+ ```php
21
+ interface Logger {
22
+ public function log(string $message): void;
23
+ }
24
+ ```
25
+
26
+ ## Traits
27
+
28
+ Use traits for horizontal code reuse, but use sparingly.
29
+
30
+ ```php
31
+ trait Loggable {
32
+ private function log(string $msg) { ... }
33
+ }
34
+ ```
35
+
36
+ ## Enums
37
+
38
+ Use native Enums (PHP 8.1+) instead of class constants.
39
+
40
+ ```php
41
+ enum Status: string {
42
+ case Draft = 'draft';
43
+ case Published = 'published';
44
+ }
45
+ ```
package/data/version.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "lastUpdated": "2026-01-15",
4
- "totalGuidelines": 91,
3
+ "lastUpdated": "2026-05-14",
4
+ "totalGuidelines": 99,
5
5
  "categories": {
6
- "Language": 33,
7
- "Architecture": 19,
6
+ "Language": 39,
7
+ "Architecture": 21,
8
8
  "Testing": 4,
9
9
  "Security": 4,
10
10
  "Performance": 4,
@@ -26,7 +26,9 @@
26
26
  "ruby": 2,
27
27
  "javascript": 2,
28
28
  "dart": 4,
29
- "swift": 5
29
+ "swift": 5,
30
+ "kotlin": 3,
31
+ "php": 3
30
32
  },
31
33
  "architectures": {
32
34
  "microservices": 5,
@@ -36,13 +38,15 @@
36
38
  "event-driven": 2,
37
39
  "layered": 1,
38
40
  "serverless": 2,
39
- "hexagonal": 1
41
+ "hexagonal": 1,
42
+ "bounded-contexts": 1,
43
+ "component-based": 1
40
44
  },
41
45
  "levels": {
42
- "basic": 20,
43
- "standard": 77,
44
- "expert": 91,
45
- "full": 91
46
+ "basic": 23,
47
+ "standard": 83,
48
+ "expert": 99,
49
+ "full": 99
46
50
  },
47
51
  "datasources": {
48
52
  "sql": 3,
@@ -0,0 +1,51 @@
1
+ # SDLC Workflows
2
+
3
+ aicgen injects a structured 6-command SDLC workflow into every generated assistant configuration. These commands guide the AI assistant through a repeatable, artifact-driven development lifecycle.
4
+
5
+ ## The Flow
6
+
7
+ ```
8
+ /spec → /research → /plan → /build → /check → /ship
9
+ ```
10
+
11
+ | Step | Command | Output artifact |
12
+ |------|---------|----------------|
13
+ | 1 | [`/spec [name]`](sdlc/spec.md) | `docs/specs/{name}.md` |
14
+ | 2 | [`/research`](sdlc/research.md) | Appends `## Research Findings` to spec |
15
+ | 3 | [`/plan`](sdlc/plan.md) | `docs/plans/{name}.md` |
16
+ | 4 | [`/build [phase?]`](sdlc/build.md) | Code changes |
17
+ | 5 | [`/check`](sdlc/check.md) | Inline verification report |
18
+ | 6 | [`/ship`](sdlc/ship.md) | PR description draft |
19
+
20
+ ## Commands
21
+
22
+ - [/spec](sdlc/spec.md) — Capture feature requirements before writing any code
23
+ - [/research](sdlc/research.md) — Codebase scan + web research + infrastructure preference
24
+ - [/plan](sdlc/plan.md) — Phased, checkpoint-driven implementation plan
25
+ - [/build](sdlc/build.md) — Execute plan phase by phase with review checkpoints
26
+ - [/check](sdlc/check.md) — Verify implementation against spec and run tests
27
+ - [/ship](sdlc/ship.md) — Pre-flight checks and PR description draft
28
+
29
+ ## Output directory
30
+
31
+ All spec and plan artifacts are saved to the `docs/` directory in the user's project. This directory is created automatically if it does not exist.
32
+
33
+ ```
34
+ docs/
35
+ ├── specs/
36
+ │ └── {feature-name}.md
37
+ └── plans/
38
+ └── {feature-name}.md
39
+ ```
40
+
41
+ ## Guard rails
42
+
43
+ | Command | Pre-condition |
44
+ |---------|--------------|
45
+ | `/research` | Active spec in `docs/specs/` — prompts `/spec` if missing |
46
+ | `/plan` | Active spec with `## Research Findings` — warns if research was skipped |
47
+ | `/build` | Active plan in `docs/plans/` — prompts `/plan` if missing |
48
+
49
+ ## Source
50
+
51
+ Command definitions are maintained in [`aicgen/data/workflows/sdlc.md`](https://github.com/aicgen/aicgen/blob/main/data/workflows/sdlc.md) and injected into every generated config at `aicgen init` time.
@@ -0,0 +1,38 @@
1
+ # /build [phase]
2
+
3
+ **Purpose:** Execute the next (or a specified) phase of the current implementation plan, pausing between phases for review.
4
+
5
+ ## When to use
6
+
7
+ After `/plan`. Run once per phase until all phases are complete. Can also be used to re-execute a specific phase by passing its number.
8
+
9
+ ## Arguments
10
+
11
+ | Argument | Required | Description |
12
+ |----------|----------|-------------|
13
+ | `phase` | No | Phase number to execute. If omitted, executes the next incomplete phase. |
14
+
15
+ ## Pre-condition
16
+
17
+ An active plan must exist in `docs/plans/`. If none is found, the assistant will prompt you to run `/plan` first and stop.
18
+
19
+ ## Steps
20
+
21
+ 1. Read the active plan from `docs/plans/`
22
+ 2. Determine the next incomplete phase (or the specified phase)
23
+ 3. Announce which phase is being executed and what it covers
24
+ 4. Implement step by step, following existing codebase patterns and conventions
25
+ 5. Summarise what was changed and created
26
+ 6. Mark the phase complete in the plan file
27
+ 7. Run relevant tests and report results
28
+ 8. Ask: "Phase {n} complete. Continue to phase {n+1}?" before proceeding
29
+
30
+ ## Behaviour
31
+
32
+ - The assistant pauses after each phase and waits for your go-ahead
33
+ - If tests fail at the end of a phase, the assistant reports failures before asking to continue
34
+ - The plan file is updated in place as phases are completed — it acts as a progress tracker
35
+
36
+ ## Next step
37
+
38
+ After all phases are complete, run [`/check`](check.md) to verify the full implementation against the spec.