$npx -y skills add managedcode/dotnet-skills --skill xtwitter-scraperUse XTwitterScraper when a .NET application needs typed access to Xquik's X automation REST API for tweet search, user lookup, posting workflows, extraction jobs, monitors, webhooks, or giveaway draws. USE FOR: integrating the XTwitterScraper NuGet package; reviewing Xquik API cl
| 1 | # XTwitterScraper |
| 2 | |
| 3 | ## Trigger On |
| 4 | |
| 5 | - adding the `XTwitterScraper` NuGet package to a .NET application |
| 6 | - searching tweets, reading tweet/user data, running extraction jobs, or monitoring X accounts through Xquik from .NET |
| 7 | - posting tweets, replies, likes, reposts, follows, or DMs through typed SDK methods |
| 8 | - exporting extraction results, handling raw responses, retries, rate limits, or API errors |
| 9 | - wiring Xquik webhook events into ASP.NET Core, workers, queues, or background processing |
| 10 | |
| 11 | ## Workflow |
| 12 | |
| 13 | 1. Confirm the project actually needs Xquik API access from .NET. If it only needs prompt guidance, use a generic agent or API-design skill instead. |
| 14 | 2. Install the NuGet package: |
| 15 | |
| 16 | ```bash |
| 17 | dotnet add package XTwitterScraper |
| 18 | ``` |
| 19 | |
| 20 | 3. Configure credentials through environment or secret storage. Prefer `X_TWITTER_SCRAPER_API_KEY`; keep `X_TWITTER_SCRAPER_BASE_URL` at its default unless a test fixture intentionally overrides it. |
| 21 | 4. Create `XTwitterScraperClient` at the composition boundary and inject it or a narrow wrapper into application services. Do not scatter client construction across handlers. |
| 22 | 5. Build typed `Params` objects for SDK calls instead of manually concatenating query strings. |
| 23 | 6. Treat paginated responses, extraction jobs, binary exports, and webhook events as different flow types. Do not force them through one generic helper. |
| 24 | 7. Preserve typed exceptions. Catch `XTwitterScraperRateLimitException`, authorization errors, and 5xx errors only where the application can retry, defer, or show a useful state. |
| 25 | 8. Validate with unit tests around your wrapper and integration tests with configured API credentials only when the environment explicitly provides them. |
| 26 | |
| 27 | ## Architecture |
| 28 | |
| 29 | ```mermaid |
| 30 | flowchart LR |
| 31 | A["ASP.NET Core or worker service"] --> B["Application wrapper"] |
| 32 | B --> C["XTwitterScraperClient"] |
| 33 | C --> D["Xquik REST API"] |
| 34 | D --> E["Typed response models"] |
| 35 | D --> F["Webhook events"] |
| 36 | D --> G["Binary exports"] |
| 37 | ``` |
| 38 | |
| 39 | ## Core Knowledge |
| 40 | |
| 41 | - `XTwitterScraperClient` reads `X_TWITTER_SCRAPER_API_KEY`, `X_TWITTER_SCRAPER_BEARER_TOKEN`, and `X_TWITTER_SCRAPER_BASE_URL` from the environment, and can also be configured manually. |
| 42 | - The default API base URL is `https://xquik.com/api/v1`. |
| 43 | - Common read paths include tweet search, tweet detail, user search, user detail, profile tweets, followers, trends, monitors, and extraction jobs. |
| 44 | - Common write paths include tweet creation, replies, likes, reposts, follows, DMs, media upload, and giveaway draw actions. |
| 45 | - Request methods use typed `Params` classes, such as `TweetSearchParams`, and return typed response models such as paginated tweets. |
| 46 | - Binary export methods return `HttpResponse`; copy the stream deliberately instead of assuming JSON deserialization. |
| 47 | - Raw response access is available through `WithRawResponse` when code needs status, headers, or raw body inspection. |
| 48 | - `WithOptions` can override client options for one call without mutating the original client or service. |
| 49 | - The SDK retries selected transient failures by default. Do not add broad outer retry loops without checking idempotency and endpoint semantics. |
| 50 | |
| 51 | ## Decision Cheatsheet |
| 52 | |
| 53 | | If you need | Default approach | Why | |
| 54 | |---|---|---| |
| 55 | | Tweet search or user lookup | Use typed SDK methods and `Params` classes | Keeps request shape explicit | |
| 56 | | Application-wide client usage | Register one wrapper around `XTwitterScraperClient` | Keeps auth and options centralized | |
| 57 | | One-off option override | Use `WithOptions` | Avoids mutating shared client state | |
| 58 | | Headers or status inspection | Use `WithRawResponse` | Keeps normal typed flow clean | |
| 59 | | Extraction result download | Treat response as a stream | Avoids accidental JSON assumptions | |
| 60 | | Webhook handling | Map events to application commands or queue messages | Keeps delivery separate from business processing | |
| 61 | |
| 62 | ## Common Failure Modes |
| 63 | |
| 64 | - Committing API keys, sample tokens, or local environment files. |
| 65 | - Building URLs by hand instead of using SDK params. |
| 66 | - Treating every response as JSON when export endpoints may return binary data. |
| 67 | - Hiding API failures behind generic `Exception` catche |