agentleFS
MKS-01MKS-01/appscreenmap/.claude/skills/tune-crawler/SKILL.md

tune-crawler

Skill2 starsChanged 18 days agoMITView on GitHub

Diagnose and fix AppScreenMap exploration quality problems — duplicate or merged screens, wasted/repeated taps, wrong element kinds or titles, navigation/replay failures, the crawl leaving the app, slow crawls. Use after a crawl or `appscreenmap report` shows findings, or when the user says the map looks wrong.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never fix exploration by guessing.

    line 8
  2. Distinctive:

    Use synthetic data only; never commit real app dumps, since they contain user content.

    line 26
  3. Very specific:

    Verify: Run uv run pytest -q && uv run ruff check && uv run ruff format, then re-crawl the Playground with --clear-data and compare report …

    line 29
  4. Very specific:

    When the app leaves the foreground, check logcat -b crash for Process: <pkg>, before calling it "left the app".

    line 73
  5. Distinctive:

    Add new lessons here when a fix teaches something general.

    line 79

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tune the crawler: evidence → failing test → fix → re-crawl

Never fix exploration by guessing. Each fix follows this loop:

  1. Evidence. Get the run's health report and find the steps where it went wrong.
    uv run appscreenmap-engine report runs/<project>/<run-id>
    grep -n '"effect": "same_screen"' runs/<project>/<run-id>/trace.jsonl | head     # wasted taps
    The hierarchy of every screen is in runs/<project>/<run-id>/screens/<sid>.xml. To capture the live screen:
    uv run python -c "
    from appscreenmap.drivers.android import AdbDriver; from appscreenmap.core.analyzer import analyze
    d=AdbDriver(); s=d.snapshot(); w,h=d.screen_size(); o=analyze(s.xml,None,s.activity,w,h)
    print(o.title, o.patterns, o.signature)
    for e in o.elements: print(e.kind, e.action, repr(e.label), e.group, e.key)"
    To print the tree with groups, walk parse_hierarchy() + _mark_repeats(); see how packages/testkit/src/appscreenmap/testkit/helpers.py models Compose output.
  2. Failing test. Reproduce the structure in packages/core/tests/ (screen identity) or packages/crawler/tests/ (exploration) with the node() / hierarchy() helpers. Use synthetic data only; never commit real app dumps, since they contain user content.
  3. Fix in the right layer (map below). Keep the change minimal and explain why in a comment only where it's non-obvious.
  4. Verify. Run uv run pytest -q && uv run ruff check && uv run ruff format, then re-crawl the Playground with --clear-data and compare report numbers before and after (steps/screen, no-ops, near-duplicates, nav failures). Then add the re-run to the Playground canvas (merge --into <canvas> <run> --move, see the crawl-app skill) instead of leaving a new run behind.

iOS crawl? Start with the ios-simulator skill: its table of symptoms (missing tab bar, in-app browser, blank trees) separates app accessibility gaps from crawler bugs before you change any code.

Symptom → where to look

Symptom (report / trace)Likely causeCode
Same screen appears as 2+ ids (near-duplicate pair)Dynamic text leaking into tokens; threshold too strictanalyzer.analyze() token rules, normalize_text, CrawlConfig.similarity, Explorer.identify()
Different screens share one id; "crowded" screenTokens too coarse (Compose: every node is View)text tokens, layout_fingerprint, identify()
Wrong variant_ofLayout similarity too loose / wrong triggerAppMap.mark_variant, LAYOUT_VARIANT
Same element tapped on many screens, no effectGlobal element not inferredAppMap.infer_global_nav (nav/tab kinds), _kind()
Distinct buttons collapsed / missingKey collision after normalization_elements() key + ordinal logic
Element keys change between visits → not_found, re-exploredKey built from dynamic text or position_elements() key rules (scroll keys are positional)
Header/buttons treated as list rows (and capped)Over-eager repeat detection_mark_repeats() (leaf rule, grid rule)
Whole list explored one row at a timeRows not grouped, or outcomes not judged "same"_mark_repeats, AppMap.apply_list_cap, _same_outcome
nav_failed, many restartsHistory-dependent back edges, start screen variesExplorer.routes() costs, navigate(), follow()
Typing navigates away / closes screenKeyboard handlingExplorer.autofill(), AdbDriver.hide_keyboard() (ESC, never BACK)
left_app, x: screensPinning failed or disabledAdbDriver.pin(), Explorer.restart(), stay_in_app
Title is the activity nameNo title heuristic matched_title(), the fallback in Explorer.record()
Slow (>4 s/step)Device I/O, not Pythonsettle_seconds; future uiautomator2 driver (extend-crawler)

Lessons already learned (don't regress)

  • Compose flattens LazyColumn rows into leaf siblings, so leaves are only list rows inside real ListView/RecyclerView/GridView.
  • Digits are normalized (10:15 → ##:##) for identity. Colliding element keys get #2, #3 instead of being dropped.
  • Nested controls inside list rows (a card's "MORE") form their own group.
  • ListView rows are often not clickable; they're treated as implicitly clickable.
  • BACK can close search screens, so the keyboard is hidden with ESC.
  • BACK at the app's root exits the app, so the app is pinned via am task lock. A force-stop unpins, so restart() re-pins.
  • A screen first seen outside a recorded action has origin: unknown and gets a path the first time a known screen leads there. Only restart() may mark origin: launch (an empty path means "launch lands here"). The viewer builds its tree from reach_path, so never leave a pathless screen looking like a root.
  • An action that only changes scrolled content (a tap that scrolls the list, a WebView exposing its text) must not create a new screen. identify(obs, hint=src) keeps the source screen when the fixed part (fixed_tokens: outside scrollers/WebViews: title, toolbar, nav) is unchanged.
  • Android 10+ often shows no crash dialog: the app just disappears and another app comes to the front. When the app leaves the foreground, check logcat -b crash for Process: <pkg>, before calling it "left the app".
  • First-run screens (sign-in, onboarding) disappear once the app saves state. With --clear-data the crawler may pm clear once to get back (data_reset event, max 5 per crawl).
  • Pinning shows an "App pinned" toast; restart() waits it out so screenshots (and visual diffs) stay clean.
  • Stdout must be line-buffered, or background logs stay empty.

Add new lessons here when a fix teaches something general.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.