<note>For React hooks documentation</note> topic="hooks" <note>For routing documentation</note> topic="routing" </example>
<note>For specific Next.js API</note> topic="getServerSideProps" <note>For specific TypeScript utility type</note> topic="Partial" </example>
<step>2. Use Context7 to get latest documentation</step> get-library-docs context7CompatibleLibraryID="/facebook/react" topic="useState" <step>3. Compare current usage with documented best practices</step> </example>
<step>2. Use Serena to find all usages of changed APIs</step> find_referencing_symbols name_path="getStaticProps" <step>3. Plan migration based on documentation</step> </example>
<anti_patterns> <avoid name="skipping_resolution"> <description>Calling get-library-docs without resolving library ID first</description> <instead>Always call resolve-library-id to get the correct Context7-compatible library ID</instead> </avoid> <avoid name="excessive_tokens"> <description>Requesting maximum tokens for simple queries</description> <instead>Use specific topics and appropriate token limits (2000-3000 for quick lookups, 5000 for standard queries)</instead> </avoid> <avoid name="ignoring_trust_scores"> <description>Using libraries with low trust scores or snippet counts</description> <instead>Prefer libraries with trust scores 7-10 and higher snippet counts for better documentation quality</instead> </avoid> <avoid name="wrong_library_name"> <description>Using incorrect or outdated library names (e.g., "react-query" vs "tanstack/query")</description> <instead>Try alternative names or broader search terms if library not found</instead> </avoid> </anti_patterns>
<workflow> <phase name="identify"> <objective>Identify documentation needs</objective> <step>1. Determine which library needs documentation</step> <step>2. Check if library ID is known or needs resolution</step> </phase> <phase name="resolve"> <objective>Resolve library identifier</objective> <step>1. Use resolve-library-id to find the library</step> <step>2. Verify the resolved ID matches intended library</step> </phase> <phase name="fetch"> <objective>Fetch relevant documentation</objective> <step>1. Use get-library-docs with resolved ID</step> <step>2. Specify topic if known for focused results</step> <step>3. Adjust tokens parameter for detail level</step> </phase> </workflow><best_practices> <practice priority="critical">Always resolve library ID before fetching documentation</practice> <practice priority="critical">Prefer libraries with trust scores 7-10 for better documentation quality</practice> <practice priority="high">Use specific topics to reduce token usage and increase relevance</practice> <practice priority="high">Check snippet count as indicator of documentation completeness</practice> <practice priority="medium">Use versioned IDs when available for specific version documentation</practice> </best_practices>
<rules priority="critical"> <rule>Always resolve library ID before fetching documentation</rule> <rule>Verify trust score is 7 or higher before using library documentation</rule> </rules> <rules priority="standard"> <rule>Use specific topics to reduce token usage</rule> <rule>Check snippet count for documentation quality indicators</rule> <rule>Use versioned IDs when available for specific versions</rule> <rule>Combine with Serena for codebase verification workflows</rule> </rules><error_escalation> <level severity="low"> <example>Library not found with exact name</example> <action>Note in report, try alternative names, proceed</action> </level> <level severity="medium"> <example>Documentation not available for topic</example> <action>Document issue, use AskUserQuestion for clarification</action> </level> <level severity="high"> <example>Context7 service unavailable</example> <action>STOP, present options to user</action> </level> <level severity="critical"> <example>Conflicting documentation versions</example> <action>BLOCK operation, require explicit user acknowledgment</action> </level> </error_escalation>
<related_skills> <skill name="serena-usage">Combines with Context7 for codebase verification workflows</skill> <skill name="investigation-patterns">Uses Context7 for documentation research</skill> <skill name="nix-ecosystem">Uses Context7 for NixOS and Home Manager documentation</skill> <skill name="typescript-ecosystem">Uses Context7 for TypeScript and framework documentation</skill> <skill name="golang-ecosystem">Uses Context7 for Go library documentation</skill> <skill name="rust-ecosystem">Uses Context7 for Rust crate documentation</skill> </related_skills>
<constraints> <must>Verify library ID before fetching documentation</must> <must>Specify topic when known for focused results</must> <must>Check documentation version matches project requirements</must> <avoid>Fetching documentation without verifying library identity</avoid> <avoid>Using outdated documentation for current implementations</avoid> </constraints>