If all the user stories for the current sprint are completed and we work on a task that will be for the next sprint, then how can we classify it?
Can it be called as "Spike"?
If all the user stories for the current sprint are completed and we work on a task that will be for the next sprint, then how can we classify it?
Can it be called as "Spike"?
If you add a story to the current sprint because you are early, then it's still called a story.
If you are not adding a story but just working on a task, then you are not doing something "allowed" by scrum, since by the end of the sprint you need to have a potentially releasable product.
If there is not enough time to develop a whole story, I am sure there's bugs to fix, refactoring to do, technical debt to pay back, more accurate testing to do, etc.
If you continually find yourself overdelivering or always on time then you need to push harder.
Wikipedia defines a Spike as:
A time boxed period used to research a concept and/or create a simple prototype...
Note that the term Spike is used as it is a piece of work which interacts with, or "spikes through", all the different layers in your system.
Hence if you begin work on a task that will be for the next sprint, and you are clear on how you are going to implement a solution, then that should be a Story.
However if a clear solution is not known and you are likely going to be doing some research/exploratory work, then it should be deemed a Spike.
A Spike is a learning activity. Typically, when the Team doesn't know enough to estimate a Story, a Spike is organized. The size of the Spike should be estimated (Spikes are timeboxed to either one or two days, utilizing one or two Team members). The Team member(s) report back to the Team at the conclusion, and hopefully the Team now has enough information to estimate the Story. Sometimes (hopefully rarely), a second Spike is needed. If this doesn't provide enough information, that's often a sign that the situation needs higher-level thought and clarification.
Your real question is how to bring in additional work at the end of a Sprint. Is everything done early? Bring in a story that fits into the remaining time and can be completed. Or as Sklivvz stated, pay down the Technical Debt. Or end the Sprint early, and get started on the next one!
It's very tempting in such a situation to get a 'jump-start' on a Story thought to be slated for the next Sprint. This has potential to generate 'waste' (in the Lean sense), and is something to be wary of, if not avoided.