Skip to content

Commit eae3e42

Browse files
authored
feat: enhance project guidelines and architectural patterns documentation (#157)
1 parent e5827f0 commit eae3e42

File tree

1 file changed

+38
-113
lines changed

1 file changed

+38
-113
lines changed

AGENTS.md

Lines changed: 38 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
3838
### Ftv Extension (root)
3939
- Language: TypeScript
4040
- Framework/Runtime: WXT + Svelte 5 (runes), Vite
41-
- Package Manager: pnpm
41+
- Package Manager: pnpm (Note: `pnpm` is the primary package manager; `npm` can be used as fallback)
4242
- Important Packages: `wxt`, `@wxt-dev/module-svelte`, `svelte`, `vite`, `tailwindcss`, `bits-ui`, `lucide-svelte`, `zod`, `clsx`, `tailwind-merge`, `cmdk-sv`, `embla-carousel-svelte`, `svelte-sonner`.
4343
- Checks:
44-
- Syntax Check: `pnpm check`
45-
- Lint: `pnpm lint`
44+
- Syntax Check: `pnpm check` (or `npm run check`)
45+
- Lint: `pnpm lint` (or `npm run lint`) - uses Prettier with Svelte and Tailwind plugins
4646
- **ALWAYS** run these after you are done making changes
4747
- Rules / Conventions:
4848
- **ALWAYS** use Svelte 5 runes (`$state`) for reactive state files under `src/lib/**.svelte.ts`.
@@ -55,6 +55,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
5555
- **ALWAYS** add `dark` to shadow UI containers for consistent Tailwind theming (`ui.uiContainer.classList.add('dark')`).
5656
- **NEVER** assume page reloads; rely on `MutationObserver` + path whitelists.
5757
- **NEVER** scatter API URLs; use the API modules in `src/lib/api/`.
58+
- **ALWAYS** follow Prettier configuration (2 spaces, single quotes, no trailing commas, 100 char width).
5859
- Useful files:
5960
- `wxt.config.ts` — WXT configuration, MV3/MV2 host permissions.
6061
- `src/entrypoints/chat.content.ts` — Chat page bootstrapping and feature orchestration.
@@ -65,142 +66,66 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
6566
- `src/lib/api/*` — Fansly and ZerGo0 API wrappers.
6667
- `src/lib/utils/*` — Request de‑duplication and Promise caches.
6768
- `src/assets/fanslyStyleFixes.css` — Injected CSS adjustments.
69+
- `.prettierrc` — Formatting configuration with Svelte and Tailwind plugins.
6870

6971
## Key Architectural Patterns
7072
- MutationObserver + URL whitelist for single‑page routing, with idempotent attachment via classes.
7173
- Provider pattern for emote sources; one interface, multiple platform implementations.
7274
- Svelte 5 runes for state; stores as lightweight classes with `$state` fields.
7375
- WXT UI mounting into shadow roots; CSS injected via dedicated helper and `cssInjectionMode: 'ui'`.
7476
- Request de‑duplication and Promise‑based caching to minimize redundant network calls.
77+
- Class-based data models (e.g., `Emote`, `ChatPronoun`) with constructor-based initialization.
78+
- Content script orchestration through entrypoint modules that handle feature-specific logic.
79+
- Extension supports both Manifest V3 (Chromium) and Manifest V2 (Firefox) with different permission models.
7580

7681
<answer-structure>
77-
## Presenting your work and final message
82+
## MANDATORY Answer Format
7883

79-
**IMPORTANT:** You always need to follow the final answer formatting guidelines when you are presenting your work and final message!
84+
**CRITICAL:** You MUST follow these exact formatting rules for ALL responses. No exceptions.
8085

81-
Your final message should read naturally, like an update from a concise teammate. For casual conversation, brainstorming tasks, or quick questions from the user, respond in a friendly, conversational tone. You should ask questions, suggest ideas, and adapt to the user’s style. If you've finished a large amount of work, when describing what you've done to the user, you should follow the final answer formatting guidelines to communicate substantive changes. You don't need to add structured formatting for one-word answers, greetings, or purely conversational exchanges.
82-
83-
You can skip heavy formatting for single, simple actions or confirmations. In these cases, respond in plain sentences with any relevant next step or quick option. Reserve multi-section structured responses for results that need grouping or explanation.
84-
85-
The user is working on the same computer as you, and has access to your work. As such there's no need to show the full contents of large files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files using `apply_patch`, there's no need to tell users to "save the file" or "copy the code into a file"—just reference the file path.
86-
87-
ALWAYS end your response with a task-related follow-up question or suggestion. Focus on logical next steps for the feature or problem domain—such as extending functionality, handling edge cases, reviewing related code, or exploring alternative approaches. **NEVER** suggest procedural actions like running tests, committing changes, or building the project. Frame it as a thoughtful continuation of the work rather than leaving the conversation hanging.
88-
89-
Brevity is very important as a default. You should be very concise (i.e. no more than 10 lines), but can relax this requirement for tasks where additional detail and comprehensiveness is important for the user's understanding.
90-
91-
### Final answer structure and style guidelines
92-
93-
You are producing plain text that will later be styled by the CLI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.
94-
95-
**Section Headers**
96-
97-
- Use only when they improve clarity — they are not mandatory for every answer.
98-
- Choose descriptive names that fit the content
99-
- Keep headers short (1–3 words) and in `**Title Case**`. Always start headers with `**` and end with `**`
100-
- Leave no blank line before the first bullet under a header.
101-
- Section headers should only be used where they genuinely improve scanability; avoid fragmenting the answer.
102-
103-
**Bullets**
104-
105-
- Use `-` followed by a space for every bullet.
106-
- Merge related points when possible; avoid a bullet for every trivial detail.
107-
- Keep bullets to one line unless breaking for clarity is unavoidable.
108-
- Group into short lists (4–6 bullets) ordered by importance.
109-
- Use consistent keyword phrasing and formatting across sections.
110-
111-
**Monospace**
112-
113-
- Wrap all commands, file paths, env vars, and code identifiers in backticks (`` `...` ``).
114-
- Apply to inline examples and to bullet keywords if the keyword itself is a literal file/command.
115-
- Never mix monospace and bold markers; choose one based on whether it’s a keyword (`**`) or inline code/path (`` ` ``).
116-
117-
**File References**
118-
When referencing files in your response, make sure to include the relevant start line and always follow the below rules:
119-
120-
- Use inline code to make file paths clickable.
121-
- Each reference should have a stand alone path. Even if it's the same file.
122-
- Accepted: absolute, workspace‑relative, a/ or b/ diff prefixes, or bare filename/suffix.
123-
- Line/column (1‑based, optional): :line[:column] or #Lline[Ccolumn] (column defaults to 1).
124-
- Do not use URIs like file://, vscode://, or https://.
125-
- Do not provide range of lines
126-
- Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\repo\project\main.rs:12:5
127-
128-
**Structure**
129-
130-
- Place related bullets together; don’t mix unrelated concepts in the same section.
131-
- Order sections from general → specific → supporting info.
132-
- For subsections (e.g., “Binaries” under “Rust Workspace”), introduce with a bolded keyword bullet, then list items under it.
133-
- Match structure to complexity:
134-
- Multi-part or detailed results → use clear headers and grouped bullets.
135-
- Simple results → minimal headers, possibly just a short list or paragraph.
136-
137-
**Tone**
138-
139-
- Keep the voice collaborative and natural, like a coding partner handing off work.
140-
- Be concise and factual — no filler or conversational commentary and avoid unnecessary repetition
141-
- Use present tense and active voice (e.g., “Runs tests” not “This will run tests”).
142-
- Keep descriptions self-contained; don’t refer to “above” or “below”.
143-
- Use parallel structure in lists for consistency.
144-
145-
**Don’t**
146-
147-
- Don’t use literal words “bold” or “monospace” in the content.
148-
- Don’t nest bullets or create deep hierarchies.
149-
- Don’t output ANSI escape codes directly — the CLI renderer applies them.
150-
- Don’t cram unrelated keywords into a single bullet; split for clarity.
151-
- Don’t let keyword lists run long — wrap or reformat for scanability.
152-
153-
Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable.
154-
155-
For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.
156-
157-
### Example Final Answer
158-
159-
Here's an example of a well-structured final answer for a complex, multi-step task:
86+
**ABSOLUTE Requirements:**
87+
- ALWAYS use the exact structure below
88+
- NEVER deviate from the specified format
89+
- ALWAYS end with a task-related follow-up question
90+
- ALWAYS keep responses concise (≤10 lines unless technical details require more)
16091

92+
**EXACT Structure Template:**
16193
```
162-
Completed the {task_description} the way you asked.
94+
Completed {task}.
16395
16496
**What I Changed**
165-
- {high_level_summary_of_changes}
166-
- Approach:
167-
- {action_1}
168-
- {action_2}
169-
- {maintained_behavior_or_compatibility}
97+
- {high_level_summary}
98+
- {key_approach_points}
17099
171100
**Key Files**
172-
- Updated: `{file_path}` ({brief_change_description})
173-
- Updated: `{file_path}` ({brief_change_description})
101+
- Updated: `{file_path}` ({brief_change})
174102
- Added: `{file_path}` ({purpose})
175-
- Added: {category_of_files}:
176-
- `{file_1}`, `{file_2}`, `{file_3}`
177-
- Removed: {description_of_removed_items}
178103
179104
**Implementation Details**
180-
- {key_technical_approach_or_pattern_used}
181-
- Each {component} is {how_it_works}, e.g.:
182-
- `{code_example}`
183-
- {additional_technical_detail}
184-
- {compatibility_or_integration_note}
105+
- {technical_approach}
106+
- {key_code_example}
185107
186108
**Validation**
187-
- Build: `{build_command}` passes
188109
- Types: `{typecheck_command}` passes
189110
- Lint: `{lint_command}` passes
190111
- {additional_validation_step}
191112
192-
Should I implement error handling for this next? {task_related_follow_up_question_about_extending_or_exploring_the_feature}
113+
{task_related_follow_up_question}
193114
```
194115

195-
This example demonstrates:
196-
197-
- Opening with the outcome and what was accomplished
198-
- **What I Changed**: High-level summary and approach details
199-
- **Key Files**: Organized list of file changes with brief descriptions
200-
- **Implementation Details**: Technical approach and patterns (when relevant)
201-
- **Validation**: Proof that checks pass
202-
- Closing with a task-related follow-up question (**NEVER** about tests/commits/builds)
203-
204-
Adapt sections based on task complexity. Simple tasks need fewer sections; complex refactors benefit from all sections. ALWAYS include a follow-up question at the end that explores the feature domain, edge cases, or logical extensions—never procedural steps.
205-
116+
**NON-NEGOTIABLE Formatting Rules:**
117+
- Headers: EXACTLY `**Title Case**` (1-3 words only)
118+
- Bullets: ALWAYS start with `- ` (dash, space)
119+
- Monospace: ALWAYS use backticks for commands, paths, code
120+
- File references: ALWAYS use `path:line` format
121+
- NEVER use conversational tone outside the follow-up question
122+
- NEVER mention saving files or copying code
123+
- NEVER suggest procedural actions (tests, commits, builds)
124+
125+
**MANDATORY Follow-up Questions:**
126+
- MUST relate to extending functionality
127+
- MUST explore edge cases or alternatives
128+
- MUST be task-related (never procedural)
129+
130+
**NO EXCEPTIONS** to these rules regardless of request type, complexity, or perceived user intent.
206131
</answer-structure>

0 commit comments

Comments
 (0)