AGENTS.md
AGENTS.mdAGENTS.mdroot
Quality
88/100
Scores the file, not the repository.Length
2,173 words
34 headings · 2 code blocksRepository
14k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# AGENTS.md23Guidance for AI agents working in this repository.45## Project Rules67Project-specific context, repository layout, build commands, and local operating rules.89### Project Overview1011Easydict is a macOS dictionary and translation app that supports word lookup, text12translation, and OCR screenshot translation.1314### Platform and Language1516- Supports macOS 13.0+.17- Uses SwiftUI for all new UI components and views.1819### Directory Structure2021```22Easydict/23├── Easydict/ # App source root24│ ├── App/ # App entry, pch, bridge, plist, assets, localization25│ │26│ ├── Swift/ # Swift source root27│ │ ├── Feature/ # Product feature modules28│ │ │ ├── ActionManager/ # Action routing and execution29│ │ │ ├── Screenshot/ # Screenshot feature30│ │ │ ├── Shortcut/ # Keyboard shortcut model and UI31│ │ │ └── ... # Other product features32│ │ │33│ │ ├── Service/ # Translation and AI provider implementations34│ │ │ ├── Model/ # Service request and response models35│ │ │ ├── Google/ # Google translation service36│ │ │ ├── OpenAI/ # OpenAI-compatible service integration37│ │ │ └── ... # Other translation and AI services38│ │ │39│ │ ├── Model/ # Shared app data models40│ │ ├── Utility/ # Cross-feature utilities and helpers41│ │ │ ├── EventMonitor/ # Global event monitoring and triggers42│ │ │ ├── Extensions/ # Swift, AppKit, SwiftUI, Foundation extensions43│ │ │ └── ... # Other shared utilities44│ │ │45│ │ └── View/ # Shared SwiftUI and AppKit-facing views46│ │47│ └── objc/ # Legacy code - maintenance only48│ ├── Libraries/ # Bundled legacy helper libraries49│ ├── Utility/ # Legacy helper categories and utilities50│ └── ViewController/ # Legacy window and query controllers51│52├── EasydictTests/ # Unit tests53└── Pods/ # CocoaPods dependencies and integration project54```5556### Build and Test Commands5758Run `xcodebuild` only when:5960- Swift, Objective-C, or other Xcode-compiled app source changes exceed 10061 substantive lines. Xcode project/workspace metadata, documentation, scripts,62 and comment-only edits do not count toward this trigger.63- Unit test source files under `EasydictTests/**/*.swift` are added or changed.64- The user explicitly asks for a build or test run.6566Evaluate the 100-line trigger only after implementation is complete. Use the final67task-owned diff, count added and deleted substantive lines together instead of using68an estimate or net line count, exclude blank lines and unrelated pre-existing changes,69and recalculate before finishing if the implementation changes again.7071Do not run multiple `xcodebuild` commands concurrently against the same workspace and72DerivedData location. Concurrent runs can contend for the shared build database,73intermediates, and test bundles, which leads to flaky conflicts.7475`xcodebuild` may take several minutes. Wait for it to finish.7677If the default Xcode DerivedData location fails because of permission, cache, or runner78state, use an temporary external DerivedData directory instead of a repo-local one:7980`-derivedDataPath ~/Library/Developer/Xcode/DerivedData/Easydict-Temporary`8182After the build or test completes, remove that DerivedData directory before83finishing the task.8485Common build and test commands:8687```bash88# Build89xcodebuild build \90 -workspace Easydict.xcworkspace \91 -scheme Easydict | xcbeautify9293# Test (builds and runs a test in one command)94xcodebuild test \95 -workspace Easydict.xcworkspace \96 -scheme Easydict \97 -only-testing:EasydictTests/UtilityFunctionsTests/testAES | xcbeautify9899# Build for testing100xcodebuild build-for-testing \101 -workspace Easydict.xcworkspace \102 -scheme Easydict | xcbeautify103104# e.g. run specific test class, -only-testing:<Target>/<TestClass>105xcodebuild test-without-building \106 -workspace Easydict.xcworkspace \107 -scheme Easydict \108 -only-testing:EasydictTests/UtilityFunctionsTests | xcbeautify109110# e.g. run specific test method, -only-testing:<Target>/<TestClass>/<testMethod>111xcodebuild test-without-building \112 -workspace Easydict.xcworkspace \113 -scheme Easydict \114 -only-testing:EasydictTests/UtilityFunctionsTests/testAES | xcbeautify115```116117Recommended usage:118119- `build`: default validation when `xcodebuild` validation is required.120- `test`: simplest one-shot test run; builds and runs tests in one command.121- When unit test source files change, use `xcodebuild test` for the first validation.122 Scope it with `-only-testing:<Target>/<TestSuiteOrClass>` for the changed test when123 possible; if the mapping is unclear, run the relevant broader test target or suite.124- `build-for-testing` + `test-without-building`: preferred when rerunning the same tests125 repeatedly.126- `test-without-building` requires a compatible prior `build-for-testing` with the same127 workspace, scheme, destination, configuration, and DerivedData location.128- If code or build settings changed, rerun `build-for-testing` before129 `test-without-building`.130- Prefer `-only-testing:` when debugging a specific test class or method.131132### Localization133134- All user-facing UI text must be localized. Do not hard-code visible strings in SwiftUI,135 AppKit, scripts, or bundled web assets that users can see.136- `Localizable.xcstrings` manages app string localization. Whenever user-facing text is137 added or its meaning changes, enumerate the catalog's current locales and update every138 one for the affected key instead of copying nearby entries.139- Use static String Catalog keys directly in UI and string APIs when possible, for example140 `Text("setting.general.appearance.light_dark_appearance")`.141- Do not build localization keys dynamically or concatenate localized fragments. For text142 with runtime values, localize the full sentence with a dedicated entry and pass the143 values as arguments.144- Use lowercase, dot-separated keys with snake_case segments where needed, and do not145 rename keys casually. Follow `<scope>.<category>.<subcategory>.<element>`, for example146 `common.done` or `setting.general.appearance.light_dark_appearance`.147148## Cross-Language Code Quality Rules149150These rules apply to handwritten Swift, Python, Shell, JavaScript/TypeScript, and other151source files in this repository.152153### Source Organization Rules154155- Organize source directories by feature or bounded responsibility once an area grows156 beyond a few files. Keep feature-specific UI, core, state, storage, services,157 utilities, and docs together.158- Keep source files focused on one clear responsibility. Prefer extracting a helper,159 module, or sibling script when a file starts mixing unrelated parsing, UI, I/O,160 orchestration, and validation concerns.161- Handwritten source files should generally stay within 500 lines. Files approaching or162 exceeding this size should be reviewed for a responsibility split before adding more163 behavior.164- Handwritten source files should not exceed 1000 lines. Existing files over this limit165 are technical debt; do not add new complex flows to them without first splitting the166 file or documenting a concrete split plan.167- Generated files, third-party code, pure data files, templates, large fixtures, and168 intentionally vendored runtime files are exempt from the line-count guideline.169- Use the language's normal section markers in longer files to group lifecycle, state170 updates, command handling, I/O, parsing, and private helpers. Do not add a section171 marker for a single isolated function unless it materially improves navigation.172173### Naming Rules174175- Use each language and toolchain's normal naming conventions for compiled or imported176 source files, modules, types, functions, and tests.177- Use kebab-case for non-imported documentation, exported artifacts, app-managed runtime178 paths, and standalone scripts unless surrounding tooling already requires another179 style.180- For new or renamed types, functions, properties, parameters, and local variables,181 prefer clear, concise names, remove repeated surrounding context, and usually keep182 them within 20 characters.183- If a longer name is required by a system API, external protocol, or unavoidable domain184 term, keep it as short as possible and treat it as an exception.185186### Coding Practices187188- Avoid single-letter variable names except trivial loop indices.189- Avoid global helpers, static or type-level functions, and mutable globals unless the190 language, module, or domain model clearly requires them. Utility modules and types may191 expose type-level helpers when that is their main responsibility.192- Do not extract one-off literals into variables or constants unless they are reused or193 have clear semantic meaning. Name a one-off constant only when a magic number has194 distinctive visual or domain meaning.195- Prefer async/await over callback-based completion handlers in languages and runtimes196 where async/await is the established option.197198### Documentation Comment Rules199200- Add file-level comments for non-trivial scripts or modules so readers know the entry201 point, responsibility, and important side effects.202- Add short documentation comments for complex functions, command entry points, state203 machines, parsers, I/O boundaries, and recovery/error-handling logic. Do not add204 mechanical comments for obvious getters, path helpers, or thin wrappers.205- Keep comment lines within 80 characters, avoid restating obvious type or property206 names, and update comments whenever responsibilities or behavior change.207- Use the language's normal comment style: Swift documentation comments, Python208 docstrings, Shell comments before functions, and JSDoc/TSDoc where appropriate.209- When creating or updating source file header comments, use the current Git username in210 the `Created by ...` line. Do not use agent names such as `Codex`, `Claude`, or211 `AI Assistant`.212213### Test Code Rules214215- Do not use the same agent session to both modify production code and add unit tests.216- Prefer assigning unit tests to a different agent from the implementation agent, for217 example Codex for production code and Claude Code for unit tests.218- Do not add tests for UI code or UI-focused changes.219- Add or update tests only for changes with meaningful behavior or correctness risk. Skip220 trivial pass-through code, simple glue code, obvious accessors, and behavior already221 covered elsewhere, and run the relevant tests.222- Prefer concrete production code and high-signal behavior assertions. Do not add223 test-only protocols, mocks, overrides, or invasive production hooks for low-value224 tests.225226## Swift-Xcode Rules227228Reusable Swift and Xcode rules for source organization, documentation, testing, and APIs.229230### Xcode Project Metadata231232Unless the user explicitly says otherwise, when adding or moving files, also update the233owning `.xcodeproj/project.pbxproj` file so the files appear in Xcode's navigator.234235- By default, every newly added project file, including developer-facing documentation236 such as Markdown, HTML or SVG files, must have a matching `PBXFileReference` under the237 correct `PBXGroup`.238- Do not add documentation files to build phases such as `Resources` unless the file is239 intentionally shipped at runtime.240241### Swift Source Organization Rules242243- Keep each Swift source file focused on one primary `class` or `struct`. Multiple244 declarations are acceptable only for tightly coupled protocols, simple pure data245 models, small private helper types, or extensions and conformance blocks that directly246 support the primary type.247- Group functions that implement the same `protocol` together instead of scattering them248 across a type.249- Mark each protocol implementation block with `// MARK: - <ProtocolName>` or an equally250 clear section title, such as `// MARK: - WCSessionDelegate`.251- Use `// MARK:` sections in longer classes and structs to organize lifecycle, state252 updates, protocol implementations, and private helpers. Do not add a `MARK` only for a253 single isolated function unless it materially improves navigation.254255### Swift Naming Rules256257- Use `UpperCamelCase` for directories and files that are compiled by Xcode, including258 Swift, Objective-C, and test source files.259260### Swift Coding Practices261262- Avoid `static` functions and variables unless type-level semantics clearly require them.263 Utility types may use `static`.264- Prefer `for … where` over `for` plus inline `if` filtering.265266### Swift Documentation Comment Rules267268- Add a type-level comment immediately before every class, struct, enum, protocol, and269 actor. For core types, use 2-4 short sentences and keep the comment around 220-320270 English characters. For simple private helper types, use 1-2 short sentences and keep271 it under 180 characters.272- Add English documentation comments for functions when behavior or intent is not obvious.273 Use inline comments only for non-obvious reasoning or complex logic.274275### Libraries and API Usage276277- Use **SFSafeSymbols** type-safe APIs instead of hard-coded SF Symbol strings.278- Prefer `Image(systemSymbol: .chevronRight)` over `Image(systemName: "chevron.right")`.279- Prefer `Label("MyText", systemSymbol: .cCircle)` over280 `Label("MyText", systemImage: "c.circle")`.281- In SwiftUI, use `foregroundStyle<S>(_ style: S)` instead of deprecated282 `foregroundColor(_:)`.283- In SwiftUI, use `background(alignment:content:)` or trailing-closure284 `background { ... }` for background views instead of deprecated285 `background(_:alignment:)`. Keep `Color` and material `ShapeStyle` backgrounds on their286 dedicated overloads.287- Use `Alamofire` async/await APIs for network requests.288- Use `Defaults` for user preferences and settings; avoid introducing new direct289 `UserDefaults` usage.290291### Swift Test Code Rules292293- Each test source file may declare at most one `@Suite` type.294295## General Agent Rules296297Language-agnostic agent guidance for tool usage, local skill overlays, and working298habits.299300### Skill Overlay Rules301302- Store local skill overlay files in `.agents/overrides/`; use them to extend shared303 skill or tool instructions without editing the shared source.304- When using `fireworks-tech-graph`, read305 `.agents/overrides/fireworks-tech-graph-quality-rules.md` after the skill and apply its306 diagram quality, connector, label, export, and rendered-review rules.307308### MCP Servers309310Always use the OpenAI developer documentation MCP server if you need to work with the311OpenAI API, ChatGPT Apps SDK, Codex, or related developer tools.312313### Agent Working Principles314315#### Think Before Coding316317- State assumptions, uncertainties, and tradeoffs before implementation.318- If requirements are unclear or have multiple plausible interpretations, ask before319 choosing. Mention simpler alternatives when they exist.320321#### Simplicity First322323- Implement the minimum solution that satisfies the request. Avoid speculative features,324 single-use abstractions, and unrequested configurability.325- If a solution grows beyond the real problem, simplify it before delivering.326327#### Surgical Changes328329- Touch only files and lines needed for the current request. Match existing style and330 avoid opportunistic refactors or comment and format churn.331- Remove only imports, variables, functions, or files made unused by the current change.332 Mention unrelated cleanup opportunities instead of doing them.333334#### Goal-Driven Execution335336- Translate tasks into verifiable success criteria and keep working until those criteria337 are met or a blocker is clear.338- For multi-step work, state a brief plan and validate with relevant tests, checks,339 builds, or manual inspection.340
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| wpscanteam/wpscanAGENTS.md · 9.7k | AGENTS.md | setupbuildteststyle+6 | 100/100 | 2 days ago | |
| OnlyTerp/prompt-cache-skillsAGENTS.md · 112 | AGENTS.md | setupbuildtestlint-format+5 | 100/100 | 3 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago |
