Skip to content

Commit d565a2b

Browse files
committed
wip
1 parent c60d3cf commit d565a2b

26 files changed

Lines changed: 473 additions & 62 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: antigravity-protocol
3+
description: Use this skill ALWAYS whenever the user asks you to write code, modify files, fix bugs, plan features, or do any software development task. Trigger this whenever the user wants efficient execution, low token usage, or mentions "antigravity", "planning mode", "fast path", or complains about you using too many tokens or thinking too much.
4+
---
5+
6+
# Antigravity Protocol (v2.0): High-Efficiency Coding
7+
8+
This skill instructs Claude to drop high-token conversational behavior and adopt a strict, API-driven, structured approach to software development, prioritizing exact edits and planning over exploratory guessing.
9+
10+
## 1. Core Directives (Always Follow These)
11+
12+
1. **Never use generic terminal commands** (`cat`, `grep`, `sed`, `ls`, or complex bash scripts) for file operations or exploration. Use your built-in edit/search tools.
13+
2. **Chunk-based editing ONLY**. Never output full file contents. Issue search-and-replace style edits targeting exact line numbers.
14+
3. **Stop guessing**. If a request is ambiguous, do NOT write test scripts to "figure it out". Stop and ask the user a specific question.
15+
4. **No Chat Clutter (Use Artifacts)**: Do not dump 100+ lines of code, logs, or planning into the main chat window. If you must output substantial text, use your file tools to create a local `.md` artifact file instead, and provide the user a link.
16+
5. **Acknowledge and Act**. Do NOT write preambles ("I understand you want to..."). Output the tool call and state "Done."
17+
18+
## 2. Process Intent (Determine Mode)
19+
20+
### Mode A: Investigatory (Information Requests)
21+
22+
- **Trigger:** "How does X work?", "Find where Y happens."
23+
- **Action:** Search the codebase silently. Output only the short answer. Do not create a plan.
24+
25+
### Mode B: The Fast Path (Small Changes)
26+
27+
- **Trigger:** "Fix this typo", "Center the button", "Make the background red".
28+
- **Action:**
29+
1. Retrieve the file context to find exact line numbers.
30+
2. Issue a precise file-replacement tool call.
31+
3. Close turn with a 1-sentence summary. No planning required.
32+
33+
### Mode C: Strict Planning Mode (Large Tasks)
34+
35+
- **Trigger:** "Add a new page", "Implement auth", "Refactor the database".
36+
- **Action Flow:**
37+
1. **Silent Phase:** Trace dependencies silently. Do NOT modify any code.
38+
2. **Plan Artifact:** Create `implementation_plan.md` in the project root. Document exact files to touch (`[NEW]`, `[MODIFY]`, `[DELETE]`) and the logical changes.
39+
3. **Halt for Approval:** Stop generating text entirely. Wait for the user to approve the plan.
40+
4. **Execution Checklist:** Create `task.md`. Execute the diffs exactly as defined in the plan, updating the checklist (`[x]`) as you go.
41+
5. **Verification Phase:** Before claiming completion, run the required build/test terminal command (e.g., `npm run build`, `flutter test`) to ensure your changes didn't break compilation.
42+
43+
## 3. Persistent Knowledge Management
44+
45+
To minimize tokens on future prompts, you must create a "save state" for complex architectural changes.
46+
47+
- After completing a Mode C task, create or append to a `system_architecture.md` or `.cursorrules` file detailing the design pattern you just used (e.g., "The subscription cache uses Riverpod and must be updated in X file").
48+
- Always read this file before starting new Mode C plans.
49+
50+
## 4. Tool Hierarchy
51+
52+
Evaluate tools in this strict priority order:
53+
54+
1. `Read / Search Tools`: (Highest Priority - Targeted reads, low token).
55+
2. `Edit / Replace Tools`: (For targeted code edits).
56+
3. `Create File Tools`: (For brand new files and Markdown artifacts).
57+
4. `Terminal Commands`: (Lowest Priority - Use ONLY for running compiled tests, starting servers, or installing packages. NEVER for edits or file reading).

apps/modeling-commons-backend/src/modules/model/database/model.repository.port.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Model } from '#prisma/index';
12
import type {
23
ModelEntity,
34
ModelSearchFilters,
@@ -7,6 +8,8 @@ import type { Paginated, PaginatedQueryParams } from '#src/shared/db/repository.
78
import type { RepositoryPort } from '#src/shared/db/repository.port.ts';
89
import type { TransactionContext } from '#src/shared/db/transaction.port.ts';
910

11+
export type ModelRecord = Model;
12+
1013
export interface ModelRepository extends RepositoryPort<ModelEntity> {
1114
findByIdIncludeDeleted(id: string): Promise<ModelEntity | undefined>;
1215
setLatestVersion(ctx: TransactionContext, modelId: string, versionNumber: number): Promise<void>;

apps/modeling-commons-backend/src/modules/model/database/model.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
ModelSearchFilters,
55
ModelVisibility,
66
} from '#src/modules/model/domain/model.types.ts';
7-
import type { ModelRecord } from '#src/modules/model/model.mapper.ts';
7+
import type { ModelRecord } from '#src/modules/model/database/model.repository.port.ts';
88
import type { Paginated, PaginatedQueryParams } from '#src/shared/db/repository.port.ts';
99
import type { TransactionContext } from '#src/shared/db/transaction.port.ts';
1010
import { resolveTransaction } from '#src/shared/db/prisma-transaction.manager.ts';

apps/modeling-commons-backend/src/modules/model/domain/model.types.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1+
import type { ModelRecord } from '../database/model.repository.port.ts';
2+
13
export const ModelVisibility = {
24
public: 'public',
35
private: 'private',
46
unlisted: 'unlisted',
57
} as const;
68
export type ModelVisibility = (typeof ModelVisibility)[keyof typeof ModelVisibility];
79

8-
export type ModelEntity = {
9-
id: string;
10-
latestVersionNumber: number | null;
11-
parentModelId: string | null;
12-
parentVersionNumber: number | null;
13-
visibility: ModelVisibility;
14-
isEndorsed: boolean;
15-
createdAt: Date;
16-
updatedAt: Date;
17-
deletedAt: Date | null;
18-
};
10+
export type ModelEntity = ModelRecord;
1911

2012
export type CreateModelProps = {
2113
title: string;

apps/modeling-commons-backend/src/modules/model/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Mapper } from '#src/shared/ddd/mapper.interface.ts';
22
import type { ModelEntity } from '#src/modules/model/domain/model.types.ts';
3-
import type { ModelRecord } from '#src/modules/model/model.mapper.ts';
3+
import type { ModelRecord } from '#src/modules/model/database/model.repository.port.ts';
44
import type { ModelResponseDto } from '#src/modules/model/dtos/model.response.dto.ts';
55
import type { ModelRepository } from '#src/modules/model/database/model.repository.port.ts';
66
import type modelDomain from '#src/modules/model/domain/model.domain.ts';

apps/modeling-commons-backend/src/modules/model/model.mapper.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
import type { Mapper } from '#src/shared/ddd/mapper.interface.ts';
2-
import type { ModelEntity, ModelVisibility } from '#src/modules/model/domain/model.types.ts';
2+
import type { ModelEntity } from '#src/modules/model/domain/model.types.ts';
3+
import type { ModelRecord } from '#src/modules/model/database/model.repository.port.ts';
34
import type { ModelResponseDto } from '#src/modules/model/dtos/model.response.dto.ts';
45
import { ajv } from '#src/shared/utils/index.ts';
56
import { ArgumentInvalidException } from '#src/shared/exceptions/index.ts';
67

7-
export type ModelRecord = {
8-
id: string;
9-
latestVersionNumber: number | null;
10-
parentModelId: string | null;
11-
parentVersionNumber: number | null;
12-
visibility: ModelVisibility;
13-
isEndorsed: boolean;
14-
createdAt: Date;
15-
updatedAt: Date;
16-
deletedAt: Date | null;
17-
};
18-
198
const modelSchema = {
209
type: 'object',
2110
properties: {
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import type { Mapper } from './mapper.interface.ts';
2+
3+
class NotImplementedException extends Error {}
4+
5+
const identity = <T, U>(x: T): U => x as unknown as U;
6+
7+
function createMapperHelper<Entity, Record, Response>(
8+
input: Partial<Mapper<Entity, Record, Response>>,
9+
): Mapper<Entity, Record, Response> {
10+
return {
11+
toDomain:
12+
input.toDomain ??
13+
(() => {
14+
throw new NotImplementedException('toDomain not implemented on this mapper');
15+
}),
16+
toPersistence:
17+
input.toPersistence ??
18+
(() => {
19+
throw new NotImplementedException('toPersistence not implemented on this mapper');
20+
}),
21+
toResponse: input.toResponse
22+
? (e) => applyGlobalResponseFormat(input.toResponse!(e))
23+
: () => {
24+
throw new NotImplementedException('toResponse not implemented on this mapper');
25+
},
26+
};
27+
}
28+
29+
// Read requests can be satisfied with the identity function
30+
// if a custom domain shape is not required.
31+
// -- Omar Ibrahim, Apr 16 26
32+
export function createReadOnlyMapper<Record, Response>(input: {
33+
toResponse: (record: Record) => Response;
34+
}): Mapper<Record, Record, Response> {
35+
return createMapperHelper<Record, Record, Response>({
36+
toDomain: identity as (record: Record) => Record,
37+
toResponse: input.toResponse,
38+
});
39+
}
40+
41+
export function createWriteOnlyMapper<Entity extends Record, Record, Response>(input: {
42+
toDomain: (record: Record) => Entity;
43+
toResponse: (entity: Entity) => Response;
44+
}): Mapper<Entity, Record, Response> {
45+
return createMapperHelper<Entity, Record, Response>({
46+
toDomain: input.toDomain,
47+
toPersistence: identity as (entity: Entity) => Record,
48+
toResponse: input.toResponse,
49+
});
50+
}
51+
52+
export function createMapper<Entity, Record, Response>(
53+
input: Mapper<Entity, Record, Response>,
54+
): Mapper<Entity, Record, Response> {
55+
return createMapperHelper(input);
56+
}
57+
58+
export { identity };
59+
function applyGlobalResponseFormat<T>(dto: T): T {
60+
// Date → ISO, Buffer → base64 data-url, null passthrough, etc.
61+
// Keep the list small and documented.
62+
// -- Omar Ibrahim, Apr 16 26
63+
if (dto === null || typeof dto !== 'object') return dto;
64+
const out: { [key: string]: unknown } = { ...(dto as object) };
65+
for (const key of Object.keys(out)) {
66+
const value = out[key];
67+
if (value instanceof Date) out[key] = value.toISOString();
68+
}
69+
return out as T;
70+
}

apps/modeling-commons-backend/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"#src/*": ["./src/*"],
66
"#modules/*": ["./src/modules/*"],
77
"#tests/*": ["./tests/*"],
8-
"#prisma/*": ["./generated/prisma/*.js"]
8+
"#prisma/*": ["./generated/prisma/*"]
99
}
1010
},
1111
"include": ["src", "tests"],

apps/modeling-commons-frontend/app/app.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ export default defineAppConfig({
156156
md: "px-6 py-[0.625rem] gap-3 text-md",
157157
lg: "px-5 py-2 gap-2",
158158
},
159+
variant: {
160+
link: "p-0",
161+
},
159162
},
160163
compoundVariants: [
161164
{
@@ -181,5 +184,12 @@ export default defineAppConfig({
181184
},
182185
],
183186
},
187+
188+
table: {
189+
slots: {
190+
root: "ring ring-neutral-darkest/15 rounded-sm",
191+
base: "mb-0",
192+
},
193+
},
184194
},
185195
});

apps/modeling-commons-frontend/app/assets/styles/main.scss

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,27 @@
88

99
@layer website {
1010
@include meta.load-css("@repo/tailwind-config/scss/normalize.scss");
11-
@include meta.load-css("@repo/tailwind-config/scss/netlogo-theme.scss");
11+
12+
@include meta.load-css(
13+
"@repo/tailwind-config/scss/netlogo-theme.scss",
14+
$with: ("netlogo-table": false)
15+
);
16+
17+
// Reset some critical values for @nuxt/ui to behave
18+
// as expected. data-slot="root" is the root element of a
19+
// a @nuxt/ui component.
20+
// -- Omar Ibrahim, Apr 16 26
21+
[data-slot="root"] {
22+
& p {
23+
margin-bottom: 0;
24+
}
25+
& ul {
26+
margin: 0;
27+
}
28+
& li {
29+
margin-inline: 0;
30+
}
31+
}
1232

1333
h1,
1434
h2,

0 commit comments

Comments
 (0)