Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion extras/skills/codemark/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ For common query patterns across languages, see:

## Best Practices

- **Target small, specific code**: Prefer single functions over entire classes, specific methods over whole modules. Smaller bookmarks are more resilient to refactoring, easier to understand, and more precise for navigation. A well-chosen function bookmark survives most structural changes, while large class bookmarks often drift when code is reorganized.
- **Target small, specific code**: Prefer single functions over entire classes, specific methods over whole modules. Smaller bookmarks are more resilient to refactoring, easier to understand, and more precise for navigation.
- **Fine-grained execution targeting**: Don't just bookmark containers (classes/functions). Bookmark **execution boundaries** like critical method calls (`call_expression`), authorization gates (`if_statement`), or complex state transitions (`switch`/`match`).
- **Granularity Strategy**: We prefer **more, highly specific bookmarks** over fewer, general ones. For example, if a function performs three critical steps (auth, validation, DB write), it is better to bookmark those three specific lines/nodes than to bookmark the entire function.
- Use `--created-by agent` to distinguish your bookmarks from the user's.
- Use `--collection <name>` when creating bookmarks to add them directly to a collection (collections are auto-created if they don't exist).
- **Iterative enhancement**: When working with an existing bookmark and discover new context, use `annotate` to add notes without re-parsing the file. Multiple agents can annotate the same bookmark over time.
Expand Down
16 changes: 16 additions & 0 deletions extras/skills/codemark/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ Focus on *why* the code matters and its relationships. Avoid repeating informati
codemark add --file src/auth.rs --range 42 --note "Core auth validator. entry point for all signed requests. Relationships: depends on Claims struct." --tag feature:auth --tag role:entrypoint --tag layer:logic --created-by agent
```

## Targeting Fine-Grained Execution Logic

Instead of bookmarking the entire function, target the specific execution point where critical actions occur.

### Bookmark a specific method call inside a function
```bash
# Target the exact line where the database is updated
codemark add-from-query \
--file src/db/repo.rs \
--query '(call_expression function: (member_expression property: (property_identifier) @method (#eq? @method "update_user_balance"))) @target' \
--note "Critical: Database update point for user balances. Relationships: triggered after payment verification." \
Comment on lines +38 to +41
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify Rust node availability in official grammar metadata.
python - <<'PY'
import urllib.request
url = "https://raw.githubusercontent.com/tree-sitter/tree-sitter-rust/master/src/node-types.json"
s = urllib.request.urlopen(url).read().decode()
for token in ["member_expression", "property_identifier", "field_expression", "call_expression"]:
    print(f"{token}: {token in s}")
PY

Repository: DanielCardonaRojas/codemark

Length of output: 2652


🏁 Script executed:

# First, explore the markdown file to understand context and other examples
head -100 extras/skills/codemark/examples.md

Repository: DanielCardonaRojas/codemark

Length of output: 4405


🏁 Script executed:

# Search for other language examples to understand pattern
rg "codemark add-from-query" extras/skills/codemark/examples.md -A 5

Repository: DanielCardonaRojas/codemark

Length of output: 3170


🌐 Web query:

Rust tree-sitter grammar node types member_expression property_identifier

💡 Result:

In the tree-sitter Rust grammar (https://github.com/tree-sitter/tree-sitter-rust), method calls like vec.len and field access like obj.field are parsed as field_expression nodes. A field_expression has two fields: receiver (the base expression or scoped_identifier) and field (a field_identifier node containing the property name as text). There are no member_expression or property_identifier node types in this grammar. field_identifier nodes are highlighted as @property in queries/highlights.scm. The full node types are in src/node-types.json (96.7KB file in the repo) and can be used to generate Rust enums via crates like tss-rust or type-sitter. In Rust tree-sitter bindings, access the property name via node.child_by_field_name("field").utf8_text(source_code).to_string.

Citations:


Use Rust-compatible query syntax for the .rs file example.

The query uses JavaScript/TypeScript node types (member_expression, property_identifier) but targets a Rust file (src/db/repo.rs). In Rust's tree-sitter grammar, method calls use field_expression and field_identifier instead. This query will not match.

Suggested fix
- --query '(call_expression function: (member_expression property: (property_identifier) `@method` (`#eq`? `@method` "update_user_balance"))) `@target`' \
+ --query '(call_expression function: (field_expression field: (field_identifier) `@method` (`#eq`? `@method` "update_user_balance"))) `@target`' \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
codemark add-from-query \
--file src/db/repo.rs \
--query '(call_expression function: (member_expression property: (property_identifier) @method (#eq? @method "update_user_balance"))) @target' \
--note "Critical: Database update point for user balances. Relationships: triggered after payment verification." \
codemark add-from-query \
--file src/db/repo.rs \
--query '(call_expression function: (field_expression field: (field_identifier) `@method` (`#eq`? `@method` "update_user_balance"))) `@target`' \
--note "Critical: Database update point for user balances. Relationships: triggered after payment verification." \
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@extras/skills/codemark/examples.md` around lines 38 - 41, The example command
uses JS/TS tree-sitter node types (member_expression, property_identifier) which
won't match a Rust file; update the --query value in the codemark add-from-query
example to use Rust node types (e.g., field_expression and field_identifier) and
keep the capture name `@target` and the method identifier token (currently
"update_user_balance") so the command still targets the same call site; ensure
the query replaces member_expression→field_expression and
property_identifier→field_identifier (and adjust any predicate names if needed)
so it matches Rust method calls in src/db/repo.rs.

--tag layer:data \
--tag role:repository \
--created-by agent
```

## Creating Bookmarks with Raw Queries

### 1. Use dry-run to verify query uniqueness
Expand Down
59 changes: 56 additions & 3 deletions extras/skills/codemark/queries/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,69 @@ If you're bookmarking code that seems like it will be refactored:

### Strategy: Bookmark Multiple Related Functions

When a function has siblings you also care about, bookmark them explicitly rather than relying on broad queries:
When a function has siblings or internal steps you also care about, bookmark them explicitly. We prefer **more, highly specific bookmarks** over fewer, general ones.

```bash
# Bookmark each method individually
codemark add-from-query --file src/auth.swift --query '(function_declaration name: (simple_identifier) @name (#eq? @name "validateToken")) @target' --note "Auth validation: validateToken" --tag feature:auth
codemark add-from-query --file src/auth.swift --query '(function_declaration name: (simple_identifier) @name (#eq? @name "refreshToken")) @target' --note "Auth validation: refreshToken" --tag feature:auth
codemark add-from-query --file src/auth.swift --query '(function_declaration name: (simple_identifier) @name (#eq? @name "checkPermission")) @target' --note "Auth validation: checkPermission" --tag feature:auth
```

### Structural Signature Matching
## Targeting Fine-Grained Execution Logic

Sometimes bookmarking an entire function is too broad. You can target specific execution boundaries, logic gates, and method calls *inside* those functions.

### 1. Bookmarking Method Calls (`call_expression`)
Instead of bookmarking where a function is defined, bookmark where a critical function is **invoked**.

```scheme
# Target any execution of `verify_signature` (Rust, TS, Python)
(call_expression
function: (identifier) @func
(#eq? @func "verify_signature")) @target
```

```scheme
# Target a specific method call on an object, like `db.commit()`
(call_expression
function: (member_expression
property: (property_identifier) @method
(#eq? @method "commit"))) @target
```

### 2. Bookmarking Conditionals (`if_statement`)
Target the exact decision points, such as authorization guards or error handling branches.

```scheme
# Target an if-statement that checks an "is_admin" variable
(if_statement
condition: (identifier) @cond
(#eq? @cond "is_admin")) @target
```

### 3. Bookmarking Comparisons (`binary_expression`)
Identify hardcoded business rules or boundary limits.

```scheme
# Target anywhere a strict equality check compares against the string "admin"
(binary_expression
operator: "=="
right: (string) @val
(#match? @val "admin")) @target
```

### 4. Bookmarking Complex Branching (`switch` / `match`)
Target state machines or reducers by locating `switch_statement` or `match_expression`.

```scheme
# TS / Go / Swift: Target a switch statement switching on "action.type"
(switch_statement
value: (member_expression
property: (property_identifier) @prop
(#eq? @prop "type"))) @target
```

## Structural Signature Matching

Instead of matching by name, match by parameter/return types which change less often:

Expand Down
31 changes: 31 additions & 0 deletions extras/skills/codemark/queries/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,37 @@ Any async method:
(#eq? @method "InvalidateCache")) @target))
```

### Call Expression (Invocation)

Target where a specific method is invoked:

```scheme
(invocation_expression
function: (identifier) @func
(#eq? @func "VerifyToken")) @target
```

### Switch Statement

Target complex branching logic:

```scheme
(switch_statement
expression: (identifier) @val
(#eq? @val "action")) @target
```

### If Statement

Target specific logical decision points:

```scheme
(if_statement
condition: (parenthesized_expression
(identifier) @cond
(#eq? @cond "IsAdmin"))) @target
```

## Module Tagging

C# uses `namespace:<name>` with the full C# namespace:
Expand Down
30 changes: 30 additions & 0 deletions extras/skills/codemark/queries/dart.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,36 @@ Any async function:
(#eq? @method "parseToken")) @target)
```

### Call Expression (Method Call)

Target where a specific method is invoked:

```scheme
(method_invocation
name: (simple_identifier) @method
(#eq? @method "verifyToken")) @target
```

### Switch Statement

Target complex branching logic:

```scheme
(switch_statement
expression: (identifier) @val
(#eq? @val "action")) @target
```

### If Statement

Target specific logical decision points:

```scheme
(if_statement
condition: (identifier) @cond
(#eq? @cond "isAdmin")) @target
```

## Module Tagging

Dart uses `package:<name>` based on the package or library name:
Expand Down
31 changes: 31 additions & 0 deletions extras/skills/codemark/queries/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ Any exported (capitalized) function:
(#eq? @type "string")))) @target
```

### Call Expression (Function Call)

Target where a specific function is invoked:

```scheme
(call_expression
function: (identifier) @func
(#eq? @func "VerifyToken")) @target
```

### Switch Statement

Target complex branching logic:

```scheme
(switch_statement
value: (identifier) @val
(#eq? @val "action")) @target
```
Comment on lines +112 to +115
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use the correct Go switch node kind.

switch_statement is not the Go Tree-sitter node kind; this pattern should target expression_switch_statement (or type_switch_statement when needed).

🔧 Proposed fix
-(switch_statement
+(expression_switch_statement
   value: (identifier) `@val`
   (`#eq`? `@val` "action")) `@target`
#!/bin/bash
# Verify switch node names in official tree-sitter-go metadata.
python - <<'PY'
import urllib.request
url = "https://raw.githubusercontent.com/tree-sitter/tree-sitter-go/master/src/node-types.json"
s = urllib.request.urlopen(url).read().decode()
for token in ["switch_statement", "expression_switch_statement", "type_switch_statement"]:
    print(f"{token}: {token in s}")
PY
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@extras/skills/codemark/queries/go.md` around lines 112 - 115, The pattern
uses the wrong Go Tree-sitter node kind `switch_statement`; update the query to
target the correct Go node kinds such as `expression_switch_statement` (or
`type_switch_statement` when matching type switches) instead of
`switch_statement`, keeping the capture names `@val` and `@target` unchanged so
the rest of the query logic still binds the switch value and target capture.


### If Statement

Target specific logical decision points:

```scheme
(if_statement
condition: (call_expression
function: (identifier) @func
(#eq? @func "IsAuthorized"))) @target
```

## Module Tagging

Go uses `package:<path>` with the full package path relative to module root (using dots):
Expand Down
32 changes: 32 additions & 0 deletions extras/skills/codemark/queries/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,38 @@ Any static method:
(#eq? @type "String")))) @target
```

### Call Expression (Method Call)

Target where a specific method is invoked:

```scheme
(method_invocation
name: (identifier) @method
(#eq? @method "verifyToken")) @target
```

### Switch Statement

Target complex branching logic:

```scheme
(switch_statement
condition: (parenthesized_expression
(identifier) @val
(#eq? @val "action"))) @target
```
Comment on lines +128 to +132
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify Java switch node/field names in official grammar metadata.
python - <<'PY'
import urllib.request
url = "https://raw.githubusercontent.com/tree-sitter/tree-sitter-java/master/src/node-types.json"
s = urllib.request.urlopen(url).read().decode()
for token in ["switch_statement", "switch_expression", "\"value\""]:
    print(f"{token}: {token in s}")
PY

Repository: DanielCardonaRojas/codemark

Length of output: 2652


🏁 Script executed:

# First, check the actual file content
cat -n extras/skills/codemark/queries/java.md | sed -n '120,140p'

Repository: DanielCardonaRojas/codemark

Length of output: 571


🏁 Script executed:

# Search for any tree-sitter Java grammar files in the repo
find . -name "*.json" -path "*/java*" -o -name "*grammar*" -type f | grep -i java

Repository: DanielCardonaRojas/codemark

Length of output: 53


🏁 Script executed:

# Look for other Java query examples or test files that might show correct usage
fd -t f "java" | head -20

Repository: DanielCardonaRojas/codemark

Length of output: 146


🏁 Script executed:

# Check the Java test file for switch examples
cat tests/fixtures/java/AuthService.java | head -100

Repository: DanielCardonaRojas/codemark

Length of output: 2884


🏁 Script executed:

# Search for any node-types or grammar references in the repo
find . -name "node-types.json" -o -name "*grammar*" | grep -i java

Repository: DanielCardonaRojas/codemark

Length of output: 53


🏁 Script executed:

# Search for any documentation or comments about tree-sitter Java in the codebase
rg -i "switch_statement|switch_expression" --type md --type txt

Repository: DanielCardonaRojas/codemark

Length of output: 607


🏁 Script executed:

# Check if there's a package.json or similar that shows tree-sitter-java version
cat package.json 2>/dev/null || cat package-lock.json 2>/dev/null | head -50

Repository: DanielCardonaRojas/codemark

Length of output: 53


🏁 Script executed:

# Look for tree-sitter config files or dependencies
rg -i "tree.sitter|grammar" --type json --type toml --type yaml | head -20

Repository: DanielCardonaRojas/codemark

Length of output: 963


🏁 Script executed:

# Check if there's a .tree-sitter or similar directory
find . -type d -name "*tree*" -o -name "*grammar*"

Repository: DanielCardonaRojas/codemark

Length of output: 53


🏁 Script executed:

# Search for any comments or documentation in the markdown files about node names
rg "node.*type|grammar|switch" extras/skills/codemark/queries/java.md -B 2 -A 2

Repository: DanielCardonaRojas/codemark

Length of output: 162


🏁 Script executed:

# Look at how conditions are used in other query patterns (comparison check)
rg "condition:" extras/skills/codemark/queries/java.md

Repository: DanielCardonaRojas/codemark

Length of output: 148


🌐 Web query:

tree-sitter-java 0.23 switch_statement switch_expression grammar node types

💡 Result:

In tree-sitter-java version 0.23.x (latest v0.23.5 as of Dec 2024), the grammar supports both traditional and enhanced switch statements/expressions from Java 14+ (PR #78 merged Apr 2021) and Java 21 pattern matching (PR #158 merged Aug 2023). Key node types related to switch: - switch_statement: Traditional switch statement (switch (expr) { case ... : statements; }) - switch_expression: Enhanced switch used as expression (switch (expr) { case ... -> expr; }), can yield value - switch_construct: Internal unified construct used in both contexts (mentioned in PR #78 discussion) The grammar.js defines switch_block as either traditional switch_line groups or arrow_switch_line (case -> expr). PR #78 commit fb5038b explicitly renamed/used "switch_expression instead of switch_statement" for the expression form. Static node types are generated in src/node-types.json (79KB file, lists all node types with children/fields). To see exact switch node structure: 1. Clone https://github.com/tree-sitter/tree-sitter-java 2. Run tree-sitter generate 3. Check src/node-types.json for "switch_statement", "switch_expression" entries npm package includes src/node-types.json and grammar.json (182KB). No direct raw content found, but PR #78 confirms distinct nodes for statement vs expression forms, following Java spec separation while unifying parsing via switch_construct.

Citations:


🌐 Web query:

tree-sitter-java grammar "switch_expression" OR "switch_statement" node types

💡 Result:

In tree-sitter-java, the enhanced switch construct is represented by the node type "switch_construct" (it’s both an expression and a statement), rather than separate node types named "switch_expression" or "switch_statement". So, for your query: - switch_expression node type: not found as a distinct node type name in tree-sitter-java; the grammar uses switch_construct instead. - switch_statement node type: not found as a distinct node type name in tree-sitter-java; the grammar uses switch_construct instead. The related internal node names mentioned in the grammar update include "switch_block" and "switch_line" / "arrow_switch_line" (for the traditional and arrow forms of cases).

Citations:


🌐 Web query:

tree-sitter-java src/node-types.json switch_construct field names

💡 Result:

The tree-sitter-java grammar defines a "switch_construct" node type for enhanced switch statements/expressions (introduced in Java 14+). This node appears in src/node-types.json, which is auto-generated from grammar.js via tree-sitter generate. No search results provided the exact JSON entry for "switch_construct" fields, as the file content is not directly quoted in snippets. However, Tree-sitter node types with fields are defined in grammar.js using field(name, rule) syntax, which populates the "fields" object in node-types.json with keys as field names. From PR #78 (merged), switch_construct is defined as both expression and statement, with structure: switch ( selector ) { switch_block } Where switch_block uses switch_line (traditional cases) or arrow_switch_line (case -> expr). Typical fields for similar constructs (e.g., method_declaration has "body", "name") suggest switch_construct likely has fields like: - "selector" or "discriminant": the expression after 'switch' - "body" or "cases" or "switch_block": the { ... } content Later PRs (#158 for Java 21 pattern matching) added "guard" nonterminal, potentially adding a "guard" field to case labels. To view exact current fields: 1. Clone https://github.com/tree-sitter/tree-sitter-java 2. Run tree-sitter generate 3. Check src/node-types.json for { "type": "switch_construct", ..., "fields": { ... } } Tree-sitter docs confirm fields enable named child access: ts_node_field_name_for_child(node, child_index).

Citations:


🌐 Web query:

site:github.com tree-sitter-java "switch_construct" field value OR condition

💡 Result:

In the tree-sitter-java grammar, "switch_construct" is the node type for Java switch statements and expressions (introduced for enhanced switch support in Java 14+). It serves as both an expression and statement. No sources explicitly document specific named fields like "value" or "condition" for this node, nor "OR condition". The grammar defines switch_construct with substructures like switch_block containing switch_line or arrow_switch_line, but detailed field names are in src/node-types.json (not directly accessible in results). Pattern matching updates (Java 21) added "guard" nonterminal for when-clauses, but no "value" or "condition" fields mentioned. Likely fields include selector (the switch expression), cases (list of switch labels/rules), and body (switch block), based on typical Tree-sitter Java grammar conventions from PR discussions, but unconfirmed explicitly.

Citations:


🌐 Web query:

site:github.com/tree-sitter/tree-sitter-java "switch_construct" query scm

💡 Result:

"switch_construct" is a non-terminal (grammar rule name) in the Tree-sitter Java parser grammar (defined in grammar.scm). It represents the enhanced switch statement/expression syntax introduced in Java 14+, supporting both traditional switch statements and switch expressions with arrow syntax (case L -> expr). It is used in both expression and statement contexts, as noted in development PRs for Tree-sitter Java grammar updates. "SCM" refers to the Scheme-based grammar file format used by Tree-sitter (grammar.scm). The "query scm" likely refers to Tree-sitter queries (in queries/*.scm files), but no direct query named or using "switch_construct" was found; highlights.scm exists but does not reference it explicitly. No connection to general Source Control Management (SCM) tools found.

Citations:


🌐 Web query:

site:github.com/tree-sitter/tree-sitter-java queries highlights "switch"

💡 Result:

The query "queries highlights 'switch'" refers to Tree-sitter syntax highlighting queries for the Java grammar, where "switch" is highlighted as a keyword. Tree-sitter uses .scm files like queries/highlights.scm to define syntax highlighting rules for code editors and tools. In the Java grammar, "switch" is explicitly listed under @keyword for highlighting.

Citations:


🏁 Script executed:

# Check if there are any test cases or examples using switch in the codemark repo
rg "switch" tests/ -A 3 -B 3

Repository: DanielCardonaRojas/codemark

Length of output: 53


🌐 Web query:

tree-sitter-java highlights.scm switch_construct selector expression

💡 Result:

In tree-sitter-java, the highlights.scm file defines syntax highlighting queries for Java code using Tree-sitter queries. The keyword "switch" is highlighted as @keyword, matching the literal token "switch" in switch statements and expressions. There is no specific query targeting "switch_construct" (the unified node for both switch statements and switch expressions, introduced in PR #78 for enhanced switch support), its "selector", or "expression". The selector (the expression after "switch (" and before ")") would typically be captured by general expression or identifier queries, such as (identifier) @variable, depending on its type. Switch cases ("case") are also @keyword. The highlights.scm prioritizes broad captures like keywords, identifiers, types, and functions, without specialized highlighting for switch substructures. For example: - Keywords: ["switch", "case", "default", ...] @keyword - Identifiers: (identifier) @variable To highlight switch selectors specifically, a custom query could be added like: (switch_construct selector: (expression) @variable.parameter) but none exists in the official queries/highlights.scm (as of commit a7db5227).

Citations:


🌐 Web query:

"tree-sitter-java" "switch_construct" example pattern TreeSitter query

💡 Result:

A Tree-sitter query example pattern matching "switch_construct" in the tree-sitter-java grammar is: (switch_construct) @switch This captures any switch construct node, which represents enhanced switch expressions/statements in modern Java (introduced in Java 14+), as per the grammar updates in PRs like #78 and #79. For more specific matching, such as highlighting from queries/highlights.scm: "switch" @keyword To match the full structure: (switch_construct selector: (_) @condition body: (switch_block) @switch.body) Use the Tree-sitter playground (tree-sitter.github.io/playground or uber.github.io/piranha/tree-sitter-playground with Java selected) to test queries against Java switch code and visualize the "switch_construct" node.

Citations:


Correct the Java switch query node type and field.

The pattern uses switch_statement with condition, which don't exist in tree-sitter-java v0.23. The correct node type is switch_construct with the selector field.

🔧 Proposed fix
-(switch_statement
-  condition: (parenthesized_expression
-    (identifier) `@val`
-    (`#eq`? `@val` "action"))) `@target`
+(switch_construct
+  selector: (identifier) `@val`
+  (`#eq`? `@val` "action")) `@target`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
(switch_statement
condition: (parenthesized_expression
(identifier) @val
(#eq? @val "action"))) @target
```
(switch_construct
selector: (identifier) `@val`
(`#eq`? `@val` "action")) `@target`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@extras/skills/codemark/queries/java.md` around lines 128 - 132, The
Tree-sitter Java query is using the wrong node type and field: replace uses of
switch_statement and its condition field with the correct node type
switch_construct and its selector field; update the pattern around
(switch_statement condition: (parenthesized_expression (identifier) `@val` (`#eq`?
`@val` "action"))) `@target` to reference switch_construct and selector so the query
matches tree-sitter-java v0.23 (preserve the `@val` and `@target` capture names).


### If Statement

Target specific logical decision points:

```scheme
(if_statement
condition: (parenthesized_expression
(identifier) @cond
(#eq? @cond "isAdmin"))) @target
```

## Module Tagging

Java uses `package:<name>` with the full Java package name (dot notation):
Expand Down
31 changes: 31 additions & 0 deletions extras/skills/codemark/queries/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,37 @@ Decorators are automatically skipped; this targets the function itself:
(#eq? @method "validate_token")) @target))
```

### Call Expression (Function Call)

Target where a specific function is invoked:

```scheme
(call_expression
function: (identifier) @func
(#eq? @func "verify_token")) @target
```

### Match Statement (Python 3.10+)

Target complex branching logic:

```scheme
(match_statement
subject: (identifier) @val
(#eq? @val "event")) @target
```

### If Statement

Target specific logical decision points:

```scheme
(if_statement
condition: (call_expression
function: (identifier) @func
(#eq? @func "is_authorized"))) @target
```

### Function with Specific Parameters

Function with a specific parameter name:
Expand Down
31 changes: 31 additions & 0 deletions extras/skills/codemark/queries/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,37 @@ Any async function:
(async)) @target
```

### Call Expression (Function Call)

Target where a specific function is invoked:

```scheme
(call_expression
function: (identifier) @func
(#eq? @func "verify_token")) @target
```

### Match Expression

Target complex branching logic:

```scheme
(match_expression
value: (identifier) @val
(#eq? @val "event")) @target
```

### If Statement

Target specific logical decision points:

```scheme
(if_statement
condition: (call_expression
function: (identifier) @func
(#eq? @func "is_authorized"))) @target
```

### Function with Specific Signature

Function taking String and returning Claims:
Expand Down
32 changes: 32 additions & 0 deletions extras/skills/codemark/queries/swift.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,38 @@ Any async function:
(#eq? @effect "async")) @target
```

### Call Expression (Function Call)

Target where a specific function is invoked:

```scheme
(call_expression
function: (navigation_expression
(navigation_suffix
(simple_identifier) @method
(#eq? @method "verifyToken")))) @target
```

### Switch Statement

Target complex branching logic:

```scheme
(switch_statement
expr: (identifier) @val
(#eq? @val "action")) @target
```

### If Statement

Target specific logical decision points:

```scheme
(if_statement
condition: (identifier) @cond
(#eq? @cond "isAdmin")) @target
```

### Function with Specific Signature

Function taking String and returning Claims:
Expand Down
Loading
Loading